25
Oracle 10gR2 RAC Standby DB Creation Guide

Oracle 10gR2 RAC StdbyDb Creation Guide

Embed Size (px)

Citation preview

Page 1: Oracle 10gR2 RAC StdbyDb Creation Guide

Oracle 10gR2 RAC Standby DB Creation Guide

Midrange Standards & Integrated EngineeringRDBMS Oracle Engineering

Published Oct 15, 2007

Version 1.0

Page 2: Oracle 10gR2 RAC StdbyDb Creation Guide

MSIE – Oracle Engineering Oracle 10gR2 RAC StdbyDb Creation Guide

Page 2 of 16

Page 3: Oracle 10gR2 RAC StdbyDb Creation Guide

MSIE – Oracle Engineering Oracle 10gR2 RAC StdbyDb Creation Guide

Table of Contents

1 Introduction......................................................................................................................3

2 Creating a RAC enabled Standby Database Using RMAN..............................................3

3 Configure the Oracle Cluster Registry.............................................................................9

4 Enable Archiving to the Standby and Check for Log Gaps............................................10

5 Managing the Standby Database....................................................................................12

Appendix A.........................................................................................................................13

Appendix B.........................................................................................................................14

Revision History.................................................................................................................15

Page 3 of 16

Page 4: Oracle 10gR2 RAC StdbyDb Creation Guide

MSIE – Oracle Engineering Oracle 10gR2 RAC StdbyDb Creation Guide

1 Introduction

This document is to assist in the creation of an Oracle 10gR2 RAC enabled standby database. It adheres to the standards and best practices outlined in Oracle’s Maximum Availability Architecture (MAA) Best Practices. To use RMAN to create the standby database, the existing database must be using an Rman catalog and the primary database’s backup filesystem/directory structure on the primary database server must be created on the destination environment.

In our environments the primary database name and the standby database name are the same. In a standby database configuration dataguard uses various initialization parameters including db_unique_name. The primary database‘s db_unique_name is the same as its database name, which should be the app pneumonic with a P attached (i.e. TESTP). The standby database’s name is also TESTP and the standby’s db_unique_name should be the same app pneumonic with a C attached (i.e. TESTC). In this document, the standby db_unique_name is referred to as STDBY_DB_U_NAME.

2 Creating a RAC enabled Standby Database Using RMAN

2.1 Steps to perform on all primary database nodes:

1. Create tns entries for the primary and standby database services. See Appendix A.

2.2 Steps to perform on node 1 of the primary database:

1. Ensure all logging is enabled:

SQL> alter database force logging;

2. If necessary, Create a password file in $ORACLE_HOME/dbs:

$ orapwd file=$ORACLE_HOME/dbs/orapwINSTANCE_NAME password=sys_pwd

3. Create ‘standby’ redo logs. For each thread (instance) create standby redo logs. The number of standby redo log groups for each thread should equal the number of redo log groups for each thread + 1. If there are 4 redo log groups for each thread, then create 5 standby redo log groups for each thread. Also, if there are 4 redo log groups for each thread, then the first standby redo log group for each thread will be ‘GROUP 5’. Change the thread number and group number below to the appropriate numbers. Also change the size. The size must match the size of the existing redo logs. Repeat this command for each thread and each group of each thread.

SQL> ALTER DATABASE ADD STANDBY LOGFILE THREAD X GROUP X ('+SHARED_DATA_DG01', '+SHARED_AUXFILES_DG01') SIZE XXM;

4. Create an updated pfile from the spfile:

SQL> create pfile=’/oracle/admin/DB_NAME/pfile/initDB_NAME.ora’ from spfile;

Page 4 of 16

Page 5: Oracle 10gR2 RAC StdbyDb Creation Guide

MSIE – Oracle Engineering Oracle 10gR2 RAC StdbyDb Creation Guide

5. Edit the initialization file and set Standby and Archiving parameters:

db_unique_name = DB_NAMEfal_client = DB_NAMEfal_server = STDBY_DB_U_NAMElog_archive_config = ‘DG_CONFIG=(DB_NAME, STDBY_DB_U_NAME)’log_archive_dest_1 = ‘LOCATION=USE_DB_RECOVERY_FILE_DEST

VALID_FOR=(ALL_LOGFILES, ALL_ROLES) DB_UNIQUE_NAME= DB_NAME’

log_archive_dest_2 = ‘SERVICE=STDBY_DB_U_NAME LGWR ASYNC REOPEN=60 VALID_FOR=(ONLINE_LOGFILES, PRIMARY_ROLE) DB_UNIQUE_NAME= STDBY_DB_U_NAME’

log_archive_dest_state_2 = DEFERstandby_archive_dest = ‘LOCATION=USE_DB_RECOVERY_FILE_DEST’standby_file_management = AUTOdb_file_name_convert = '+SHARED_DATA_DG01/STDBY_DB_U_NAME/',

'+SHARED_DATA_DG01/DB_NAME/'log_file_name_convert = '+SHARED_DATA_DG01/STDBY_DB_U_NAME/',

'+SHARED_DATA_DG01/DB_NAME/', '+SHARED_AUXFILES_DG01/STDBY_DB_U_NAME/','+SHARED_AUXFILES_DG01/DB_NAME/'

Example:

db_unique_name = TESTPfal_client = TESTPfal_server = TESTClog_archive_config = ‘DG_CONFIG=(TESTP, TESTC)’log_archive_dest_1 = ‘LOCATION=USE_DB_RECOVERY_FILE_DEST

VALID_FOR=(ALL_LOGFILES, ALL_ROLES) DB_UNIQUE_NAME=TESTP’

log_archive_dest_2 = ‘SERVICE=TESTC LGWR ASYNC REOPEN=60 VALID_FOR=(ONLINE_LOGFILES, PRIMARY_ROLE) DB_UNIQUE_NAME=TESTC’

log_archive_dest_state_2 = DEFERstandby_archive_dest = ‘LOCATION=USE_DB_RECOVERY_FILE_DEST’standby_file_management = AUTOdb_file_name_convert = '+SHARED_DATA_DG01/TESTC/',

'+SHARED_DATA_DG01/ TESTP /'log_file_name_convert = '+SHARED_DATA_DG01/ TESTC /',

'+SHARED_DATA_DG01/ TESTP /', '+SHARED_AUXFILES_DG01/ TESTC /','+SHARED_AUXFILES_DG01/ TESTP /'

6. Recreate the spfile:

$ srvctl stop database –d DB_NAME

SQL> create spfile=’+shared_auxfiles_dg01/DB_NAME/parameterfile/spfileDB_NAME.ora’ from pfile=’/oracle/admin/DB_NAME/pfile/initDB_NAME.ora’;

7. Start up the database, if necessary enable archiving first:

SQL> startup mount > alter database archivelog; > shutdown immediate

Page 5 of 16

Page 6: Oracle 10gR2 RAC StdbyDb Creation Guide

MSIE – Oracle Engineering Oracle 10gR2 RAC StdbyDb Creation Guide

$ srvctl start service –d DB_NAME

8. Backup the primary database, controlfile, and archive logs to /ora01/orabkup/DB_NAME/stdby. The rman 10g schema owner/pwd for E&Os shared rman catalog is: rman10g/rmandba:

RMAN> connect target /RMAN> connect catalog rman_schema_owner/rman_schema_pwd@rman_catalog_dbRMAN> configure channel device type disk format ‘/ora01/orabkup/%d/stdby/%d_%s_%p_%T’;RMAN> backup as compressed backupset database > include current controlfile for standby > plus archivelog;RMAN> configure channel device type disk clear;

2.3 Steps to perform on all nodes of the standby database cluster:

1. Create admin directories and symbolic link for the database under $ORACLE_BASE/admin/DB_NAME:

