Anda di halaman 1dari 32

TECHNICAL REPORT

Network Appliance, a pioneer and industry leader in data storage technology, helps organizations understand and meet complex technical challenges with advanced storage solutions and global data management strategies.

SAP R/3 Oracle/UNIX: Backup & Recovery in a SAN Environment


Nils Bauer | Network Appliance | May 2003 | TR-3261

TECHNICAL REPORT

Network Appliance Inc.

TECHNICAL REPORT

Table of Contents
1. Introduction ............................................................................................................................................................ 3 2. Standard SAP Split Mirror Backup for Oracle .................................................................................................... 4 3. Configuration Example ......................................................................................................................................... 6 4. Split Mirror Backup at the Database Server Using Snapshots ......................................................................... 7 5. Split Mirror Backup at a Backup Server Using Snapshots ............................................................................. 17 6. Backup/Recovery with Snapshot and SnapRestore ........................................................................................ 23 7. Backup/Restore Strategy in the SAP Environment ......................................................................................... 31

Network Appliance Inc.

TECHNICAL REPORT

1. Introduction
When you back up data or perform a restore with recovery, you should take the following parameters into account: 1. Time frame available for making the backup (backup window) 2. Actual time required to make the backup 3. Maximum reasonable time for performing a restore with recovery 4. Actual time required for the restore with recovery (MTTR = mean time to recover) Points 1 and 3 are parameters that are predetermined by the SAP application environment. Production systems frequently have to be available 24 hours a day, 7 days a week, which is why the backup time frame is very small. The maximum reasonable time for a restore with recovery usually depends on which business processes are affected by the SAP system downtime and the costs it incurs. These parameters are not determined by a particular method used but by the business processes that use this method. Parameters 2 and 4 are only defined by the method used. This method must, therefore, ensure that the backup can be made within the backup time frame available and a restore with recovery is executed within the time specified in parameter 3. Two basic backup variants are supported: Offline backup (cold backup) In this case, the database is shut down before the backup is made and is restarted when the backup is complete. The SAP application is not available while the backup is being made. The parameter for this backup variant is the length of time for which the database is unavailable. Online backup (hot backup) In this case, the database is switched to hot backup mode before the backup is made. Once the backup has been completed, hot backup mode is exited. The parameter for this backup variant is the length of time for which the database is in hot backup mode, since this mode affects performance. The time required to restore the database from the backup medium. The time required to recover the database via all the redo logs created as of the point when the backup was made to the point at which the recovery operation was completed.

The time required for a restore with recovery is based on two values:

The NetApp Snapshot and SnapRestore features enable backups to be made within very small backup time frames and significantly reduce the time required for restore with recovery. Create a backup on a backup medium using the SAP split mirror scenario supported by brbackup. The database here is backed up from the Snapshot. With this method, the length of time that the database is unavailable (cold backup) or running in hot backup mode (hot backup) is reduced to just a few minutes or seconds. Create a backup with a Snapshot => backup to disk in a few seconds. These backups can be made at shorter time intervals (hours) when the system is online.

Network Appliance Inc.

TECHNICAL REPORT

Restore the database to the status of a Snapshot using SnapRestore. This only takes a few minutes, regardless of the size of the database. Fast database recovery, since only a small number of redo logs have to be processed => Prerequisite: several Snapshots are taken when the system is online.

2. Standard SAP Split Mirror Backup for Oracle


2.1. Introduction The SAP backup tool brbackup supports the backup of the database using mirrored disks. This mirror is split before the backup is made. Using this technique it is possible to do an online or an offline backup. The time when the database is offline or the database is in hot backup mode is very short. This functionality enables the user to back up large databases or systems that do not allow large backup windows. The backup can be done either at the database server or with a separate backup server where Brbackup is implemented. The separate backup server minimizes the performance influence of the backup on the productive system. The backup of the database can be made using all backup methods supported by brbackup. (local tape, backint, etc.)

Split Mirror Backup at the Database Server

When the backup is carried out on the database server, the backup consists of the following steps: Starting brbackup -t offline_split (Offline Backup)
brbackup -t online_split (Online Backup)

Brbackup stops the database (offline backup) or sets the appropriate tablespaces in hot backup mode (online backup).

Network Appliance Inc.

TECHNICAL REPORT

The database server splits the mirror and mounts the split disks from the disk subsystem. Brbackup starts the database (offline backup) or ends the Hot Backup Mode on the appropriate tablespaces (online backup). The database is backed up from the mirrored disks. The mirror is resynchronized.

Split Mirror Backup with a Separate Backup Host When using a separate backup server the backup consists of the following steps: Starting brbackup -t offline_split (offline backup)
brbackup -t online_split (online backup)

Brbackup stops the database (offline backup) or sets the appropriate tablespaces in hot backup mode (online backup). These commands are carried out over SQL*Net. The backup server splits the mirror and mounts the split disks from the disk subsystem. Brbackup starts the database (offline backup) or ends the hot backup mode on the appropriate tablespaces (online backup). These commands are carried out over SQL*Net. The database is backed up from the mirrored disks. The mirror is resynchronized.

Network Appliance Inc.

TECHNICAL REPORT

2.2. Additional Information OSS Note 170607 OSS-Note 156620 SAPNet http://service.sap.com/atg: "Split Mirror Disk Backup for Oracle"

3. Configuration Example
Software releases used: SAP: SAP 4.6C SR2 Oracle: 8.1.7-64 Solaris: 8 The installation of the SAP system was accomplished according to the technical report TR-3243, SAP R/3 4.6C Oracle/UNIX: Integrating with a NetApp Filer in a SAN environment." Note: The file systems must be mounted with the "logging" option in order to be able to suspend I/O operation before a Snapshot of the file system is taken! Several parameters must be adapted in the scripts. Parameter Hostname SAP Server Hostname NetApp Filer Volume Names SAP SID Configuration example pp400 Fujitsu-Siemens Primecluster snapdrive2 -> data volume snapdrive -> log volume LUN

Password for oracle user "system" netapp

Network Appliance Inc.

TECHNICAL REPORT

4. Split Mirror Backup at the Database Server Using Snapshots


The employment of the NetApp Snapshot technology offers several advantages in relation to normal, block-oriented mirror techniques in the SAP Split Mirror environment. No double disk capacity necessary for the mirror. No complex configuration for the disk mirrors necessary. The Snapshot is taken with one command, without any previous configuration.

