Sunteți pe pagina 1din 38

Oracle 11gR2 Data Guard

Component Installation Instructions


AT&T property
Mohammed Shanser Nasser
Table of Contents
1. Introduction ............................................................................................ 4
1.1. Purpose.................................................................................................... 4
1.2. Audience .................................................................................................. 4
1.3. Certified Configurations Environment....................................................... 4
2. System Installation Requirements........................................................ 5
2.1. Hardware Requirement ............................................................................ 5
2.2. Oracle Software Requirement .................................................................. 6
3. Certification Environment ..................................................................... 6
4. Creating a Physical Data Guard ............................................................ 7
4.1. Prepare 11gR2 database ......................................................................... 7
4.2. Configure SSH for User Equivalence ....................................................... 8
4.3. Primary Database Set Up ...................................................................... 14
4.3.1. Identify database name ..........................................................................................................14
4.3.2. Create Password File .............................................................................................................14
4.3.3. Enable Force Logging............................................................................................................15
4.3.4. Configure the Primary Database to Receive Redo Data .......................................................15
4.3.5. Enable Archiving ...................................................................................................................17
4.3.6. Prepare initialization file for Primary Database .....................................................................17
4.4. Prepare Standby Database .................................................................... 19
4.4.1. Prepare initialization parameter file for Standby Database....................................................19
4.4.2. Create Backup copy of the Primary Database .......................................................................21
4.4.3. Create a Control File for the Standby Database .....................................................................23
4.4.4. Copy files from Primary server to Standby Server ................................................................23
4.4.5. Configure listeners & tnsnames for both primary and standby database ...............................24
4.4.6. Set Up the Environment to Support the Standby Database....................................................26
4.5. Start the Physical Database ................................................................... 27
4.6. Verify the Physical Standby Database ................................................... 27
4.6.1. Stopping Redo Apply ............................................................................................................30
4.7. Enable Active Dataguard ....................................................................... 30
5. Data Guard Broker Configuration ....................................................... 31
5.1. Start Data Guard Broker ........................................................................ 31
5.2. Update Listener.ora................................................................................ 32
5.3. Set up Broker Configuration ................................................................... 33
5.4. Enabling the Broker Configuration. ........................................................ 35
5.5. Remove Data Guard Broker................................................................... 36
6. APPENDIX A: Glossary & Acronyms.................................................. 38
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.

 In all configurations, the Oracle 11g Data Guard will be installed with the
following default settings:
Default Setting Type Initial Default Setting Value
User login name Oracle, root
User group dba, oinstall, oper
User login password Oracle
ORACLE_HOME /u00/app/oracle/product/11.2.0.2/database
Oracle_base /u00/app/oracle
Install 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
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


 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: c3806z244101
DB_NAME: TEST
DB_UNIQUE_NAME: TEST
SERVICE_NAMES: TEST

Standby server:

hostname: c3806z244102
DB_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 VIP
135.25.244.29 oraVIPL
#Dataguard VIP
135.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.
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:
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
$ 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 oracle@135.25.225.185 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)? yes
Warning: 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 users
for legitimate business purposes only. The actual or
attempted unauthorized access, use or modification of this
system is strictly prohibited by AT&T. Unauthorized users
are subject to Company disciplinary proceedings and/or
criminal and civil penalties under state, federal, and
other applicable domestic and foreign laws. The use of
this system may be monitored and recorded for administra-
tive and security reasons. Anyone accessing this system
expressly consents to such monitoring and is advised that
if such monitoring reveals possible evidence of criminal
activity, AT&T may provide the evidence of such activity
to law enforcement officials. All users must comply with
AT&T Corporate Instructions regarding the protection of
AT&T information assets.

By continuing with the login process, you are giving a


positive confirmation to this warning.

Password: (enter oracle password)

ssh oracle@135.25.225.185 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 users
for legitimate business purposes only. The actual or
attempted unauthorized access, use or modification of this
system is strictly prohibited by AT&T. Unauthorized users
are subject to Company disciplinary proceedings and/or
criminal and civil penalties under state, federal, and
other applicable domestic and foreign laws. The use of
this system may be monitored and recorded for administra-
tive and security reasons. Anyone accessing this system
expressly consents to such monitoring and is advised that
if such monitoring reveals possible evidence of criminal
activity, AT&T may provide the evidence of such activity
to law enforcement officials. All users must comply with
AT&T Corporate Instructions regarding the protection of
AT&T information assets.

By continuing with the login process, you are giving a


positive 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 oracle@135.25.225.100 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)? yes
Warning: Permanently added '135.25.225.100' (RSA) to the list of
known hosts.

$ ssh oracle@135.25.225.100 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 oracle@135.25.225.185 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)? yes
Warning: 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 users
for legitimate business purposes only. The actual or
attempted unauthorized access, use or modification of this
system is strictly prohibited by AT&T. Unauthorized users
are subject to Company disciplinary proceedings and/or
criminal and civil penalties under state, federal, and
other applicable domestic and foreign laws. The use of
this system may be monitored and recorded for administra-
tive and security reasons. Anyone accessing this system
expressly consents to such monitoring and is advised that
if such monitoring reveals possible evidence of criminal
activity, AT&T may provide the evidence of such activity
to law enforcement officials. All users must comply with
AT&T Corporate Instructions regarding the protection of
AT&T information assets.

