You are on page 1of 19

Oracle Database Backup and Restore Guide PowerSchool Student Information System

Released April 22, 2009 Document Owner: Documentation Services This edition applies to Release 5.2 of the PowerSchool Premier 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 2008 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
Introduction ........................................................................................................... 1 Terminology ....................................................................................................... 1 Backup and Restore Setup ..................................................................................... 2 Flash Recovery Area ............................................................................................ 2 How to Change the Flash Recovery Area Size ................................................ 2 Backup Retention Policies ..................................................................................... 3 How to Alter Retention for Full and Incremental Backups ................................ 3 How to Alter Retention for Flashback Recovery .............................................. 4 Backup Process ...................................................................................................... 6 How To Manually Perform a Full Backup........................................................ 7 Restore and Recovery ............................................................................................ 9 Restore and Recovery Scenarios....................................................................... 9 How to Restore and Recover from a Specific Backup Date and Time ................. 9 Restore and Recovery to a Test Server................................................................. 10 Preventing Database Lockout ......................................................................... 10 How to Unlock the Database ..................................................................... 11 Data Pump Directory .................................................................................... 11 How to Restore and Recover to a Different Server........................................ 12 Removing Previous Server Information............................................................ 13 How to Remove Previous Server Information on a Test Server ....................... 14 Modifying Oracle User Permissions....................................................................... 14

Contents

iii

Oracle Database Backup and Restore Guide

Introduction
This guide describes the backup and recovery process and the steps necessary to restore the PowerSchool 5.2 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 Mac OS X and/or Windows 2003 and the Oracle database. You must also have PowerSchool 5.2 installed and operating correctly. Please refer to the appropriate section for step-by-step instructions: Database Restore for Mac OS X Database Restore for Windows 2003

Terminology
The following table describes terminology used in this document. Term Flashback Full Backup Definition A technology supplied with Oracle used to back up, restore, and recover the database. 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. The length of time that data in a backup set (a set being a full backup and all of its subsequent incremental backups) is not eligible to be overwritten.

Retention Policy

Introduction

Oracle Database Backup and Restore Guide

Backup and Restore Setup


Backups are automatically set and configured during the Oracle Jobs installation process. There are some configuration options that you can change to meet your needs. During the Oracle Jobs installation, the email parameters are entered, which determine who receives notification that the backup has completed. For more information, see the Sybase to Oracle Migration Guide or the PowerSchool 5.2 Installation Guide on the PowerSchool Customer Support Web site.

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 increased. After migration to PowerSchool 5.2 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 flash_recovery_area folder is located in the following directory: Windows Search the root of all the drives for oradata. This directory may contain a folder called flash_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 flash_recovery_area folder.

Mac /u03/oradata/flash_recovery_area/

How to Change the Flash Recovery Area Size


To change the flash recovery area size, perform the following procedure. 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 Support intervention. Windows 1. Open the Command Prompt. 2. Enter sqlplus / as sysdba
Backup and Restore Setup 2

Oracle Database Backup and Restore Guide

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. Mac 1. Open Terminal. 2. Enter sudo su oracle 3. Press Enter/Return. 4. Enter sqlplus / as sysdba 5. Press Enter/Return. 6. 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; 7. Press Enter/Return. 8. Enter Exit.

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


Windows 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';
Backup and Restore Setup 3

Oracle Database Backup and Restore Guide

5. Press Enter/Return. 6. Enter Exit. 7. Press Enter/Return. Mac 1. Open Terminal. 2. Enter sudo su oracle. 3. Press Enter/Return. 4. To log into SQLPLUS, enter sqlplus / as sysdba 5. Press Enter/Return. 6. 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'; 7. Press Enter/Return. 8. Enter Exit.

How to Alter Retention for Flashback Recovery


