You are on page 1of 4

ONLINE-EXTRA CONTENT

should be considered. For more information about cross-


Optimizing Disaster Recovery Using Oracle Data Guard
instance archiving, refer to the Oracle9i Data Guard Concepts
on Dell PowerEdge Servers
and Administration manual at http://download-west.oracle.com/
By Paul Rad, Zafar Mahmood, Ibrahim Fashho, Raymond Dutcher, Lawrence To, and Ashish Ray
docs/cd/B10501_01/server.920/a96653/toc.htm.

Creating an Effective Disaster Recovery SQL> alter system set cluster_database=false

Architecture Using Oracle9i RAC and scope=spfile;


SQL> alter system set archive_log_start=true
Oracle Data Guard on Dell Platforms scope=spfile;
Recently, joint engineering teams from Dell and Oracle completed a proj- SQL> alter system set archive_log_dest_1=
ect demonstrating the use of Oracle9i™ Real Application Clusters (RAC) 'LOCATION=/u03/arch' scope=spfile;
and Oracle® Data Guard on Linux®-based Dell™ servers and Dell stor- SQL> shutdown immediate
age as a powerful but low-cost, high-availability and disaster recovery SQL> startup mount exclusive
solution. The following procedures describe the steps to produce an SQL> alter database archivelog;
Oracle Maximum Availability Architecture (MAA) configuration con- SQL> alter system set cluster_database=true
sisting of a primary site in Austin, Texas, and a secondary site in Dallas, scope=spfile;
Texas. Each site contains a two-node cluster running Oracle9i RAC and SQL> shutdown immediate
Oracle Data Guard. The database name is SALES. The node names at SQL> startup
the primary site in Austin are austin1 and austin2; the node names at
the secondary site in Dallas are dallas1 and dallas2. d. Start all other Oracle RAC instances.
Using RAC at each of the primary and secondary sites helps ensure
high availability in the event of local node failures. Using Data Guard e. Verify that the database is in ARCHIVELOG mode and that
in the Maximum Availability protection mode, which is based on syn- automatic archiving is enabled.
chronous redo transport from the primary database to the standby data-
base, helps ensure that no data is lost in the event of a failure or disaster SQL> archive log list
at the primary site. Database log mode Archive Mode
Automatic archival Enabled
Create a backup of the primary database and copy it Archive destination /u03/arch
to the standby database Oldest online log sequence 7
1. Ensure that the primary database is in ARCHIVELOG mode: Next log sequence to archive 9
Current log sequence 9
a. Verify the current status of the database.
2. Create the backup: Use any backup copy of the primary database
SQL> archive log list to create the physical standby database, as long as the necessary
Database log mode No Archive Mode archived redo log files exist to completely recover the database.
Automatic archival Disabled Oracle recommends the Recovery Manager (RMAN) utility for this
Archive destination ?/dbs/arch task, which enables the creation of an online backup without the
Oldest online log sequence 7 need to shut down the primary database.
Current log sequence 9
3. Create the standby control file by entering the following at the
The query result No Archive Mode for the database log mode command prompt:
indicates that the database is not in ARCHIVELOG mode. If
the database is already in ARCHIVELOG mode, then this line SQL> alter database create standby controlfile as
would read Archive Mode. '/home/oracle/standby.ctl';
Database altered.
b. To enable archiving, leave one Oracle instance running and
shut down all other instances. 4. Copy the following files from the primary database to the standby
host: the backup data files, standby control file, system parameter
c. To enable ARCHIVELOG mode, mount the single Oracle data- file (SPFILE), and all available redo logs archived since the
base instance exclusively using the following commands. backup was started.
Note: A clustered file system is recommended for the archive The standby control file should be copied to the files listed by
log destination /u03/arch; otherwise, cross-instance archiving the database parameter control_files.

March 2004 POWER SOLUTIONS 1


