ORACLE 11G DB

48
Oracle 11gR2 Data Guard Component Installation Instructions

description

CLUSTER

Transcript of ORACLE 11G DB

Page 1: ORACLE 11G DB

Oracle 11gR2 Data Guard

Component Installation Instructions

Page 2: ORACLE 11G DB

AT&T propertyMohammed Shanser Nasser

Page 3: ORACLE 11G DB

Table of Contents

1. Introduction.............................................................................................41.1. Purpose....................................................................................................41.2. Audience..................................................................................................41.3. Certified Configurations Environment.......................................................4

2. System Installation Requirements........................................................52.1. Hardware Requirement............................................................................52.2. Oracle Software Requirement..................................................................6

3. Certification Environment......................................................................6

4. Creating a Physical Data Guard............................................................84.1. Prepare 11gR2 database.........................................................................84.2. Configure SSH for User Equivalence.......................................................84.3. Primary Database Set Up.......................................................................12

4.3.1. Identify database name...........................................................................................................124.3.2. Create Password File..............................................................................................................134.3.3. Enable Force Logging............................................................................................................134.3.4. Configure the Primary Database to Receive Redo Data.......................................................134.3.5. Enable Archiving....................................................................................................................154.3.6. Prepare initialization file for Primary Database.....................................................................15

4.4. Prepare Standby Database....................................................................174.4.1. Prepare initialization parameter file for Standby Database....................................................174.4.2. Create Backup copy of the Primary Database........................................................................194.4.3. Create a Control File for the Standby Database.....................................................................214.4.4. Copy files from Primary server to Standby Server................................................................214.4.5. Configure listeners & tnsnames for both primary and standby database...............................224.4.6. Set Up the Environment to Support the Standby Database....................................................24

4.5. Start the Physical Database...................................................................254.6. Verify the Physical Standby Database...................................................25

4.6.1. Stopping Redo Apply.............................................................................................................284.7. Enable Active Dataguard........................................................................28

5. Data Guard Broker Configuration.......................................................295.1. Start Data Guard Broker.........................................................................295.2. Update Listener.ora................................................................................305.3. Set up Broker Configuration...................................................................315.4. Enabling the Broker Configuration..........................................................335.5. Remove Data Guard Broker...................................................................34

6. APPENDIX A: Glossary & Acronyms..................................................36

Page 4: ORACLE 11G DB

1. Introduction

Oracle Data Guard ensures high availability, data protection, and disaster recovery for enterprise data. Data Guard provides a comprehensive set of services that create, maintain, manage, and monitor one or more standby databases to enable production Oracle databases to survive disasters and data corruptions.

1.1. Purpose

This document provides step by step instruction on Oracle 11GR2 Data guard set up and configuration.

This guide is submitted along with the following:

Operational Readiness Testing (ORT) Guide

1.2. Audience

This document is intended for personnel involved in installing, configuring and maintaining the Oracle 11g Dataguard. This document does not describe any customization of the Oracle 11g Dataguard, or other applications(s) (e.g., web servers and databases), that may be required for an individual customer. Such customization is outside the scope of this document.

1.3. Certified Configurations Environment

The following are the certified configurations Environment covered by this document.

Configure a standby database on a separate system that uses the same directory structure as the primary system which is recommended by Oracle.

In this document, the datafiles, log files, and control files on the primary and standby systems should have the same names and path names and use Optimal Flexible Architecture (OFA) naming conventions.

The archival directories on the standby database should also be identical between sites, including size and structure. This strategy allows other operations such as backups, switchovers, and failovers to execute the same set of steps, reducing the maintenance complexity.

Page 5: ORACLE 11G DB

In all configurations, the Oracle 11g Data Guard will be installed with the following default settings:

Default Setting Type Initial Default Setting ValueUser login name Oracle, root

User group dba, oinstall, operUser login password Oracle

ORACLE_HOME /u00/app/oracle/product/11.2.0.2/database

Oracle_base /u00/app/oracleInstall directory /u00/app/oracle

Oracle 11g listener port 1521

2. System Installation Requirements

2.1. Hardware Requirement

Physical memory (at least 1 GB) of RAM) At least an amount of swap space equal the amount of RAM Temporary space (at least 1 GB) available in /tmp. File system.

Requires 8 GB disk space file systems /u00 which used for Oracle software installation and at least 4 GB disk space for other four used for data file installation. The following is the recommended file system configuration. Recommended: /u00 8 GB /u01 4 GB /u02 4 GB /u03 4 GB /u04 4 GB

1. Oracle recommends using the same hardware platform for both primary and standby servers.

2. The hardware between the primary and standby system should have the same number of CPUs, memory size, storage configuration. If the standby system is smaller than the primary system, you may have to restrict the work that can be done on the standby system after a switchover or failover. The standby system must have enough resources available to receive and apply all redo data from the primary database

Page 6: ORACLE 11G DB

3. Differences between the primary server(s) and the standby server(s) are permitted as long as the Oracle software installed on all servers is of the same Oracle Platform as defined in metalink ID 413484.1, and is certified to run on each server.  Examples of such differences that are supported include the following:

Hardware manufacturer (e.g. Dell and Sun or Hitachi and EMC) Hardware configuration (e.g. number of CPUs, amount of RAM, storage

configuration, etc) Processor (e.g. x86-64 AMD64 and x86-64 Intel 64; POWER4 and

POWER5) Operating system distribution (e.g. Red Hat Linux and SUSE Linux)

Note:

The same Oracle Platform is defined as Oracle software installed from the same Oracle installation, and having the same PLATFORM_ID.

You can find the PLATFORM_ID inside the database in the V$DATABASE view using the query below:

SQL>select platform_id, platform_name from v$database;

PLATFORM_ID PLATFORM_NAME----------- ----------------------------------- 13 Linux 64-bit for AMD

2.2. Oracle Software Requirement

The same release of Oracle Database Enterprise Edition must be installed on the primary database and all standby databases.

Oracle Data Guard is available only as a feature of Oracle Database Enterprise Edition. It is not available with Oracle Database Standard Edition.

The COMPATIBLE initialization parameter must be set to the same value on all databases in a Data Guard configuration.

3. Certification Environment

Following are the assumptions for this data guard configuration, update the configuration according to your system requirement:

2 Linux 5 servers 2.6.18-164.9.1.el5 x86_64 GNU/Linux

Page 7: ORACLE 11G DB

Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 Oracle Home has identical path on both primary and standby servers

Primary server:

hostname: c3806z244101DB_NAME: TEST DB_UNIQUE_NAME: TEST SERVICE_NAMES: TEST

Standby server:

hostname: c3806z244102DB_NAME: TEST DB_UNIQUE_NAME: TESTSBY1 SERVICE_NAMES: TESTSBY1

Update /etc/hosts to include the other server’s ip and hostname information.

On both primary and standby servers:

$ cat /etc/hosts

# Do not remove the following line, or various programs# that require network functionality will fail.135.25.225.100 D5L5805-225-100 (primary cluster server)135.25.225.101 D5L5805-225-101 (secondary cluster server)135.25.225.185 D5l5855-225-185 (standby server)

localhost# Oracle VIP135.25.244.29 oraVIPL#Dataguard VIP135.25.244.41 oraDGVIP

4. Creating a Physical Data Guard

4.1. Prepare 11gR2 database

1. If 11gR2 database exist on primary server, skip step 2 and continue on step 3 to install 11gR2 software on standby server.

Page 8: ORACLE 11G DB

2. If Oracle 11gR2 database not exist on primary server, follow Oracle 11gR2 installation guide with the link below to perform an Oracle Database 11gR2 installation (install both software and database)

Oracle 11gR2 11.2.0.2 (standaloneVCS) for Linux 5 x (64Bit) CIG.docx

3. Perform an Oracle Database 11gR2 software installation only follow the link above on standby server.

4.2. Configure SSH for User Equivalence

Configure SSH to allow user equivalence provides a secure means of copying files and executing programs on other server without requiring password prompts.

It is recommend to open two window, one for primary server, the other for standby server.

Generating public/private rsa key pair.

Login as root on primary server (currently active VCS server)

$ su - root$ passwd oracle (enter password for oracle)

$ su - oracle$ mkdir ~/.ssh$ chmod 755 ~/.ssh$ /usr/bin/ssh-keygen -t rsa (press Enter to accept the default)

Generating public/private rsa key pair.Enter file in which to save the key (/home/oracle/.ssh/id_rsa):Enter passphrase (empty for no passphrase):Enter same passphrase again:Your identification has been saved in /home/oracle/.ssh/id_rsa.Your public key has been saved in /home/oracle/.ssh/id_rsa.pub.The key fingerprint is:2d:b4:7e:20:86:da:69:b4:8d:bc:3f:a0:21:3a:93:9a oracle@D5L5805-225-100

$ /usr/bin/ssh-keygen -t dsa (press Enter to accept the default)

Generating public/private dsa key pair.Enter file in which to save the key (/home/oracle/.ssh/id_dsa):Enter passphrase (empty for no passphrase):Enter same passphrase again:

Page 9: ORACLE 11G DB

Your identification has been saved in /home/oracle/.ssh/id_dsa.Your public key has been saved in /home/oracle/.ssh/id_dsa.pub.The key fingerprint is:ef:bc:99:9b:c0:d9:eb:14:e9:c5:0f:36:68:ba:ce:54 oracle@D5L5805-225-100

NOTE: If this is a VCS Cluster with Data Guard configuration you need to setup ssh on the secondary VCS server.

Login as root on secondary server (currently passive VCS server)

$ su - root$ passwd oracle (enter password for oracle)

$ su - oracle$ mkdir ~/.ssh$ chmod 755 ~/.ssh$ /usr/bin/ssh-keygen -t rsa (press Enter to accept the default)

Generating public/private rsa key pair.Enter file in which to save the key (/home/oracle/.ssh/id_rsa):Enter passphrase (empty for no passphrase):Enter same passphrase again:Your identification has been saved in /home/oracle/.ssh/id_rsa.Your public key has been saved in /home/oracle/.ssh/id_rsa.pub.The key fingerprint is:30:90:6c:dd:d4:9a:92:78:4f:93:e5:c2:2b:65:8f:41 oracle@D5L5805-225-101

$ /usr/bin/ssh-keygen -t dsa (press Enter to accept the default)

Generating public/private dsa key pair.Enter file in which to save the key (/home/oracle/.ssh/id_dsa):Enter passphrase (empty for no passphrase):Enter same passphrase again:Your identification has been saved in /home/oracle/.ssh/id_dsa.Your public key has been saved in /home/oracle/.ssh/id_dsa.pub.The key fingerprint is:1e:dc:ab:8e:98:35:61:aa:c2:da:5c:2b:94:fe:f3:9e oracle@D5L5805-225-101

Login as root on standby server

$ su - root$ passwd oracle

$ su - oracle

Page 10: ORACLE 11G DB

$ mkdir ~/.ssh$ chmod 755 ~/.ssh$ /usr/bin/ssh-keygen -t rsa (press Enter to accept the default)$ /usr/bin/ssh-keygen -t dsa (press Enter to accept the default)

Copy keys

From primary server.

Note: The IP following oracle@ is standby server IP address

$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys$ ssh [email protected] cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

The authenticity of host ' 135.25.225.185(135.25.225.185)' can't be established.RSA key fingerprint is a4:9e:5c:ec:8e:33:31:e0:f5:ba:3a:b6:cb:d2:6e:34.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added '135.25.225.185' (RSA) to the list of known hosts.at&t linux reference system (RHEL 5) - installed 10-25-11 09:14 UTC ********** Warning Notice **********This system is restricted solely to AT&T authorized usersfor legitimate business purposes only. The actual orattempted unauthorized access, use or modification of thissystem is strictly prohibited by AT&T. Unauthorized usersare subject to Company disciplinary proceedings and/orcriminal and civil penalties under state, federal, andother applicable domestic and foreign laws. The use ofthis system may be monitored and recorded for administra-tive and security reasons. Anyone accessing this systemexpressly consents to such monitoring and is advised thatif such monitoring reveals possible evidence of criminalactivity, AT&T may provide the evidence of such activityto law enforcement officials. All users must comply withAT&T Corporate Instructions regarding the protection ofAT&T information assets.

By continuing with the login process, you are giving apositive confirmation to this warning.

Password: (enter oracle password)

ssh [email protected] cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

at&t linux reference system (RHEL 5) - installed 10-25-11 09:14 UTC ********** Warning Notice **********This system is restricted solely to AT&T authorized usersfor legitimate business purposes only. The actual or

Page 11: ORACLE 11G DB