Directories: adump bdump cdump udump pfile create localSymbolic Link: backup -> /ora01/orabkup/DB_NAME

2. Put an entry into oratab for the instances:

INSTANCE_NAME:/oracle/product/10.2.0/db_1:N

3. Create tns entries for the primary and standby databases and create the local/remote listener entry for the standby database (See Appendix A). Also, create a tns entry for the database’s Rman catalog database.

4. Tnsping the primary and standby databases and the rman catalog:

$ tnsping DB_NAME $ tnsping STDBY_DB_U_NAME$ tnsping rman_catalog_db

5. Create initINSTANCE_NAME.ora in $ORACLE_HOME/dbs with the following entry:

spfile=’+shared_auxfiles_dg01/STDBY_DB_U_NAME/parameterfile/spfileDB_NAME.ora’

6. Create a password file in $ORACLE_HOME/dbs:

$ orapwd file=$ORACLE_HOME/dbs/orapwINSTANCE_NAME password=sys_pwd

2.4 Steps to perform on node 1 of the standby database cluster:

1. Create the database’s backup filesystem directory:

/ora01/orabkup/DB_NAME/stdby

2. Copy the primary database’s backup files and the parameter file to the above directory.

3. Create a tnsnames entry for the primary database’s Rman catalog if it is different than the rman catalog entered earlier.

Page 6 of 16

Page 7: Oracle 10gR2 RAC StdbyDb Creation Guide

MSIE – Oracle Engineering Oracle 10gR2 RAC StdbyDb Creation Guide

4. Create the ASM directory for the spfile:

$ . oraenv………> +ASM1………> /oracle/product/10.2.0/asm_1$ asmcmdASMCMD> mkdir +shared_auxfiles_dg01/STDBY_DB_U_NAME/parameterfileASMCMD> exit

5. Set the Oracle environment for the database instance:

$ . oraenv………> INSTANCE_NAME

6. Edit the initialization file and set Standby and Archiving parameters for the standby database:

db_unique_name = STDBY_DB_U_NAMEfal_client = STDBY_DB_U_NAME fal_server = DB_NAMElog_archive_config = ‘DG_CONFIG=(DB_NAME, STDBY_DB_U_NAME)’log_archive_dest_1 = ‘LOCATION=USE_DB_RECOVERY_FILE_DEST

VALID_FOR=(ALL_LOGFILES, ALL_ROLES) DB_UNIQUE_NAME=STDBY_DB_U_NAME’

log_archive_dest_2 = ‘SERVICE=DB_NAME LGWR ASYNC REOPEN=60 VALID_FOR=(ONLINE_LOGFILES, PRIMARY_ROLE) DB_UNIQUE_NAME=DB_NAME ’

db_file_name_convert = '+SHARED_DATA_DG01/DB_NAME/', '+SHARED_DATA_DG01/STDBY_DB_U_NAME/'

log_file_name_convert = '+SHARED_DATA_DG01/DB_NAME/', '+SHARED_DATA_DG01/STDBY_DB_U_NAME/', '+SHARED_AUXFILES_DG01/DB_NAME/','+SHARED_AUXFILES_DG01/STDBY_DB_U_NAME/'

Example:

db_unique_name = TESTCfal_client = TESTCfal_server = TESTPlog_archive_config = ‘DG_CONFIG=(TESTP, TESTC)’log_archive_dest_1 = ‘LOCATION=USE_DB_RECOVERY_FILE_DEST

VALID_FOR=(ALL_LOGFILES, ALL_ROLES) DB_UNIQUE_NAME=TESTC’

log_archive_dest_2 = ‘SERVICE= TESTP LGWR ASYNC REOPEN=60 VALID_FOR=(ONLINE_LOGFILES, PRIMARY_ROLE) DB_UNIQUE_NAME=TESTP’’

db_file_name_convert = '+SHARED_DATA_DG01/TESTP/', '+SHARED_DATA_DG01/TESTC/'

