0% found this document useful (0 votes)
51 views13 pages

Disaster Recovery Oracle

Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors. SAP, r / 3, xApps, xApp, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP Business ByDesign are trademarks of SAP AG in Germany and several other countries all over the world.

Uploaded by

Abhishek Dwivedi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views13 pages

Disaster Recovery Oracle

Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors. SAP, r / 3, xApps, xApp, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP Business ByDesign are trademarks of SAP AG in Germany and several other countries all over the world.

Uploaded by

Abhishek Dwivedi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

White Paper: Oracle Database Administration

Disaster Recovery for Oracle

April 2008

SAP AG Neurottstrae 16 69190 Walldorf Germany T +49/18 05/34 34 24 F +49/18 05/34 34 20 www.sap.com

SAP Copyrights and Trademarks


Copyright 2008 SAP AG. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice.. Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors. Microsoft, Windows, Excel, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation.

Java is a registered trademark of Sun Microsystems, Inc. JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape. SAP, R/3, xApps, xApp, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP Business ByDesign, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary. These materials are subject to change without notice. These materials

IBM, DB2, DB2 Universal Database, OS/2, Parallel Sysplex, MVS/ESA, AIX, S/390, AS/400, OS/390, OS/400, iSeries, pSeries, xSeries, zSeries, System i, System i5, System p, System p5, System x, System z, System z9, z/OS, AFP, Intelligent Miner, WebSphere, Netfinity, Tivoli, Informix, i5/OS, POWER, POWER5, POWER5+, OpenPower and PowerPC are trademarks or registered trademarks of IBM Corporation. Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or registered trademarks of Adobe Systems Incorporated in the United States and/or other countries. Oracle is a registered trademark of Oracle Corporation. UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group. Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc. HTML, XML, XHTML, and W3C are trademarks or registered trademarks of W3C, World Wide Web Consortium, Massachusetts Institute of Technology.

are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.

Where to Find this Documentation You can find this documentation at the following address: http://www.sdn.sap.com/irj/sdn/ora

Typographic Conventions
Type Style Example Text Represents Words or characters quoted from the screen. These include field names, screen titles, pushbuttons labels, menu names, menu paths, and menu options. Cross-references to other documentation. Example text Emphasized words or phrases in body text, graphic titles, and table titles. Technical names of system objects. These include report names, program names, transaction codes, table names, and key concepts of a programming language when they are surrounded by body text, for example, SELECT and INCLUDE. Output on the screen. This includes file and directory names and their paths, messages, names of variables and parameters, source text, and names of installation, upgrade and database tools. Exact user entry. These are words or characters that you enter in the system exactly as they appear in the documentation. Variable user entry. Angle brackets indicate that you replace these words and characters with appropriate entries to make entries in the system. Keys on the keyboard, for example, F2 or ENTER.

Icons
Icon Meaning Caution Example Note Recommendation Syntax

EXAMPLE TEXT

Example text

Example text

<Example text>

EXAMPLE TEXT

Disaster Recovery for Oracle

Contents
Introduction ...............................................................................................................5 Restoring the Hardware and Operating System .....................................................5 Installing the Database and SAP Software .............................................................5 Creating the File Systems ........................................................................................6 I. Disaster Recovery with BRRECOVER ..................................................................6
Disaster Recovery Phases with BRRECOVER ......................................................................... 6 Performing Disaster Recovery with BRRECOVER................................................................... 7

II. Disaster Recovery with BRRESTORE .................................................................9


Adapting the init<DBSID>.sap File on Tape ............................................................................. 9 Restoring Other Profile and Log Files from Tape .................................................................. 10 Using an External Backup Program ........................................................................................ 11 Resetting the Database to the Last Backup ........................................................................... 12 Recovery Procedure ................................................................................................................. 12

Additional Information ............................................................................................13


SAP Library ................................................................................................................................ 13 SAP Notes .................................................................................................................................. 13

April 2008

Disaster Recovery for Oracle

Introduction
If you lose your entire system (possibly including hardware) and you have not taken any special precautions against this (for example, an Oracle standby configuration), you must restore the system step-by-step. This document describes how to reinstall your system and how to keep data loss to a minimum by using the SAP tools BRRECOVER and BRRESTORE.