attempted unauthorized access, use or modification of thissystem is strictly prohibited by AT&T. Unauthorized usersare subject to Company disciplinary proceedings and/orcriminal and civil penalties under state, federal, andother applicable domestic and foreign laws. The use ofthis system may be monitored and recorded for administra-tive and security reasons. Anyone accessing this systemexpressly consents to such monitoring and is advised thatif such monitoring reveals possible evidence of criminalactivity, AT&T may provide the evidence of such activityto law enforcement officials. All users must comply withAT&T Corporate Instructions regarding the protection ofAT&T information assets.

By continuing with the login process, you are giving apositive confirmation to this warning.

Password: (enter oracle password)

$ chmod 644 ~/.ssh/authorized_keys

From standby server, login as user oracle issue the following command:

Note: The IP following oracle@ is primary (or active VCS) server’s IP address

$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys$ ssh [email protected] cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

The authenticity of host '135.25.225.100 (135.25.225.100)' can't be established.RSA key fingerprint is 2d:57:b8:3c:72:17:47:67:b5:db:cd:e2:fb:bd:9b:b8.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added '135.25.225.100' (RSA) to the list of known hosts.

$ ssh [email protected] cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

$ chmod 644 ~/.ssh/authorized_keys

From secondary VCS (passive) server.

Note: The IP following oracle@ is standby server IP address

$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys$ ssh [email protected] cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

Page 12: ORACLE 11G DB

The authenticity of host '135.25.225.185 (135.25.225.185)' can't be established.RSA key fingerprint is a4:9e:5c:ec:8e:33:31:e0:f5:ba:3a:b6:cb:d2:6e:34.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added '135.25.225.185' (RSA) to the list of known hosts.at&t linux reference system (RHEL 5) - installed 10-25-11 09:14 UTC ********** Warning Notice **********This system is restricted solely to AT&T authorized usersfor legitimate business purposes only. The actual orattempted unauthorized access, use or modification of thissystem is strictly prohibited by AT&T. Unauthorized usersare subject to Company disciplinary proceedings and/orcriminal and civil penalties under state, federal, andother applicable domestic and foreign laws. The use ofthis system may be monitored and recorded for administra-tive and security reasons. Anyone accessing this systemexpressly consents to such monitoring and is advised thatif such monitoring reveals possible evidence of criminalactivity, AT&T may provide the evidence of such activityto law enforcement officials. All users must comply withAT&T Corporate Instructions regarding the protection ofAT&T information assets.

By continuing with the login process, you are giving apositive confirmation to this warning.

Password: (enter oracle password)

$ chmod 644 ~/.ssh/authorized_keys

From standby server, login as user oracle issue the following command:

Note: The IP following oracle@ is secondary (or passive VCS) server’s IP address

$ ssh [email protected] cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

The authenticity of host '135.25.225.101 (135.25.225.101)' can't be established.RSA key fingerprint is cf:24:a7:d6:b5:7c:81:a4:d1:d3:90:c3:34:d5:ce:dc.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added '135.25.225.101' (RSA) to the list of known hosts.

$ ssh [email protected] cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

$ chmod 644 ~/.ssh/authorized_keys

Establish User Equivalence

Page 13: ORACLE 11G DB

Test Connectivity on all servers

On Primary:

$ hostnameD5L5805-225-100

$ ssh 135.25.225.185 hostname

at&t linux reference system (RHEL 5) - installed 10-25-11 09:14 UTC ********** Warning Notice **********This system is restricted solely to AT&T authorized usersfor legitimate business purposes only. The actual orattempted unauthorized access, use or modification of thissystem is strictly prohibited by AT&T. Unauthorized usersare subject to Company disciplinary proceedings and/orcriminal and civil penalties under state, federal, andother applicable domestic and foreign laws. The use ofthis system may be monitored and recorded for administra-tive and security reasons. Anyone accessing this systemexpressly consents to such monitoring and is advised thatif such monitoring reveals possible evidence of criminalactivity, AT&T may provide the evidence of such activityto law enforcement officials. All users must comply withAT&T Corporate Instructions regarding the protection ofAT&T information assets.

By continuing with the login process, you are giving apositive confirmation to this warning.

D5l5855-225-185

On standby server

$ hostnameD5l5855-225-185

$ ssh 135.25.225.100 hostname

D5L5805-225-100

On secondary server

$ hostnameD5L5805-225-101

$ ssh 135.25.225.185 hostnameat&t linux reference system (RHEL 5) - installed 10-25-11 09:14 UTC ********** Warning Notice **********

Page 14: ORACLE 11G DB

This system is restricted solely to AT&T authorized usersfor legitimate business purposes only. The actual orattempted unauthorized access, use or modification of thissystem is strictly prohibited by AT&T. Unauthorized usersare subject to Company disciplinary proceedings and/orcriminal and civil penalties under state, federal, andother applicable domestic and foreign laws. The use ofthis system may be monitored and recorded for administra-tive and security reasons. Anyone accessing this systemexpressly consents to such monitoring and is advised thatif such monitoring reveals possible evidence of criminalactivity, AT&T may provide the evidence of such activityto law enforcement officials. All users must comply withAT&T Corporate Instructions regarding the protection ofAT&T information assets.

By continuing with the login process, you are giving apositive confirmation to this warning.

D5l5855-225-185

On standby server

$ hostnameD5l5855-225-185

$ ssh 135.25.225.101 hostnameD5L5805-225-101

4.3. Primary Database Set Up

Login to Primary server:

4.3.1. Identify database name

$ sqlplus / as sysdbaSQL> select name from v$database;NAME---------TEST

SQL> show parameters uniqueNAME TYPE VALUE------------------------------------ ----------- ----------db_unique_name string TEST

4.3.2. Create Password File

Page 15: ORACLE 11G DB

A password file must be created on the Primary and copied over to the Standby site. The sys password must be identical on both sites. This is a key pre requisite in order to be able to ship and apply archived logs from Primary to Standby.

$ cd $ORACLE_HOME/dbs$ orapwd file=orapwTEST password=oracle force=y

4.3.3. Enable Force Logging

Recommended that Primary database must be in FORCE LOGGING mode. Check it with the following command.

A force logging might take a while to complete because it waits for all unlogged direct I/O operations to finish

SQL> select FORCE_LOGGING from v$database;

FOR---NO

SQL> alter database force logging;

Database altered.

SQL> select FORCE_LOGGING from v$database;

FOR---YES

4.3.4. Configure the Primary Database to Receive Redo Data

Create standby redo logs on the primary database to support the standby role. The standby redo logs must be at least as large as the largest redo log file as the primary database online logs.

