Manage Learn to apply best practices and optimize your operations.

Creating an Oracle physical standby server

Define high availability
Define, Install and Test Real Application Clusters (RAC)
ASM Instance and ASM Disk Groups
How to manage an ASM instance with ASMCMD and ASMLIB
Implementing Oracle 11g data guard and data guard protection modes
Creating an Oracle physical standby server

All of the databases, whether physical or logical, must be created as a physical standby first. The tools used to create the standby are RMAN, Data Guard Broker, or Oracle Grid Control. Steps must be completed on both primary and standby servers. However, the steps on the primary database only need to be done once, no matter how many standby servers are being created. Oracle 11g RMAN provides a simple command for creating the standby database and backing up the database at the same time.

Project 8-3 Create a Physical Standby Server

Step by Step

1. Complete the following steps on the primary server:

select FORCE_LOGGING from v$database;
alter database force logging;
-- forces all changes to be logged even if nologging
might be set on an object 

2. Configure the redo transport authentication; use a remote login password file.

3. Add standby logfiles to the primary. The logs on the standby need to be the same size or larger than on the primary in order for the primary redo to be applied to the standby redo logs.

alter database add standby logfile '/u...' size 50M; 

4. Set initialization parameters on the primary server:

DB_UNIQUE_NAME (Doesn't change even if the standby becomes the primary)
LOG_ARCHIVE_DEST_1='LOCATION=/u01/oraarch/DG01' ## local archive directory
VALID_FOR=(ONLINE_LOGFILE,PRIMARY_ROLE) db_unique_name=DG01' ## sets the type
of transport and used for physical standby

5. Put the primary server in archive log mode.

6. The network configurations for the standby database need to be configured on both the primary and secondary servers. Using Oracle Net Manager on both servers will help configure this. (Refer to the discussion in Chapter 3.) In configuring a service name, use the unique_db name for the standby server. After setting up the listener and service on both servers, verify that the password file has been copied over and the directories for adump, bdump, flashback, and so on have been created.

7. Creating the standby database over the network, start up the standby database in NOMOUNT mode.

8. On the primary server, issue the RMAN command and connect as sysdba:

RMAN> connect auxiliary sys/password@DG02
RMAN> run {
allocate channel disk1 type disk;
allocate auxiliary channel stby type disk;
duplicate target database for standby from active database
parameter_value_convert 'DG01','DG02'
set db_unique_name='DG02'
set db_file_name_convert='/dg01/','/dg02/'
set log_file_name_convert='/dg01/','/dg02/'
set control_files='/u01/app/oradata/controlfiles/dg02.ctl'
set log_archive_max_processes='5'
set fal_client='dg02' ## FAL (fetch archive log) client and is used if
roles are switched
set fal_server='dg01'
set standby_file_management='AUTO'
set log_archive_config='dg_config=(dg01,dg02)'
set log_archive_dest_1='service=dg01 ASYNC
valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE) db_unique_name=DG01'

9. Log into the primary server and switch the logfile:

SQLPLUS>alter system switch logfile;  
10. Start the recovery process on the standby server:

SQLPLUS> alter database recover managed standby database
using current logfile disconnect;
Primary and standby servers have been created and now should be verified.

Project Summary

In this project, primary and standby databases were created. The configuration of the parameters and starting up the instances all need to be completed before the recovery process on the standby server starts. Following these steps should give you a good idea what it takes to create a standby server.

To manage the Data Guard system, the Data Guard Broker (command line) or Oracle Enterprise Manager Grid Control can be used. In order to use the Data Guard Broker, the parameter DG_BROKER_START needs to be set to TRUE and the listener needs to have the databases with broker services added. DGMRGL is the command to invoke the broker. For Oracle Grid Control, once the database targets are added to the Grid, the Data Guard management is possible. These tools provide a way to failover the database to the standby and back again to primary. They hold the configurations and allow modifications as well as managing and monitoring the Data Guard environment.

Tie It All Together

High availability is an important topic for database systems with the effort to remove all single points of failure in business critical applications. There are several components of Oracle 11g which, either standing alone or in combination, provide highly available solutions. Oracle Real Application Clusters (RAC) along with Data Guard provides a very fast failover system with the capabilities of an off-site standby database for disaster recovery. Automatic Storage Management (ASM) offers several advancements for managing the database files and disk in order to provide a stable environment that can minimize maintenance windows and downtime. Planning with your business and reviewing these as well as other database features should assist you in developing and implementing a well-architected, highly available database system.

This was last published in May 2010

Dig Deeper on Oracle database backup and recovery

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.