NetApp Snapshot Backup at the Database Server The described configuration assumes installation of the SAP system according to TR-3243, SAP R/3 4.6C Oracle/UNIX: Integrating with a NetApp Filer in a SAN Environment! 4.1. Profile Parameter in init<SID>.sap The section of the file initSID.sap shows the necessary parameters for a split mirror backup with brbackup. With the parameters orig_db_home and primary_db a split mirror backup at the database server can be accomplished. In the parameter field split_cmd the script is indicated, which is necessary for the split of the mirrors. In this script the Snapshot of the data and log volume is taken, and the Snapshots are mounted as LUNs. In the parameter field resync_cmd the script that should resync the mirror is indicated. In this script the created Snapshot LUNs are unmounted and destroyed.
... ... .. ... ... .. # backup type [offline | offline_force | offline_standby | offline_split # | offline_stop | online | online_cons | online_split] # default: offline backup_type = offline_split
Network Appliance Inc.

TECHNICAL REPORT

... ... .. ... ... .. # original database home directory for split mirror disk backup # no default orig_db_home = /oracle/SID ... ... .. ... ... .. # split mirror disks command # used if backup_type = offline_split | online_split # caution: if successful, exit code 0 and no output! # no default split_cmd = "/mnt/filer/software/projekte/backup_lun/split_cmd.sh" # resynchronize mirror disks command # used if backup_type = offline_split | online_split # caution: if successful, exit code 0 and no output! # no default resync_cmd = "/mnt/filer/software/projekte/backup_lun/resync_cmd.sh" ... ... .. ... ... .. # Oracle instance string to the primary database # [primary_db = <inst_str> | LOCAL] # no default primary_db = LOCAL

4.2. Script for Split Command The script split_cmd.sh creates a Snapshot of the volume snapdrive2. This Snapshot is then mounted as a LUN at the server. In the example there are always four Snapshots present, whereby the oldest is always deleted when a new one is taken. In order to provide a Snapshot of the online logs, when running a full offline backup, a further Snapshot of the log volume is taken. The script split_cmd.sh must be registered in initSID.sap as parameter split_cmd. Since some of the commands need to be executed as user root at the database server. These commands are executed with remote shell as user root. Remote shell access must be permitted. In order to be able to scan for new disks with the devfsadm command the corresponding disks must already be defined in /kernel/drv/sd.conf. The LUN IDs of the new disks are set to 1 and 2 in the script and must be adapted to the existing environment.
#! /bin/bash ############################################################################ # Name: split_cmd.sh # split command for SAP split mirror backup # # Network Appliance # Nils Bauer # # 10/18/2002 ############################################################################ LOGFILE=/mnt/filer/software/projekte/backup_lun/split_cmd.log date > $LOGFILE 2>&1 ######################### # rotate old snapshots ######################### rsh sapfiler1 snap delete rsh sapfiler1 snap rename rsh sapfiler1 snap rename rsh sapfiler1 snap rename
Network Appliance Inc.

snapdrive2 snapdrive2 snapdrive2 snapdrive2

sapdata_old3 >> $LOGFILE 2>&1 sapdata_old2 sapdata_old3 >> $LOGFILE 2>&1 sapdata_old1 sapdata_old2 >> $LOGFILE 2>&1 sapdata_new sapdata_old1 >> $LOGFILE 2>&1

TECHNICAL REPORT

rsh sapfiler1 snap delete snapdrive saplogs_new >> $LOGFILE 2>&1 ######################## Create Snapshots ##################################### ######################### # lock and flush data filesystem ######################### rsh pp400 -l root /usr/sbin/lockfs -w /oracle/LUN_sapdata >> $LOGFILE 2>&1 rsh pp400 -l root /usr/sbin/lockfs -f /oracle/LUN_sapdata >> $LOGFILE 2>&1 ######################### # create new snapshots for data volume ######################### rsh sapfiler1 snap create snapdrive2 sapdata_new >> $LOGFILE 2>&1 ######################### # unlock data filesystem ######################### rsh pp400 -l root /usr/sbin/lockfs -u /oracle/LUN_sapdata >> $LOGFILE 2>&1 ######################### # lock and flush log filesystem ######################### rsh pp400 -l root /usr/sbin/lockfs -w /oracle >> $LOGFILE 2>&1 rsh pp400 -l root /usr/sbin/lockfs -f /oracle >> $LOGFILE 2>&1 ######################### # create new snapshots for log volume ######################### rsh sapfiler1 snap create snapdrive saplogs_new >> $LOGFILE 2>&1 ######################### # unlock log filesystem ######################### rsh pp400 -l root /usr/sbin/lockfs -u /oracle >> $LOGFILE 2>&1 ######################## Create/check/mount snapshot LUNS ######################### ######################### # create LUNs based on snapshots ######################### rsh sapfiler1 lun create -b /vol/snapdrive2/.snapshot/sapdata_new/sapdata_lun /sapdata/vol/snapdrive2/sapdata_lun/sapdata_copy >> $LOGFILE 2>&1 rsh sapfiler1 lun create -b /vol/snapdrive/.snapshot/saplogs_new /saplog_lun/saplog/vol/snapdrive/saplog_lun/saplog_copy >> $LOGFILE 2>&1 ######################### # map LUNs to initiator group (pp400 with LUN ID 1 and 2) ######################### rsh sapfiler1 lun map /vol/snapdrive2/sapdata_lun/sapdata_copy pp400 1 >> $LOGFILE 2>&1 rsh sapfiler1 lun map /vol/snapdrive/saplog_lun/saplog_copy pp400 2 >> $LOGFILE 2>&1 ######################### # check luns and mappings ######################### rsh sapfiler1 lun show /vol/snapdrive2/sapdata_lun/sapdata_copy >> $LOGFILE 2>&1 rsh sapfiler1 lun show /vol/snapdrive/saplog_lun/saplog_copy >> $LOGFILE 2>&1 ######################### # get new volumes ######################### rsh pp400 -l root /usr/sbin/devfsadm >> $LOGFILE 2>&1 #########################
Network Appliance Inc.

TECHNICAL REPORT

# file system check on new volumes ######################### rsh pp400 -l root /usr/sbin/fsck -y /dev/rdsk/c2t1d1s6 >> $LOGFILE 2>&1 rsh pp400 -l root /usr/sbin/fsck -y /dev/rdsk/c2t1d2s6 >> $LOGFILE 2>&1 ######################### # mount new volumes ######################### rsh pp400 -l root /usr/sbin/mount /dev/dsk/c2t1d1s6 /mnt/sapdata_copy >> $LOGFILE 2>&1 rsh pp400 -l root /usr/sbin/mount /dev/dsk/c2t1d2s6 /mnt/saplog_copy >> $LOGFILE 2>&1