The recommended number of standby redo logs is one more than the number of online redo logs for each thread.

Perform the following query to determine the size of each log file and the number of log groups in the redo log:

SQL> select group#, substr(member, 1,40) member from v$logfile;

GROUP# MEMBER---------- ---------------------------------------- 3 /u04/oradata/TEST/redo03.log 2 /u04/oradata/TEST/redo02.log

Page 16: ORACLE 11G DB

1 /u04/oradata/TEST/redo01.log

SQL> SELECT GROUP#, THREAD#, BYTES FROM V$LOG;

GROUP# THREAD# BYTES---------- ---------- ---------- 1 1 52428800 2 1 52428800 3 1 52428800

SQL> alter database add standby logfile group 4 ('/u04/oradata/TEST/slog01.log') size 52428800;

SQL> alter database add standby logfile group 5 ('/u04/oradata/TEST/slog02.log') size 52428800;

SQL> alter database add standby logfile group 6 ('/u04/oradata/TEST/slog03.log') size 52428800;

SQL> alter database add standby logfile group 7 ('/u04/oradata/TEST/slog04.log') size 52428800;

Check the results of the previous statements by querying the V$STANDBY_LOG view:

SQL> SELECT GROUP#, THREAD#, BYTES, STATUS FROM V$STANDBY_LOG;

GROUP# THREAD# BYTES STATUS---------- ---------- ---------- ---------- 4 0 52428800 UNASSIGNED 5 0 52428800 UNASSIGNED 6 0 52428800 UNASSIGNED 7 0 52428800 UNASSIGNED

Check the members created by querying V$LOGFILE view:

SQL> select group#,TYPE,substr(member, 1,40) member from v$logfile;

GROUP# TYPE MEMBER---------- ------- ---------------------------------------- 3 ONLINE /u04/oradata/TEST/redo03.log 2 ONLINE /u04/oradata/TEST/redo02.log 1 ONLINE /u04/oradata/TEST/redo01.log 4 STANDBY /u04/oradata/TEST/slog01.log 5 STANDBY /u04/oradata/TEST/slog02.log 6 STANDBY /u04/oradata/TEST/slog03.log 7 STANDBY /u04/oradata/TEST/slog04.log

7 rows selected.

Page 17: ORACLE 11G DB

4.3.5. Enable Archiving

The Primary Database must be running in ARCHIVELOG mode. Check it by issuing the following command.

SQL> archive log list; Database log mode Archive ModeAutomatic archival EnabledArchive destination USE_DB_RECOVERY_FILE_DESTOldest online log sequence 6Next log sequence to archive 8Current log sequence 8SQL>

If archiving is not enabled, issue the following statements to put the primary database in ARCHIVELOG mode and enable automatic archiving:

NOTE: Freeze the Veritas Cluster first.

hagrp -freeze <group> -persistent

SQL> SHUTDOWN IMMEDIATE;SQL> STARTUP MOUNT;SQL> ALTER DATABASE ARCHIVELOG;SQL> ALTER DATABASE OPEN;

4.3.6. Prepare initialization file for Primary Database

Create pfile from spfile on primary database. This pfile can be copied to standby location and modified./FORMAT:

SQL> CREATE PFILE=’$ORACLE_HOME/dbs/initTEST_P.ora' from spfile;File created.

$ cd $ORACLE_HOME/dbs

Need to copy to a /tmp dir location because VCS requires the $ORACLE_HOME/dbs/initTEST.ora to point to spfile.

Edit for $ORACLE_HOME/dbs/initTEST.ora for spfile

-bash-3.2$ cat initTEST.oraspfile='/u00/app/oracle/product/11.2.0.2/database/dbs/spfileTEST.ora'

$ cp initTEST_P.ora /tmp/initTEST.ora

$ cat /tmp/initTEST.ora

Page 18: ORACLE 11G DB

Original init file

$ cat /tmp/initTEST.oraTEST.__db_cache_size=16777216TEST.__java_pool_size=29360128TEST.__large_pool_size=4194304TEST.__shared_pool_size=109051904TEST.__streams_pool_size=0*.audit_file_dest='/u00/app/oracle/admin/TEST/adump'*.background_dump_dest='/u00/app/oracle/admin/TEST/bdump'*.compatible='11.2.0.2.0'*.control_files='/u01/oradata/TEST/control01.ctl','/u02/oradata/TEST/control02.ctl','/u03/oradata/TEST/control03.ctl'*.core_dump_dest='/u00/app/oracle/admin/TEST/cdump'*.db_block_size=8192*.db_domain=''*.db_file_multiblock_read_count=16*.db_name='TEST'*.db_recovery_file_dest='/u04/flash_recovery_area/TEST'*.db_recovery_file_dest_size=2147483648*.dispatchers='(PROTOCOL=TCP) (SERVICE=TESTXDB)'*.log_archive_dest=’/u04/arch/TEST’*.log_archive_format=’log%t_%s_%r.arc’*.job_queue_processes=10*.open_cursors=300*.pga_aggregate_target=199229440*.processes=150*.remote_login_passwordfile='EXCLUSIVE'*.sga_target=167772160*.undo_management='AUTO'*.undo_tablespace='UNDOTBS1'*.user_dump_dest='/u00/app/oracle/admin/TEST/udump'

Note:

If you are using “log_archive_dest” parameter you need to remove “log_archive_dest” from the init file as it is going to be taken care by “log_archive_dest_1” parameter listed below. In this example, remove the following line from initTEST.ora

*.log_archive_dest='/u04/arch/TEST'

Add the following parameter to /tmp/initTEST.ora

$ vi /tmp/initTEST.ora………..

DB_UNIQUE_NAME=’TEST’LOG_ARCHIVE_CONFIG='DG_CONFIG=(TEST,TESTSBY1)'

LOG_ARCHIVE_DEST_1= 'LOCATION=/u04/arch/TEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=test'

Page 19: ORACLE 11G DB

LOG_ARCHIVE_DEST_2= 'SERVICE=testsby1 LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=testsby1'

LOG_ARCHIVE_DEST_STATE_1=ENABLELOG_ARCHIVE_DEST_STATE_2=ENABLE

REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVELOG_ARCHIVE_MAX_PROCESSES=30

FAL_SERVER=testsby1FAL_CLIENT=TESTSTANDBY_FILE_MANAGEMENT=AUTO

local_listener='(address=(protocol=tcp)(host=135.25.244.29)(port=1521))' Note: host is ip address of the primary cluster vip which can be found In /etc/hosts file.

