Backup Restore Guide

15
Oracle Database Backup and Restore Guide PowerSchool Student Information System

description

Restore from backup

Transcript of Backup Restore Guide

  • Oracle Database Backup and Restore Guide

    PowerSchool Student Information System

  • Released December 2012

    Document Owner: Documentation Services

    This edition applies to Release 7.x of the PowerSchool software and to all subsequent releases and modifications until otherwise indicated in new editions or updates.

    The data and names used to illustrate the reports and screen images may include names of individuals, companies, brands, and products. All of the data and names are fictitious; any similarities to actual names are entirely coincidental.

    PowerSchool is a trademark, in the U.S. and/or other countries, of Pearson Education, Inc. or its affiliate(s).

    Copyright 2012 Pearson Education, Inc. or its affiliates. All rights reserved. All trademarks are either owned or licensed by Pearson Education, Inc. or its affiliates. Other brands and names are the property of their respective owners.

  • Oracle Database Backup and Restore Guide

    Contents 3

    Contents Introduction ........................................................................................................... 4

    Terminology ......................................................................................................... 4

    Understanding Oracle Backup and Recovery .......................................................... 5

    Backups ............................................................................................................... 5

    Oracle File Structure .............................................................................................. 5

    Disaster Recovery Concepts .................................................................................... 6

    Backup ................................................................................................................... 7

    Manually Initiating a Backup ................................................................................... 8

    Datapumps ........................................................................................................... 8

    Restore and Recovery .......................................................................................... 11

    Data Replication to a Different Server using the Datapump Utility ........................ 11

    Administration ..................................................................................................... 12

    Flash Recovery Area ............................................................................................ 12

    Backup Retention Policies ..................................................................................... 13

    Removing Previous Server Information .................................................................. 13

    Modifying Oracle User Password ............................................................................ 14

    Disabling Production-Impacting Settings and Functionality ....................................... 14

    Oracle Jobs Email Settings ................................................................................... 15

  • Oracle Database Backup and Restore Guide

    Introduction 4

    Introduction This guide describes the backup and recovery process and the steps necessary to restore the PowerSchool 7.0 or later database server from a database backup created within the previous seven days. For recoveries that require data older than seven days, or to restore data to a different server, contact PowerSchool Technical Support.

    This guide is intended for PowerSchool system administrators. To use this guide, you must be familiar with Windows 2008 and the Oracle database. You must also have PowerSchool 7.0 or later installed and operating correctly.

    Please refer to the appropriate section for step-by-step instructions:

    Terminology The following table describes terminology used in this document.

    Term Definition

    Flashback Flashback is an optional feature of an Oracle database that is enabled by default with the installation of PowerSchool and Oracle. Fashback is a database that keeps track of the changes made to the Oracle database. It recognizes which Oracle redo logs, archive files, or backup sets hold the data for any given point in time within the flashback retention period. Flashback is a quick and simple way to restore the database to any point in time within the current flashback retention period (default is 7 days).

    Note: Due to changes in PowerSchool 7, Flashback should not be used without assistance from PowerSchool Support as it can cause database corruption.

    Full Backup An operation that backs up all database files. Files are backed up whether or not they have changed since the last backup.

    Note: Archive logs are included in the backup and are deleted each time a backup is created.

    Incremental Backup An operation that backs up only the database files that have changed since a previous backup. Oracle supports nine different incremental backup levels for file system backups. A differential incremental backup copies data that changed since an incremental backup at the same or lower level.

    Retention Policy The length of time that data in a backupset (a set being a full backup and all of its subsequent incremental backups) is not eligible to be overwritten.

  • Oracle Database Backup and Restore Guide

    Understanding Oracle Backup and Recovery 5

    Understanding Oracle Backup and Recovery This section provides a simplified overview of Oracle processes. Many technical details are not included to keep the overview simplified.

    Backups When you make a change in PowerSchool, modifying or creating data, the change is written to the Oracle database. Oracle records the change to the database data file, and then writes the change to another file called a redo log. Redo logs are also known as online logs, or online redo logs.

    Writing changes to both the data file and the redo log ensures that every change made to the database is immediately backed up.

    Redo logs make it possible to undo changes made to the database, and also make it possible to restore the database in case of data loss due to hardware failure or user error.

    This is a very simple overview of the core concept of backup and recovery in an Oracle database. Oracle records and backs up every change to the database almost immediately.

    There are five redo logs configured in the installation of Oracle with PowerSchool. Oracle writes to each of them one at a time. When the current redo log reaches 512 megabytes in size, Oracle stops writing to it and starts writing to the next redo log. When Oracle changes to a new redo log, the previous redo log is backed up, to an archive log so the previous redo log can be reused. Oracle cycles through the five redo logs, continuously reusing them and backing them up over and over. Backed up redo logs are called archive logs.

    Archive logs are not reused; they are backed up into backup sets and deleted nightly. Each night, the scheduled Oracle jobs backup all the days archive logs into backup sets (a set of backup files). Once the archive logs become part of the backup sets, the archive logs are deleted.

    By default, PowerSchool will keep 31 days of the backup sets. Oracle jobs that perform backups run nightly. Once a week there is a full backup generated, and incremental backups are made the other six days of the week. Incremental backups contain only the changes made to the database since the previous backup.

    Oracle File Structure An Oracle installation creates a number of files and folders on the drive(s). On a Windows operating system, the primary folders are oracle and oradata. Since Oracle is a self-managing database, it is very important that the permissions of these folders are not changed. In addition, there are some folders that should not be accessed at all while the Oracle service is running, including access by antivirus or backup software. Otherwise, the database can be corrupted

    Backupsets, archivelogs and the flashback files should never be manually modified or deleted. Oracle manages these files within the parameters defined by the retention policy. For more information on how to modify the retention policy, refer to the Administration section of this guide.

  • Oracle Database Backup and Restore Guide

    Understanding Oracle Backup and Recovery 6

    The following tables list the directory locations for backing up Oracle data:

    Windows

    Directory Location Online Backup

    oracle\product\11.2.0\dbhome_1\NETWORK\ADMIN X

    oracle\product\11.2.0\dbhome_1\database

    oradata\[SID]\DATAFILE X X

    oradata\fast_recovery_area\[SID]\backupset X

    oradata\fast_recovery_area\[SID]

    Note: [SID] is the SID entered during the Oracle installation (commonly and by default PSPRODDB).

    Disaster Recovery Concepts Disaster recovery is the process of regaining access to the data, hardware and software necessary to resume critical business operations after a natural or human-induced disaster. A school district's Disaster Recovery Plan (DRP) with respect to PowerSchool relies heavily on usage and configuration characteristics specific to each and every server and district.

    This section covers backup and recovery topics, and identifies directories that should be backed up in accordance with your entire district's DRP.

    In addition to backing up the Oracle file systems identified in the tables in the previous section, it is also possible to export your data to a file that can be used to recover your database in the event of a disaster.

    The best practice for disaster recovery is frequently exporting your data and moving the exported data to another physical location. Steps to export your data are provided in the procedure How to Run a Datapump Export in the Backup section of this guide. With this single export data file stored safely away, you can easily recover to a new server.

    The export process can be run anytime without interrupting access to PowerSchool or the database. The resulting export file is relatively small and can be compressed, making it easy to transfer to another server or media (CD, DVD, or tape) for off-site storage. Using the database export to store your data off-site, in addition to the Oracle automated backups, provides you with the redundancy necessary to quickly recover from any disaster scenario. Previous days' datapumps can be backed up while the database is online.

    The Oracle automated scheduled backups enable the quick recovery from many situations, such as data file corruption due to power outages or user errors, but recovering from a hard drive failure can be complicated, difficult, or even impossible if you do not have the correct off-site backups. With an exported data file, recovery is simplified.

    Additional backup and restore functions and processes, including a list of Oracle file systems that should be included in warm and cold backups that can also be used to restore your database in the event of a disaster, are provided in this guide.

  • Oracle Database Backup and Restore Guide

    Backup 7

    Backup Backups are automatically set and configured using the Configure PowerSchool Backup Jobs link in the PowerSchool Installer. There are configuration options that you can change to meet your needs.

    During the Configure PowerSchool Backup Jobs configuration stage, the email parameters are entered, which determine who receives notification that the backup has completed.

    A full backup is performed automatically every Saturday at 1:15 a.m. An incremental backup runs nightly at 1:15 a.m. and will backup all data changed since the most recent full backup.

    The Oracle scheduler executes the backup scripts. An email notifies the designated administrator that a backup is completed and directs the administrator to check the log output. Log files are available in the Flash recovery area. The Flash recovery area location is based on the database layout configured during installation. For more information, see the Database Layout section of the PowerSchool 7.x Upgrade and Installation Guide or the Sybase to Oracle Migration Guide on PowerSource.

    The default recovery span is 31 days, which means that backups can be recovered up to 31 days in the past.

    Note: The steps outlined in this document address recoveries that require data from the past seven days. Any recoveries older than seven days may require PowerSchool Technical Supports intervention.

    There are several ways to back up PowerSchools associated database files.

    Online backups are created while PowerSchool and Oracle are running and accessible.

    With PowerSchool and Oracle running there are several directories to backup to assure recovery in the event of disaster.

    Important: If other Oracle related files are backed up while PowerSchool and Oracle are online, possible data corruption can occur within Oracle tablespaces (datafiles) resulting in the need for server downtime while PowerSchool Technical Support repairs the database or recovers a backup from before the incident occurred.

    Offline backups, or cold backups, are created while PowerSchool and Oracle are not running and not accessible. All files can be backed up in offline status.

    With both PowerSchool and Oracle not running, there are several directories to backup. By backing up these directories, a snapshot is taken of archive (redo) logs, flash recovery logs and the weekly and nightly backups that occur at 1:15 a.m. every morning. These directories are locked while Oracle is running and the operating system does not allow them to be backed up.

    When generating offline or online backups, it is recommended that you copy the backups from the nightly volume to a separate storage area in case of a disaster. Pearson recommends moving a copy of the backup to a separate physical location such as an establishment that specializes in media storage.

  • Oracle Database Backup and Restore Guide

    Backup 8

    Manually Initiating a Backup There are two types of backups generated through the Oracle Jobs. There is a full backup that is run weekly and an incremental backup run on a daily basis. In the backupset folder, the filenames of the backups are dated and either have an L0 in the file name for the weekly backup, or an L1 for the incremental backup.

    How To Manually Perform a Full Backup 1. On Windows, open the Command Prompt.

    2. Enter the following:

    Weekly Full Backup

    [Oracle binaries drive]\oracle\scripts\[SID]\backup\ps_weekly_backup.bat

    Daily Incremental Backup

    [Oracle binaries drive]\oracle\scripts\[SID]\backup\ps_daily_backup.bat

    3. Press Enter/Return.

    4. Check the RMAN output log for any errors:

    [Oracle binaries drive]\oracle\scripts\[SID]\backup\rmanlog.log

    Datapumps The datapump scripts rely on the data pump directory. The export script automatically exports files to the data pump directory, and the import script automatically looks for files to import in that same directory.

    Seven days worth of data pumps are maintained. The data pumps are named based upon the day of the week in which the export occurred. For every 10K students, allocate 25GB of additional disk space. Pearson strongly recommends including these data pumps as part of your offsite backup strategies. To disable this feature, set the PS.DAILY_FULL_EXPDP job to false in PowerSchool Administrator.

    The data pump directory is found in the following locations:

    Windows

    The drive location is dependent on the database layout selected during installation. If one drive was selected for the database installation, the directory is located on that drive in the following directory:

    [drive]:\oradata\PSPRODDB\data_pump_dir

    If two or more drives were selected for the database installation, the data pump directory is located on the second drive in the same path listed above.

  • Oracle Database Backup and Restore Guide

    Backup 9

    How to Run a Datapump Export 1. On the server that you want to export data from, open the Command Prompt.

    2. Enter [drive]:, where [drive] is the drive on which the Oracle binaries are installed.

    3. Press Enter/Return.

    4. Enter cd \oracle\scripts.

    5. Press Enter/Return.

    6. Enter Export.bat [SID] [Filename], where [SID] is the SID entered during the Oracle installation (commonly and by default PSPRODDB). [Filename] is the name you provide for the file that includes the export dataset. The filename can be anything you choose in any format.

    7. Press Enter/Return.

    8. The datapump export is now in the folder [drive]:\oradata\[SID]\data_pump_dir.

    Note: Previous days' datapumps can be backed up while the database is online.

    How to Run a Datapump Import 1. On the application server, navigate to Program Files > PowerSchool and double-

    click PowerSchool Installer.html to open the PowerSchool Installer.

    2. On the Configure Server page, click Stop PowerSchool/PowerTeacher Services. On the Confirmation page, click Confirm. PowerSchool/PowerTeacher Services are stopped.

    3. On the Configure Server Page, click Stop ReportWorks Services. On the Confirmation page, click Confirm. ReportWorks services are stopped.

    4. On the application server, open the Microsoft Management Console, navigate to Services, and then right-click on Pearson PowerSchool Message Service and select Stop from the pop-up menu.

    5. On the server that you want to import data to, copy the datapump export file to [drive]:\oradata\[SID]\data_pump_dir.

    6. Open the Command Prompt.

    7. Enter [drive]:, where [drive] is the drive on which the Oracle binaries are installed.

    8. Press Enter/Return.

    9. Enter cd \oracle\scripts.

    10. Press Enter/Return.

    11. If this server currently has a PowerSchool database installed, enter DropSchema.bat [SID] and press Enter/Return. If this is the first time a PowerSchool database is installed, continue to the next step.

    12. Enter Import.bat [SID] [Filename] [Clear Settings (Y/N)]. The filename is the name of the datapump file that is in the [drive]:\oradata\[SID]\data_pump_dir. [Clear Settings] will delete production server connection information for PowerSchool, PowerTeacher Gradebook, and ReportWorks. Note: This setting will not disable email, SIF, or AutoComm/AutoSend events.

  • Oracle Database Backup and Restore Guide

    Backup 10

    13. Press Enter/Return.

    14. On the application server, open the Microsoft Management Console, navigate to Services, and then right-click on Pearson PowerSchool Message Service and select Restart from the pop-up menu.

    15. On the PowerSchool Installer Configure Server page, click Start PowerSchool/PowerTeacher Services. On the Confirmation page, click Confirm. PowerSchool/PowerTeacher Services are started.

    16. On the Configure Server Page, click Start ReportWorks Services. On the Confirmation page, click Confirm. ReportWorks services are started.

    17. On the application server, navigate to Program Files > PowerSchool and double-click PowerSchool Installer.html to open the PowerSchool Installer.

    18. Click Configure PowerSchool Backup Jobs, and follow the on-screen instructions.

  • Oracle Database Backup and Restore Guide

    Restore and Recovery 11

    Restore and Recovery It is possible to restore the backup onto a different computer running PowerSchool 7.0.

    To remedy an accidental erasure of the database, perform the first part of the Restore process to make a backup of any existing databases. Be sure you have a full backup before running any restore and recovery scenarios. For more information, see the Manually Initiating a Backup section.

    To import a backup to a server (for example, a test server), perform the procedure Restore and Recovery to a Test Server.

    Data Replication to a Different Server using the Datapump Utility Restoration and recovery of the database to a test server requires the use of Oracles data pump technology.

    The following steps are used to replicate data on a different server:

    Daily export files are available on your production server.

    [drive]:\oradata\[SID]\data_pump_dir

    Remove any existing data on the target server (run the DropSchema script as instructed in the How to Run a Datapump Import procedure in the Backup section).

    Import data into the target server (see How to Run a Datapump Import in the Backup section).

    Configure Oracle Jobs through the Configure PowerSchool Backup Jobs link in the PowerSchool Installer.

    Remove previous server information (see How to Remove Previous Server Information on a Test Server in the Administration section).

    Modify the PS user password, if applicable (see Modifying Oracle User Permissions in the Administration section).

    The three scripts listed below are included in the Oracle installer to simplify the import and export process. These scripts are located on the same drive on which the Oracle binaries are installed (Drive 1). See How to Run a Datapump Export in the Backup section for details on export.

    [drive]:\oracle\scripts\Export.bat

    [drive]:\oracle\scripts\DropSchema.bat

    [drive]:\oracle\scripts\Import.bat

    Two of the scripts execute the export or import of data. The DropSchema script deletes existing schema, which is necessary when importing into an Oracle database with an existing dataset.

  • Oracle Database Backup and Restore Guide

    Administration 12

    Administration

    How to Unlock the Database User Accounts If you have been locked out of the database, a generic error stating that PowerSchool cannot connect to the database appears. There are several reasons why this error occurs.

    Use the following procedure to unlock the database user accounts.

    1. On the database server, on the command prompt type sqlplus /@PSPRODDB as sysdba

    Note: If you used a Database SID other than PSPRODDB, substitute it in the above command.

    2. You are now logged into Oracle using local authentication. On the command prompt type Alter user PS account unlock;

    3. Press Enter.

    4. Type Alter user PS_MGMT account unlock;

    5. Press Enter.

    6. Type exit

    7. Press Enter.

    Flash Recovery Area PowerSchool is installed with a default limit of 100GB of backup space. Depending on usage of the application and retention policy, this value may need to be adjusted. After migration to PowerSchool 5.2 or later is complete, it is recommended that the flash recovery area limit be adjusted while considering overhead for the operating system and other processes.

    The following formula can be used to adjust the flash recovery area:

    100GB + ([Remaining free hard drive space on the flash recovery drive] X 80%)

    For example, after PowerSchool is installed, there is 600GB of hard drive space left. Based on the above calculation, the flash recovery area should be set to 580GB:

    100GB + (600GB X .80) = 580GB

    The fast_recovery_area folder is located in the following directory:

    Search the root of all the drives for oradata. This directory may contain a folder called fast_recovery_area. The location is dependent on how many drives were selected during the initial Oracle installation. The oradata directory may be located on multiple drives, but only one of these directories will contain the fast_recovery_area folder.

    How to Change the Flash Recovery Area Size To change the flash recovery area size, perform the following procedure.

  • Oracle Database Backup and Restore Guide

    Administration 13

    Note: If you do not perform this procedure, backup space on the server could reach capacity limit, resulting in server downtime and the need for PowerSchool Technical Support intervention.

    1. Open the Command Prompt.

    2. Enter sqlplus / as sysdba

    3. Press Enter/Return.

    4. Enter ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE=[new_size]; (where [new_size] is the size decided on using the formula above). For example: ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE=580G;

    5. Press Enter/Return.

    6. Enter Exit.

    7. Press Enter/Return.

    Backup Retention Policies By default PowerSchool sets the retention policy for backups to 31 days for full and incremental backups and seven days for flash recovery. Full and incremental backups are snapshots of the database taken daily at 1:15 a.m. Flash recovery is used to transform your database into what it looked like on a certain day at a specific time. The data that allows you to do this is kept for seven days and takes more storage space than the daily snapshots.

    Use the following procedures to alter these backup retention policies.

    How to Alter Retention for Full and Incremental Backups 1. Open the Command Prompt.

    2. To log into SQLPLUS, enter sqlplus / as sysdba

    3. Press Enter/Return.

    4. Enter UPDATE PS_MGMT.RMAN_PROPERTIES SET PROPERTY_VALUE = [X] WHERE PROPERTY_NAME = 'rman_retention_window'; where [X] is the number of days you would like to retain your daily backups. For example: UPDATE PS_MGMT.RMAN_PROPERTIES SET PROPERTY_VALUE = 7 WHERE PROPERTY_NAME = 'rman_retention_window';

    5. Press Enter/Return.

    6. Enter Exit.

    7. Press Enter/Return.

    Removing Previous Server Information The cleaning of production information from the Server_Instance, Server_Config, ConfigItem tables and the PSM_Configuration table that could cause a user to point to a production server rather than a test server is now incorporated into the PowerSchool

  • Oracle Database Backup and Restore Guide

    Administration 14

    Installer. The Import.bat now requires a third parameter that takes a Y or N for cleaning these settings.

    For Example

    Import.bat [SID] [Filename] Y: This command will clear tables. This will not disabled Email, SIF, or AutoComm/AutoSend items.

    Import.bat [SID] [FILENAME] N: This command will import data as it was exported from your production server. This is not recommended for any test server.

    Modifying Oracle User Password The PowerSchool Installer now allows the user to change the PS database user password.

    How to Modify the Oracle User Password 1. On you server, navigate to Program Files > PowerSchool.

    2. Double click the PowerSchool Installer shortcut

    3. Click on the Reset PS Password link from the home page.

    4. Enter the Current Oracle PS Password.

    5. Enter the New PS Password and confirm the new password.

    6. Click Next.

    7. Click Confirm.

    8. Click Done.

    9. Click Configure Database Connection.

    10. Enter new Oracle PS Password.

    11. Click Next.

    12. Click Confirm.

    13. Click Done.

    Disabling Production-Impacting Settings and Functionality After launching PowerSchool in a test environment, before allowing access to other users, the following items should be removed to ensure that a test environment does not interfere with production data and processes:

    Outgoing Email On the test server, select the hidden menu between the PowerSchool and Help menus and select Set Email off and remove SMTP settings from the following location to ensure that automatic and user-generated email is not sent from the test environment:

    Start Page > System Administrator > System Settings > Email Setup

  • Oracle Database Backup and Restore Guide

    Administration 15

    AutoComm/AutoSend - If AutoComm or AutoSend are set to send or receive data via FTP or by network share, disable these processes to prevent test environment data from impacting production processes.

    Start Page > System Administrator > AutoComm/AutoSend Setup

    Double-check the following areas of PowerSchool to ensure that your production settings were properly removed and automatically reconfigured:

    Start Page > System Administrator > ReportWorks Administration > ReportWorks Preferences

    Start Page > System Administrator > System Settings > Global Server Settings

    Oracle Jobs Email Settings During the Oracle Jobs installation, an option is available to enter email information in order to inform via email once the backup job has completed. There are three properties that need to be set for the emails: the FROM address (rman_email_from), the TO address (rman_email_to) and the SMTP Server address (smtp_out_server).

    How to View the Oracle Jobs Email Settings 1. Open the Command Prompt.

    2. Enter sqlplus / as sysdba

    3. Press Enter/Return.

    4. Enter select * from PS_MGMT.rman_Properties;

    5. Press Enter/Return.

    How to Modify Oracle Jobs Email Settings 1. On you server, navigate to Program Files > PowerSchool.

    2. Double click the PowerSchool Installer shortcut.

    3. Click the Configure PowerSchool Backup Jobs link.

    4. Enter new backup settings in the applicable fields.

    5. Click Next.

    6. Click Confirm.

    7. Click Done.

    Note: When a datapump is performed on an Oracle 11g server, the backup jobs DO NOT get imported. If you do not enable backup jobs, your archive logs will reach maximum capacity and the server will run out of disk space.

    IntroductionTerminology

    Understanding Oracle Backup and RecoveryBackupsOracle File StructureWindows

    Disaster Recovery Concepts

    BackupManually Initiating a BackupHow To Manually Perform a Full BackupWeekly Full BackupDaily Incremental Backup

    DatapumpsWindowsHow to Run a Datapump ExportHow to Run a Datapump Import

    Restore and RecoveryData Replication to a Different Server using the Datapump Utility

    AdministrationHow to Unlock the Database User AccountsFlash Recovery AreaHow to Change the Flash Recovery Area Size

    Backup Retention PoliciesHow to Alter Retention for Full and Incremental Backups

    Removing Previous Server InformationModifying Oracle User PasswordHow to Modify the Oracle User Password

    Disabling Production-Impacting Settings and FunctionalityOracle Jobs Email SettingsHow to View the Oracle Jobs Email SettingsHow to Modify Oracle Jobs Email Settings