4.3. Script for Resync Command The script resync_cmd.sh unmounts and destroys the LUNs, which were created with split_cmd.sh.
#! /bin/bash ############################################################################ # Name: resync_cmd.sh # resync command for SAP split mirror backup # # Network Appliance # Nils Bauer # # 10/18/2002 ############################################################################ LOGFILE=/mnt/filer/software/projekte/backup_lun/resync_cmd.log date > $LOGFILE 2>&1 rsh pp400 -l root /usr/sbin/umount /mnt/sapdata_copy >> $LOGFILE 2>&1 rsh sapfiler1 lun unmap /vol/snapdrive2/sapdata_lun/sapdata_copy pp400 >> $LOGFILE 2>&1 rsh sapfiler1 lun destroy /vol/snapdrive2/sapdata_lun/sapdata_copy >> $LOGFILE 2>&1 rsh pp400 -l root /usr/sbin/umount /mnt/saplog_copy >> $LOGFILE 2>&1 rsh sapfiler1 lun unmap /vol/snapdrive/saplog_lun/saplog_copy pp400 >> $LOGFILE 2>&1 rsh sapfiler1 lun destroy /vol/snapdrive/saplog_lun/saplog_copy >> $LOGFILE 2>&1

4.4. Backup Using CCMS In order to be able to trigger the Snapshot backup with the transaction DB13 (DB planning calendar), the following actions must be accomplished: Changing the environment variable SAPDATA_HOME in the login profiles of the users
SIDadm and oraSID. User SIDadm: /home/SIDadm/.dbenv_<hostname>.csh (for C-Shell !) User oraSID: /oracle/SID/.dbenv_<<hostname>.csh (for C-Shell !)

The entry SAPDATA_HOME = /oracle/SID must be changed to SAPDATA_HOME = /mnt/sapdata_copy

Network Appliance Inc.

10

TECHNICAL REPORT

Change the selection table for the transaction DB13


- Transaction SE16 - Table: SDBAC - Choose DBSYS = ORACLE

Choose the entries ALGOF, ALL, ALLOF, ALLOG, PRTOF and PRTON. The following values must be changed: - Parameter PSTRING:Change "-t offline_force" respectively "-t online" to "-t offline_split" respectively "-t online_split". - Parameter LONGNAME: Add the phrase "NetApp Snapshot... "

Network Appliance Inc.

11

TECHNICAL REPORT

After the execution of these transactions, the changed backup entries will use the split mirror feature with Snapshots. The transaction DB13 will then show the following entries.

Network Appliance Inc.

12

TECHNICAL REPORT

4.4.1. Symbolic Links in SAPDATA_HOME

The SAP tools brbackup, brarchive, sapdba, and brrestore evaluate the environment variable SAPDATA_HOME. Because SAPDATA_HOME points to the directory /mnt/sapdata_copy several subdirectories must be made available in this directory. sapreorg
sapbackup saparch sapcheck saptrace

These directories must be available before brbackup executes split_cmd.sh (Snapshot of data LUN is not yet mounted on /mnt/sapdata_copy) and after the execution of split_cmd.sh. (Snapshot of data volume is mounted on /mnt/sapdata_copy). Therefore the links must be created in /mnt/sapdata_copy and in /oracle/LUN_sapdata.
Network Appliance Inc.

13

TECHNICAL REPORT

bash-2.03$ bash-2.03$ bash-2.03$ bash-2.03$ bash-2.03$ bash-2.03$ bash-2.03$ bash-2.03$ bash-2.03$ bash-2.03$ bash-2.03$

mkdir ln -s ln -s ln -s ln -s ln -s ln ln ln ln ln -s -s -s -s -s

/mnt/sapdata_copy /oracle/LUN/sapcheck /mnt/sapdata_copy/sapcheck /oracle/LUN/saptrace /mnt/sapdata_copy/saptrace /oracle/LUN/saparch /mnt/sapdata_copy/saparch /oracle/LUN/sapbackup /mnt/sapdata_copy/sapbackup /oracle/LUN/sapreorg /mnt/sapdata_copy/sapreorg /oracle/LUN/sapcheck /oracle/LUN_sapdata/sapcheck /oracle/LUN/saptrace /oracle/LUN_sapdata/saptrace /oracle/LUN/saparch /oracle/LUN_sapdata/saparch /oracle/LUN/sapbackup /oracle/LUN_sapdata/sapbackup /oracle/LUN/sapreorg /oracle/LUN_sapdata/sapreorg

Brbackup backs up the online redologs from origlogA/B when executing a full offline backup. Brbackup expects the online redologs in the path $SAPDATA_HOME/origlogA respectively $SAPDATA_HOME/origlogB. In order to provide the online redologs, a further Snapshot of the log volume is taken in the script split_cmd.sh. The directories origlogA and origlogB are created with symbolic links.
bash-2.03$ mkdir /mnt/saplog_copy bash-2.03# ln -s /mnt/saplog_copy/LUN/origlogA /oracle/LUN_sapdata/origlogA bash-2.03# ln -s /mnt/saplog_copy/LUN/origlogB /oracle/LUN_sapdata/origlogB
4.4.2. Restore with brrestore or sapdba

If the backups are started from the CCMS, i.e., if the environment variable SAPDATA_HOME for the user oraSID and SIDadm were changed, it is necessary to set the value for SAPDATA_HOME back to /oracle/SID before using brrestore or sapdba. Otherwise brrestore won't restore the data to the original path. Further, sapdba needs the environment variable SAPDATA_HOME pointing to /oracle/SID for several operations.
> setenv SAPDATA_HOME /oracle/SID > brrestore > ... ....

Another way is to set the environment for sapdba in a script. Therefore sapdba has to be renamed to sapdba.bin. In /usr/sap/LUN/SYS/exe/run a script sapdba with the following contents has to be created:
sapdba #!/bin/csh setenv SAPDATA_HOME /oracle/LUN /usr/sap/LUN/SYS/exe/run/sapdba.bin $*

Restoring data with sapdba can now be accomplished as usual. Brrestore however cannot restore data from the Snapshot directly to the original database directory. Brrestore always reads from the backup medium and writes to the original database directory. Of course manual copying of individual data files from the Snapshot to the original database directory is possible. With SnapRestore all data files can be reset to the timestamp of a Snapshot. Recovery must then be carried out with Oracle tools, e.g., server manager (-> see also chapter 6, "Backup/Recovery with Snapshots and SnapRestore").

Network Appliance Inc.

14

TECHNICAL REPORT

4.5. Backup Using the Command Line


4.5.1. Script snapbrbackup.sh