Windows 1. Open the Command Prompt. 2. Enter sqlplus / as sysdba 3. Press Enter/Return. 4. Enter ALTER SYSTEM SET DB_FLASHBACK_RETENTION_TARGET=[X]; where [X] is the number of minutes you would like to retain your moment in time, flash recovery area. The default is 10080 minutes, or 7 days. For example, ALTER SYSTEM SET DB_FLASHBACK_RETENTION_TARGET=4320; 5. Press Enter/Return. 6. Enter Exit. 7. Press Enter/Return. Mac 1. Open Terminal. 2. Enter sudo su oracle. 3. Press Enter/Return. 4. Enter sqlplus / as sysdba 5. Press Enter/Return. 6. Enter ALTER SYSTEM SET DB_FLASHBACK_RETENTION_TARGET=[X]; where [X] is the number of minutes you would like to retain your moment in time, flash
Backup and Restore Setup 4

Oracle Database Backup and Restore Guide

recovery area. The default is 10080 minutes, or 7 days. For example, ALTER SYSTEM SET DB_FLASHBACK_RETENTION_TARGET=4320; 7. Press Enter/Return. 8. Enter Exit.

Backup and Restore Setup

Oracle Database Backup and Restore Guide

Backup Process
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. Oracle keeps a running log, which allows the database to be fully restored to any point in time. 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 Installation Guide or the Sybase to Oracle Migration Guide on the PowerSchool Customer Support Web site. 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 is 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 is 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 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 move 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. The following tables list the directory locations for backing up Oracle data:

Backup Process

Oracle Database Backup and Restore Guide

Windows Directory Location oracle\product\10.2.0\db_1\network\admin oracle\product\10.2.0\db_1\database oradata\flash_recovery_area\[SID]\backupset oradata\flash_recovery_area\[SID] Note: [SID] is the SID entered during the Oracle installation (commonly and by default PSPRODDB). Mac Directory Location /u01/app/oracle/product/10.1.0/db_1/network/admin /u01/app/oracle/product/10.1.0/db_1/dbs /u03/oradata/flash_recovery_area/[SID]/backupset /u03/oradata/flash_recovery_area/[SID] Note: [SID] is the SID entered during the Oracle installation (commonly and by default PSPRODDB). Use the following procedure to manually perform a backup of the database. Online Backup Online Backup

How To Manually Perform a Full Backup


1. On Windows, open the Command Prompt. On Mac, open Terminal. 2. Enter the following: Windows: [Oracle binaries drive]\oracle\scripts\[SID]\backup\ps_weekly_backup.bat Mac: Log in to Oracle using the following command: sudo su oracle Press Enter/Return. Enter the following command: /Users/oracle/scripts/[SID]/backup/ps_weekly_backup.sh 3. Press Enter/Return. 4. Check the RMAN output log for any errors: Windows: [Oracle binaries drive]\oracle\scripts\[SID]\backup\rmanlog.log
7

Backup Process

Oracle Database Backup and Restore Guide

Mac: [Oracle binaries volume]/oracle/scripts/[SID]/backup/rmanlog.log

Backup Process

Oracle Database Backup and Restore Guide

Restore and Recovery


The database restoration process is a user-initiated process utilizing Flashback, which is a set of features for simple data recovery. Backups retained from the previous seven-day period allow restoration from anytime within that time period. It is also possible to restore the backup onto a different computer running PowerSchool 5.2. 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. See How To Manually Perform a Full Backup for more information.

Restore and Recovery Scenarios


To recover to a specific date and time from the previous seven days, perform the procedure How to Restore and Recover from a Specific Backup Date and Time. To import a backup to a test server (for example, a test server), perform the procedure How to Restore and Recover to a Different Server. For all other recovery scenarios, contact PowerSchool Technical Support.

How to Restore and Recover from a Specific Backup Date and Time
Windows 1. 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 FlashbackToTime.bat [SID] yyyy-mm-dd hh:mm:ss where [SID] is the SID entered during the Oracle installation (commonly and by default PSPRODDB) and yyyy-mm-dd hh:mm:ss is the exact date and time you want to restore to. 7. Press Enter/Return. Mac 1. Open Terminal. 2. Enter sudo su oracle. 3. Press Enter/Return. 4. Enter cd scripts. 5. Press Enter/Return.

