Академический Документы
Профессиональный Документы
Культура Документы
Page 1 of 30
Oracle 11gR2 RAC Data Guard Build HP INTERNAL DOCUMENT/Revised April 20, 2012
Table of Contents
1 Document Control ................................................................................................................. 4 1.1 1.2 1.3 2 3 4 5 6 7 8 9 Distribution List ...................................................................................................................... 4 Amendment Record ............................................................................................................... 4 Terminology ........................................................................................................................... 4
Summary............................................................................................................................... 5 Exclusions ............................................................................................................................. 5 Assumptions ......................................................................................................................... 5 Oracle References ................................................................................................................. 5 Requirements........................................................................................................................ 6 CRS and ASM ......................................................................................................................... 6 Ports and Firewalls ................................................................................................................ 6 Summary of Build Process...................................................................................................... 6
10 Configure Oracle Net Services ................................................................................................ 7 11 Initial Configuration ............................................................................................................... 8 11.1 DB Unique Name .................................................................................................................... 8 11.2 Primary Database: Forced Logging ......................................................................................... 8 11.3 Create Standby Logs on Primary ............................................................................................ 8 11.4 Create Directories (Standby) .................................................................................................. 8
Page 1 of 30
Oracle 11gR2 RAC Data Guard Build HP INTERNAL DOCUMENT/Revised October 18, 2010
11.5 Parameter File ........................................................................................................................ 8 12 Create Standby with Active Database Duplication .................................................................. 9 12.1 Parameter File ........................................................................................................................ 9 12.2 Create Directory ................................................................................................................... 11 12.3 Duplication ........................................................................................................................... 11 12.4 Create Standby Redo Logs on Standby ................................................................................ 11 13 Modify Primary and Start Replication................................................................................... 11 13.1 Modify tnsnames.ora ........................................................................................................... 11 13.2 Start Managed Recovery ...................................................................................................... 11 13.3 Verify Log Application .......................................................................................................... 12 13.4 RMAN configuration change on Primary (optional) ............................................................. 12 14 Registration of RAC with OCR............................................................................................... 12 15 Data Guard Broker Setup ..................................................................................................... 13 16 Automatic Client Failover..................................................................................................... 14 16.1 Services for READ/WRITE Access on Primary and Standby Servers ..................................... 14 16.2 Add Service for Read Only on Primary and Standby Servers ............................................... 14 16.3 tnsnames.ora and sqlnet.ora ............................................................................................... 15 16.4 Restart for Active Data Guard .............................................................................................. 15 17 Verification (Switchover) ..................................................................................................... 16 18 Known Issues ...................................................................................................................... 16 19 Appendices ......................................................................................................................... 17 19.1 Example ................................................................................................................................ 17 19.2 Data Guard Log Apply Verification Script ............................................................................. 22
Page 2 of 30
Oracle 11gR2 RAC Data Guard Build HP INTERNAL DOCUMENT/Revised April 20, 2012
19.3 Maximum Availability Verification Script (lgwr.sql) ............................................................. 22 19.4 Script to Check Status at Primary (check_primary.sql) ........................................................ 23 19.5 asmfiles script....................................................................................................................... 23 19.6 RI for Active Data Guard Standby Creation .......................................................................... 24
Page 3 of 30
Oracle 11gR2 RAC Data Guard Build HP INTERNAL DOCUMENT/Revised April 20, 2012
1
1.1
Document Control
Distribution List
Name
Barbara Pascavage Sherri Trojan
Role
Oracle Technical Lead Oracle CTO HP HP
Representing
1.2
Amendment Record
Version
1.0 1.1
Date
04/02/12 04/06/12
Status
Draft Draft 2
Comment
Based on 11.2.0.1 version Moved some things and added RI in Appendices Add to Backout Section for RI (in Appendices) Added more on Services Added note on TDE
1.2
04/13/12
1.3 1.4
04/18/12 4/21/12
1.3
Terminology
Term
grid
Definition
Term used to refer to the configuration of several servers (nodes) using Oracle Clusterware and Real Application Clusters; one database and multiple instances.
Oracle Managed Files; filenames are generated by Oracle replication of changes from primary to standby as the logs are written instead of after the log switches complete.
Page 4 of 30
Oracle 11gR2 RAC Data Guard Build HP INTERNAL DOCUMENT/Revised April 20, 2012
2 Summary
This document provides information on how to build Oracle 11.2.0.3 Active Data Guard physical standby databases. The grid is using Oracle 11.2.0.3 Clusterware (CRS) and Automatic Storage Management (ASM). This build can be completed with no downtime for the primary database. A bounce of the listener on the standby is required. That should take less than one minute. During that time current connections to the database are not impacted. However, no new connections can be made during that short outage. An example for the Oracle net files (listener.ora and tnsnames.ora) as well as the full rman duplication is provided in the Appendices. A sample RI is also provided in the Appendices.
3 Exclusions
This document does not include: instructions for installation and configuration of CRS and ASM instructions for installation of database binaries build of primary database.
4 Assumptions
This document is written for the experienced Oracle10 /11 DBA. This process should not be performed by anyone who has not supported and/or installed an Oracle grid configuration on a Unix (or Linux) platform. It is assumed that the Oracle DBA has access to both Oracle Support CSI and Oracle Technology Network. While the information included in this document has been tested, that is no guarantee that additional problems will not be encountered.
5 Oracle References
This document is based on Oracle Best Practices and Data Guard documentation. Metalink: How to create physical standby database with 11gRMAN DUPLICATE FROM ACTIVE DATABASE [ID 747250.1] Metalink: 11g Active Database Duplication [ID 568034.1] Metalink: Manual Completion of a Filed RMAN Duplicate [ID 360962.1] Oracle Data Guard Broker 11.2 Oracle Data Guard: Concepts and Administration 11g R2 Metalink Doc. 360962.1 Manual Completion of a Failed RMAN Duplicate.
Page 5 of 30
Oracle 11gR2 RAC Data Guard Build HP INTERNAL DOCUMENT/Revised April 20, 2012
6 Requirements
The following are required before starting this build: The executables for the binaries have already been installed at the same patch level as the production database. The CRS, ASM instance and diskgroups have been configured on both primary and standby. The ASM diskgroups on standby are the same as those in primary; no file name conversions are required. Listener is configured on both primary and standby server. Primary is in archivelog mode Primary and standby are using db_recovery_file_dest for archivelogs
For step-by-step instructions, see the Appendices: RI for Active Data Guard Standby Creation. Page 6 of 30
Oracle 11gR2 RAC Data Guard Build HP INTERNAL DOCUMENT/Revised April 20, 2012
Page 7 of 30
Oracle 11gR2 RAC Data Guard Build HP INTERNAL DOCUMENT/Revised April 20, 2012
11 Initial Configuration
The commands and actions in this section should be completed before the standby can be created.
Value
Note: This requires reboot of database. This should be set at initial database creation. If not, it can be delayed until a scheduled reboot. This does not impact the build; however, the rman archive log deletion policy cannot be set to applied on standby until this parameter is set. fal_server fal_client Net service name for the standby database Net service name for the primary database Page 8 of 30
Oracle 11gR2 RAC Data Guard Build HP INTERNAL DOCUMENT/Revised April 20, 2012
Parameter log_archive_config
Value dg_config=(<primary net service name>,<standby net service name>) service=<net service name for other database> lgwr sync affirm valid_for=(online_logfiles,primary_role) db_unique_name=<name for other database>) DEFER Note: To prevent generation of error messages on the primary, this can be set to DEFER until the initial duplication is complete and standby archivelogs are created for both the primary and standby.
log_archive_dest_2
log_archive_dest_state_2
standby_file_management dg_broker_config_file1
AUTO set this to use an ASM file: +DG_DATA/<db unique name>/dr1<db unique name>.dat set this to use an ASM file: +DG_LOGS/<db unique name>/dr2<db unique name>.dat
dg_broker_config_file2
Value
# of instances, if different FALSE (temporarily for rman duplicate) Remove this from the initial spfile used on the standby; it will be replaced with the appropriate values during the rman duplicate Page 9 of 30
Oracle 11gR2 RAC Data Guard Build
Value unique name for the standby Number assigned to each SID Name assigned to each SID ALL optional Note: This requires reboot of database. This should be set at initial database creation. If not, it can be delayed until a scheduled reboot. This does not impact the build; however, the rman archive log deletion policy cannot be set to applied on standby until this parameter is set.
<SID>.local_listener
(ADDRESS=(PROTOCOL=TCP) (HOST=fully qualified hostname) (PORT=1521)) Fully qualified SCAN name:1521 Thread number assigned to each SID Audit file destination; Make sure this points to a valid directory on the standby server. (PROTOCOL=TCP)(SERVICE=<name for XDB service) Net service name for the primary database. Net service name for the standby database dg_config=(<primary net service name>,<standby net service name>) service=<net service name for other database> lgwr sync affirm valid_for=(online_logfiles,primary_role) db_unique_name=<name for other database>) DEFER Note: To prevent generation of error messages on the primary, this can be set to DEFER until the initial duplication is complete and standby archivelogs are created for both the primary and standby.
log_archive_dest_2
log_archive_dest_state_2
standby_file_management dg_broker_config_file1
AUTO set this to use an ASM file: +DG_DATA/<db unique name>/dr1<db unique name>.dat set this to use an ASM file: +DG_LOGS/<db unique name>/dr2<db unique name>.dat
dg_broker_config_file2
Page 10 of 30
Oracle 11gR2 RAC Data Guard Build HP INTERNAL DOCUMENT/Revised April 20, 2012
Create a directory in ASM for the standby under FLASH and DATA. Create the spfile in ASM from the modified pfile. On each RAC standby server, point to the spfile in ASM from the $ORACLE_HOME/dbs/init<SID>.ora. Note: Ignore the parameter for standby_archive_dest. It is deprecated with Oracle11R2.
12.3 Duplication
Start the standby in nomount using the modified parameter file. Connections in rman must use Oracle Net. Failure to use Oracle Net will result in the following error:
RMAN-03002: failure of Duplicate Db command at 09/03/2010 18:57:27 RMAN-06217: not connected to auxiliary database with a net service name
Startup rman, connect to the target & auxiliary, then issue the duplicate command, as follows: connect target sys/<pwd>@<PRIMARY instance name>_DGMGRL connect auxiliary sys/<pwd>@<STANDBY instance name>_DGMGRL DUPLICATE TARGET DATABASE FOR STANDBY FROM ACTIVE DATABASE; Refer to the sample RMAN Dup in the Appendices for full results from this command. When the duplication completes, the standby database should be mounted; but not open. If the standby is in a RAC, immediately update the cluster_database parameter to TRUE.
Page 11 of 30
Oracle 11gR2 RAC Data Guard Build HP INTERNAL DOCUMENT/Revised April 20, 2012
On the primary, change the database to maximum availability: alter database set standby database to maximize availability; Optionally, on the standby server, clean up the trace files that were generated during the configuration. Alter the standby to begin managed recovery: alter database recover managed standby database using current logfile disconnect; Note: Until the Data Guard Broker is configured, no automation of the managed recovery is in place. Always restart managed recovery manually after a database restart or server reboot until the Data Guard Broker is configured.
srvctl add instance d <db unique name> -i <instance name> -n <node name>
Use the srvctl config database d <db unique name> of the standby.
Page 12 of 30
Oracle 11gR2 RAC Data Guard Build HP INTERNAL DOCUMENT/Revised April 20, 2012
Turn on the Data Guard broker by setting the following parameter in both the primary and standby: dg_broker_start = true
Start dgmgrl and connect as sys to the primary database (sysdba connection is assumed). Create the data guard configuration: create configuration configuration name AS primary database is db unique name for primary connect identifier is <tnsnames.ora net service name> ; Add the database to the configuration: add database db unique name for standby AS connect identifier is <tnsnames.ora net service name> maintained as physical ; Note: Use the following command to verify that the properties are configured correctly for each database: show database verbose <name> For MaxAvailability mode , LogXptMode should be SYNC for both primary and standby databases. The value of LogXptMode can be found in show database verbose. If necessary correct the LogXptMode or other properties using the command: edit database '<Database Name>' set property LogXptMode='SYNC'; Turn on the configuration: ENABLE CONFIGURATION;
When bringing the broker configuration online (enable configuration). After the configuration is enabled, Data Guard may still be performing some background work. Wait approximately ten minutes for this work to complete before verification of the configuration. Check the Broker logs (drc<SID>.log), located in the trace directory where the text version of the alert log is located, to view the actions being taken by the broker. Use the show configuration command to verify that the broker configuration is successful. For additional information and commands, refer to the Data Broker manual at Oracle Support 11gR2 Manuals. Page 13 of 30
Oracle 11gR2 RAC Data Guard Build HP INTERNAL DOCUMENT/Revised April 20, 2012
Note: The Broker will create a static service (ending in _DGMGRL) that it uses for switchover and failover. This is only used by the Broker and is not part of the normal Oracle Services. When you execute a show instance verbose <INSTANCE_NAME>, it will display a StaticConnectIdentifier in the following format: '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.209.116.60) (PORT=1521))(CONNECT_DATA=(SERVICE_NAME=TESTDB_DGMGRL) (INSTANCE_NAME=TESTDB1)(SERVER=DEDICATED)))'
16.2 Add Service for Read Only on Primary and Standby Servers
The Read Only service for access to the Active Data Guard standby must be created with both srvctl commands and with dbms_service package. First, in the primary database: exec DBMS_SERVICE.CREATE_SERVICE(SERVICE for read only access>, SERVICE for read only access>,NULL,NULL,TRUE,BASIC,SELECT,150,10,NULL); Page 14 of 30
Oracle 11gR2 RAC Data Guard Build HP INTERNAL DOCUMENT/Revised April 20, 2012
Perform log switches to ensure the change is propagated to the standby side. Then create the service with srvctl commands on both the primary and standby grids. srvctl add service d <PRIMARY DB UNIQUE NAME> -s <SERVICE for read only access> -r <comma separated list of instances> -l PHYSICAL_STANDBY q TRUE e SELECT m BASIC w 10 z 150 srvctl add service d <STANDBY DB UNIQUE NAME> -s <SERVICE for read only access> -r <comma separated list of instances> -l PHYSICAL_STANDBY q TRUE e SELECT m BASIC w 10 z 150 The service can now be started on the standby side. If it fails to start, allow time for the replication of the dbms_service command. Verify the service is correct with the srvctl config service d <db unique name> -s <service name> command. Use the srvctl status database d <db unique name> -f v command to check that the instances and service is running.
Shutdown the single instance of standby the is running. Start the standby database using srvctl start database command. Verify that the instances and services are running with the srvctl status command. Verify that the logs are being applied.
17 Verification (Switchover)
Schedule a downtime to verify the standby database switchover is working properly. Perform a switchover to the standby and then back to the original configuration. Switchover with 11gR2 is a two-step process: 1. SWITCHOVER: Connect to Data Guard Broker using <SID>_DGMGRL connection and check the status. If the result is SUCCESS, issue the switchover command. If there is a problem, resolve the problem before doing the switchover. 2. VERIFICATION: After the switchover is complete, verify that all instances & services are running and the logs are being applied. Check dgmgrl to verify the configuration shows the change of standby and primary. Check the srvctl configuration to verify that CRS has recorded the database role change.
18 Known Issues
Standby databases that are open for Active Data Guard may generate excessive audit logs in the adump directory. This is related to Oracle Bug 7006588. Until this is resolved, create a cron job to remove the aud logs at least hourly. If using TDE, the recommendation is to set the wallet for manual open. The encrypted data will replicate. However, there may be some problems when the Data Guard Broker attempts to open the wallet on the standby before the database open command completes. If there is an auto open wallet, additional testing should be completed to ensure that this does not interfere with opening the standby for Active Data Guard on the standby.
Page 16 of 30
Oracle 11gR2 RAC Data Guard Build HP INTERNAL DOCUMENT/Revised April 20, 2012
19 Appendices
This section provides samples and a checklist that can be used when creating a physical Data Guard standby for Disaster Recovery.
19.1 Example
These examples are based on the following: Primary database is TESTDB Standby database is TESADG
Duplication results:
RMAN> connected to target database: TESTDB (DBID=2561044898) RMAN> connected to auxiliary database: TESTDB (not mounted)
RMAN>
Page 17 of 30
Oracle 11gR2 RAC Data Guard Build HP INTERNAL DOCUMENT/Revised April 20, 2012
Starting Duplicate Db at 01-APR-12 using target database control file instead of recovery catalog allocated channel: ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: SID=128 device type=DISK contents of Memory Script: { backup as copy reuse targetfile '/u01/app/oracle/11.2.0.3/db_1/dbs/orapwTESTDB1' auxiliary format '/u01/app/oracle/product/11.2.0/db_1/dbs/orapwTESTADG1' } executing Memory Script Starting backup at 01-APR-12 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=75 instance=TESTDB1 device type=DISK Finished backup at 01-APR-12 contents of Memory Script: { sql clone "alter system set control_files = ''+FLASH/testadg/controlfile/current.280.779460647'', ''+DATA/testadg/controlfile/current.270.779460647'' comment= ''Set by RMAN'' scope=spfile"; backup as copy current controlfile for standby auxiliary format '+FLASH/testadg/controlfile/current.279.779460647'; restore clone controlfile to '+DATA/testadg/controlfile/current.289.779460647' from '+FLASH/testadg/controlfile/current.279.779460647'; sql clone "alter system set control_files = ''+FLASH/testadg/controlfile/current.279.779460647'', ''+DATA/testadg/controlfile/current.289.779460647'' comment= ''Set by RMAN'' scope=spfile"; shutdown clone immediate; startup clone nomount; } executing Memory Script ;
sql statement: alter system set control_files = ''+FLASH/testadg/controlfile/current.280.779460647'', ''+DATA/testadg/controlfile/current.270.779460647'' comment= ''Set by RMAN'' scope=spfile
Page 18 of 30
Oracle 11gR2 RAC Data Guard Build HP INTERNAL DOCUMENT/Revised April 20, 2012
Starting backup at 01-APR-12 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile copy copying standby control file output file name=/u800/backup/TESTDB/controlfiles/snapcf_TESTDB1.f tag=TAG20120401T125046 RECID=17 STAMP=779460647 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01 Finished backup at 01-APR-12 Starting restore at 01-APR-12 using channel ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: copied control file copy Finished restore at 01-APR-12 sql statement: alter system set control_files = ''+FLASH/testadg/controlfile/current.279.779460647'', ''+DATA/testadg/controlfile/current.289.779460647'' comment= ''Set by RMAN'' scope=spfile Oracle instance shut down connected to auxiliary database (not started) Oracle instance started Total System Global Area Fixed Size Variable Size Database Buffers Redo Buffers 2471931904 bytes
contents of Memory Script: { sql clone 'alter database mount standby database'; } executing Memory Script sql statement: alter database mount standby database contents of Memory Script: { set newname for clone tempfile 2 to new; switch clone tempfile all; set newname for clone datafile 1 to new; set newname for clone datafile 2 to new; set newname for clone datafile 3 to new;
Page 19 of 30
Oracle 11gR2 RAC Data Guard Build HP INTERNAL DOCUMENT/Revised April 20, 2012
set newname for clone datafile 4 to new; set newname for clone datafile 5 to new; set newname for clone datafile 6 to new; backup as copy reuse datafile 1 auxiliary format new datafile 2 auxiliary format new datafile 3 auxiliary format new datafile 4 auxiliary format new datafile 5 auxiliary format new datafile 6 auxiliary format new ; sql 'alter system archive log current'; } executing Memory Script executing command: SET NEWNAME renamed tempfile 2 to +DATA in control file executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME Starting backup at 01-APR-12 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile copy input datafile file number=00002 name=+DATA/testdb/datafile/sysaux.277.777741627 output file name=+DATA/testadg/datafile/sysaux.290.779460671 tag=TAG20120401T125111 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15 channel ORA_DISK_1: starting datafile copy input datafile file number=00001 name=+DATA/testdb/datafile/system.276.777741623 output file name=+DATA/testadg/datafile/system.291.779460687 tag=TAG20120401T125111 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07 channel ORA_DISK_1: starting datafile copy input datafile file number=00005 name=+DATA/testdb/datafile/example.278.777741629 output file name=+DATA/testadg/datafile/example.292.779460695 tag=TAG20120401T125111
Page 20 of 30
Oracle 11gR2 RAC Data Guard Build HP INTERNAL DOCUMENT/Revised April 20, 2012
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07 channel ORA_DISK_1: starting datafile copy input datafile file number=00003 name=+DATA/testdb/datafile/undotbs1.279.777741633 output file name=+DATA/testadg/datafile/undotbs1.293.779460701 tag=TAG20120401T125111 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03 channel ORA_DISK_1: starting datafile copy input datafile file number=00006 name=+DATA/testdb/datafile/undotbs2.280.777741633 output file name=+DATA/testadg/datafile/undotbs2.298.779460705 tag=TAG20120401T125111 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01 channel ORA_DISK_1: starting datafile copy input datafile file number=00004 name=+DATA/testdb/datafile/users.281.777741635 output file name=+DATA/testadg/datafile/users.297.779460705 tag=TAG20120401T125111 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01 Finished backup at 01-APR-12 sql statement: alter system archive log current contents of Memory Script: { switch clone datafile all; } executing Memory Script datafile 1 switched to datafile copy input datafile copy RECID=17 STAMP=779460712 file name=+DATA/testadg/datafile/system.291.779460687 datafile 2 switched to datafile copy input datafile copy RECID=18 STAMP=779460712 file name=+DATA/testadg/datafile/sysaux.290.779460671 datafile 3 switched to datafile copy input datafile copy RECID=19 STAMP=779460712 file name=+DATA/testadg/datafile/undotbs1.293.779460701 datafile 4 switched to datafile copy input datafile copy RECID=20 STAMP=779460713 file name=+DATA/testadg/datafile/users.297.779460705 datafile 5 switched to datafile copy input datafile copy RECID=21 STAMP=779460713 file name=+DATA/testadg/datafile/example.292.779460695
Page 21 of 30
Oracle 11gR2 RAC Data Guard Build HP INTERNAL DOCUMENT/Revised April 20, 2012
datafile 6 switched to datafile copy input datafile copy RECID=22 STAMP=779460713 file name=+DATA/testadg/datafile/undotbs2.298.779460705 Finished Duplicate Db at 01-APR-12 RMAN> Recovery Manager complete.
/ PROMPT Report archive gaps select thread#, low_sequence#, high_sequence# from v$archive_gap / PROMPT Currently waiting for the following log PROMPT If using Real Time Apply, no rows will be returned select thread#, sequence# from v$managed_standby where status = 'WAIT_FOR_LOG' / PROMPT Archivelog Space Report col limit format 999,999,999 heading "Limit (mb)"; col used format 999,999,999 heading "Space Used (mb)"; col free format 999,999,999 heading "Space Free (mb)"; select space_limit/(1024*1024) limit , (space_used + space_reclaimable)/(1024*1024) used , (space_limit-(space_used+space_reclaimable))/(1024*1024) free ,number_of_files from v$recovery_file_dest /
Page 23 of 30
Oracle 11gR2 RAC Data Guard Build HP INTERNAL DOCUMENT/Revised April 20, 2012
BACKOUT: 1. On primary, change the following parameters: alter database set log_archive_dest_state_2 = DEFER ; alter database set dg_broker_start=FALSE; 2. On primary and standby: remove Data Broker files from ASM 3. On standby: shutdown standby database comment out cron job for deletion of archive logs IMPLEMENTATION PLAN ** Secondary Contacts ** Oracle DBA performing database duplicate Name: Phone: Email: ** Bridge Line - N/A ** Teams HP Oracle DBA ** Implementation StepsContact MRO before starting. 855-724-0190 or www.rooms.hp.com/attend/default.aspx?key=RPL2ZQJLR2
Primary Database Unique Name: Primary Servers: SCAN and Clustername for Primary:
Standby Database Unique Name: Standby Server for Build: Additional Standby Servers: SCAN and Clustername for Standby:
Page 24 of 30
Oracle 11gR2 RAC Data Guard Build HP INTERNAL DOCUMENT/Revised April 20, 2012
1. Standby Build Server: Add the following entry to the listener.ora file and restart the listener. (SID_LIST_LISTENER = (SID_DESC=(GLOBAL_DBNAME=<db_unique_name>) (ORACLE_HOME=<full path for ORACLE_HOME>) (SID_NAME=<instance name>)) )
2. Add entry to all tnsnames.ora files on the primary and standby servers:
<STANDBY DB UNIQUE NAME> = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = <ip or name for standby vip>) (PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = <db unique name for standby>) (INSTANCE_NAME = <db unique name for standby instance) (UR=A ) ) )
4. Make the following changes on the Primary Database: alter database force logging (if force logging is already in place, this will error out without any impact) create standby logs check number and size of current logs: select group#, bytes/1024/1024 from v$log; add standby logs (at least one more than the number of log groups), using the following command syntax where # is a number: alter database add standby logfile group 20#; verify the standby logs are there: select group#, type from v$logfile; 5. Add parameter values for primary (alter system command with scope=both): fal_server=<standby db unique name> Page 25 of 30
Oracle 11gR2 RAC Data Guard Build HP INTERNAL DOCUMENT/Revised April 20, 2012
fal_client=<primary db unique name> log_archive_config=dg_config=(<primary net service name>,<standby net service name>) log_archive_dest_2=service=<net service name for standby> lgwr sync affirm valid_for=(onine_logfiles,primary_role) db_unique_name=<db unique name for standby> standby_file_management=AUTO dg_broker_config_file1=+DATA/<db unique name for primary>/dr1<db unique name for primary>.dat db_broker_config_file2=+FLASH//<db unique name for primary>/dr2<db unique name for primary>.dat
6. On primary, create a pfile from the spfile: create pfile=<path and file name> from spfile; 7. Create the following directories on Standby: file for adump (audit logs) on each Standby server ASM DATA and FLASH directories for standby unique name
8. Copy from $ORACLE_HOME/dbs on primary to all standby servers and rename with standby SID: orapwd for primary spfile for primary (modify primary unique name in the file to the standby unique name)
9. Copy the pfile created from the primary spfile to the standby server that will be used for the build. Modify the copy of the pfile on the standby: change references from db unique name of primary to db unique name for standby with the following exceptions: Do NOT change db_name and log_archive_config parameters audit_trial=NONE cluster_database=FALSE remove references to controlfiles modify local_listener to reference listener on standby modify remote_listener to SCAN for standby dispatcher changed to use standby unique name fal_server=<primary net service name> fal_client=<standby net service name> log_archive_dest_2=service=<net service name for primary> lgwr sync affirm valid_for=(onine_logfiles,primary_role) db_unique_name=<db unique name for primary> dg_broker_config_file1=+DATA/<db unique name for standby>/dr1<db unique name for standby>.dat Page 26 of 30
Oracle 11gR2 RAC Data Guard Build HP INTERNAL DOCUMENT/Revised April 20, 2012
10. Perform duplicate command (after duplicate finishes the standby database should be in mount state): sqlplus: startup nomount rman connect target sys/****@<net service name for primary> connect auxiliary sys/****@<net service name for standby> duplicate target database for standby from active database; exit; cluster_database=TRUE scope=spfile
12. Modify tnsnames.ora on all the primary and standby servers to point to the scan and remove the instance specification:
<STANDBY DB UNIQUE NAME> = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = <scan for standby grid>) (PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = <db unique name for standby>) (UR=A ) ) )
13. Create standby redo logs on standby database (mounted) and start recovery: add same number of standby logs as added on primary database: alter database add standby logfile group 30#; verify the standby logs are there (select group#, type from v$logfile) start log apply in sqlplus: alter database recover managed standby database disconnect from session; 14. On primary, if log_archive_dest_state_2=DEFER change it to ENABLE and switch logfile several times. 15. Change to maximum availability: on primary: alter database set standby database to maximize availability; on standby: alter database recover managed standby database cancel; on standby: alter database recover managed standby database using current logfile disconnect;
16. Verify log apply on standby. select al.thread#, max(al.sequence#) Last Recd ,max(lh.sequence#) Last Applied from Page 27 of 30
Oracle 11gR2 RAC Data Guard Build HP INTERNAL DOCUMENT/Revised April 20, 2012
(select thread#, sequence# from v$archived_log) al ,(select thread#, sequence# from v$archived_log where applied=YES and registrar=RFS) lh where al.thread#=lh.thread# group by al.thread# order by al.thread#; 17. Register standby RAC with OCR: srvctl add database d <db unique name> \ -o <$ORACLE_HOME full path> \ -s open n <db name> -r PHYSICAL_STANDBY \ -p <location of spfile> -a DATA,FLASH for each instance: srvctl add instance d <db unique name> -i <instance name> \ -n <node name> VERIFY: srvctl config database d <db unique name>
18. Configure broker from primary server: Set parameter in both standby and primary: dg_broker_start=TRUE Log into Data Guard Broker and create configuration: dgmgrl connect /
create configuration <name> AS primary database IS <db unique name for primary> connect identifier is <net service name for primary>; add database <db unique name for standby> AS connect identifier IS <net service name for standby> maintained as physical; show database verbose <name>; if necessary: edit database <database name> set property LogXpMode=SYNC; enable configuration; show configuration; 19. Modify service(s) for connections to primary (if a service is added an entry should be added to all the tnsnames.ora files on the primary and standby servers): srvctl modify service d <primary db unique name> \ -s <service name> -l PRIMARY q TRUE e SELECT -w 10 z 150 Verify with command: srvctl config service d <primary db unique name> -s <service name> Page 28 of 30
Oracle 11gR2 RAC Data Guard Build HP INTERNAL DOCUMENT/Revised April 20, 2012
20. Add service(s) for connections to standby when it is activated (if a service is added an entry should be added to all the tnsnames.ora files on the primary and standby servers): srvctl add service d <standby db unique name> \ -s <service for read write access> -r <comma separated list of instances> \ -l PRIMARY q TRUE e SELECT m BASIC w 10 z 150 Verify with command: srvctl config service d <standby db unique name> -s <service name> 21. Add service for read only connections to standby: sqlplus on PRIMARY: execute dbms_service.create_service(<name for readonly access>,<name for read only service>,null, null,TRUE,BASIC,SELECT,150,10,null);
On PRIMARY: srvctl add service d <primary db unique name> \ -s <service for read only access> -r <comma separated list of instances> \ -l PHYSICAL_STANDBY q TRUE e SELECT m BASIC w 10 z 150 Verify with command: srvctl config service d <primary db unique name> -s <service name>
On STANDBY: srvctl add service d <standby db unique name> \ -s <service for read only access> -r <comma separated list of instances> \ -l PHYSICAL_STANDBY q TRUE e SELECT m BASIC w 10 z 150
On STANDBY, verify with command: srvctl config service d <standby db unique name> -s <service name> 22. Add tnsnames.ora on primary and standby for read only service created: <ALIAS for READ ONLY> = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = <scan for primary>)(PORT=1521)) (ADDRESS = (PROTOCOL = TCP) (HOST = <scan for standby>)(PORT=1521)) (LOAD_BALANCE = yes) (CONNECT_DATA = (SERVICE_NAME=<service name for read only)) ) Page 29 of 30
Oracle 11gR2 RAC Data Guard Build HP INTERNAL DOCUMENT/Revised April 20, 2012
23. Add to sqlnet.ora: SQLNET.OUTBOUND_CONNECT_TIMEOUT=3 24. Stop managed recovery and shutdown standby: alter database recover manage standby database cancel; shutdown immediate; 25. Restart standby with srvctl start database command. The standby should be started along with the read only service. Since the broker is configured, the log apply will be started automatically. 26. Execute srvctl status command to verify standby is started with services. 27. Verify log apply is working (from standby): select process, status, thread#, sequence#, block# from v$managed_standby; 28. Set up an hourly cron job to delete the aud logs from $ORACLE_BASE/admin/<db unique name>/adump.
Page 30 of 30
Oracle 11gR2 RAC Data Guard Build HP INTERNAL DOCUMENT/Revised April 20, 2012