Note:If LOG_ARCHIVE_FORMAT=%t_%s_%r.arc does not exist in original init file, add the following to the initTEST file.

LOG_ARCHIVE_FORMAT=%t_%s_%r.arc

Create arch directory to store archive log as specified in the initTEST.ora file.

$ mkdir -p /u04/arch/TEST

Startup primary database with updated init file as oracle user NOTE: Freeze the Veritas Cluster first

hagrp –freeze <group> -persistent

$ sqlplus / as sysdbaSQL> shutdown immediate;SQL> startup nomount pfile=/tmp/initTEST.oraSQL> create spfile from pfile=’tmp/initTEST.ora’;SQL> shutdown immediate;ORA-01507: database not mounted

ORACLE instance shut down.

SQL> startup;

4.4. Prepare Standby Database

4.4.1. Prepare initialization parameter file for Standby Database

Page 20: ORACLE 11G DB

Modifying Initialization Parameters for a Physical Standby Database

$ login to primary server as oracle$ sqlplus / as sysdba$ SQL> CREATE PFILE=’/tmp/initTESTSBY1.ora' from spfile;File created

$cd /tmp$cat initTESTSBY1.ora

TEST.__db_cache_size=16777216TEST.__java_pool_size=29360128TEST.__large_pool_size=4194304TEST.__shared_pool_size=109051904TEST.__streams_pool_size=0*.audit_file_dest='/u00/app/oracle/admin/TEST/adump'*.background_dump_dest='/u00/app/oracle/admin/TEST/bdump'*.compatible='11.2.0.2.0'*.control_files='/u01/oradata/TEST/control01.ctl','/u02/oradata/

TEST/control02.ctl','/u03/oradata/TEST/control03.ctl'*.core_dump_dest='/u00/app/oracle/admin/TEST/cdump'*.db_block_size=8192*.db_domain=''*.db_file_multiblock_read_count=16*.db_name='TEST'*.db_recovery_file_dest='/u04/flash_recovery_area/TEST'*.db_recovery_file_dest_size=2147483648*.DB_UNIQUE_NAME='TEST'*.dispatchers='(PROTOCOL=TCP) (SERVICE=TESTXDB)'*.FAL_CLIENT='TEST'*.FAL_SERVER='testsby1'*.job_queue_processes=10*.LOG_ARCHIVE_CONFIG='DG_CONFIG=(TEST,TESTSBY1)'*.LOG_ARCHIVE_DEST_1='LOCATION=/u04/arch/TEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=test'*.LOG_ARCHIVE_DEST_2='SERVICE=testsby1 LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=testsby1'*.LOG_ARCHIVE_DEST_STATE_1='ENABLE'*.LOG_ARCHIVE_DEST_STATE_2='ENABLE'*.LOG_ARCHIVE_FORMAT='%t_%s_%r.arc'*.LOG_ARCHIVE_MAX_PROCESSES=30*.open_cursors=300*.pga_aggregate_target=199229440*.processes=150*.REMOTE_LOGIN_PASSWORDFILE='EXCLUSIVE'*.sga_target=167772160*.standby_file_management='auto'*.undo_management='AUTO'*.undo_tablespace='UNDOTBS1'*.user_dump_dest='/u00/app/oracle/admin/TEST/udump'

Update the following line at file /tmp/initTESTSBY1.ora

Before

Page 21: ORACLE 11G DB

*.DB_UNIQUE_NAME=TEST

*.LOG_ARCHIVE_DEST_1='LOCATION=/u04/arch/TEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=test'

*.LOG_ARCHIVE_DEST_2='SERVICE=testsby1 LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)

DB_UNIQUE_NAME=testsby1'local_listener='(address=(protocol=tcp)(host=135.25.244.29)

(port=1521))'

After

*.DB_UNIQUE_NAME=TESTSBY1

*.LOG_ARCHIVE_DEST_1='LOCATION=/u04/arch/TEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=testsby1'

*.LOG_ARCHIVE_DEST_2='SERVICE=test LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)

DB_UNIQUE_NAME=test'

local_listener='(address=(protocol=tcp)(host= D5l5855-225-185)(port=1521))' Note: host means standby hostname or ip address of standby

4.4.2. Create Backup copy of the Primary Database

Identify the primary database Datafiles

SQL> select name from v$datafile;

NAME---------------------------------------------------------/u01/oradata/TEST/system01.dbf/u01/oradata/TEST/sysaux01.dbf/u01/oradata/TEST/undotbs01.dbf/u02/oradata/TEST/users01.dbf

SQL> select member from v$logfile;MEMBER--------------------------------------------------/u04/oradata/TEST/redo03.log/u04/oradata/TEST/redo02.log/u04/oradata/TEST/redo01.log/u04/oradata/TEST/slog01.log/u04/oradata/TEST/slog02.log

Page 22: ORACLE 11G DB

/u04/oradata/TEST/slog03.log/u04/oradata/TEST/slog04.log

7 rows selected.

SQL> select file_name from dba_temp_files;FILE_NAME---------------------------------------------------/u03/oradata/TEST/temp01.dbf

SQL> select name from v$controlfile;

NAME---------------------------------------------------/u01/oradata/TEST/control01.ctl/u02/oradata/TEST/control02.ctl/u03/oradata/TEST/control03.ctl

Shutdown the primary database and copy all the datafiles, log files returned in above query to standby location

NOTE: Freeze the Veritas Cluster first.

hagrp -freeze <group> -persistent

SQL> shutdown immediate;SQL> exit;

On primary server

# su - root# mkdir /export/stdby# chown oracle:dba /export/stdby

Copy data and log files

$ Su - oracle

$ cp /u01/oradata/TEST/system01.dbf /export/stdby$ cp /u01/oradata/TEST/sysaux01.dbf /export/stdby$ cp /u01/oradata/TEST/undotbs01.dbf /export/stdby$ cp /u02/oradata/TEST/users01.dbf /export/stdby

$ cp /u04/oradata/TEST/redo03.log /export/stdby$ cp /u04/oradata/TEST/redo02.log /export/stdby$ cp /u04/oradata/TEST/redo01.log /export/stdby$ cp /u04/oradata/TEST/slog01.log /export/stdby$ cp /u04/oradata/TEST/slog02.log /export/stdby$ cp /u04/oradata/TEST/slog03.log /export/stdby$ cp /u04/oradata/TEST/slog04.log /export/stdby

$ cp /u03/oradata/TEST/temp01.dbf /export/stdby