If the backup is not to be started with the CCMS, it can be started with the script snapbrbackup.sh. The shell script must be executed as user oraSID. The script snapbrbackup.sh serves the call of brbackup with the appropriate options. Further in the script the necessary environment variables are set in order to accomplish a split mirror backup at the database server. The environment variable SAPDATA_HOME must point to /mnt/sapdata_copy.
#! /bin/bash ######################################################################## # Name: snapbrbackup.sh # SAP Split Mirror Backup for Oracle with NetApp Snapshots # # Parameter: online_split Online Backup # offline_split Offline Backup # # Network Appliance GmbH # 26.02.2003 Nils Bauer ######################################################################### ######################################################################## # The following Parameter must be adjusted !!!! ######################################################################## ORACLE_SID=LUN PW_SYSTEM_USER="netapp" ######################################################################## # Environment for brbackup SAPDATA_HOME=/mnt/sapdata_copy ######################################################################## # Variables TYPE="" ######################################################################## # Syntax check case $1 in "online_split") TYPE="online_split" ;; "offline_split") TYPE="offline_split" ;; *) echo "Syntax: snapbrbackup <online_split|offline_split>" exit ;; esac ######################################################################## # Start brbackup brbackup -u system/$PW_SYSTEM_USER -c force -t $TYPE -m all
4.5.2. Symbolic Links in SAPDATA_HOME

The SAP tools brbackup, brarchive, sapdba, and brrestore evaluate the environment variable SAPDATA_HOME. Because SAPDATA_HOME points to the directory /mnt/sapdata_copy, several subdirectories must be made available in this directory.
sapreorg sapbackup

Network Appliance Inc.

15

TECHNICAL REPORT

saparch sapcheck saptrace

These directories must be available before brbackup executes split_cmd.sh (Snapshot of data LUN is not yet mounted on /mnt/sapdata_copy) and after the execution of split_cmd.sh. (Snapshot of data volume is mounted on /mnt/sapdata_copy). Therefore the links must be created in /mnt/sapdata_copy and in /oracle/LUN_sapdata.
bash-2.03$ bash-2.03$ bash-2.03$ bash-2.03$ bash-2.03$ bash-2.03$ bash-2.03$ bash-2.03$ bash-2.03$ bash-2.03$ bash-2.03$ mkdir ln -s ln -s ln -s ln -s ln -s ln ln ln ln ln -s -s -s -s -s /mnt/sapdata_copy /oracle/LUN/sapcheck /mnt/sapdata_copy/sapcheck /oracle/LUN/saptrace /mnt/sapdata_copy/saptrace /oracle/LUN/saparch /mnt/sapdata_copy/saparch /oracle/LUN/sapbackup /mnt/sapdata_copy/sapbackup /oracle/LUN/sapreorg /mnt/sapdata_copy/sapreorg /oracle/LUN/sapcheck /oracle/LUN_sapdata/sapcheck /oracle/LUN/saptrace /oracle/LUN_sapdata/saptrace /oracle/LUN/saparch /oracle/LUN_sapdata/saparch /oracle/LUN/sapbackup /oracle/LUN_sapdata/sapbackup /oracle/LUN/sapreorg /oracle/LUN_sapdata/sapreorg

Brbackup backs up the online redologs from origlogA/B when executing a full offline backup. Brbackup expects the online redologs in the path $SAPDATA_HOME/origlogA respectively $SAPDATA_HOME/origlogB. In order to provide the online redologs, a further Snapshot of the log volume is taken in the script split_cmd.sh. The directories origlogA and origlogB are created with symbolic links.
bash-2.03$ mkdir /mnt/saplog_copy bash-2.03# ln -s /mnt/saplog_copy/LUN/origlogA /oracle/LUN_sapdata/origlogA bash-2.03# ln -s /mnt/saplog_copy/LUN/origlogB /oracle/LUN_sapdata/origlogB

Network Appliance Inc.

16

TECHNICAL REPORT

5. Split Mirror Backup at a Backup Server Using Snapshots

NetApp Snapshot Backup at Separate Backup Server The further described configuration assumes an installation of the SAP system according to TR3243, SAP R/3 4.6C Oracle/UNIX: Integrating with a NetApp Filer in a SAN Environment! 5.1. Script for Split Command The script split_cmd.sh creates a Snapshot of the volume snapdrive2. This Snapshot is then mounted as a LUN at the server. In the example there are always four Snapshots presentthe oldest is always deleted when a new one is taken. In order to provide a Snapshot of the online logs when running a full offline backup, a further Snapshot of the log volume is taken. The script split_cmd.sh must be registered in initSID.sap as parameter split_cmd. Since some of the commands need to be executed as user root at the database server these commands are executed with remote shell as user root. Remote shell access must be permitted. In order to be able to scan for new disks with the devfsadm command, the corresponding disks must already be defined in /kernel/drv/sd.conf. The LUN IDs of the new disks are set to 1 and 2 in the script and must be adapted to the existing environment.
#! /bin/bash ############################################################################ # Name: split_cmd.sh # split command for SAP split mirror backup # # Network Appliance # Nils Bauer # # 10/18/2002 ############################################################################ LOGFILE=/mnt/filer/software/projekte/backup_lun/split_cmd.log date > $LOGFILE 2>&1
Network Appliance Inc.

17

TECHNICAL REPORT

######################### # rotate old snapshots ######################### rsh sapfiler1 snap delete rsh sapfiler1 snap rename rsh sapfiler1 snap rename rsh sapfiler1 snap rename rsh sapfiler1 snap delete

snapdrive2 sapdata_old3 >> $LOGFILE 2>&1 snapdrive2 sapdata_old2 sapdata_old3 >> $LOGFILE 2>&1 snapdrive2 sapdata_old1 sapdata_old2 >> $LOGFILE 2>&1 snapdrive2 sapdata_new sapdata_old1 >> $LOGFILE 2>&1 snapdrive saplogs_new >> $LOGFILE 2>&1

######################## Create Snapshots ##################################### ######################### # lock and flush data filesystem ######################### rsh pp400 -l root /usr/sbin/lockfs -w /oracle/LUN_sapdata >> $LOGFILE 2>&1 rsh pp400 -l root /usr/sbin/lockfs -f /oracle/LUN_sapdata >> $LOGFILE 2>&1 ######################### # create new snapshots for data volume ######################### rsh sapfiler1 snap create snapdrive2 sapdata_new >> $LOGFILE 2>&1 ######################### # unlock data filesystem ######################### rsh pp400 -l root /usr/sbin/lockfs -u /oracle/LUN_sapdata >> $LOGFILE 2>&1 ######################### # lock and flush log filesystem ######################### rsh pp400 -l root /usr/sbin/lockfs -w /oracle >> $LOGFILE 2>&1 rsh pp400 -l root /usr/sbin/lockfs -f /oracle >> $LOGFILE 2>&1 ######################### # create new snapshots for log volume ######################### rsh sapfiler1 snap create snapdrive saplogs_new >> $LOGFILE 2>&1 ######################### # unlock log filesystem ######################### rsh pp400 -l root /usr/sbin/lockfs -u /oracle >> $LOGFILE 2>&1 ######################## Create/check/mount snapshot LUNS ######################### ######################### # create LUNs based on snapshots ######################### rsh sapfiler1 lun create -b /vol/snapdrive2/.snapshot/sapdata_new/sapdata_lun /sapdata vol/snapdrive2/sapdata_lun/sapdata_copy >> $LOGFILE 2>&1 rsh sapfiler1 lun create -b /vol/snapdrive/.snapshot/saplogs_new/saplog_lun /saplog vol/snapdrive/saplog_lun/saplog_copy >> $LOGFILE 2>&1 ######################### # map LUNs to initiator group (backup with LUN ID 1 and 2) ######################### rsh sapfiler1 lun map /vol/snapdrive2/sapdata_lun/sapdata_copy backup 1 >> $LOGFILE 2>&1 rsh sapfiler1 lun map /vol/snapdrive/saplog_lun/saplog_copy backup 2 >> $LOGFILE 2>&1 ######################### # check luns and mappings #########################
Network Appliance Inc.