You can automatically perform the most important disaster recovery steps, especially the restore of profiles and log files, with BRRECOVER. We strongly recommend you to use BRRECOVER for disaster recovery. The procedures described here explain the interconnections. Only use these procedures in an exceptional situation. Note the following: UNIX Environment variables Windows

$ORACLE_HOME $SAPDATA_HOME

%ORACLE_HOME% %SAPDATA_HOME% sqlplus %ORACLE_HOME%\database

Oracle SQLPLUS tool Profile file directory

sqlplus $ORACLE_HOME/dbs

The default values for these variables are as follows: UNIX Windows

$ORACLE_HOME = /oracle/<DBSID>/<DB_VERS> $SAPDATA_HOME = /oracle/<DBSID>

%ORACLE_HOME% = <x>:\oracle\<DBSID>\<DB_VERS> %SAPDATA_HOME% = <y>:\oracle\<DBSID>

Windows: If the SAPARCH, SAPBACKUP, or SAPREORG directories are not located under %SAPDATA_HOME%, use the corresponding environment variables %SAPARCH%, %SAPBACKUP% or %SAPREORG%. The separator character used in UNIX / must be replaced with \ for Windows.

Restoring the Hardware and Operating System


Install the same version of the operating system you were using before the loss. When replacing the hard disks, make sure the replacement disks can be used to recreate the original structure and size of your disk partitions. Format the replacement disks according to the procedure described in the SAP installation guide. Keep the reserved memory for the superuser (root) to a minimum as recommended in the installation guide.

Installing the Database and SAP Software


The installation of the SAP software includes the software installation of the database. The initial SAP database should be completely new. However, do not load any data into the empty SAP tables. Alternatively, restore a full backup of your operating system or use the SAP installation CD.

April 2008

Disaster Recovery for Oracle

Creating the File Systems


It is important to take into account the file systems that were mounted at the time of the loss. If necessary, create new SAPDATA directories (mount points). These are usually used to define a disk or logical memory area (logical volume). Place the tape from the last successful complete BRBACKUP tape into the tape drive.

I. Disaster Recovery with BRRECOVER


We recommend you to perform disaster recovery with BRRECOVER if possible. If you lose your entire Oracle database system (possibly including hardware) and you have not taken any special security precautions - such as setting up a Standby Database - then you have to recover the system as much as possible, step by step. This section describes how to begin reinstalling the system in the event of such a disaster, and how to keep data loss to a minimum by using BRRECOVER. You can only restore profiles and log files using this function. This is a preparation step for subsequent database recovery with one of the following: Database point-in-time recovery Whole database reset Before you start disaster recovery, make sure that: SAP and Oracle software is correctly installed The file systems that is, sapdata<x> directories exist and are configured as before the disaster.

Disaster Recovery Phases with BRRECOVER


The following figure shows how disaster recovery works:
Select restore from BRBACKUP or BRARCHIVE backup

Select restore device type

Specify restore parameters

Select profiles and log files

Restore selected profiles and log files

Select detail logs for restore

Restore selected detail logs

BRRECOVER

Profile and log directories

Disaster recovery consists of these phases: 1. Select restore from BRBACKUP or BRARCHIVE backup. You select the BRBACKUP or BRARCHIVE backup that contains the required profiles and logs. 2. Select restore device type phase

April 2008

Disaster Recovery for Oracle

You select the device to be used from the following possibilities: o o o o o Local tape Remote tape Local disk Remote disk Backup utility

3. Specify restore parameters phase Depending on your choice of restore device type, you specify appropriate restore parameters. 4. Select profiles and log files phase You select the profiles and log files that you want to restore from the following: Backup profile Oracle profile BACKINT / mount profile util_par_file Detail log from one of the following: o o BRARCHIVE detail Log BRBACKUP detail Log

Summary log from one of the following o o o o o BRARCHIVE summary Log BRBACKUP summary Log BRSPACE summary Log BRSPACE structure Change Log BRSPACE parameter Change Log

Control file from a BRARCHIVE backup