Copy the init and password file from Primary to Standby location

Page 23: ORACLE 11G DB

$ cp $ORACLE_HOME/dbs/initTESTSBY1.ora /export/stdby

$ cp $ORACLE_HOME/dbs/orapwTEST /export/stdby

4.4.3. Create a Control File for the Standby Database

Issue the following command on primary database to create control file for the standby database.

$ sqlplus / as sysdba

SQL> startup mount (If database is not up)ORACLE instance started.

Total System Global Area 1603411968 bytesFixed Size 2144824 bytesVariable Size 939525576 bytesDatabase Buffers 654311424 bytesRedo Buffers 7430144 bytesDatabase mounted.

SQL> ALTER DATABASE CREATE STANDBY CONTROLFILE AS '/export/stdby/control_stdby11g.ctl';

Database altered.

4.4.4. Copy files from Primary server to Standby Server

Login standby server, copy datafiles, log files, control files, pfile and password file created in step above to the standby server.

Login in standby server

# su - root# mkdir /export/stdby# chown oracle:dba /export/stdby

# su - oracle# cd /export/stdby

$ sftp 135.25.225.100 (sftp to primary server) $ sftp> cd /export/stdbysftp> mget * sftp> bye

Page 24: ORACLE 11G DB

Create all required directories for files, dump directories and archived log destination on standby server. The directory created on standby server should be the same as the directory on primary server.

$ mkdir -p /u01/oradata/TEST$ mkdir -p /u02/oradata/TEST$ mkdir -p /u03/oradata/TEST$ mkdir -p /u04/oradata/TEST

$ mkdir -p /u04/flash_recovery_area/TEST$ mkdir -p /u04/arch/TEST$ mkdir -p /u00/app/oracle/admin/TEST/adump

Copy files to its destination on standby server.

$ cd /export/stdby

$ cp system01.dbf /u01/oradata/TEST$ cp sysaux01.dbf /u01/oradata/TEST$ cp undotbs01.dbf /u01/oradata/TEST$ cp users01.dbf /u02/oradata/TEST

$ cp temp01.dbf /u03/oradata/TEST

$ cp redo03.log /u04/oradata/TEST $ cp redo02.log /u04/oradata/TEST $ cp redo01.log /u04/oradata/TEST $ cp slog01.log /u04/oradata/TEST $ cp slog02.log /u04/oradata/TEST $ cp slog03.log /u04/oradata/TEST $ cp slog04.log /u04/oradata/TEST

$ cp control_stdby11g.ctl /u01/oradata/TEST/control01.ctl$ cp control_stdby11g.ctl /u02/oradata/TEST/control02.ctl$ cp control_stdby11g.ctl /u03/oradata/TEST/control03.ctl

$ cp initTESTSBY1.ora $ORACLE_HOME/dbs$ cp orapwTEST $ORACLE_HOME/dbs

4.4.5. Configure listeners & tnsnames for both primary and standby database

On primary server

$ cd $ORACLE_HOME/network/admin

$ vi listener.ora

LISTENER = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC)) (ADDRESS = (PROTOCOL = TCP)(HOST = oraVIPL)(PORT = 1521)) )SID_LIST_LISTENER =

Page 25: ORACLE 11G DB

(SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = /u00/app/oracle/product/11.2.0.2/database) (PROGRAM = extproc) ) (SID_DESC = (SID_NAME = TEST) (ORACLE_HOME = /u00/app/oracle/product/11.2.0.2/database) ) )

$ vi tnsnames.ora

TEST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = oraVIPL)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = TEST) ) )

TESTSBY1 = (DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = D5l5855-225-185)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = TESTSBY1) ) )

On standby server

$ cd $ORACLE_HOME/network/admin

$ vi listener.ora

SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = /u00/app/oracle/product/11.2.0.2/database) (PROGRAM = extproc) ) (SID_DESC = (GLOBAL_DBNAME = TESTSBY1) (ORACLE_HOME = /u00/app/oracle/product/11.2.0.2/database) (SID_NAME = TEST) ) (SID_DESC = (SERVICE_NAME= TESTSBY1_XPT) (SID_NAME = TEST) (ORACLE_HOME = /u00/app/oracle/product/11.2.0.2/database) ) )

LISTENER = (DESCRIPTION_LIST = (DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = D5l5855-225-185)(PORT = 1521)) (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) )

Page 26: ORACLE 11G DB

)

$ vi tnsnames.ora

TESTSBY1 = (DESCRIPTION = (ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = D5l5855-225-185)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = TESTSBY1) ) )

TEST = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = oraVIPL)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = TEST) ) )

Start the listener and check tnsping on both servers

$ lsnrctl stop$ lsnrctl start

$ tnsping TEST

$ tnsping TESTSBY1

4.4.6. Set Up the Environment to Support the Standby Database

$ ORACLE_HOME=/u00/app/oracle/product/11.2.0.2/database$ Export ORACLE_HOME

$ ORACLE_SID=TEST$export ORACLE_SID

Create oratab on standby server as root user

$ su - root

Add the following to the file oratab with ORACLE_SID =TEST, ORACLE_HOME=/u00/app/oracle/product/11.2.0.2/database

# vi /etc/oratab

TEST:/u00/app/oracle/product/11.2.0.2/database:N

Page 27: ORACLE 11G DB

# chown oracle:dba /etc/oratab# chmod 755 /etc/oratab

Generate a spfile on standby server

$ su - oracle$ sqlplus / as sysdba$ SQL> startup nomount pfile=’$ORACLE_HOME/dbs/initTESTSBY1.ora’;

ORACLE instance started.

Total System Global Area 1603411968 bytesFixed Size 2144824 bytesVariable Size 956302792 bytesDatabase Buffers 637534208 bytesRedo Buffers 7430144 bytes

$ SQL> create spfile from pfile=’$ORACLE_HOME/dbs/initTESTSBY1.ora';File created.

SQL> shutdown immediate;ORA-01507: database not mounted

ORACLE instance shut down.

4.5. Start the Physical Database

Startup mount the Standby database using spfile.

SQL> startup mount

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;Database altered.

4.6. Verify the Physical Standby Database

Identify standby database.

SQL> show parameters db_unique_name;NAME TYPE VALUE------------------------------------ ----------- --------------db_unique_name string TESTSBY1

SQL> SELECT NAME FROM V$DATABASE;

NAME

Page 28: ORACLE 11G DB

---------TEST