18

TECHNICAL REPORT

rsh sapfiler1 lun show /vol/snapdrive2/sapdata_lun/sapdata_copy >> $LOGFILE 2>&1 rsh sapfiler1 lun show /vol/snapdrive/saplog_lun/saplog_copy >> $LOGFILE 2>&1 ######################### # get new volumes ######################### rsh localhost -l root /usr/sbin/devfsadm >> $LOGFILE 2>&1 ######################### # file system check on new volumes ######################### rsh localhost -l root /usr/sbin/fsck -y /dev/rdsk/c1t1d1s6 >> $LOGFILE 2>&1 rsh localhost -l root /usr/sbin/fsck -y /dev/rdsk/c1t1d2s6 >> $LOGFILE 2>&1 ######################### # mount new volumes ######################### rsh localhost -l root /usr/sbin/mount /dev/dsk/c1t1d1s6 /mnt/sapdata_copy >> $LOGFILE 2>&1 rsh localhost -l root /usr/sbin/mount /dev/dsk/c1t1d2s6 /mnt/saplog_copy >> $LOGFILE 2>&1

5.2. Script for Resync Command The script resync_cmd.sh unmounts and destroys the LUNs, which were created with split_cmd.sh.
#! /bin/bash ############################################################################ # Name: resync_cmd.sh # resync command for SAP split mirror backup # # Network Appliance # Nils Bauer # # 10/18/2002 ############################################################################ LOGFILE=/mnt/filer/software/projekte/backup_lun/resync_cmd.log date > $LOGFILE 2>&1 rsh localhost -l root /usr/sbin/umount /mnt/sapdata_copy >> $LOGFILE 2>&1 rsh sapfiler1 lun unmap /vol/snapdrive2/sapdata_lun/sapdata_copy backup >> $LOGFILE 2>&1 rsh sapfiler1 lun destroy /vol/snapdrive2/sapdata_lun/sapdata_copy >> $LOGFILE 2>&1 rsh localhost -l root /usr/sbin/umount /mnt/saplog_copy >> $LOGFILE 2>&1 rsh sapfiler1 lun unmap /vol/snapdrive/saplog_lun/saplog_copy backup >> $LOGFILE 2>&1 rsh sapfiler1 lun destroy /vol/snapdrive/saplog_lun/saplog_copy >> $LOGFILE 2>&1

5.3. Installation and Configuration Oracle and SAP Software Create the home directory /oracle/SID. Create the user oraSID at the backup sever with the same parameters as they are at the database server.

Network Appliance Inc.

19

TECHNICAL REPORT

Copy the files .login, .cshrc,.dbenv_<hostname>.csh from the database server to /oracle/SID at the backup server. Adapt the file name dbenv_<hostname>.csh to the correct host name of the backup server. Install the Oracle software as user oraSID. Copy the file /oracle/SID/817_64/network/admin/tnsnames.ora and sqlnet.ora from the database server to the backup server. => Test the connection with
# tnsping SID

Test the connection from the backup server to the database server:
# svrmgrl SVRMGR> connect system@SID Password: ******** Connected. SVRMGR>

Copy the files /sapmnt/SID/exe/brbackup, brconnect, and brtools from the database server to the backup server (e.g., to usr/local/bin) Copy the files /oracle/SID/817_64/dbs/initSID.sap, init_817.ora and initora.addon from the database server to the backup server Create an Oracle password file at the database server. orapwd file=$ORACLE_HOME/dbs/orapw password=<irgendwas> entries=100 Insert remote_login_passwordfile = exclusive in initSID.ora at the database server. Shut down and restart the database to activate the changes. The Oracle user system must have SYSOPER rights. SVRMGR>grant sysoper to
system;

Insert the backup server into the /etc/hosts.equiv file at the database server, since the backup server must execute commands via remote shell. Export the directory /oracle/LUN/sapbackup at the database server. Mount the directory sapbackup from the database server to /oracle/LUN/sapbackup at the backup server. Create the directory /oracle/LUN/sapreorg.

5.4. Symbolic Links and Directories in SAPDATA_HOME The SAP tools brbackup, brarchive, sapdba, and brrestore evaluate the environment variable SAPDATA_HOME. Because SAPDATA_HOME points to the directory /mnt/sapdata_copy several subdirectories must be made available in this directory.
sapreorg sapbackup

Network Appliance Inc.

20

TECHNICAL REPORT

saparch sapcheck saptrace

These directories must be available before brbackup executes split_cmd.sh (Snapshot of data LUN is not yet mounted on /mnt/sapdata_copy) and after the execution of split_cmd.sh. (Snapshot of data volume is mounted on /mnt/sapdata_copy) Therefore the links must be created in /mnt/sapdata_copy at the backup server and in /oracle/LUN_sapdata at the database server. The following commands must be executed at the backup server:
bash-2.03$ bash-2.03$ bash-2.03$ bash-2.03$ bash-2.03$ bash-2.03$ mkdir ln -s ln -s ln -s ln -s ln -s /mnt/sapdata_copy /oracle/LUN/sapcheck /mnt/sapdata_copy/sapcheck /oracle/LUN/saptrace /mnt/sapdata_copy/saptrace /oracle/LUN/saparch /mnt/sapdata_copy/saparch /oracle/LUN/sapbackup /mnt/sapdata_copy/sapbackup /oracle/LUN/sapreorg /mnt/sapdata_copy/sapreorg

The following commands must be executed at the database server:


bash-2.03$ bash-2.03$ bash-2.03$ bash-2.03$ bash-2.03$ ln ln ln ln ln -s -s -s -s -s /oracle/LUN/sapcheck /oracle/LUN_sapdata/sapcheck /oracle/LUN/saptrace /oracle/LUN_sapdata/saptrace /oracle/LUN/saparch /oracle/LUN_sapdata/saparch /oracle/LUN/sapbackup /oracle/LUN_sapdata/sapbackup /oracle/LUN/sapreorg /oracle/LUN_sapdata/sapreorg