The control file must only be reloaded here when the offline redo log files were saved with RMAN after the last run of BRBACKUP was started. 5. Restore selected profiles and log files phase BRRECOVER directly restores the selected profiles and log files without calling BRRESTORE. 6. Select detail logs for restore phase You select the detail logs that you want to restore. You can only select logs on the selected restore device type, such as a disk or external backup tool (BACKINT). For tape device type, the details logs are determined by the mounted tape volume. 7. Restore selected detail logs phase BRRECOVER directly restores the selected detail logs from the disk, tape, or external backup tool without calling BRRESTORE.

Performing Disaster Recovery with BRRECOVER


You can use BR*Tools for Oracle to recover from a disaster. You use BRRECOVER to restore missing or damaged profiles and log files. BRRESTORE is not called by disaster recovery, because it might require the BRBACKUP logs or the BRARCHIVE logs, which might not be available in a disaster.

April 2008

Disaster Recovery for Oracle

You use this process if either of the following is true: You have lost the entire database, including the profiles and the BRBACKUP logs or the BRARCHIVE logs.

You have only lost the profiles and the BRBACKUP or BRARCHIVE logs. This process does not actually restore data files or recover redo log files. It only restores the profiles and BRBACKUP or BRARCHIVE logs from copies that you made during previous backups. Therefore, it prepares the database for you to perform one of the following guided BR*Tools options: Database point-in-time (PIT) recovery Whole database reset Complete database recovery and database PIT recovery are not possible after disaster recovery because the current control file (required for complete database recovery) is missing and the database cannot be opened (required for tablespace PIT recovery).

Only perform this process if you are an expert in Oracle database administration. Even as an expert, we recommend that you first try other types of recovery supported by BR*Tools. If you are not an expert, you might severely damage the database with this procedure. You might lose data and cause downtime to fix the problem. Prerequisites Since this function is designed for experts, the usual safeguards are not present: o o o There is no database status check. You have less guidance than otherwise, since BRRECOVER cannot offer you default choices in all situations. You can choose individual actions independently.

For all procedures, the backup medium with the required backup files must obviously be present. You need to know exactly which file to restore and where it is. You are effectively performing a copy at operating-system level. BRRECOVER restores the profiles and logs to the standard directory. If you choose device type Backup utility for the restore, note the following: o o The BACKINT repository with the latest backup must be available because the tapes are administered using this repository in the backup utility. The BACKINT parameter file must normally exist, depending on the specific implementation that you are using. If it is required but is unavailable, you must first try and recreate it before performing disaster recovery. BRRECOVER calls BACKINT to perform the restore. BACKINT performs the restore of the profiles or logs from the latest backup.

o o Process

1. You start BRGUI or BRTOOLS. 2. You choose Restore and recovery 3. You choose the required procedure: o Restore profiles and logs files from BRBACKUP backup Disaster recovery.

April 2008

Disaster Recovery for Oracle

Restore profiles and logs files from BRARCHIVE backup

BRRECOVER starts the restore and displays the menu Device Type.

4. You choose the device tape where the backups of the profiles or logs are stored. BRRECOVER displays the parameters for restoring the profiles or logs, depending on what kind of device type you specified. The default parameters are taken from the current profile, initialization profile init<DBSID>.sap, if available. 5. For a disk backup or a utility backup, you note the following: o For a disk backup, you can specify the backup directory. BRRECOVER looks in the subdirectory <DBSID> of the specified directory to find the summary log for BRBACKUP or BRARCHIVE. It uses the information there for the restore. For a utility backup, check Prerequisites above.

6. You choose Continue to continue the restore with the displayed parameters. BRRECOVER warns you that the profiles and logs might be overwritten. BRRECOVER displays the restore menu where you can specify which profiles and logs to restore: o o If a log or profile already exists on disk, the recommendation is No to avoid overwriting it. If a log or profile does not exist on disk, the recommendation is Yes to let you restore it.

7. If required, you change the recommended values for restoring the profiles and logs. You can select several profiles or logs to restore. 8. You choose Continue to start restoring the selected profiles or logs. 9. You check the results in the BRRECOVER logs: o o The summary log recov<DBSID>.log displays the return code. The detail log v<encoded timestamp>.drv displays the progress.

II. Disaster Recovery with BRRESTORE