Restore and Recovery

Oracle Database Backup and Restore Guide

6. Enter ./FlashbackToTime.sh [SID] yyyy-mm-dd hh:mm:ss where [SID] is the SID entered during the Oracle installation (commonly and by default PSPRODDB) and yyyy-mm-dd hh:mm:ss is the exact date and time you want to restore to. 7. Press Enter/Return.

Restore and Recovery to a Test Server


Restoration and recovery of the database to a test server requires the use of Oracles data pump technology. The following steps are used to create a test server: Export data from your production server. Remove any existing data on your test server. Import data into your test server. Remove previous server information. Modify the PS user password (if applicable).

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 or Volume 1). On a Mac, the scripts are located in the Oracle users home directory. Windows Mac /Users/oracle/scripts/Export.sh /Users/oracle/scripts/DropSchema.sh /Users/oracle/scripts/Import.sh [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.

Preventing Database Lockout When Restoring Older Backups


When restoring a database backup created prior to PowerSchool version 5.2.1 to be used with a post 5.2.1 release, some additional steps are required to prevent database lockout. Run the latest PowerSchool Database Jobs Installer (available on PowerSource). After restoring the backup, execute the DBPasswordUtil-DBNode script, available on the database server in the following directory:
10

Restore and Recovery

Oracle Database Backup and Restore Guide

o o

Windows - C:\Program Files\PowerSchool Database Tools Mac - Applications\PowerSchool Database Tools

Enter the current PowerSchool database user password when prompted. Enter a new password when prompted, type gen to generate a random password, or enter the same password again.

How to Unlock the Database


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. The following procedure is used to unlock the database. 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. 8. Execute the DBPasswordUtil-DBNode script. 9. Enter the password when prompted. Note: If database is still locked when PowerSchool is launched, locate the serverconfig.props or powerschool-config.properties files on the server, delete any usernames or passwords listed in these files, and repeat the How to Unlock the Database procedure.

Data Pump Directory


The 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. 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.
Restore and Recovery 11

Oracle Database Backup and Restore Guide

Mac The volume location is dependent on the database layout selected during installation. If one volume was selected for the database installation, the directory is located on that volume in the following directory: [volume]:/u02/oradata/PSPRODDB/data_pump_dir If two or more volumes were selected for the database installation, the data pump directory is located on the second volume in the same path listed above.

How to Restore and Recover to a Different Server


Windows 1. On the server that contains the latest backup, 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. Navigate to [drive]:\oradata\[SID]\data_pump_dir. 9. Copy the export file and paste it to [drive]:\oradata\[SID]\data_pump_dir on the other server. Note: For more information, see Data Pump Directory. 10. On the test server, stop Tomcat and the PowerSchool application. For more information, see Knowledgebase Article 5919: Stop and Start Tomcat on the PowerSchool Customer Support Web site. 11. On the test server, open the Command Prompt and enter [drive]:, where [drive] is the drive on which the Oracle binaries are installed. 12. Press Enter/Return. 13. Enter cd \oracle\scripts. 14. Press Enter/Return. 15. 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. 16. Enter Import.bat [SID] [Filename]. 17. Press Enter/Return. 18. On the test server, start Tomcat and the PowerSchool application. For more information, see Knowledgebase Article 5919: Stop and Start Tomcat on the PowerSchool Customer Support Web site.
Restore and Recovery 12

Oracle Database Backup and Restore Guide

19. Reinstall Oracle Jobs. Mac 1. On the server that contains the latest backup, open Terminal. 2. Enter sudo su oracle. 3. Press Enter/Return. 4. Enter cd scripts. 5. Press Enter/Return. 6. Enter ./Export.sh [SID] [Filename]. 7. Press Enter/Return. Note: SID is the name of the Oracle instance on the server; in most cases it is PSDRODDB. The filename is the name you provide for the file that includes the export dataset. 8. Navigate to /u02/oradata/[SID]/data_pump_dir. 9. Copy the export file and paste it to /u02/oradata/[SID]/data_pump_dir on the other server. Note: For more information, see Data Pump Directory. 10. On the test server, stop Tomcat and the PowerSchool application. For more information, see Knowledgebase Article 5919: Stop and Start Tomcat on the PowerSchool Customer Support Web site. 11. On the test server, open Terminal and enter sudo su oracle. 12. Press Enter/Return. 13. Enter cd scripts. 14. Press Enter/Return. 15. If this server currently has a PowerSchool database installed, enter ./DropSchema.sh [SID] and press Enter/Return. If this is the first time a PowerSchool database is installed, continue to the next step. 16. Enter ./Import.sh [SID] [Filename]. 17. Press Enter/Return. 18. On the test server, start Tomcat and the PowerSchool application. For more information, see Knowledgebase Article 5919: Stop and Start Tomcat on the PowerSchool Customer Support Web site. 19. Reinstall Oracle Jobs.

Removing Previous Server Information


When using a datapump to restore data to a test server, the production server information is stored within two tables in the database. To allow the new server to be recognized and configured correctly, complete the following procedure prior to starting PowerSchool. Note: Do not use this procedure on an existing server that must remain online running the same data set. This procedure should only be completed on the server on which the data has just be recovered.
Restore and Recovery 13

Oracle Database Backup and Restore Guide

How to Remove Previous Server Information on a Test Server


Windows 1. Open a Command prompt. 2. Enter sqlplus / as sysdba 3. Press Enter/Return. 4. Press Enter/Return. 5. Enter truncate table ps.server_instance; 6. Press Enter/Return. 7. Enter truncate table ps.server_config; 8. Press Enter/Return. 9. Enter Exit Mac 1. Open Terminal. 2. Enter sudo su oracle 3. Press Enter/Return. 4. Enter the password for the admin account you are using. 5. Press Enter/Return. 6. Enter sqlplus / as sysdba 7. Press Enter/Return. 8. Enter truncate table ps.server_instance; 9. Press Enter/Return. 10. Enter truncate table ps.server_config; 11. Press Enter/Return. 12. Enter Exit These settings will be recreated the first time you launch PowerSchool on your test server. When you launch PowerSchool for the first time, navigate to the System > System Settings > Server Settings page and enter values that mimic your production server. Ensure that the PowerTeacher gradebook settings at the bottom of the page match the address of your test server. Click Submit, then restart PowerSchool.

Modifying Oracle User Permissions


During the creation of a test server, the DropSchema process removes the PS user from the database. The Import process recreates it using the information from the production server. If the PS password set during the installation of Oracle is different than the one existing on the test server, perform the following procedure to modify the password on the test server. If the default passwords were selected on both test and production servers, do not perform this procedure.
Restore and Recovery 14

Oracle Database Backup and Restore Guide

Windows 1. Open the Command Prompt. 2. Enter sqlplus / as sysdba 3. Press Enter/Return. 4. Enter ALTER USER [username] identified by [password]; where [username] is the name of the user you are changing and [password] is the password you are changing it to. For example, ALTER USER PS identified by PS_SUPPORT; 5. Press Enter/Return. 6. Enter Exit 7. Press Enter/Return. Mac 1. Open Terminal. 2. Enter sudo su oracle. 3. Press Enter/Return. 4. Enter sqlplus / as sysdba 5. Press Enter/Return. 6. Enter ALTER USER [username] identified by [password]; where [username] is the name of the user you are changing and [password] is the password you are changing it to. For example, ALTER USER PS identified by PS_SUPPORT; 7. Press Enter/Return. 8. Enter Exit.

Restore and Recovery

15

www.PearsonSchoolSystems.com

You might also like