Brbackup backs up the online redologs from origlogA/B when executing a full offline backup. Brbackup expects the online redologs in the path $SAPDATA_HOME/origlogA respectively $SAPDATA_HOME/origlogB. In order to provide the online redologs, a further Snapshot of the log volume is taken in the script split_cmd.sh. The directories origlogA and origlogB are created with symbolic links. The following commands must be executed at the database server:
bash-2.03$ mkdir /mnt/saplog_copy bash-2.03# ln -s /mnt/saplog_copy/LUN/origlogA /oracle/LUN_sapdata/origlogA bash-2.03# ln -s /mnt/saplog_copy/LUN/origlogB /oracle/LUN_sapdata/origlogB

5.5. Profile Parameter in init<SID>.sap The section of the file initSID.sap shows the necessary parameters for a split mirror backup with brbackup. With the parameters orig_db_home and primary_db a split mirror backup at the database server can be accomplished. In the parameter field split_cmd the script is indicated, which is necessary for the split of the mirrors. In this script the Snapshot of the data and log volume is taken and the Snapshots are mounted as LUNs. In the parameter field resync_cmd the script is indicated that should resync the mirror. In this script the created Snapshot LUNs are unmounted and destroyed.
... ... .. ... ... .. # backup type [offline | offline_force | offline_standby | offline_split # | offline_stop | online | online_cons | online_split] # default: offline backup_type = offline_split
Network Appliance Inc.

21

TECHNICAL REPORT

... ... .. ... ... .. # original database home directory for split mirror disk backup # no default orig_db_home = /oracle/SID ... ... .. ... ... .. # split mirror disks command # used if backup_type = offline_split | online_split # caution: if successful, exit code 0 and no output! # no default split_cmd = "/mnt/filer/software/projekte/backup_lun/split_cmd.sh" # resynchronize mirror disks command # used if backup_type = offline_split | online_split # caution: if successful, exit code 0 and no output! # no default resync_cmd = "/mnt/filer/software/projekte/backup_lun/resync_cmd.sh" ... ... .. ... ... .. # Oracle instance string to the primary database # [primary_db = <inst_str> | LOCAL] # no default primary_db = LUN

5.6. Script snapbrbackup.sh The shell script must be executed as user oraSID. The script snapbrbackup.sh serves the call of brbackup with the appropriate options. The necessary environment variables are set further in the script in order to accomplish a split mirror backup. The environment variable SAPDATA_HOME must point to /mnt/sapdata_copy.
#! /bin/bash ######################################################################## # Name: snapbrbackup.sh # SAP Split Mirror Backup for Oracle with NetApp Snapshots # # Parameter: online_split Online Backup # offline_split Offline Backup # # Network Appliance GmbH # 26.02.2003 Nils Bauer ######################################################################### ######################################################################## # The following Parameter must be adjusted !!!! ######################################################################## ORACLE_SID=LUN PW_SYSTEM_USER="netapp" ######################################################################## # Environment for brbackup SAPDATA_HOME=/mnt/sapdata_copy ######################################################################## # Variables TYPE="" ######################################################################## # Syntax check case $1 in "online_split") TYPE="online_split" ;;
Network Appliance Inc.

22

TECHNICAL REPORT

"offline_split") TYPE="offline_split" ;; *) echo "Syntax: snapbrbackup <online_split|offline_split>" exit ;; esac ######################################################################## # Start brbackup brbackup -u system/$PW_SYSTEM_USER -c force -t $TYPE -m all

6. Backup/Recovery with Snapshot and SnapRestore


6.1. Introduction With Snapshots, complete copies of the database can be provided in a few seconds. These copies can be restored completely with SnapRestore. The restore of a Snapshot with SnapRestore takes only a few minutes. Snapshots work on the volume level. With SnapRestore a single LUN or a complete volume can be restored to a certain Snapshot. To be able to perform a rollforward of the database with the online and offline redologs different issues must be considered. At least one copy of the control files must be outside the data LUN. After a SnapRestore is accomplished, this control file must be copied into the appropriate directory in the data LUN. If all control files are stored in the sapdata volume, a rollforward can be made only by recover database using backup control file. After such a recovery the database can be opened only with alter database open resetlogs. A complete recovery using an older backup is then no longer possible. To be able to reset the database to the state of a Snapshot, one control file must be stored in the data LUN. If possible, only the sapdata directories should be stored in the data LUN so that no log files, etc., are reset to an old timestamp when using SnapRestore.

Network Appliance Inc.

23

TECHNICAL REPORT

File System Structure for Recovery with SnapRestore 6.2. Scripts The script snapshot.sh takes a Snapshot of the volume snapdrive2. In the example three Snapshots are always present; the oldest is always deleted when a new one is taken. With the parameter online or offline, whether the database is shut down or set in hot backup mode before the Snapshot is taken is controlled. After the creation of the Snapshots the hot backup mode is ended or the database is started again.
snapshot.sh #! /bin/bash ######################################################################## # Name: Snapshot # Create a Snapshot # Turning tablespaces in hot backup mode or shut down DB # # Syntax Snapshot <online|offline> # # Parameter: online Turns all tablespaces in hotbackup mode before # doing the Snapshot. Ends hotbackup mode after # creating the Snapshot # offline Shuts down the DB before doing the Snapshot # Starts the DB after creating the Snapshot # # Network Appliance GmbH # 16.02.2003 Nils Bauer
Network Appliance Inc.

24

TECHNICAL REPORT

# # ######################################################################## LOGFILE=/mnt/filer/software/projekte/backup_lun/snapshot.log date > $LOGFILE 2>&1 ######################################################################## # Variables ######################################################################## ON_OR_OFF=0 NAME="" ######################################################################## # Syntax check ######################################################################## if [ "$1" ] then ON_OR_OFF=$1 else echo "Syntax: snapshot <online|offline> " exit 1 fi if [ "$ON_OR_OFF" = "online" -o "$ON_OR_OFF" = "offline" ] then : else echo "Syntax: snapshot <online|offline> " exit 1 fi ######################################################################## # main ######################################################################## if [ "$ON_OR_OFF" = "online" ] then /mnt/filer/software/projekte/backup_lun/dohotbackup.sh rsh sapfiler1 snap delete snapdrive2 sap_online_old2 rsh sapfiler1 snap rename snapdrive2 sap_online_old1 sap_online_old2 rsh sapfiler1 snap rename snapdrive2 sap_online_new sap_online_old1 # lock and flush data file system rsh pp400 -l root /usr/sbin/lockfs -w /oracle/LUN_sapdata rsh pp400 -l root /usr/sbin/lockfs -f /oracle/LUN_sapdata rsh pp400 -l root /usr/sbin/lockfs -a # create new Snapshot rsh sapfiler1 snap create snapdrive2 sap_online_new # unlock file system rsh pp400 -l root /usr/sbin/lockfs -u /oracle/LUN_sapdata rsh pp400 -l root /usr/sbin/lockfs -a /mnt/filer/software/projekte/backup_lun/endhotbackup.sh fi if [ "$ON_OR_OFF" = "offline" ] then /mnt/filer/software/projekte/backup_lun/doshutdown.sh rsh sapfiler1 snap delete snapdrive2 sap_offline_old2 rsh sapfiler1 snap rename snapdrive2 sap_offline_old1 sap_offline_old2 rsh sapfiler1 snap rename snapdrive2 sap_offline_new sap_offline_old1 # lock and flush data file system rsh pp400 -l root /usr/sbin/lockfs -w /oracle/LUN_sapdata rsh pp400 -l root /usr/sbin/lockfs -f /oracle/LUN_sapdata rsh pp400 -l root /usr/sbin/lockfs -a # create new snapshot rsh sapfiler1 snap create snapdrive2 sap_offline_new # unlock file system
Network Appliance Inc.