Adapting the init<DBSID>.sap File on Tape
At least one valid init<DBSID>.sap file must exist before you can start BRRESTORE. You can find a sample file as follows: /usr/sap/<SID>/SYS/exe/run/initSID.sap Adapt this file, for example with respect to the devices and drivers used. For more information, see Additional Information [page 5]. Check all operating system-dependent parameters and adapt these as required. Configure the same block size in the cpio_in_flags parameter and if you used the dd command for the backup the dd_in_flags parameter as for backups. Then, enter the following commands to restore the latest backup of the BRBACKUP profile file $ORACLE_HOME/dbs/init<DBSID>.sap: OS> cd $ORACLE_HOME/dbs OS> brrestore -n init_sap Alternatively the init<DBSID>.sap file can also be read as a third file from a BRBACKUP tape using the cpio operating system command:

April 2008

Disaster Recovery for Oracle

UNIX cd $ORACLE_HOME/dbs mt -f /dev/ rewind mt -f dev/ fsf 2 cpio -ivuB < /dev/

Windows cd %ORACLE_HOME%\database mt -f /dev/ rewind mt -f /dev/ fsf 2 cpio -ivuB -I /dev/

If you have configured a different block size in the init<DBSID>.sap parameter cpio_flags, you must use this same block size when restoring.

Restoring Other Profile and Log Files from Tape


First, restore the files backed up during the last BRBACKUP backup of the database: Profile files Oracle profile file: $ORACLE_HOME/dbs/init<DBSID>.ora To restore the files, enter the following commands: OS> cd $ORACLE_HOME/dbs OS> brrestore -n init_ora BRSPACE summary and structure log files BRSPACE summary log: $SAPDATA_HOME/sapreorg/space<DBSID>.log Structure log: $SAPDATA_HOME/sapreorg/struc<DBSID>.log To restore both log files, enter the following commands: OS> cd $SAPDATA_HOME/sapreorg OS> brrestore -n space_log BRBACKUP summary log file, $SAPDATA_HOME/sapbackup/back<DBSID>.log To restore the file, enter the following command: OS> cd $SAPDATA_HOME/sapbackup OS> brrestore -n sum_log The last entry in the summary log corresponds to the last backup. This is the relevant entry for the detail log (see next file below). The last entry is usually incomplete for example, Return Code not current but this does not affect any subsequent operations. BRBACKUP detail log file, $SAPDATA_HOME/sapbackup/<coded timestamp>.<fid> OS> brrestore -n det_log Note the <coded_timestamp> (that is, the filename without extension) and the function ID <fid> (that is, the filename extension) from the name of this restored file in the restore directory. These are required for the following steps.

Alternatively you can quickly restore all logs from the BRBACKUP tape into the current directory using a single BRRESTORE command: brrestore n all_log Then copy the individual logs into the correct directories.

April 2008

10

Disaster Recovery for Oracle

Remove the BRBRACKUP tape from the tape drive and replace it with the BRARCHIVE tape of the last backup of the offline redo log files. Now restore the BRARCHIVE summary log, $SAPDATA_HOME/saparch/arch<DBSID>.log, from the BRARCHIVE tape by entering the following commands: OS> cd $SAPDATA_HOME/saparch OS> brrestore -n sum_log OS> cd $SAPDATA_HOME/sapreorg OS> brrestore n control_file

The last command above, which reloads the control file, is only necessary when the offline redo log files were saved with RMAN after the last run of BRBACKUP was started. If the control file is reloaded, you must copy it to all the original locations defined in the Oracle parameter control_files. Remove the BRARCHIVE tape from the tape drive and replace it with the BRBACKUP tape.

Using an External Backup Program