log_file_name_convert = '+SHARED_DATA_DG01/TESTP/', '+SHARED_DATA_DG01/TESTC/', '+SHARED_AUXFILES_DG01/TESTP/','+SHARED_AUXFILES_DG01/TESTC/'

7. Create the spfile:

SQL> create spfile=’+shared_auxfiles_dg01/STDBY_DB_U_NAME/parameterfile/spfileDB_NAME.ora’ from pfile=’/oracle/admin/DB_NAME/pfile/initDB_NAME.ora’;

Page 7 of 16

Page 8: Oracle 10gR2 RAC StdbyDb Creation Guide

MSIE – Oracle Engineering Oracle 10gR2 RAC StdbyDb Creation Guide

8. Start up the database instance:

SQL> startup nomount

9. Ensure that the database services (DB_NAME and STDBY_DB_U_NAME) are registered with the listener:

$ lsnrctl status orals01_nodename

The database service and instance should be listed. The status will be ‘BLOCKED’.

10. Create the standby database:

$ rmanRMAN> connect target sys/sys_pwd@DB_NAME RMAN> connect catalog rman_schema_owner/rman_schema_pwd@rman_catalog_dbRMAN> connect auxiliary /RMAN> run {

allocate auxiliary channel stdby type disk; duplicate target database for standby dorecover nofilenamecheck; }

RMAN> exit

11. If necessary, edit the pfile and modify the control_files parameter:

a. Get the paths and names of the controlfiles:

SQL> show parameter control_files

b. Change the value for control_files in the parameter file to the value returned above.

12. If the names of the control files changed, recreate the spfile:

SQL> shutdown immediateSQL> create spfile=’+shared_auxfiles_dg01/STDBY_DB_U_NAME/parameterfile/spfileDB_NAME.ora’

from pfile=‘/oracle/admin/DB_NAME/pfile/initDB_NAME.ora’;

13. If necessary, remove unused control files that were created by the duplicate database process:

$ export ORACLE_SID=+ASM1$ export ORACLE_HOME=/oracle/product/10.2.0/asm_1$ asmcmdASMCMD> cd +SHARED_DATA_DG01/STDBY_DB_U_NAME/CONTROLFILEASMCMD> lsASMCMD> rm current.xxx.xxxxxxxxx # Remove the control file that is not being used.ASMCMD> cd +SHARED_FRA_DG01/STDBY_DB_U_NAME/CONTROLFILEASMCMD> lsASMCMD> rm current.xxx.xxxxxxxxx # Remove the control file that is not being used.ASMCMD> exit

14. Set the Oracle environment back to the database instance environment:

$ . oraenv………> INSTANCE_NAME

15. Mount the database:

Page 8 of 16

Page 9: Oracle 10gR2 RAC StdbyDb Creation Guide

MSIE – Oracle Engineering Oracle 10gR2 RAC StdbyDb Creation Guide

SQL> startup mount

16. As with the production database, create ‘standby’ redo logs on the standby database. Create the same number of ‘standby’ redo log groups on the standby database that you created on the production database.

The first group number here will be the number of redo log groups + the number of standby redo log groups created on the production database + 1. If there are 4 redo log groups for each thread, then there were 5 standby redo log groups created on the production database, so the first standby redo log group created here would be ‘GROUP 10’ for each thread. Change the Xs below to the appropriate numbers. Also change the size. The size must match the size of the existing redo logs.

SQL> ALTER DATABASE ADD STANDBY LOGFILE THREAD X GROUP X ('+SHARED_DATA_DG01', '+SHARED_AUXFILES_DG01') SIZE XXM;

17. Shutdown the database:

SQL> shutdown immediate

Page 9 of 16

Page 10: Oracle 10gR2 RAC StdbyDb Creation Guide

MSIE – Oracle Engineering Oracle 10gR2 RAC StdbyDb Creation Guide

3 Configure the Oracle Cluster Registry

3.1 Steps to perform on node 1 of the standby database:

1. Ensure that all instances are shutdown on all nodes.

