HP Open View Storage Data Protector A.05.50 Backing up an Oracle Data Guard environment Executive Summary .............................................................................................................................. 2 Solution Description ............................................................................................................................. 3 Solution Description ..........................................................................................................
Executive Summary This whitepaper describes how to use HP Open View Storage Data Protector A.05.50 to backup an Oracle Data Guard environment. The major benefit of Oracle Data Guard from a backup administrator perspective is the offload of production database backups to a standby database in order to minimize the impact of running backups to the production system. In case media recovery will be required on the Production site these backups can be used to directly restore and recover the production system.
Solution Description The paper contains instructions how to backup and restore Oracle Data Guard components using HP Open View Storage Data Protector A.05.50 with the Cell Manager installed on a Windows 2000 server and Oracle Data Guard 10g installed on HPUX 11.23 PA-RISC. Described instructions and procedures are working on other platforms as well – please check the Data Protector A.05.50 Platform and Integration support matrix. An updated version of this matrix is available on the web under http://www.
Oracle Data Guard Overview Data Guard enables and automates the management of a disaster recovery solution for Oracle databases located on the same campus or across the continent. Data Guard consists of a production database (also known as the primary database) and one or more standby database(s), which are consistent copies of the production database. A standby database can be either a physical standby database or a logical standby database.
A switchback operation is nothing more than a subsequent switchover operation to return the roles to their original state. Failover Failover is the operation of taking the primary database offline on one site and bringing one of the standby databases online as the new primary database. A failover operation can be invoked when an unplanned catastrophic failure occurs on the primary database. DG failover is a series of steps to convert a standby database into a production database.
Configure Oracle Data Guard under Data Protector Before it is possible to run an Oracle backup with Data Protector, the Oracle instance needs to be configured for Data Protector. Within a Data Guard environment two instances exist - Primary and Standby – and need to be configured for Data Protector. While the configuration of the Primary instance is like the configuration of a normal Oracle instance the Standby instance requires a manual configuration.
Figure 4 below lists the configuration files on the used setup as an example. Figure 4 Primary instance - Configuration Files Now copy both files into the same directory and replace the primary system name (oracle2 in our example) by the standby system name (oracle1), so you should have now 4 files listed as seen in Figure 5. There is no need to modify the contents of the files.
Therefore either adds a new identifier to both tnsnames configuration files or uses an exiting one and make sure that it exists on both systems and always points to the LOCAL instance. Use this new identifier for your Data Protector / Oracle Integration configuration like shown in Figure 3.
Backing up Oracle Data Guard Once Primary and Standby instance are configured for Data Protector, it is now possible to define a backup specification for these instances and to run online database backups. I. Backing up the Primary database From a Data Protector perspective, the Primary database is a normal Oracle database in status “OPEN” and running in archive mode.
A backup specification was created for a Primary database backup based on the “Blank Backup” Data Protector template. All Database components were marked for backup (database, archives, controlfile) and two backup devices with concurrency 1 each were selected. The backup specification was saved as OraPRI_DG1.
Two backup modifications are supported: A. Backup specification name not changed B.
} -input { "run {" "allocate channel 'dev_0' type 'sbt_tape'" " parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=DG1,OB2BARLIST=OraSTBY_DG1)';" "allocate channel 'dev_1' type 'sbt_tape'" " parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=DG1,OB2BARLIST=OraSTBY_DG1)';" "backup incremental level " " format 'OraSTBY_DG1.dbf'" " database;" "backup" " format 'OraSTBY_DG1.dbf'" " archivelog all;" "backup" " format 'OraSTBY_DG1.
In Oracle 9i it is not possible to backup the current control file from the Standby database backup. The best way to get a control file backup is to create a separate backup specification using the DP GUI and in the Source Window select the current control file only. This backup will be taken directly from the Production database, but the impact on the running production instance can be ignored.
Below an example of an RMAN script that allocates two channels and performs a database backup. run { allocate channel 'dev_0' type 'sbt_tape' parms='ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=DG1, OB2BARLIST=OraSTBY_DG1, OB2BARHOSTNAME=oracle1)'; allocate channel 'dev_1' type 'sbt_tape' parms='ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=DG1, OB2BARLIST=OraSTBY_DG1, OB2BARHOSTNAME=oracle1)'; backup incremental level 0 format 'OraSTBY_DG1.
Restore In this section, we will describe 3 possible restore scenarios, and for each of them document the needed steps to bring the data guard configuration back online. We will consider 3 different scenarios: I. – Instantiation of the Primary database after a Failover (Loss of the primary database) II. – Datafile loss on the primary Database. Restore using backup of the Standby III. – Loss of a data file on the Standby CAUTION It is only possible to run restores directly from RMAN.
In our case, we simulate a site failure by shutting down (abort) the primary database oracle2 and deleting all database files: SQL> shutdown abort ORACLE instance shut down. SQL> On the standby, verify that there are no gaps in the archived redo log files by querying the v$archive_gap view.
For recreating the SITE oracle2, first we need to create a standby database on SITE oracle2 and afterwards perform a switchover.
oracle@oracle2[DG1]:/oradata/DG1$ sqlplus " /as sysdba" SQL*Plus: Release 10.1.0.3.0 - Production on Wed May 4 07:54:13 2005 Copyright (c) 1982, 2004, Oracle. All rights reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.3.
Total System Global Area 536870912 bytes Fixed Size 1310536 bytes Variable Size 157548728 bytes Database Buffers 377487360 bytes Redo Buffers 524288 bytes Database mounted. SQL> alter database set standby to maximize availability; Database altered. SQL> alter database open; Database altered. SQL> We can now set the standby database in recovery mode: SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION; Database altered.
SQL> select PROTECTION_MODE, SWITCHOVER_STATUS from v$database; PROTECTION_MODE SWITCHOVER_STATUS -------------------------------MAXIMUM AVAILABILITY TO STANDBY SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> startup mount ORACLE instance started. Total System Global Area 536870912 bytes Fixed Size 1310536 bytes Variable Size 157548728 bytes Database Buffers 377487360 bytes Redo Buffers 524288 bytes Database mounted.
ORACLE instance shut down. SQL> startup mount ORACLE instance started. Total System Global Area 536870912 bytes Fixed Size 1310536 bytes Variable Size 157548728 bytes Database Buffers 377487360 bytes Redo Buffers 524288 bytes Database mounted. SQL> alter database set standby to maximize availability; Database altered. SQL> alter database open; Database altered.
II. – Datafile Loss of the Primary database For this scenario, we will simulate the loss of a datafile on the Primary site, by renaming the file, and use a full backup taken on the standby to perform a full recovery of the tablespace. In this case, we recover the tablespace on the primary without forcing a failover to the standby. Figure 8 Restore scenario 2 For the purpose of the testing, we create a new tablespace called payroll, perform a full backup on the standby using the Oracle Recovery Manager.
Using the full backup previously taken at the standby, we perform a recovery of the tablespace on the primary, using RMAN. For the restore, the tablespace needs to be offline. oracle@oracle2[DG1]:/oradata/DG1$ cat restore_payroll.
III. – Loss of a data file on the Standby As in the previous scenario, we delete a datafile on the standby database and using the full backup taken on the standby, restore the datafile to disk. Figure 9 Restore scenario 3 Once the file has been restored, we start the redo apply which will perform the recovery on the tablespace (assuming all needed archived logs are on disk) We delete the payroll01.dbf file: oracle@oracle1[DG1]:/oradata/DG1$ mv payroll01.dbf payroll01.dbf.
We restore the datafile from the backup taken from the standby database: oracle@oracle1[DG1]:/oradata/DG1$ rman target / catalog rman/xxxx@rcat_oracle3 Recovery Manager: Release 10.1.0.3.0 - 64bit Production Copyright (c) 1995, 2004, Oracle. All rights reserved. connected to target database: DG1 (DBID=1531960840) connected to recovery catalog database RMAN> @restore_payroll.
After the file restore, the payroll.dbf datafile has an SCN number, which is lower than the Database SCN number as seen in the alert logfile: Wed May 11 17:50:23 2005 Full restore complete of datafile 6 /oradata/DG1/payroll01.
Summary The whitepaper describes how to configure, backup and restore an Oracle Data Guard environment using HP Open View Storage Data Protector.
Appendix Appendix A: Data Protector session report of a Standby database backup [Normal] From: BSM@oracle3 "OraSTBY_DG1_WholeOnline" Time: 17.05.2005 17:30:05 OB2BAR application on "oracle1" successfully started. ob2rman.exe started with arguments: -backup -full Recovery Manager: Release 10.1.0.3.0 - 64bit Production Copyright (c) 1995, 2004, Oracle. All rights reserved.
channel dev_0: finished piece 1 at 05/17/2005 [14:31:01] piece handle=OraSTBY_DG1_WholeOnline.dbf comment=API Version 2.0,MMS Version 65.5.50.74 channel dev_0: backup set complete, elapsed time: 00:00:15 channel dev_0: starting incremental level 0 datafile backupset channel dev_0: specifying datafile(s) in backupset input datafile fno=00006 name=/oradata/DG1/payroll01.dbf channel dev_0: starting piece 1 at 05/17/2005 [14:31:01] [Normal] From: OB2BAR_Oracle8@oracle1 "DG1" Time: 17.05.
[Normal] From: OB2BAR_Oracle8@oracle1 "DG1" Time: 17.05.2005 17:33:30 Starting OB2BAR Backup: oracle1:Oracle Recovery Backup Catalog "Oracle8" [Normal] From: OB2BAR_Oracle8@oracle1 "DG1" Time: 17.05.2005 17:33:33 Completed OB2BAR Backup: oracle1:Oracle Recovery Backup Catalog "Oracle8" [Normal] From: ob2rman.exe@oracle1 "DG1" Time: 05/17/05 17:33:33 Backup of the Oracle Catalog Database succeeded. [Normal] From: BSM@oracle3 "OraSTBY_DG1_WholeOnline" Time: 17.05.
Appendix B: Target database restore using RMAN RMAN> @recreate_standby.
[Normal] From: OB2BAR_Oracle8@oracle2 "DG1" Time: 05/04/05 07:50:36 Starting OB2BAR Restore: oracle1:Ora1_DG1_Online.dbf "Oracle8" [Normal] From: OB2BAR_Oracle8@oracle2 "DG1" Time: 05/04/05 07:52:14 Completed OB2BAR Restore: oracle1:Ora1_DG1_Online.dbf "Oracle8" channel dev_0: restored backup piece 1 piece handle=Ora1_DG1_Online.
Appendix C: Useful Recovery Catalog Views/ V$ views1 Recovery Catalog View Corresponding V$ View Catalog View Describes ... RC_ARCHIVED_LOG V$ARCHIVED_LOG Archived and unarchived redo logs RC_BACKUP_CONTROLFILE V$BACKUP_DATAFILE Control files in backup sets RC_BACKUP_CORRUPTION V$BACKUP_CORRUPTION Corrupt block ranges in datafile backups RC_BACKUP_DATAFILE V$BACKUP_DATAFILE Datafiles in backup sets RC_BACKUP_FILES V$BACKUP_FILES RMAN backups and copies known to the repository.
Recovery Catalog View Corresponding V$ View Catalog View Describes ...
For more information HP Open View Data Protector Overview & Features http://www.hp.com/go/dataprotector HP Open View Data Protector support matrices http://www.openview.hp.com/products/datapro/spec_0001.html Oracle Data Guard http://www.oracle.com/technology/deploy/availability/htdocs/DataGuardOverview.html Oracle Recovery Manager (RMAN) http://www.oracle.com/technology/deploy/availability/htdocs/rman_overview.htm Oracle10g Data Guard Concepts and Administration guide.