If you use the BACKINT interface, the procedure is somewhat different. The profiles init<DBSID>.utl (optional, depending on backup program) and init<DBSID>.sap must exist before you use BACKINT. For the init<DBSID>.sap profile, you only have to set the backup_dev_type parameter to util_file and define the profile name of the external backup program in the util_par_file parameter. You might have to reconstruct this profile either by editing or by using the external backup program directly. Then restore the following files one by one: BRBACKUP current summary log: $SAPDATA_HOME/sapbackup/back<DBSID>.log OS> brrestore -b2 #NULL m $SAPDATA_HOME/sapbackup/back<DBSID>.log The last entry in the summary log corresponds to the last backup. This is the relevant entry for the detail log (see next file below). The last entry is usually incomplete (for example, Return Code not current), but this does not affect any subsequent operations. Note the <coded_timestamp> (that is, the filename without extension) and the <fid> (that is, the filename extension) from the name of this restored file in the restore directory. These are required for the following steps. BRBACKUP last detail log, $SAPDATA_HOME/sapbackup/<coded timestamp>.<fid> OS> brrestore -b2 #NULL -m $SAPDATA_HOME/sapbackup/<coded timestamp>.<fid> You can restore all other files in the same way with this command: OS> brrestore -b2 #NULL -m <pathname> Replace <pathname> by: $ORACLE_HOME/dbs/init<DBSID>.ora $ORACLE_HOME/dbs/init<DBSID>.sap $ORACLE_HOME/dbs/init<DBSID>.dba $ORACLE_HOME/dbs/init<DBSID>.utl $SAPDATA_HOME/saparch/arch<DBSID>.log $SAPDATA_HOME/sapreorg/struct<DBSID>.log $SAPDATA_HOME/sapreorg/reorg<DBSID>.log

April 2008

11

Disaster Recovery for Oracle

$SAPDATA_HOME/sapreorg/cntrl<DBSID>.dbf

The last item above, for the control file, is only necessary when the offline redo log files were saved with RMAN after the last run of BRBACKUP was started. If the control file is reloaded, you must copy it to all the original locations defined in the Oracle parameter control_files. The procedure described above is complex. Alternatively, you can use the external tool's restore function.

Resetting the Database to the Last Backup


You always have to recover an online backup to a point in time after the backup. You can also perform a recovery for an offline backup if you want a more up-to-date status than that of the imported offline backup. Restore control files if not yet restored: OS> brrestore -b <coded_timestamp>.<fid> -m 0 Restore online redo log files if an offline backup is used: OS> brrestore -b <coded_timestamp> -m 00 Mount the database if the backup was done using RMAN: SQL> connect / as sysdba SQL> startup mount Restore all database files: OS> brrestore -b <coded_timestamp>.<fid> -m all You have determined <coded_timestamp> and <fid> from the summary BRBACKUP log in a previous step.

If you want to perform further recovery, do not open the database at this point. This can happen after the restore of an offline backup.

Recovery Procedure
Remove the BRBRACKUP tape from the tape drive and replace it with the BRARCHIVE tape. Restore the required offline redo log files: OS> brrestore -a <log_seg_No_A>-<log_seg_No_B> <Log_Seg_No_A> is the current log sequence number found in the header of the BRBACKUP log. <Log_Seg_No_B> corresponds to the sequence number of the last offline redo log file backed up (that is, the last entry in the summary BRARCHIVE log: arch<DBSID>.log). You can perform database recovery using the Oracle SQLPLUS as follows (mount the database only if not yet done): SQL> connect / as sysdba SQL> set autorecovery off SQL> startup mount SQL> recover database using backup controlfile until cancel

April 2008

12

Disaster Recovery for Oracle

You must confirm every recovery step with ENTER. After the entire recovery procedure is finished, complete this step with cancel.

SQL> alter database open resetlogs;

Additional Information
SAP Library
You can find more information on Oracle database administration and the contents of this document in the SAP Library as follows:

All paths refer to Release SAP NetWeaver Process Integration 7.1 of the SAP Library. 1. Call up the SAP Help Portal at help.sap.com/nwpi71 KNOWLEDGE CENTER FOR SAP NETWEAVER PROCESS INTEGRATION 7.1 SAP NetWeaver Process Integration Library English. 2. Choose Administrators Guide Technical Operations for SAP NetWeaver Administration of Databases Database Administration for Oracle SAP Database Guide: Oracle Approach to Oracle DBA Restore and Recovery Disaster Recovery.

You can also find this plus selected extracts from the SAP Library at: www.sdn.sap.com/irj/sdn/ora Documentation in Help Portal SAP on Oracle Knowledge Center SAP

SAP Notes
You can find SAP Notes at: service.sap.com/notes

April 2008

13

You might also like