By continuing with the login process, you are giving a


positive 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 oracle@135.25.225.101 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)? yes
Warning: Permanently added '135.25.225.101' (RSA) to the list of
known hosts.

$ ssh oracle@135.25.225.101 cat ~/.ssh/id_dsa.pub >>


~/.ssh/authorized_keys

$ chmod 644 ~/.ssh/authorized_keys


 Establish User Equivalence

 Test Connectivity on all servers

On Primary:

$ hostname
D5L5805-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 users
for legitimate business purposes only. The actual or
attempted unauthorized access, use or modification of this
system is strictly prohibited by AT&T. Unauthorized users
are subject to Company disciplinary proceedings and/or
criminal and civil penalties under state, federal, and
other applicable domestic and foreign laws. The use of
this system may be monitored and recorded for administra-
tive and security reasons. Anyone accessing this system
expressly consents to such monitoring and is advised that
if such monitoring reveals possible evidence of criminal
activity, AT&T may provide the evidence of such activity
to law enforcement officials. All users must comply with
AT&T Corporate Instructions regarding the protection of
AT&T information assets.

By continuing with the login process, you are giving a


positive confirmation to this warning.

D5l5855-225-185

On standby server

$ hostname
D5l5855-225-185

$ ssh 135.25.225.100 hostname

D5L5805-225-100

On secondary server

$ hostname
D5L5805-225-101

$ 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 users
for legitimate business purposes only. The actual or
attempted unauthorized access, use or modification of this
system is strictly prohibited by AT&T. Unauthorized users
are subject to Company disciplinary proceedings and/or
criminal and civil penalties under state, federal, and
other applicable domestic and foreign laws. The use of
this system may be monitored and recorded for administra-
tive and security reasons. Anyone accessing this system
expressly consents to such monitoring and is advised that
if such monitoring reveals possible evidence of criminal
activity, AT&T may provide the evidence of such activity
to law enforcement officials. All users must comply with
AT&T Corporate Instructions regarding the protection of
AT&T information assets.

By continuing with the login process, you are giving a


positive confirmation to this warning.

D5l5855-225-185

On standby server

$ hostname
D5l5855-225-185

$ ssh 135.25.225.101 hostname


D5L5805-225-101

4.3. Primary Database Set Up

Login to Primary server:

4.3.1. Identify database name

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

SQL> show parameters unique


NAME TYPE VALUE
------------------------------------ ----------- ----------
db_unique_name string TEST

4.3.2. Create Password File


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
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.
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 Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 6
Next log sequence to archive 8
Current log sequence 8
SQL>

 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.ora


spfile='/u00/app/oracle/product/11.2.0.2/database/dbs/spfileTEST.ora'

$ cp initTEST_P.ora /tmp/initTEST.ora

$ cat /tmp/initTEST.ora
Original init file

$ cat /tmp/initTEST.ora
TEST.__db_cache_size=16777216
TEST.__java_pool_size=29360128
TEST.__large_pool_size=4194304
TEST.__shared_pool_size=109051904
TEST.__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'
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

REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
LOG_ARCHIVE_MAX_PROCESSES=30

FAL_SERVER=testsby1
FAL_CLIENT=TEST
STANDBY_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 sysdba
SQL> shutdown immediate;
SQL> startup nomount pfile=/tmp/initTEST.ora
SQL> 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


 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=16777216
TEST.__java_pool_size=29360128
TEST.__large_pool_size=4194304
TEST.__shared_pool_size=109051904
TEST.__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/T
EST/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
*.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
/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
$ 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 bytes


Fixed Size 2144824 bytes
Variable Size 939525576 bytes
Database Buffers 654311424 bytes
Redo Buffers 7430144 bytes
Database 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/stdby
sftp> mget *
sftp> bye
 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 =
(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))
)
)

$ 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
# 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 bytes


Fixed Size 2144824 bytes
Variable Size 956302792 bytes
Database Buffers 637534208 bytes
Redo 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
---------
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 sysdba
SQL> startup
SQL> SELECT DATABASE_ROLE FROM V$DATABASE;

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

SQL> archive log list


Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u04/arch/TEST
Oldest online log sequence 11
Next log sequence to archive 13
Current log sequence 13

SQL> alter system switch logfile;


System altered.

SQL> archive log list

Database log mode Archive Mode


Automatic archival Enabled
Archive destination /u04/arch/TEST
Oldest online log sequence 12
Next log sequence to archive 14
Current log sequence 14
 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;
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


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


$ 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))
)
)
 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
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.dat
dg_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 Production
Copyright (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

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

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.dat
dg_broker_config_file2 string /u00/app/oracle/product/11.2.0.2
/database/dbs/dr2TEST.dat
dg_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.dat
dg_broker_config_file2 string /u00/app/oracle/product/11.2.0.2
/database/dbs/dr2TEST.dat
dg_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:


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.dat
dg_broker_config_file2 string /u00/app/oracle/product/11.2.0.2
/database/dbs/dr2TESTSBY1.dat
dg_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
6. APPENDIX A: Glossary & Acronyms

ACRONYM DEFINITION

S-ar putea să vă placă și