25

TECHNICAL REPORT

rsh pp400 -l root /usr/sbin/lockfs -u /oracle/LUN_sapdata rsh pp400 -l root /usr/sbin/lockfs -a /mnt/filer/software/projekte/backup_lun/dostartup.sh fi exit 0 dohotbackup.sh #! /bin/bash $ORACLE_HOME/bin/sqlplus system/netapp @/mnt/filer/software/projekte/backup_lun /dobegin.sql endhotbackup.sh #! /bin/bash $ORACLE_HOME/bin/sqlplus system/netapp @/mnt/filer/software/projekte/backup_lun /doend.sql dobegin.sql connect system/netapp set feedback off set pagesize 0 spool /mnt/filer/software/projekte/backup_lun/begin_backup.sql select 'alter tablespace '||tablespace_name||' begin backup;' from dba_tablespaces; spool off @/mnt/filer/software/projekte/backup_lun/begin_backup.sql exit doend.sql connect system/netapp set feedback off set pagesize 0 spool /mnt/filer/software/projekte/backup_lun/end_backup.sql select 'alter tablespace '||tablespace_name||' end backup;' from dba_tablespaces; spool off @/mnt/filer/software/projekte/backup_lun/end_backup.sql exit doshutdown.sh #! /bin/bash $ORACLE_HOME/bin/sqlplus system/netapp @/mnt/filer/software/projekte/backup_lun /dbshut.sql dostartup.sh #! /bin/bash $ORACLE_HOME/bin/svrmgrl < /mnt/filer/software/projekte/backup_lun/dbstart.sql dbstart connect internal startup exit dbshut connect internal shutdown immediate exit
Network Appliance Inc.

26

TECHNICAL REPORT

6.3. Distribution of the Control Files If in the R/3 releases used all the control files are stored in the data LUN, the control files should be distributed to other directories. Otherwise, after a SnapRestore of the data LUN, all control files have the state of the Snapshot. A forward recovery would only be possible with the option ..using backup controlfile. Opening the database after the recovery is then only possible with the option ..resetlogs. This has the disadvantage that no complete recovery of an older backup is then possible. In order to make a complete reset of the database to the state of a Snapshot, one control file should always be stored in the data LUN (e.g., sapdata1). Therefore two of the three control files should be stored in the SAPARCH and ORIGLOGA directories. Shut down the database Edit the configuration file .../oracle/SID/dbs/init<SID>.ora Adapt the path for the control files in line control_files = (... ...) Create the directories .../oracle/SID/origlogA/cntrl and ./oracle/SID/saparch/cntrl Move the files .../oracle/SID/sapdata1/cntrl/cntrlSID.dbf and ... /oracle/SID/sapdata2/cntrl/cntrlSID.dbf to the directories .../oracle/SID/origlogA/cntrl and .../oracle/SID/saparch/cntrl Start up the database

6.4. Integration into SAP CCMS Taking a Snapshot can be defined as a job in the SAP CCMS. To simplify the job planning, it is possible to define external commands inside the SAP system, which call the scripts with the appropriate parameters. The script snapshot.sh must be copied to the directory /usr/sap/SYS/exe/run. Create an external command for a Snapshot while the database is online
Transaction SM69 Create a command Name: ZSNAPSHOT_ONLINE Operating System: ANYOS OS Command: snapshot.sh Parameter : online Save

Create an external command for a Snapshot while the database is offline


Transaction SM69 Create a command Name: ZSNAPSHOT_OFFLINE Operating System: ANYOS OS Command: snapshot.sh Parameter : offline Save

Network Appliance Inc.

27

TECHNICAL REPORT

6.5. Restore with SnapRestore


6.5.1. SnapRestore and Forward Recovery

If a forward recovery of the database is desired, a current control file must be copied to the data LUN after the SnapRestore. Thereupon either a complete or an incomplete recovery can be done. A restore of the complete database with SnapRestore is accomplished with the following steps: Stop the SAP Shutdown the database Unmount the data LUN
bash-2.03# umount /oracle/LUN_sapdata

Set data LUN offline


bash-2.03# rsh sapfiler1 lun offline /vol/snapdrive2/sapdata_lun/sapdata

Restore the LUN with SnapRestore Assumption: A Snapshot was taken, while the database was in hot backup mode. The snapshotname is "sap_online_new".

Network Appliance Inc.

28

TECHNICAL REPORT

bash-2.03# rsh sapfiler1 snap restore -t file -s sap_online_new /vol/snapdrive2/sapdata_lun/sapdata WARNING! This will restore a file from a Snapshot into the active file system. If the file already exists in the active file system, it will be overwritten with the contents from the Snapshot. Are you sure you want to do this? Y You have selected file /vol/snapdrive2/sapdata_lun/sapdata, snapshot sap_online_new Proceed with restore? Y

Set data LUN online


bash-2.03# rsh sapfiler1 lun online/vol/snapdrive2/sapdata_lun/sapdata

Mount data LUN


bash-2.03# mount /oracle/LUN_sapdata

Copy the control files from /oracle/SID/origlogA/cntrl to /oracle/SID/sapdata1/cntrl, so that all control files have the newest state and a forward recovery is possible. Recover the database using Oracle server manager.
SVRMGR> connect internal Connected.SVRMGR> startup mount; ORACLE instance started. Total System Global Area 543407804 bytes Fixed Size 102076 bytes Variable Size 236228608 bytes Database Buffers 306012160 bytes Redo Buffers 1064960 bytes Database mounted. SVRMGR> recover database; ORA-00279: change 1204404 generated at 02/28/2003 16:00:23 needed for thread 1 ORA-00289: suggestion : /oracle/LUN/saparch/LUNarch1_1373.dbf ORA-00280: change 1204404 for thread 1 is in sequence #1373 Specify log: {<RET>=suggested | filename | AUTO | CANCEL} Log applied. ... ... ... ... .. Media recovery complete. SVRMGR> alter database open; Statement processed. SVRMGR>

