Purpose
If you lose your entire Oracle database system (possibly including hardware), and have not taken any special security precautions – such as setting up an
Oracle standby database – then you have to recover the system as much as possible, step by step. This section describes how to re-install the system, and how to keep data loss to a minimum by using BRRESTORE.Prerequisites
The following information is helpful to understand this section:
UNIX |
Windows |
|
Environment variables |
$ORACLE_HOME |
%ORACLE_HOME% |
Oracle Server Manager Oracle SQLPLUS |
Oracle 8.1: svrmgrlOracle 9.0: sqlplus |
Oracle 8.1: SVRMGRLOracle 9.0: SQLPLUS |
Profile file directory |
$ORACLE_HOME/dbs |
%ORACLE_HOME%\database |
The default values for these variables are as follows:
UNIX |
Windows |
|
Oracle 8.1 and 9.0 |
$ORACLE_HOME = /oracle/<SID>/<DB_VERS> |
%ORACLE_HOME% = <x>:\orant |
$SAPDATA_HOME = /oracle/<SID> |
%SAPDATA_HOME% = <y>:\oracle\<SID> |
Windows: If the
Process Flow
Install the same operating system that you had before the loss.
Recreate the distribution of the hard disks according to the original size and structure. Take this into account when purchasing the replacement disks.
Format the disks as described in the SAP installation documentation, which you can find at
http://service.sap.com/instguides. Keep the reserved memory for superuser (root) to a minimum, as recommended in the installation guide.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.
When you do this, take special consideration of the mounted file systems at the time of the loss. If necessary, create new SAPDATA directories (mount points). These usually identify a hard disk or a logical volume.
Place the BRBACKUP backup tape of the last successful and complete backup in the tape unit.
At least one valid
Adapt this file, for example with respect to the devices and drivers used. (See: Configuration of the BRBACKUP profile file).
Also note the following points:
cd $ORACLE_HOME/dbs
Alternatively the
init<DBSID>.sap file can also be read as a third file from a BRBACKUP tape using the cpio operating system command.UNIX:
cd $ORACLE_HOME/dbs
mt -f /dev/… rewind
mt -f 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.Do this as follows:
cd $ORACLE_HOME/dbs
brrestore -n init_ora
(this includes both profiles)
Do this as follows:
cd $SAPDATA_HOME/sapreorg
brrestore -n reorg_log
(this includes both logs)
Do this as follows:
cd $SAPDATA_HOME/sapbackup
brrestore -n sum_log
The last entry in the summary log matches the last backup. This is the relevant entry for the detail log (see next step). The last entry is normally incomplete, for example: return code not current. However this does not have any consequences for any of the subsequent operations.
Do this as follows:
brrestore -n det_log
From SAP Release 4.5B, 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.
BRARCHIVE summary log:
$SAPDATA_HOME/saparch/arch<DBSID>.logDo this as follows:
cd $SAPDATA_HOME/saparch
brrestore -n sum_log
If you use the BACKINT interface the procedure differs in some respects:
The profiles
init<DBSID>.utl (optional, depending on backup program) and init<DBSID>.sap must exist before you use BACKINT. In the profile init<DBSID>.sap you only have to define the name of the profile of the external backup program in the parameter util_par_file. You might have to reconstruct this first. You can do this either by editing, or by using the BACKINT command line interface to restore it directly.$SAPDATA_HOME/sapbackup/back<DBSID>.log
Do this as follows:
cd $SAPDATA_HOME/sapbackup
brrestore -d util_file -b2 "#NULL" -m $SAPDATA_HOME/sapbackup/back<DBSID>.log
The last entry in the summary log matches the last backup. This is the relevant entry for the detail log (see next step). The last entry is normally incomplete, for example: return code not current. However this does not have any consequences for any of the subsequent operations. Take the
<coded_timestamp> and the <fid> from this entry. This is required for the following operations.$SAPDATA_HOME/sapbackup/<coded timestamp>.<fid>
Do this as follows:
brrestore -d util_file -b2 "#NULL" -m $SAPDATA_HOME/sapbackup/<coded timestamp>.<fid>
Do this as follows:
brrestore -d util_file -b2 "#NULL" -m <pathname>
where
<pathname> is to be replaced 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
The procedure described above is complex. You can use the restore function of the external tool as an alternative.
An online backup must always be recovered to a point in time after the backup.
If you require a more current status than that of the restored offline backup you can also perform a recovery.
Restore the backup completely:
brrestore -b <coded_timestamp>.<fid> -m full
The
<coded_timestamp> and <fid> were already determined from the summary BRBACKUP log.If you have to perform recovery you must not open the database at this point.
brrestore -a <log_seg_No_A>-<log_seg_No_B>
<Log_Seg_No_A>
stands as ‘Current log sequence’ in the header of the detail BRBACKUP log.<Log_Seg_No_B>
stands as ‘target log sequence no.’ and matches the last backed up offline redo log file (last entry in the summary BRARCHIVE log arch<DBSID>.log).SQLPLUS> connect / as sysdba
SQLPLUS> startup database
SQLPLUS> recover database using backup controlfile until cancel
SQLPLUS> alter database open resetlogs;