2. Add the database, instances, and service to the Oracle Cluster Registry and start them:

$ srvctl add database –d DB_NAME –o $ORACLE_HOME –p +shared_auxfiles_dg01/STDBY_DB_U_NAME/parameterfile/spfileDB_NAME.ora –r PHYSICAL_STANDBY –s mount –y automatic

$ srvctl add instance -d DB_NAME -i DB_NAME1 -n NODE_NAME_1$ srvctl add instance -d DB_NAME -i DB_NAMEn -n NODE_NAME_n

$ --- Add additional instances if necessary.

Create a service for the database and add it to the OCR configuration. The “srvctl add service” options are:

-s for the service name-r for the preferred instance list-a for the available instance list-P for the TAF policy, either NONE or BASIC

Instances can be configured as PREFERRED or AVAILABLE instances. A service will distribute connections across all running “preferred” instances of a database. If no “available” instances have been configured and a “preferred” instance goes down, the service will distribute connections across the remaining “preferred” instances. If one or more instances have been configured as “available” instances, and those available instances are up and running, and one or more “preferred” instances go down, the service will distribute connections across the remaining “preferred” instances and one or more “available” instance.

Change P_INSTX to the preferred instance names of the database.Add additional primary instances if necessary.

Change A_INSTX to the available instance names of the database.Add additional available instance if necessary. If all instances are preferred instances, remove the “–a…” option.

Change the failover option (–P) to either NONE or BASIC. If the application has not configured Fast Connection Failover (FCF) then use BASIC failover. If the application has configured FCF then use NONE.

SRVCTL SYNTAX:

$ srvctl add service -d DB_NAME -s DB_NAME_SRV01 -r P_INST1,P_INSTX -a A_INST1,A_INSTX –P NONE/BASIC

EXAMPLE (Assuming all instances are preferred and TAF policy=BASIC): $ srvctl add service -d DB_NAME -s DB_NAME_SRV01 -r INSTANCE_NAME1,INSTANCE_NAME2,… –P BASIC

Page 10 of 16

Page 11: Oracle 10gR2 RAC StdbyDb Creation Guide

MSIE – Oracle Engineering Oracle 10gR2 RAC StdbyDb Creation Guide

3. Start the standby database instances in managed recovery mode:

a) If all instances for the database are to be started:

$ srvctl start service –d DB_NAME -o mountPRKP-1030 : Failed to start the service DB_NAME_SRV01.CRS-0215: Could not start resource 'ora.DB_NAME.DB_NAME_SRV01.INST_NAME.srv'.# These errors are ok. This service will not be started until the database has been failed over.

If only certain instance are to be started:

$ srvctl start service –d DB_NAME –s DB_NAME_SRV01 –i INST_NAME1,INST_NAME2,… -o mountPRKP-1030 : Failed to start the service DB_NAME_SRV01.CRS-0215: Could not start resource 'ora.DB_NAME.DB_NAME_SRV01.INST_NAME.srv'.# These errors are ok. This service will not be started until the database has been failed over.

b) Put the database into managed recovery mode:

SQL> alter database recover managed standby database using current logfile disconnect;

4. Check the status of the database instance(s):

$ srvctl status database –d DB_NAME

5. Ensure that the database service and instances are registered with the listener:

$ lsnrctl status orals01_nodename

The database services and instances should be listed. The status should be ‘READY’.

4 Enable Archiving to the Standby and Check for Log Gaps

4.1 Enable Archiving to the Standby:

1. From node 1 of the primary database cluster, enable the transfer of archive logs to the standby server:

SQL> alter system set log_archive_dest_state_2=enable scope=both;

Edit the primary database init file and change the following line:

log_archive_dest_state_2 = enable

2. Execute a log switch:

SQL> alter sytem archive log current;

This will do a log switch on all primary database instances.Verify that the archive logs were created on the standby database servers.

Page 11 of 16

Page 12: Oracle 10gR2 RAC StdbyDb Creation Guide