The time necessary for a complete restore and recovery of the database depends only on the number of redologs that have to be applied. The restore of the LUN with SnapRestore takes only a few minutes.
6.5.2. Reset the Database to a Snapshot

If the database is to be reset to the state of a Snapshot, the control file from the data LUN must be copied to the directories ../origloga/cntrl and ../saparch/cntrl. The restore is made by the following steps: Restore from a Snapshot taken at online operation:
Network Appliance Inc.

29

TECHNICAL REPORT

Stop the SAP system. Shut down the database. Unmount the data LUN.
bash-2.03# umount /oracle/LUN_sapdata

Set the data LUN offline.


bash-2.03# rsh sapfiler1 lun offline /vol/snapdrive2/sapdata_lun/sapdata

Restore the data LUN with SnapRestore. Assumption: A Snapshot was taken while the database was in hot backup mode. The Snapshot name is sap_online_new.
bash-2.03# rsh sapfiler1 snap restore -t file -s sap_online_new /vol/snapdrive2/sapdata_lun/sapdata WARNING! This will restore a file from a Snapshot into the active filesystem. If the file already exists in the active filesystem, it will be overwritten with the contents from the Snapshot. Are you sure you want to do this? Y You have selected file /vol/snapdrive2/sapdata_lun/sapdata, snapshot sap_online_new Proceed with restore? Y

Set data LUN online.


bash-2.03# rsh sapfiler1 lun online /vol/snapdrive2/sapdata_lun/sapdata

Mount data LUN.


bash-2.03# mount /oracle/LUN_sapdata

Copy the control files from ../oracle/SID/sapdata1/cntrl to ../oracle/SID/origlogA/cntrl and ../oracle/SID/saparch/cntrl, so that all control files have the state of the Snapshot. Incomplete recovery of the database using Servermanager (e.g., time-based recovery).
# > > > svrmgrl connect internal startup mount recover database until time '2001-06-19:12:59:55' using backup controlfile; > ... ... ... . -> Apply the Offline Redologs > alter database open resetlogs;

Restore from an offline database Snapshot: Stop the SAP system. Shutdown the database. Unmount the data LUN.
bash-2.03# umount /oracle/LUN_sapdata

Set data LUN offline.


bash-2.03# rsh sapfiler1 lun offline /vol/snapdrive2/sapdata_lun/sapdata

Network Appliance Inc.

30

TECHNICAL REPORT

Restore the data LUN with SnapRestore. Assumption: A Snapshot of the data and log volume was taken while the database was offline. The Snapshot names are sap_offline_new and sap_offlogs_new
bash-2.03# rsh sapfiler1 snap restore -t file -s sap_offline_new /vol/snapdrive2/sapdata_lun/sapdata

WARNING! This will restore a file from a Snapshot into the active file system. If the file already exists in the active file system, it will be overwritten with the contents from the Snapshot. Are you sure you want to do this? Y You have selected file /vol/snapdrive2/sapdata_lun/sapdata, snapshot sap_online_new Proceed with restore? Y Set data LUN online.
bash-2.03# rsh sapfiler1 lun online /vol/snapdrive2/sapdata_lun/sapdata

Mount data LUN.


bash-2.03# mount /oracle/LUN_sapdata

Copy the control files from ../oracle/SID/sapdata1/cntrl to ../oracle/SID/origlogA/cntrl and ../oracle/SID/saparch/cntrl, so that all control files have the state of the Snapshot. Temporarily mount the Snapshot of the log volume.
bash-2.03# rsh sapfiler1 lun create -b /vol/snapdrive/.snapshot/saplogs_new/saplog_lun/saplog /vol/snapdrive/saplog_lun/saplog_copy bash-2.03# rsh sapfiler1 lun map /vol/snapdrive/saplog_lun/saplog_copy pp400 2 bash-2.03# devfsadm bash-2.03# /usr/sbin/mount /dev/dsk/c2t1d2s6 /mnt/saplog_copy

Copy the online redologs from /mnt/sapdata_copy/LUN/origlogA/B and mirrlogA/B to /oracle/LUN/origlogA/B and/or mirrlogA/B. Start the database.
# svrmgrl > connect internal > startup

7. Backup/Restore Strategy in the SAP Environment


7.1. SAP Production System Using Snapshot and SnapRestore technology saves substantial time when backups or restores are carried out. Take a daily online or offline backup with brbackup and SAP split mirror with Snapshots. The offline time of the database or the time when the database is in hot backup mode is limited to a few minutes or seconds. Whether the backup is to be taken directly at the database server or with a separate backup host, depends on the performance influence, which can be accepted at the database server. These Snapshots can be stored e.g. one week. Thus the Snapshots sapdata_old1 to sapdata_old6 and sapdata_new have to be configured in the script split_cmd.sh. Take several additional Snapshots daily of the database in hot backup mode, e.g., every two hours. These Snapshots provide a very fast restore of the database with

Network Appliance Inc.

31

TECHNICAL REPORT

SnapRestore. In the case of an error, at least the offline redologs of the last two hours must be applied. Therefore the Snapshots sap_online_old1 to sap_online11 and sap_online_new have to be configured in the script snapshot.sh. The backup of the offline redologs with brarchive should be taken when the logs of the last two hours are still on disk so that, in the restore/recovery case, no logs must be restored from tape. In this example 7+12=19 Snapshots are held in the sapdata volume. Altogether 255 Snapshots are possible per volume. The space requirement of the Snapshots depends on the change behavior of the SAP application. The number of backups taken with brbackup and the additional number of Snapshots in hot backup mode must planned individually for each SAP system. When installing support packages, or doing an SAP upgrade or a database reorganization, the use of Snapshots offers additional time savings. In case of an error, the system can quickly be brought back to the starting point using SnapRestore. Thus, repeating the procedure is possible to carry out the conversion successfully. A restore from tape takes too long, depending on database size, to be able to make a second attempt.

7.2. SAP Test or Development Systems On test systems, test runs of larger conversions are carried out in the SAP environment, before these conversions are done on the production system. Examples are: Installing support packages SAP upgrade Database reorganization

Normally these test runs have to be done more than once or have to be repeated in case of an error. The use of Snapshots and SnapRestore provides the possibility to reset the test system to the starting point quickly, without restoring the system from tape.

Network Appliance Inc. 2005 Network Appliance, Inc. All rights reserved. Specifications subject to change without notice. NetApp, NetCache, and the Network Appliance logo are registered trademarks and Network Appliance, DataFabric, and The evolution of storage are trademarks of Network Appliance, Inc., in the U.S. and other countries. Oracle is a registered trademark of Oracle Corporation. All other brands or products are trademarks or registered trademarks of their respective holders and should be treated as such.

32

Anda mungkin juga menyukai