SQL> SELECT DATABASE_ROLE FROM V$DATABASE;

DATABASE_ROLE----------------PHYSICAL STANDBY

Identify the existing archived redo log files on standby.

SQL> SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;

SEQUENCE# FIRST_TIM NEXT_TIME---------- --------- --------- 10 02-FEB-10 03-FEB-10 11 03-FEB-10 03-FEB-10 11 03-FEB-10 03-FEB-10 12 03-FEB-10 04-FEB-10 12 03-FEB-10 04-FEB-10

Switch logfiles on primary.

On the primary database, issue the statement to force a log switch and archive the current online redo log file group

$ sqlplus / as sysdbaSQL> startupSQL> SELECT DATABASE_ROLE FROM V$DATABASE;

DATABASE_ROLE----------------PRIMARY

SQL> archive log listDatabase log mode Archive ModeAutomatic archival EnabledArchive destination /u04/arch/TESTOldest online log sequence 11Next log sequence to archive 13Current log sequence 13

SQL> alter system switch logfile;System altered.

SQL> archive log list

Database log mode Archive ModeAutomatic archival EnabledArchive destination /u04/arch/TESTOldest online log sequence 12Next log sequence to archive 14Current log sequence 14

Page 29: ORACLE 11G DB

Verify the new redo data was archived on the standby database.

On the standby database, query the V$ARCHIVED_LOG view to verify the redo data was received and archived on the standby database:

SQL> SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME, APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;

SEQUENCE# FIRST_TIM NEXT_TIME---------- --------- --------- 10 02-FEB-10 03-FEB-10 11 03-FEB-10 03-FEB-10 12 03-FEB-10 04-FEB-10 13 04-FEB-10 04-FEB-10

The archived redo log files are now available to be applied to the physical standby database.

Verify that received redo has been applied.

On the standby database, query the V$ARCHIVED_LOG view to verify that received redo has been applied:

SQL> SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG;

SEQUENCE# APP---------- --- 11 NO 10 NO 12 NO 13 NO

To start log apply services on a physical standby database, ensure the physical standby database is started and mounted and then start Redo Apply using the SQL ALTER DATABASE RECOVER MANAGED STANDBY DATABASE statement.

You can specify that Redo Apply runs as a foreground session or as a background process, and enable it with real-time apply.

To start Redo Apply in the foreground, issue the following SQL statement: SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE;

If you start a foreground session, control is not returned to the command prompt until recovery is canceled by another session.

To start Redo Apply in the background, include the DISCONNECT keyword on the SQL statement. For example:

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;

Page 30: ORACLE 11G DB

This statement starts a detached server process and immediately returns control to the user. While the managed recovery process is performing recovery in the background, the foreground process that issued the RECOVER statement can continue performing other tasks. This does not disconnect the current SQL session.

To start real-time apply, include the USING CURRENT LOGFILE clause on the SQL statement. For example:

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE;

4.6.1. Stopping Redo Apply

To stop Redo Apply, issue the following SQL statement in another window:

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

4.7. Enable Active Dataguard

Active Data Guard is a new option in the 11g Enterprise Edition. The physical standby database can be opened for real time querying without interrupting the redo apply process from the primary to the standby server.

To turn on the Active Guard option is to open the database in read only mode and to start the Redo Apply process

On the Standby:

Check if the DG is in active mode:

SQL> select 'Active Data Guard is Enabled' adg from v$managed_standby a, v$database b where a.process like 'MRP%' and b.open_mode='READ ONLY';

no rows selected

If the query returns with a result the “Active Guard is enabled” then the Active Guard is enabled.

If the query returns with “no rows selected” then the Active Data Guard is not enabled. Follow the steps below to turn on the active data guard.

1. Stop the redo apply

sql> recover managed standby database cancel;

2. Shutdown the physical standby instance

Page 31: ORACLE 11G DB

sql> shutdown

3. Startup the standby database

sql> startup

4. Start the redo apply

sql> recover managed standby database disconnect using current logfile;

5. Verify whether ADG is enabled

SQL> select 'Active Data Guard is Enabled' adg from v$managed_standby a, v$database b where a.process like 'MRP%' and b.open_mode='READ ONLY';

ADG----------------------------Active Data Guard is Enabled

5. Data Guard Broker Configuration

The Data Guard Broker provides command-line interface (DGMGRL) which enables you to control and monitor a Data Guard configuration from the DGMGRL prompt or within scripts. You can perform most of the activities required to manage and monitor the databases in the configuration using DGMGRL.

5.1. Start Data Guard Broker

1. Connect to primary database and check the value of DG_BROKER_START

$ . oraenv $ sqlplus / as sysdba SQL> show parameter dg_broker_start

NAME TYPE VALUE------------------------------------ ----------- ------------------------------dg_broker_start boolean FALSE

2. On the primary database, set the DG_BROKER_START parameter to TRUE.

SQL> alter system set dg_broker_start=true scope=both;

3. Connect to standby database and check the value of DG_BROKER_START

Page 32: ORACLE 11G DB

$ su - oracle $ . oraenv $ sqlplus / as sysdba SQL> show parameter dg_broker_start

NAME TYPE VALUE------------------------------------ ----------- ------------------------------dg_broker_start boolean FALSE

4. On the standby database, set the DG_BROKER_START parameter to TRUE.

SQL> alter system set dg_broker_start=true scope=both;

5.2. Update Listener.ora

Update listener.ora for both primary and standby server. The bold section indicated the added section for DG broker.

$ cd $ORACLE_HOME/network/admin$ vi listener.ora

On Primary server

SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = /u00/app/oracle/product/11.2.0.2/database) (PROGRAM = extproc) ) (SID_DESC = (GLOBAL_DBNAME = TEST) (SID_NAME = TEST) (ORACLE_HOME = /u00/app/oracle/product/11.2.0.2/database) ) (SID_DESC = (GLOBAL_DBNAME = TEST_DGMGRL) (SERVICE_NAME= TEST) (SID_NAME = TEST) (ORACLE_HOME = /u00/app/oracle/product/11.2.0.2/database) ) )

LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC)) (ADDRESS = (PROTOCOL = TCP)(HOST = oraVIPL)(PORT = 1521)) ) )

Page 33: ORACLE 11G DB

On standby server

SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = /u00/app/oracle/product/11.2.0.2/database) (PROGRAM = extproc) ) (SID_DESC = (GLOBAL_DBNAME = TESTSBY1) (ORACLE_HOME = /u00/app/oracle/product/11.2.0.2/database) (SID_NAME = TEST) ) (SID_DESC = (GLOBAL_DBNAME = TESTSBY1_DGMGRL) (SERVICE_NAME= TESTSBY1) (SID_NAME = TEST) (ORACLE_HOME = /u00/app/oracle/product/11.2.0.2/database) ) (SID_DESC = (SERVICE_NAME= TESTSBY1_XPT) (SID_NAME = TEST) (ORACLE_HOME = /u00/app/oracle/product/11.2.0.2/database) ) )

LISTENER = (DESCRIPTION_LIST = (DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = D5l5855-225-185) (PORT = 1521)) (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) )

Reload the listener on both servers.

$ lsnrctl reload

5.3. Set up Broker Configuration

1. The broker configuration files are automatically created when the broker is started using ALTER SYSTEM SET DG_BROKER_START=TRUE.

On Primary:

SQL> show parameters DG_BROKER_CONFIG

NAME TYPE VALUE------------------------------------ ----------- ------------------------------dg_broker_config_file1 string /u00/app/oracle/product/11.2.0.2/ /database/dbs/dr1TEST.dat

Page 34: ORACLE 11G DB

dg_broker_config_file2 string /u00/app/oracle/product/11.2.0.2/ /database/dbs/dr2TEST.dat On Standby:

SQL> show parameters DG_BROKER_CONFIG

NAME TYPE VALUE------------------------------------ ----------- ------------------------------dg_broker_config_file1 string /u00/app/oracle/product/11.2.0.2/ database/dbs/dr1TESTSBY1.datdg_broker_config_file2 string /u00/app/oracle/product/11.2.0.2/ database/dbs/dr2TESTSBY1.dat

2. Invoke DGMGRL on primary server and connect to primary database.

# su - oracle

$ dgmgrl

DGMGRL for Linux: Version 11.2.0.2.0 - 64bit ProductionCopyright (c) 2000, 2005, Oracle. All rights reserved.Welcome to DGMGRL, type "help" for information.

DGMGRL> CONNECT sys/oracle@test

Where oracle is sys’s password

3. Create the broker configuration on primary

CREATE CONFIGURATION 'DGCONFIG1' AS PRIMARY DATABASE IS 'TEST' CONNECT IDENTIFIER IS TEST;

Configuration "DGCONFIG1" created with primary database "TEST"

4. Display information about the configuration.

DGMGRL> SHOW CONFIGURATION;

Configuration Name: DGCONFIG1 Enabled: NO Protection Mode: MaxPerformance Databases: TEST - Primary database

Fast-Start Failover: DISABLED

Page 35: ORACLE 11G DB

Current status for "DGCONFIG1":DISABLED

5. Add the physical standby database to the broker configuration.

DGMGRL> ADD DATABASE TESTSBY1 AS CONNECT IDENTIFIER IS TESTSBY1 ;

Database "testsby1" added

6. Verify that the testsby1 database was added to the configuration.

DGMGRL> SHOW CONFIGURATION;

Configuration Name: DGCONFIG1 Enabled: NO Protection Mode: MaxPerformance Databases: TEST - Primary database testsby1 - Physical standby database

Fast-Start Failover: DISABLED

Current status for "DGCONFIG1":DISABLED

5.4. Enabling the Broker Configuration.

1. Enable the entire configuration

DGMGRL> ENABLE CONFIGURATION;Enabled.

2. Verify that the configuration was successfully enabled

DGMGRL> SHOW CONFIGURATION;

Configuration Name: DGCONFIG1 Enabled: YES Protection Mode: MaxPerformance Databases: TEST - Primary database testsby1 - Physical standby database

Page 36: ORACLE 11G DB

Fast-Start Failover: DISABLED

Current status for "DGCONFIG1":SUCCESS

5.5. Remove Data Guard Broker

1. Remove the Data Guard Broker Configuration

Connect to the Primary Database DGMGRL> connect sys/<Password>@<Primary Database>

DGMGRL>connect sys/oracle@test

Remove the Data Guard Broker Configuration DGMGRL> remove configuration;

2. On the primary database set dg_broker_start=false:

$ sqlplus / as sysdba

SQL> show parameter dg_broker

NAME TYPE VALUE------------------------------------ ----------- ------------------------------dg_broker_config_file1 string /u00/app/oracle/product/11.2.0.2 /database/dbs/dr1TEST.datdg_broker_config_file2 string /u00/app/oracle/product/11.2.0.2 /database/dbs/dr2TEST.datdg_broker_start boolean TRUE

SQL> alter system set dg_broker_start=false scope=both;System altered.

SQL> show parameter dg_broker;

NAME TYPE VALUE------------------------------------ ----------- ------------------------------dg_broker_config_file1 string /u00/app/oracle/product/11.2.0.2 /database/dbs/dr1TEST.datdg_broker_config_file2 string /u00/app/oracle/product/11.2.0.2 /database/dbs/dr2TEST.datdg_broker_start boolean FALSE

3. On the primary disable any archive destinations that are archiving to the standby:

SQL> select dest_id,destination,status from v$archive_dest where target='STANDBY';

4. on the standby set the dg_broker_start parameter to false:

Page 37: ORACLE 11G DB

SQL> alter system set dg_broker_start=false scope=both;

System altered.

SQL> show parameter dg_broker;

NAME TYPE VALUE------------------------------------ ----------- ------------------------------dg_broker_config_file1 string /u00/app/oracle/product/11.2.0.2 /database/dbs/dr1TESTSBY1.datdg_broker_config_file2 string /u00/app/oracle/product/11.2.0.2 /database/dbs/dr2TESTSBY1.datdg_broker_start boolean FALSE

5. Drop old broker configuration files from both primary and standby:

On primary

If files are on ASM:

ASMCMD> cd DATA/ TEST/ASMCMD> rm dr1TEST.dat ASMCMD> rm dr2TEST.dat

On UNIX

$cd $ORACLE_HOME/dbs $ rm dr1TEST.dat $ rm dr2TEST.dat

On standby

If files are on ASM:

ASMCMD> cd DATA/ TESTSBY1/ASMCMD> rm dr1TESTSBY1.dat ASMCMD> rm dr2TESTSBY1.dat

On UNIX

$cd $ORACLE_HOME/dbs $ rm dr1TESTSBY1.dat $ rm dr2TESTSBY1.dat

Page 38: ORACLE 11G DB

6. APPENDIX A: Glossary & Acronyms

ACRONYM DEFINITION