MSIE – Oracle Engineering Oracle 10gR2 RAC StdbyDb Creation Guide

4.2 Check for Archive Log Gaps:

1. On node 1 of the standby database cluster check for archive log gaps on the standby database:

SQL> select * from v$archive_gap;

If rows are returned, get the name(s) of the missing archive log files:

SQL> select thread#, sequence#, name> from v$archived_log> where thread# = THREAD#> and sequence# between LOW_SEQUENCE# and HIGH_SEQUENCE#;

Where: THREAD#, LOW_SEQUENCE#, and HIGH_SEQUENCE# are the values from the above query.

Copy the missed archive log files from the primary database server to the standby (see Appendix B)

Shutdown all of the standby database instances.

SQL> alter database recover managed standby database cancel;

$ srvctl stop database –d DB_NAME

Mount the standby database instance and register the missed archive log(s):

SQL> startup nomount > alter database mount standby database; > alter database register logfile ‘/logfile_path/logfile_name’

Where: logfile_path is the backup filesystem path and logfile_name is the name of one of the missing archive logs..

Check again for an archive log gap:

SQL> select * from v$archive_gap;

If rows are returned, repeat the appropriate steps above until there are no more gaps.

2. Once all of the log files have been registered in the standby database, place the standbydatabase in managed recovery mode.

SQL> alter database recover managed standby database disconnect;

3. Verify that the archive logs are being applied:

SQL> select thread#, sequence#, archived, applied > from v$archived_log > order by 1,2;

Archive logs should start being applied (‘applied’ should equal YES for some logs)and eventually all but the last archived log (and any duplicate entries) should be applied

Page 12 of 16

Page 13: Oracle 10gR2 RAC StdbyDb Creation Guide

MSIE – Oracle Engineering Oracle 10gR2 RAC StdbyDb Creation Guide

5 Managing the Standby Database

To start the standby database in managed recovery mode:

$ srvctl start service –d DB_NAME -o mountor$ srvctl start service –d DB_NAME –s DB_NAME_SRV01 –i INST_NAME1,INST_NAME2,… -o mount

Sqlplus> alter database recover managed standby database disconnect;

To stop managed recover:

Sqlplus> alter database recover managed standby database cancel;

To shutdown the database:

Sqlplus> alter database recover managed standby database cancel;

$ srvctl stop database –d DB_NAME

To open the database in read-only mode:

During startup (instead of putting the database in managed recovery mode):

Sqlplus> alter database open read only;

While in managed recovery mode:

Sqlplus> alter database recover managed standby database cancel;> alter database open read only;

To put the standby database back into managed recovery mode from read only mode:

The best way is to shutdown the instances and start them up in managed recovery mode:

$ srvctl stop database –d DB_NAME

$ srvctl start service –d DB_NAME -o mountor$ srvctl start service –d DB_NAME –s DB_NAME_SRV01 –i INST_NAME1,INST_NAME2,… -o mount

Sqlplus> alter database recover managed standby database disconnect;

It can be done directly from read only mode:

Sqlplus> alter database recover managed standby database disconnect;

Page 13 of 16

Page 14: Oracle 10gR2 RAC StdbyDb Creation Guide

MSIE – Oracle Engineering Oracle 10gR2 RAC StdbyDb Creation Guide

Appendix A

Change ‘DB_NAME’ and ‘STDBY_DB_U_NAME’ to the appropriate names. Change the ‘PRIMARY_HOST_VIP_1/n’ to the names of the virtual ip address (VIP) where the primary database is located. Change the ‘STDBY_HOST_VIP_1/n’ to the names of the virtual ip address (VIP) where the standby database is located. Change the port numbers ‘XXXX’ to the appropriate number. Add additional address entries if more nodes/instances are created.

Service Name Entries:

DB_NAME = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = PRIMARY_HOST_VIP1)(PORT = XXXX)) (ADDRESS = (PROTOCOL = TCP)(HOST = PRIMARY_HOST_VIPn)(PORT = XXXX)) (FAILOVER = yes) (LOAD_BALANCE = yes) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = DB_NAME ) (FAILOVER_MODE = (TYPE = SELECT) (METHOD = BASIC) (RETRIES = 180) (DELAY = 5))) )

STDBY_DB_U_NAME = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = STDBY_HOST_VIP1)(PORT = XXXX)) (ADDRESS = (PROTOCOL = TCP)(HOST = STDBY_HOST_VIPn)(PORT = XXXX)) (FAILOVER = yes) (LOAD_BALANCE = yes) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = STDBY_DB_U_NAME) (FAILOVER_MODE = (TYPE = SELECT) (METHOD = BASIC) (RETRIES = 180) (DELAY = 5))) )

Listener Entries:

On each node of the standby there should be entries for the standby database and all instances:

LISTENERS_DB_NAME = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = STDBY_HOST_VIP1)(PORT = XXXX)(QUEUESIZE = 64)) (ADDRESS = (PROTOCOL = TCP)(HOST = STDBY_HOST_VIPn)(PORT = XXXX)(QUEUESIZE = 64)) ) LISTENER_INSTANCE_NAME1 = (ADDRESS = (PROTOCOL = TCP)(HOST = STDBY_HOST_VIP1)(PORT = XXXX)(QUEUESIZE = 64)) LISTENER_INSTANCE_NAMEn = (ADDRESS = (PROTOCOL = TCP)(HOST = STDBY_HOST_VIPn)(PORT = XXXX)(QUEUESIZE = 64))

Page 14 of 16

Page 15: Oracle 10gR2 RAC StdbyDb Creation Guide

MSIE – Oracle Engineering Oracle 10gR2 RAC StdbyDb Creation Guide

Appendix B

Copying archive logs located on ASM diskgroups from one server to another.

Create a directory for the archive logs on the backup filesystem on node 1 of both the primary and standby clusters:

$ mkdir /ora01/orabkup/DB_NAME/archive_logs

On node 1 of the primary database cluster:

Get the ASM path and name of the missing archive logs:

SQL> select thread#, sequence#, name> from v$archived_log> where thread# = THREAD#> and sequence# between LOW_SEQUENCE# and HIGH_SEQUENCE#;

Where: THREAD#, LOW_SEQUENCE#, and HIGH_SEQUENCE# are the values returned from v$archive_gap on the standby database.

Create Oracle “directories”. If the missed archive logs span more that one day, repeat the first command witha new name for each directory:

SQL> create or replace directory ARCH_DIR as '+SHARED_FRA_DG01/DB_NAME/ARCHIVELOG/YYYY_MM_DD';

SQL> create or replace directory ARCH_COPY_DEST as '/ora01/orabkup/DB_NAME/archive_logs';

Copy the archive logs from ASM to the backup filesystem:

SQL> set serveroutput onSQL> BEGIN

> dbms_file_transfer.copy_file(source_directory_object => 'ARCH_DIR', > source_file_name => 'ARCHIVELOG_FILE_NAME',

> destination_directory_object => 'ARCH_COPY_DEST', > destination_file_name => 'ARCHIVELOG_FILE_NAME'); > END; > /

Where: ARCHIVELOG_FILE_NAME is the name of an archive log returned from the query above. Repeat this for all missing archive logs.

Copy the archive logs to the backup filesystem on node 1 of the standby database.

Page 15 of 16

Page 16: Oracle 10gR2 RAC StdbyDb Creation Guide

MSIE – Oracle Engineering Oracle 10gR2 RAC StdbyDb Creation Guide

Revision History

No. Date By Reason1.0 10/15/2007 Bill Drosche Initial Release

05/14/2008 Bill Drosche Reversed the values of the FAL init parameters.04/20/2009 Bill Drosche Added the VALID_FOR parameter to the

LOG_ARCHIVE_DEST_X init parameter for both the Primary and Standby databases.

Page 16 of 16