Ensure that the standby database has the same directory (ADDRESS = (PROTOCOL = TCP)(HOST = dallas2)
structure as the primary database. If the standby database has (PORT = 1521))
a different directory structure, the administrator must rename )
the data files on the standby database after copying them. (CONNECT_DATA =(SERVICE_NAME = DALLASdbsvc))
This can be done using the db_file_name_convert and )
log_file_name_convert parameters or by manually using
the alter database statements. d. Restart all the listeners on the primary and secondary site
nodes.
Set up the environment
1. Configure networking components at the primary and secondary 2. Set the initialization parameters for the primary database by exe-
sites. This must be done prior to changing the SPFILE; otherwise, cuting the following commands, which will modify the SPFILE on
many of the alter system commands to set the database param- the primary database:
eters will fail.
SQL> alter system set
a. Configure the listener for each node by adding the following log_archive_dest_2='service=DALLASnetsvc reopen=15
lines to the $ORACLE_HOME/network/admin/listener.ora lgwr sync net_timeout=30 max_failure=2 reopen=5';
file on each node: SQL> alter system set
log_archive_dest_state_1=enable;
SALES_LIST= SQL> alter system set log_archive_dest_state_2=defer;
(DESCRIPTION_LIST=(DESCRIPTION= SQL> alter system set remote_archive_enable='TRUE';
(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP) (PORT=1521))) SQL> alter system set
)) standby_archive_dest='/u03/arch'
SQL> alter system set standby_file_management='auto';
b. Configure the local listener service for dynamic instance SQL> alter system set fal_client=AUSTINnetsvc;
registration by adding the following lines to the SQL> alter system set fal_server=DALLASnetsvc;
$ORACLE_HOME/network/admin/tnsnames.ora file on SQL> alter system set local_listener=SALES_LOCAL;
each node: SQL> alter system set service_names=AUSTINdbsvc;

SALES_LOCAL=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP) 3. Set the initialization parameters for the standby database by start-
(PORT=1521))) ing the Oracle database instance in nomount state on the second-
ary site. Once the instance is started in nomount state, make the
c. Configure the network services by adding the following lines following changes to the parameter file:
to the $ORACLE_HOME/network/admin/tnsnames.ora file on
each node: SQL> startup nomount
SQL> alter system set log_archive_dest_1='LOCATION=
# Primary site /u03/arch arch';
AUSTINnetsvc = SQL> alter system set log_archive_dest_2='service=
(DESCRIPTION = AUSTINnetsvc reopen=15 lgwr sync net_timeout=
(ADDRESS_LIST = 30 max_failure=2 reopen=5';
(ADDRESS = (PROTOCOL = TCP)(HOST = austin1) SQL> alter system set log_archive_dest_state_1=enable;
(PORT = 1521)) SQL> alter system set log_archive_dest_state_2=defer;
(ADDRESS = (PROTOCOL = TCP)(HOST = austin2) SQL> alter system set remote_archive_enable='TRUE';
(PORT = 1521)) SQL> alter system set standby_archive_dest='/u03/arch'
) SQL> alter system set standby_file_management='auto';
(CONNECT_DATA = SQL> alter system set fal_client=DALLASnetsvc;
(SERVICE_NAME = AUSTINdbsvc)) SQL> alter system set fal_server=AUSTINnetsvc;
) SQL> alter system set local_listener=SALES_LOCAL;
# Secondary site SQL> alter system set service_names=DALLASdbsvc;
DALLASnetsvc =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = dallas1)
(PORT = 1521))

March 2004 POWER SOLUTIONS 2


Start the physical standby database Use the following syntax to create SRLs:
1. Start and mount all the standby instances by entering the
following command at the command prompt in the standby SQL> alter database add standby logfile group 9
Oracle database: '/u02/austin/srl09.dbf' size 500m reuse;
SQL> alter database add standby logfile group 10
> sqlplus "/ as sysdba" '/u02/austin/srl10.dbf' size 500m;
SQL> alter database mount standby database; SQL> alter database add standby logfile group 11
'/u02/austin//srl11.dbf' size 500m;
2. Validate that the standby instance is registered with the listener etc.
on node austin1 by entering the following command:
4. Place the standby database in managed recovery on node austin1:
> lsnrctl status SALES_LIST
SQL> recover managed standby database disconnect;
The command should return the following output, which indi-
cates that SALES is registered at the secondary site: 5. Enable the remote archive destination on the primary database:

Service “DALLASdbsvc” has 1 instance(s). SQL> alter system set log_archive_dest_state_2=enable;


Instance “SALES1”, status READY, has 1 handler(s)
for this service... Set the database protection mode on the primary database
The command completed successfully 1. Shut down all primary database instances except one.
Note: This example uses Maximum Availability protection mode;
3. Create standby redo logs (SRLs) on the primary and standby data- by default, Maximum Performance protection mode is enabled. If
bases at both sites. Maximum Performance is the desired protection mode, then these
Use Oracle log multiplexing to create multiple SRL members in steps are not necessary.
each standby redo group. Multiplexing protects against failures
such as disk corruption involving the online redo log or an SRL 2. Use the mount exclusive command to mount the remaining
that exists on both sides of the disk mirror for one of the mem- instance:
bers, or a user error that accidentally removes a member.
Use the following formula to determine the number of SQL> alter system set cluster_database=false
SRL groups: scope=spfile;
SQL> shutdown immediate
Number of SRL groups = Sum of all production online log SQL> startup mount exclusive
groups per thread + Number of threads
3. Set the database protection mode:
For example, if a primary database has two instances, or
threads, and each thread has four online redo log groups, then SQL> alter database set standby database to maximize
there should be ten SRL groups. Having one more SRL group for availability;
each thread than the number of the online redo log groups for the
primary database reduces the likelihood that the Oracle Log Writer 4. Validate the database protection mode:
(LGWR) process for the primary database will become blocked
because an SRL cannot be allocated on the standby database. select PROTECTION_MODE,PROTECTION_LEVEL from v$database;
Additional guidelines for creating SRLs include the following: PROTECTION_MODE PROTECTION_LEVEL
-------------------- --------------------
• Administrators should create the same number of SRLs for MAXIMUM AVAILABILITY MAXIMUM AVAILABILITY
both primary and standby databases.
• SRLs should exist on both primary and standby databases in 5. Return the primary database to RAC mode:
preparation for a switchover.
• All online redo logs and SRLs for both the primary and SQL> alter system set cluster_database=true
standby databases must be the same size. scope=spfile;
• In an Oracle RAC environment, the SRLs must reside on a SQL> shutdown
shared disk.

March 2004 POWER SOLUTIONS 3


6. Start all instances of the primary Oracle database:

SQL> startup

7. Check local and remote archive destinations on the primary data-


base by entering the following statement:

select NAME_SPACE, STATUS, TARGET, LOG_SEQUENCE,


TYPE, PROCESS, REGISTER, ERROR from v$ARCHIVE_DEST
where STATUS='INACTIVE';

Local and remote archive destinations should be returned. If all


expected destinations are not returned, then investigate the alert log
and v$ARCHIVE_DEST and v$ARCHIVE_DEST_STATUS views for
errors as follows:

select * from v$ARCHIVE_DEST_STATUS where


STATUS!='INACTIVE';

8. Ensure that the standby database is applying new archived redo


logs by executing the following two queries on the primary and
standby databases:

select 'ARCHIVED LOG MAX' || THREAD#, MAX(SEQUENCE#)


from v$ARCHIVED_LOG group by THREAD#;

On the primary database, this query shows the redo logs archived
and sent. The output from the standby and primary databases
should match.

Execute the following query on the standby database:

select 'LOG HISTORY MAX' || THREAD#, MAX(SEQUENCE#)


from v$LOG_HISTORY group by THREAD#;

On the standby database, this query shows the maximum


sequence number recovered for each thread. This should match
the output from the previous query.

For further details, refer to “Monitoring Log Apply Services for


Physical Standby Databases” in the Oracle9i Data Guard Concepts
and Administration manual.

March 2004 POWER SOLUTIONS 4

You might also like