You are on page 1of 184

Appendix A

Practices and Solutions






Oracle Database 11g: Data Guard Administration A - 2
Table of Contents

Practices for Lesson 1: Introduction to Oracle Data Guard ................................................ 4
Practices for Lesson 2: Creating a Physical Standby Database by Using SQL and RMAN
Commands .......................................................................................................................... 5
Practice 2-1: Preparing the Primary Database ................................................................ 6
Practice 2-2: Creating the Physical Standby Database ................................................. 11
Practice 2-3: Verifying That the Physical Standby Database Is Performing Correctly 29
Practices for Lesson 3: Oracle Data Guard Broker: Overview ......................................... 31
Practices for Lesson 4: Creating a Data Guard Broker Configuration ............................. 32
Practice 4-1: Setting the DG_BROKER_START Initialization Parameter .................. 33
Practice 4-2: Configuring Listener to Allow Data Guard Broker to Restart Primary
Database Instance Server Setup ................................................................................. 35
Practice 4-3: Configuring Listener to Allow Data Guard Broker to Restart Standby
Database Instance Server Setup ................................................................................. 39
Practice 4-4: Creating an Oracle Net Service Name to Allow Standby Database
Instance to Connect to Primary Database Instance Client Setup ............................... 43
Practice 4-5: Creating an Oracle Net Service Name for the Standby Database for Non-
Standard Dynamic Registration .................................................................................... 46
Practice 4-6: Creating the Broker Configuration .......................................................... 50
Practice 4-7: Enabling the Broker Configuration ......................................................... 52
Practices for Lesson 5: Creating a Physical Standby Database by Using Enterprise
Manager Grid Control ....................................................................................................... 53
Practice 5-1: Installing the Oracle Management Agent ................................................ 54
Practice 5-2: Configuring Monitoring Credentials for Your Primary Database ........... 59
Practice 5-3: Configuring Monitoring Credentials for Your Standby Database ........... 60
Practice 5-4: Configuring Preferred Credentials for Your Host Machine .................... 61
Practice 5-5: Adding a Physical Standby Database to Your Configuration ................. 62
Practice 5-6: Verifying the Broker Configuration ........................................................ 72
Practice 5-7: Deleting the Database .............................................................................. 75
Practices for Lesson 6: Creating a Logical Standby Database ......................................... 78
Practice 6-1: Creating a Logical Standby Database ...................................................... 79
Practice 6-2: Implementing SQL Apply Filtering ........................................................ 84
Practices for Lesson 7: Creating and Managing a Snapshot Standby Database ............... 89
Practice 7-1: Verifying Flashback Database on the Physical Standby Database.......... 90
------------------ ................................................................................................................... 90
Practice 7-2: Converting the Physical Standby Database to a Snapshot Standby
Database ........................................................................................................................ 92
Practice 7-3: Updating the Databases and Verifying Redo Shipment .......................... 93
Practice 7-4: Converting the Snapshot Standby Database to a Physical Standby
Database ........................................................................................................................ 95
Practices for Lesson 8: Using Oracle Active Data Guard............................................... 100
Practice 8-1: Using Real-Time Query......................................................................... 101
Practice 8-2: Enabling Block Change Tracking.......................................................... 106
Practices for Lesson 9: Configuring Data Protection Modes .......................................... 107
Practice 9-1: Setting the Data Protection Mode by Using DGMGRL ........................ 108

Oracle Database 11g: Data Guard Administration A - 3
Practice 9-2: Setting the Data Protection Mode by Using Enterprise Manager Grid
Control ........................................................................................................................ 112
Practices for Lesson 10: Performing Role Transitions ................................................... 116
Practice 10-1: Performing Switchover by Using DGMGRL ...................................... 117
Practice 10-2: Performing Switchover by Using Enterprise Manager........................ 123
Practices for Lesson 11: Using Flashback Database in a Data Guard Configuration ..... 125
Practice 11-1: Configuring Flashback Database on the Primary Database ................ 126
Practice 11-2: Configuring Flashback Database on the Standby Database ................ 127
Practices for Lesson 12: Enabling Fast-Start Failover .................................................... 128
Practice 12-1: Enabling Fast-Start Failover ................................................................ 129
Practice 12-2: Starting the Observer ........................................................................... 131
Practice 12-3: Testing Fast-Start Failover .................................................................. 134
Practice 12-4: Switching Back to Your Primary Database ......................................... 138
Practice 12-5: Stopping the Observer and Disabling Fast-Start Failover ................... 140
Practices for Lesson 13: Managing Client Connectivity ................................................ 142
Practice 13-1: Creating a Service for PC<nn>PRMY Instance .................................. 143
Practice 13-2: Creating a Service for the PC<nn>SBY1 Instance .............................. 145
Practice 13-3: Creating an Oracle Net Service Name on Your Primary Database Host
..................................................................................................................................... 148
Practice 13-4: Creating an Oracle Net Service Name on Your Standby Database Host
..................................................................................................................................... 150
Practice 13-5: Testing Your Implementation .............................................................. 151
Practices for Lesson 14: Backup and Recovery Considerations in an Oracle Data Guard
Configuration .................................................................................................................. 156
Practice 14-1: Creating the Recovery Catalog ............................................................ 157
Practice 14-2: Registering Your Database in the Recovery Catalog .......................... 159
Practice 14-3: Configuring RMAN Parameters .......................................................... 162
Practice 14-4: Recovering a Data File in Your Primary Database ............................. 166
Practices for Lesson 15: Patching and Upgrading Databases in a Data Guard
Configuration .................................................................................................................. 173
Practices for Lesson 16: Monitoring a Data Guard Broker Configuration .................... 174
Practice 16-1: Viewing Log File Details .................................................................... 175
Practice 16-2: Using DGMGRL to Monitor the Configuration .................................. 178
Practices for Lesson 17: Optimizing a Data Guard Configuration ................................. 182
Practice 17-1: Configuring Network Compression of Redo Data .............................. 183



Oracle Database 11g: Data Guard Administration A - 4
Practices for Lesson 1: Introduction to Oracle
Data Guard
There are no practices for Lesson 1, Introduction to Oracle Data Guard.

Oracle Database 11g: Data Guard Administration A - 5
Practices for Lesson 2: Creating a Physical Standby
Database by Using SQL and RMAN Commands
In the practices for Lesson 2, Creating a Physical Standby Database by Using SQL and
RMAN Commands, you create a physical standby database by using SQL and RMAN
commands.


Use this page to record information about the databases in your configuration.


Primary Database
Database Name: _________________________________________________
Instance Name: _________________________________________________
Database Unique Name: __________________________________________
Target Name: ___________________________________________________
Host: __________________________________________________________
Oracle Home: ____________________________________________________

Standby Database
Database Name: _________________________________________________
Instance Name: _________________________________________________
Database Unique Name: __________________________________________
Target Name: ___________________________________________________
Host: __________________________________________________________
Oracle Home: ____________________________________________________

Standby Database
Database Name: _________________________________________________
Instance Name: _________________________________________________
Database Unique Name: __________________________________________
Target Name: ___________________________________________________
Host: __________________________________________________________
Oracle Home: ____________________________________________________

Standby Database
Database Name: _________________________________________________
Instance Name: _________________________________________________
Database Unique Name: __________________________________________
Target Name: ___________________________________________________
Host: __________________________________________________________
Oracle Home: ____________________________________________________

Oracle Database 11g: Data Guard Administration A - 6
Practice 2-1: Preparing the Primary Database
In this practice, you verify that the primary database is configured correctly to support a
physical standby database.

Your primary database is named pc<nn>prmy, where nn represents the number of the
PC you are using in the classroom.
You create a standby database named pc<nn>sby1, where nn represents the number of
the PC that you are using in the classroom (and your primary database is on).
For example, if you are using PC 5, your primary database is pc05prmy and your
standby database is pc05sby1.
1) Open a terminal window. Change to the labs directory. Set the environment
variables for your primary database using the oraenv utility. Invoke SQL*Plus and
connect as SYSDBA to your primary database. Determine if FORCE LOGGING is
enabled. If it is not enabled, enable FORCE LOGGING mode.
[oracle@EDBVR6P1- ~]$ cd labs
[oracle@EDBVR6P1- labs]$ . oraenv
ORACLE_SID = [oracle] ? pc01prmy
The Oracle base for
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is
/u01/app/oracle
[oracle@EDBVR6P1-pc01prmy labs]$
[[oracle@EDBVR6P1-pc01prmy labs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 9 17:43:22
2010

Copyright (c) 1982, 2009, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -
Production
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining
and Real Application Testing options

SQL> SELECT force_logging FROM v$database;

FOR
---
NO

SQL> ALTER DATABASE FORCE LOGGING;

Database altered.

SQL> SELECT force_logging FROM v$database;

Practice 2-1: Preparing the Primary Database (continued)
Oracle Database 11g: Data Guard Administration A - 7
FOR
---
YES
2) Configure the standby redo logs on the primary database. You can use the
cr_sby_redologs.sql script.

SQL> @cr_sby_redologs
SQL> ALTER DATABASE ADD STANDBY LOGFILE '+DATA' size 52428800
2 /

Database altered.

SQL> ALTER DATABASE ADD STANDBY LOGFILE '+DATA' size 52428800
2 /

Database altered.

SQL> ALTER DATABASE ADD STANDBY LOGFILE '+DATA' size 52428800
2 /

Database altered.

SQL> ALTER DATABASE ADD STANDBY LOGFILE '+DATA' size 52428800
2 /

Database altered.
3) Set the LOG_ARCHIVE_DEST_1 initialization parameter on the primary database to
use the flash recovery area as the first archive log location.
SQL> alter system set log_archive_dest_1 =
'LOCATION=USE_DB_RECOVERY_FILE_DEST';

System altered.
4) Set the LOG_ARCHIVE_CONFIG and LOG_ARCHIVE_DEST_2 initialization
parameters on the primary database. You must specify the name of your primary
database and your standby database; do not use the names shown in the examples.
Note: Be sure to leave a blank space before each of the attributes of
LOG_ARCHIVE_DEST_2.
SQL> alter system set log_archive_config =
'dg_config=(pc01prmy,pc01sby1)';

System altered.

SQL> show parameter log_archive_config

NAME TYPE VALUE
-------------------- --------- -----------------------------
log_archive_config string dg_config=(pc01prmy,pc01sby1)
Practice 2-1: Preparing the Primary Database (continued)
Oracle Database 11g: Data Guard Administration A - 8

SQL> alter system
2 set log_archive_dest_2 =
3 'service=pc01sby1 async
4 valid_for=(online_logfile,primary_role)
5 db_unique_name=pc01sby1';

System altered.
SQL> show parameter log_archive_dest_2

NAME TYPE VALUE
-------------------- ------- -----------------------------
log_archive_dest_2 string service=pc01sby1 async
valid_for=(online_logfile,
primary_role)
db_unique_name=pc01sby1
Note: Output formatted for legibility
5) Configure ARCHIVELOG mode and enable automatic archiving. Note: Your
sequence numbers may be different than the ones displayed. Do not perform a log
switch because the network service for destination 2 has not been created yet.
SQL> archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 6
Current log sequence 8

SQL> SHUTDOWN IMMEDIATE
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> STARTUP MOUNT
ORACLE instance started.

Total System Global Area 439406592 bytes
Fixed Size 1337072 bytes
Variable Size 394266896 bytes
Database Buffers 37748736 bytes
Redo Buffers 6053888 bytes
Database mounted.

SQL> ALTER DATABASE ARCHIVELOG;

Database altered.

SQL> ALTER DATABASE OPEN;

Database altered.
Practice 2-1: Preparing the Primary Database (continued)
Oracle Database 11g: Data Guard Administration A - 9
6) Increase the size of the flash recovery area to 5 GB. Exit SQL*Plus.
SQL> alter system set db_recovery_file_dest_size = 5G;

System altered.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition
Release 11.2.0.1.0 - Production
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
[oracle@EDBVR6P1-pc01prmy labs]$
7) Invoke RMAN and log in to your primary database.
[oracle@EDBVR6P1-pc01prmy labs]$ rman

Recovery Manager: Release 11.2.0.1.0 - Production on Tue Feb 9
17:51:02 2010

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All
rights reserved.

RMAN> connect target /

connected to target database: PC01PRMY (DBID=2580985790)
8) Make a whole database backup, including archived redo log files. Exit RMAN.
RMAN> backup database plus archivelog;


Starting backup at 09-FEB-10
current log archived
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=145 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=8 RECID=1 STAMP=710531375
input archived log thread=1 sequence=9 RECID=2 STAMP=710531376
input archived log thread=1 sequence=10 RECID=3
STAMP=710531518
channel ORA_DISK_1: starting piece 1 at 09-FEB-10
channel ORA_DISK_1: finished piece 1 at 09-FEB-10
piece
handle=+FRA/pc01prmy/backupset/2010_02_09/annnf0_tag20100209t1
75159_0.267.710531519 tag=TAG20100209T175159 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time:
00:00:03
Finished backup at 09-FEB-10

Starting backup at 09-FEB-10
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
Practice 2-1: Preparing the Primary Database (continued)
Oracle Database 11g: Data Guard Administration A - 10
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001
name=+DATA/pc01prmy/datafile/system.256.710507257
input datafile file number=00002
name=+DATA/pc01prmy/datafile/sysaux.257.710507261
input datafile file number=00005
name=+DATA/pc01prmy/datafile/example.276.710508055
input datafile file number=00003
name=+DATA/pc01prmy/datafile/undotbs1.258.710507263
input datafile file number=00004
name=+DATA/pc01prmy/datafile/users.259.710507263
channel ORA_DISK_1: starting piece 1 at 09-FEB-10
channel ORA_DISK_1: finished piece 1 at 09-FEB-10
piece
handle=+FRA/pc01prmy/backupset/2010_02_09/nnndf0_tag20100209t1
75202_0.268.710531523 tag=TAG20100209T175202 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time:
00:01:15
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 09-FEB-10
channel ORA_DISK_1: finished piece 1 at 09-FEB-10
piece
handle=+FRA/pc01prmy/backupset/2010_02_09/ncsnf0_tag20100209t1
75202_0.269.710531601 tag=TAG20100209T175202 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time:
00:00:03
Finished backup at 09-FEB-10

Starting backup at 09-FEB-10
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=11 RECID=4
STAMP=710531604
channel ORA_DISK_1: starting piece 1 at 09-FEB-10
channel ORA_DISK_1: finished piece 1 at 09-FEB-10
piece
handle=+FRA/pc01prmy/backupset/2010_02_09/annnf0_tag20100209t1
75324_0.271.710531605 tag=TAG20100209T175324 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time:
00:00:01
Finished backup at 09-FEB-10

RMAN> exit


Recovery Manager complete.
[oracle@EDBVR6P1-pc01prmy labs]$

Oracle Database 11g: Data Guard Administration A - 11
Practice 2-2: Creating the Physical Standby Database
In this practice, you create a physical standby database.
Note: Be sure to verify the information you enter into fields in Oracle Net Manager
before proceeding to the next page.
1) On your primary database system, use Oracle Net Manager to create an Oracle Net
service name for your physical standby database. This helps the primary database
instance to connect to the standby database instance.
a) Launch Net Manager.
[oracle@EDBVR6P1-pc01prmy labs]$ netmgr
b) Expand Local. Select Service Naming and click the green plus sign in the left
navigation bar.

c) Enter pc<nn>sby1 in the Net Service Name field and click Next.
Note: For the value of nn, enter the number of the PC to which you are assigned.

d) Select TCP/IP (Internet Protocol) and click Next.
Practice 2-2: Creating the Physical Standby Database
(continued)
Oracle Database 11g: Data Guard Administration A - 12
e) Enter the fully qualified host name of the machine on which you are creating your
physical standby database and 12001 in the Port Number field. Click Next.
Note: edbvr6p2.us.oracle.com is used only as an example.

f) Enter pc<nn>sby1.us.oracle.com in the Service Name field and click
Next. Note: For the value of nn, enter the number of the PC to which you are
assigned.

Practice 2-2: Creating the Physical Standby Database
(continued)
Oracle Database 11g: Data Guard Administration A - 13
g) Click Finish.
h) Select File > Save Network Configuration to save the information to the
tnsnames.ora file. Your tnsnames.ora file should have entries similar to
the following:
[oracle@EDBVR6P1-pc01prmy labs]$ cat
$ORACLE_HOME/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File:
/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames
.ora
# Generated by Oracle configuration tools.

PC01PRMY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
edbvr6p1.us.oracle.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pc01prmy.us.oracle.com)
)
)

PC01DB11 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
edbvr6p1.us.oracle.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pc01db11.us.oracle.com)
)
)

PC01SBY1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
edbvr6p2.us.oracle.com)(PORT = 12001))
)
(CONNECT_DATA =
(SERVICE_NAME = pc01sby1.us.oracle.com)
)
)

[oracle@EDBVR6P1-pc01prmy labs]$
i) Exit Oracle Net Manager.
Practice 2-2: Creating the Physical Standby Database
(continued)
Oracle Database 11g: Data Guard Administration A - 14
2) Open a new terminal window and use ssh to connect to the machine on which your
physical standby database will be created. Log in as the oracle user with a
password of oracle. You will need to set the environment variables for the primary
Oracle database installed on that machine. The ORACLE_SID value is machine
specific. Leave this window with environment variables set when done with this step.
Set DISPLAY to your machine.
[oracle@EDBVR6P1-pc01prmy ~]$ xhost +
access control disabled, clients can connect from any host
[oracle@EDBVR6P1-pc01prmy ~]$ ssh edbvr6p2
The authenticity of host 'edbvr6p2 (10.150.23.85)' can't be
established.
RSA key fingerprint is
cc:b1:11:60:dd:4c:28:43:4a:ab:66:a1:b7:1f:d7:0c.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'edbvr6p2,10.150.23.85' (RSA) to
the list of known hosts.
oracle@edbvr6p2's password: oracle
Last login: Tue Feb 9 13:31:22 2010 from 141.144.112.73
[oracle@EDBVR6P2- ~]$ . oraenv
ORACLE_SID = [oracle] ? pc02prmy
The Oracle base for
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is
/u01/app/oracle
[oracle@EDBVR6P2-pc02prmy ~]$ export DISPLAY=edbvr6p1:2
3) Launch Oracle Net Manager to configure an entry for your standby database in the
listener.ora file.
a) Expand Local.
b) Expand Listeners.
c) Select LISTENER1.
d) Select Database Services in the list.
e) Click Add Database.
f) Enter pc<nn>sby1.us.oracle.com in the Global Database Name field.
Accept the default for Oracle Home Directory. Enter pc<nn>sby1 in the SID
field. Note: For the value of nn, enter the number of the PC to which you are
assigned.
Practice 2-2: Creating the Physical Standby Database
(continued)
Oracle Database 11g: Data Guard Administration A - 15

g) Select File > Save Network Configuration.
h) Select File > Exit.
4) On the same machine (the one on which you are creating your standby database),
invoke the listener control utility to start the LISTENER1 listener.
[oracle@EDBVR6P2-pc02prmy ~]$ lsnrctl start listener1

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 09-FEB-
2010 18:12:06

Copyright (c) 1991, 2009, Oracle. All rights reserved.

Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr:
please wait...

TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is
/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener
.ora
Log messages written to
/u01/app/oracle/diag/tnslsnr/EDBVR6P2/listener1/alert/log.xml
Listening on:
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=edBVr6p2.us.oracle.c
om)(PORT=12001)))

Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=edbvr6p2.us.oracle.c
om)(PORT=12001)))
STATUS of the LISTENER
------------------------
Alias listener1
Version TNSLSNR for Linux: Version
11.2.0.1.0 - Production
Start Date 09-FEB-2010 18:12:06
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Practice 2-2: Creating the Physical Standby Database
(continued)
Oracle Database 11g: Data Guard Administration A - 16
Listener Parameter File
/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener
.ora
Listener Log File
/u01/app/oracle/diag/tnslsnr/EDBVR6P2/listener1/alert/log.xml
Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=edBVr6p2.us.oracle.c
om)(PORT=12001)))
Services Summary...
...
Service "pc01sby1.us.oracle.com" has 1 instance(s).
Instance "pc01sby1", status UNKNOWN, has 1 handler(s) for
this service...
...
The command completed successfully
[oracle@EDBVR6P2-pc02prmy ~]$
5) Return to the terminal window for your primary database system. Change to the
$ORACLE_HOME/dbs directory and view the contents of the directory.
[oracle@EDBVR6P1-pc01prmy labs]$ cd $ORACLE_HOME/dbs
[oracle@EDBVR6P1-pc01prmy dbs]$ ls
hc_DBUA0.dat initpc01db11.ora orapwpc01db11
peshm_pc01prmy_0
hc_pc01db11.dat initpc01prmy.ora orapwpc01prmy
snapcf_pc01prmy.f
hc_pc01prmy.dat lkPC01DB11 peshm_DBUA0_0
init.ora lkPC01PRMY peshm_pc01db11_0
[oracle@EDBVR6P1-pc01prmy dbs]$
6) FTP to the host where your standby database will be created. Specify a username of
oracle and a password of oracle to log on.
[oracle@EDBVR6P1-pc01prmy dbs]$ ftp edbvr6p2
Connected to edBVr6p2.us.oracle.com.
220 edBVr6p2.us.oracle.com FTP server (Version wu-2.6.1-20)
ready.
530 Please login with USER and PASS.
530 Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Name (edbvr6p2:oracle): oracle
331 Password required for oracle
Password:
230 User oracle logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
Practice 2-2: Creating the Physical Standby Database
(continued)
Oracle Database 11g: Data Guard Administration A - 17
7) FTP your primary database password file to the standby database system, renaming
the password file so that it can be used for your physical standby database. Exit the
FTP session.
ftp> put orapwpc01prmy orapwpc01sby1
local: orapwpc01prmy remote: orapwpc01sby1
227 Entering Passive Mode (10,150,23,85,229,121)
150 Opening BINARY mode data connection for orapwpc01sby1.
226 Transfer complete.
1536 bytes sent in 4.3e-05 seconds (3.5e+04 Kbytes/s)
ftp> quit
221-You have transferred 1536 bytes in 1 files.
221-Total traffic for this session was 2046 bytes in 1
transfers.
221 Thank you for using the FTP service on
edBVr6p2.us.oracle.com.
8) Return to your standby database system window. Relocate the password file to the
$ORACLE_HOME/dbs directory. Verify that you have successfully moved it and
named it correctly.
[oracle@EDBVR6P2-pc02prmy ~]$ ls
db.env grid.env oradiag_oracle setup
Desktop labs orapwpc01sby1 setup_scripts.tar
[oracle@EDBVR6P2-pc02prmy ~]$ mv orapwpc01sby1
$ORACLE_HOME/dbs
[oracle@EDBVR6P2-pc02prmy ~]$ cd $ORACLE_HOME/dbs
[oracle@EDBVR6P2-pc02prmy dbs]$ ls
hc_DBUA0.dat initpc02db11.ora orapwpc01sby1
peshm_pc02db11_0
hc_pc02db11.dat initpc02prmy.ora orapwpc02db11
peshm_pc02prmy_0
hc_pc02prmy.dat lkPC02DB11 orapwpc02prmy
init.ora lkPC02PRMY peshm_DBUA0_0
[oracle@EDBVR6P2-pc02prmy dbs]$
9) On the standby database host, create an initialization parameter file named
initpc<nn>sby1.ora containing a single parameter: DB_NAME=pc<nn>sby1.
[oracle@EDBVR6P2-pc02prmy dbs]$ vi initpc01sby1.ora
<< add a new line per instructions >>
[oracle@EDBVR6P2-pc02prmy dbs]$ more initpc01sby1.ora
DB_NAME=pc01sby1
[oracle@EDBVR6P2-pc02prmy dbs]$
10) On the standby database host, change to the /u01/app/oracle/admin directory.
Create the pc<nn>sby1 directory.
[oracle@EDBVR6P2-pc02prmy dbs]$ cd /u01/app/oracle/admin
[oracle@EDBVR6P2-pc02prmy admin]$ ls
+ASM pc02db11 pc02prmy
[oracle@EDBVR6P2-pc02prmy admin]$ mkdir pc01sby1
Practice 2-2: Creating the Physical Standby Database
(continued)
Oracle Database 11g: Data Guard Administration A - 18
11) Change to the pc<nn>sby1 directory and create the adump, dpdump, and pfile
directories.
[oracle@EDBVR6P2-pc02prmy admin]$ cd pc01sby1
[oracle@EDBVR6P2-pc02prmy pc01sby1]$ mkdir adump dpdump pfile
12) On the standby host, set the ORACLE_SID environment variable to pc<nn>sby1
and start the instance in NOMOUNT mode with the text initialization parameter file.
Exit SQL*Plus.
[oracle@EDBVR6P2-pc02prmy pc01sby1]$ export
ORACLE_SID=pc01sby1
[oracle@EDBVR6P2-pc01sby1 pc01sby1]$ echo $ORACLE_SID
pc01sby1
[oracle@EDBVR6P2-pc01sby1 pc01sby1]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 9 18:22:02
2010

Copyright (c) 1982, 2009, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup nomount pfile=$ORACLE_HOME/dbs/initpc01sby1.ora
ORACLE instance started.

Total System Global Area 150667264 bytes
Fixed Size 1335080 bytes
Variable Size 92274904 bytes
Database Buffers 50331648 bytes
Redo Buffers 6725632 bytes
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition
Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application
Testing options
[oracle@EDBVR6P2-pc01sby1 pc01sby1]$ exit
logout
Connection to edbvr6p2 closed.
[oracle@EDBVR6P1-pc01prmy ~]$ exit
13) On the primary database host, verify that the ORACLE_SID environment variable is
set to pc<nn>prmy.
[oracle@EDBVR6P1-pc01prmy dbs]$ echo $ORACLE_SID
pc01prmy
[oracle@EDBVR6P1-pc01prmy dbs]$
14) On the primary database host, change to the $HOME/labs directory. Verify that the
cr_phys_sby1.txt script contains the correct values for your primary and
standby databases.
Practice 2-2: Creating the Physical Standby Database
(continued)
Oracle Database 11g: Data Guard Administration A - 19
[oracle@EDBVR6P1-pc01prmy dbs]$ cd $HOME/labs
[oracle@EDBVR6P1-pc01prmy labs]$ cat cr_phys_sby1.txt
run {
allocate channel prmy1 type disk;
allocate channel prmy2 type disk;
allocate channel prmy3 type disk;
allocate channel prmy4 type disk;
allocate auxiliary channel stby type disk;
duplicate target database for standby from active database
spfile
parameter_value_convert 'pc01prmy','pc01sby1'
set db_unique_name='pc01sby1'
set db_create_file_dest='+SBDAT'
set db_recovery_file_dest='+SBFRA'
set db_recovery_file_dest_size='5G'
set control_files='+SBDAT'
set log_archive_max_processes='5'
set fal_client='pc01sby1'
set fal_server='pc01prmy'
set standby_file_management='AUTO'
set log_archive_config='dg_config=(pc01prmy,pc01sby1)'
set log_archive_dest_2='service=pc01prmy ASYNC
valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE)
db_unique_name=pc01prmy'
;
}
[oracle@EDBVR6P1-pc01prmy labs]$
15) Invoke RMAN and connect as SYSDBA to the target database. Connect to the
auxiliary database.
[oracle@EDBVR6P1-pc01prmy labs]$ rman

Recovery Manager: Release 11.2.0.1.0 - Production on Tue Feb 9
18:26:16 2010

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All
rights reserved.

RMAN> connect target sys/oracle_4U

connected to target database: PC01PRMY (DBID=2580985790)

RMAN> connect auxiliary sys/oracle_4U@pc01sby1

connected to auxiliary database: PC01SBY1 (not mounted)

RMAN>
16) Execute the cr_phys_sby1.txt script.
Practice 2-2: Creating the Physical Standby Database
(continued)
Oracle Database 11g: Data Guard Administration A - 20
RMAN> @cr_phys_sby1.txt

RMAN> run {
2> allocate channel prmy1 type disk;
3> allocate channel prmy2 type disk;
4> allocate channel prmy3 type disk;
5> allocate channel prmy4 type disk;
6> allocate auxiliary channel stby type disk;
7> duplicate target database for standby from active
database
8> spfile
9> parameter_value_convert 'pc01prmy','pc01sby1'
10> set db_unique_name='pc01sby1'
11> set db_create_file_dest='+SBDAT'
12> set db_recovery_file_dest='+SBFRA'
13> set db_recovery_file_dest_size='5G'
14> set control_files='+SBDAT'
15> set log_archive_max_processes='5'
16> set fal_client='pc01sby1'
17> set fal_server='pc01prmy'
18> set standby_file_management='AUTO'
19> set
log_archive_config='dg_config=(pc01prmy,pc01sby1)'
20> set log_archive_dest_2='service=pc01prmy ASYNC
21> valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE)
db_unique_name=pc01prmy'
22> ;
23> }
using target database control file instead of recovery catalog
allocated channel: prmy1
channel prmy1: SID=25 device type=DISK

allocated channel: prmy2
channel prmy2: SID=144 device type=DISK

allocated channel: prmy3
channel prmy3: SID=23 device type=DISK

allocated channel: prmy4
channel prmy4: SID=147 device type=DISK

allocated channel: stby
channel stby: SID=96 device type=DISK

Starting Duplicate Db at 09-FEB-10

contents of Memory Script:
{
backup as copy reuse
Practice 2-2: Creating the Physical Standby Database
(continued)
Oracle Database 11g: Data Guard Administration A - 21
targetfile
'/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwpc01prmy'
auxiliary format
'/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwpc01sby1'
targetfile
'+DATA/pc01prmy/spfilepc01prmy.ora' auxiliary format

'/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfilepc01sby1.or
a' ;
sql clone "alter system set spfile=
''/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfilepc01sby1.o
ra''";
}
executing Memory Script

Starting backup at 09-FEB-10
Finished backup at 09-FEB-10

sql statement: alter system set spfile=
''/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfilepc01sby1.o
ra''

contents of Memory Script:
{
sql clone "alter system set audit_file_dest =
''/u01/app/oracle/admin/pc01sby1/adump'' comment=
'''' scope=spfile";
sql clone "alter system set dispatchers =
''(PROTOCOL=TCP) (SERVICE=pc01sby1XDB)'' comment=
'''' scope=spfile";
sql clone "alter system set db_unique_name =
''pc01sby1'' comment=
'''' scope=spfile";
sql clone "alter system set db_create_file_dest =
''+SBDAT'' comment=
'''' scope=spfile";
sql clone "alter system set db_recovery_file_dest =
''+SBFRA'' comment=
'''' scope=spfile";
sql clone "alter system set db_recovery_file_dest_size =
5G comment=
'''' scope=spfile";
sql clone "alter system set control_files =
''+SBDAT'' comment=
'''' scope=spfile";
sql clone "alter system set log_archive_max_processes =
5 comment=
'''' scope=spfile";
sql clone "alter system set fal_client =
''pc01sby1'' comment=
Practice 2-2: Creating the Physical Standby Database
(continued)
Oracle Database 11g: Data Guard Administration A - 22
'''' scope=spfile";
sql clone "alter system set fal_server =
''pc01prmy'' comment=
'''' scope=spfile";
sql clone "alter system set standby_file_management =
''AUTO'' comment=
'''' scope=spfile";
sql clone "alter system set log_archive_config =
''dg_config=(pc01prmy,pc01sby1)'' comment=
'''' scope=spfile";
sql clone "alter system set log_archive_dest_2 =
''service=pc01prmy ASYNC
valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE)
db_unique_name=pc01prmy'' comment=
'''' scope=spfile";
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script

sql statement: alter system set audit_file_dest =
''/u01/app/oracle/admin/pc01sby1/adump'' comment= ''''
scope=spfile

sql statement: alter system set dispatchers =
''(PROTOCOL=TCP) (SERVICE=pc01sby1XDB)'' comment= ''''
scope=spfile

sql statement: alter system set db_unique_name =
''pc01sby1'' comment= '''' scope=spfile

sql statement: alter system set db_create_file_dest =
''+SBDAT'' comment= '''' scope=spfile

sql statement: alter system set db_recovery_file_dest =
''+SBFRA'' comment= '''' scope=spfile

sql statement: alter system set db_recovery_file_dest_size =
5G comment= '''' scope=spfile

sql statement: alter system set control_files = ''+SBDAT''
comment= '''' scope=spfile

sql statement: alter system set log_archive_max_processes =
5 comment= '''' scope=spfile

sql statement: alter system set fal_client = ''pc01sby1''
comment= '''' scope=spfile

Practice 2-2: Creating the Physical Standby Database
(continued)
Oracle Database 11g: Data Guard Administration A - 23
sql statement: alter system set fal_server = ''pc01prmy''
comment= '''' scope=spfile

sql statement: alter system set standby_file_management =
''AUTO'' comment= '''' scope=spfile

sql statement: alter system set log_archive_config =
''dg_config=(pc01prmy,pc01sby1)'' comment= '''' scope=spfile

sql statement: alter system set log_archive_dest_2 =
''service=pc01prmy ASYNC
valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE)
db_unique_name=pc01prmy'' comment= '''' scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area 439406592 bytes

Fixed Size 1337072 bytes
Variable Size 268437776 bytes
Database Buffers 163577856 bytes
Redo Buffers 6053888 bytes
allocated channel: stby
channel stby: SID=11 device type=DISK
contents of Memory Script:
{
sql clone "alter system set control_files =
''+SBDAT/pc01sby1/controlfile/current.256.710533699''
comment=
''Set by RMAN'' scope=spfile";
backup as copy current controlfile for standby auxiliary
format '+SBDAT/pc01sby1/controlfile/current.257.710533699';
sql clone "alter system set control_files =
''+SBDAT/pc01sby1/controlfile/current.257.710533699''
comment=
''Set by RMAN'' scope=spfile";
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script

sql statement: alter system set control_files =
''+SBDAT/pc01sby1/controlfile/current.256.710533699'' comment=
''Set by RMAN'' scope=spfile

Starting backup at 09-FEB-10
channel prmy1: starting datafile copy
Practice 2-2: Creating the Physical Standby Database
(continued)
Oracle Database 11g: Data Guard Administration A - 24
copying standby control file
output file
name=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_pc01pr
my.f tag=TAG20100209T182739 RECID=1 STAMP=710533659
channel prmy1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 09-FEB-10

sql statement: alter system set control_files =
''+SBDAT/pc01sby1/controlfile/current.257.710533699'' comment=
''Set by RMAN'' scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area 439406592 bytes

Fixed Size 1337072 bytes
Variable Size 268437776 bytes
Database Buffers 163577856 bytes
Redo Buffers 6053888 bytes
allocated channel: stby
channel stby: SID=11 device type=DISK

contents of Memory Script:
{
sql clone 'alter database mount standby database';
}
executing Memory Script

sql statement: alter database mount standby database

contents of Memory Script:
{
set newname for clone tempfile 1 to new;
switch clone tempfile all;
set newname for clone datafile 1 to new;
set newname for clone datafile 2 to new;
set newname for clone datafile 3 to new;
set newname for clone datafile 4 to new;
set newname for clone datafile 5 to new;
backup as copy reuse
datafile 1 auxiliary format new
datafile 2 auxiliary format new
datafile 3 auxiliary format new
datafile 4 auxiliary format new
datafile 5 auxiliary format new
;
sql 'alter system archive log current';
Practice 2-2: Creating the Physical Standby Database
(continued)
Oracle Database 11g: Data Guard Administration A - 25
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to +SBDAT in control file

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting backup at 09-FEB-10
channel prmy1: starting datafile copy
input datafile file number=00001
name=+DATA/pc01prmy/datafile/system.256.710507257
channel prmy2: starting datafile copy
input datafile file number=00002
name=+DATA/pc01prmy/datafile/sysaux.257.710507261
channel prmy3: starting datafile copy
input datafile file number=00005
name=+DATA/pc01prmy/datafile/example.276.710508055
channel prmy4: starting datafile copy
input datafile file number=00003
name=+DATA/pc01prmy/datafile/undotbs1.258.710507263
output file
name=+SBDAT/pc01sby1/datafile/undotbs1.259.710533719
tag=TAG20100209T182757
channel prmy4: datafile copy complete, elapsed time: 00:00:46
channel prmy4: starting datafile copy
input datafile file number=00004
name=+DATA/pc01prmy/datafile/users.259.710507263
output file
name=+SBDAT/pc01sby1/datafile/example.260.710533719
tag=TAG20100209T182757
channel prmy3: datafile copy complete, elapsed time: 00:01:13
output file name=+SBDAT/pc01sby1/datafile/users.262.710533773
tag=TAG20100209T182757
channel prmy4: datafile copy complete, elapsed time: 00:00:38
output file name=+SBDAT/pc01sby1/datafile/system.258.710533719
tag=TAG20100209T182757
channel prmy1: datafile copy complete, elapsed time: 00:02:05
output file name=+SBDAT/pc01sby1/datafile/sysaux.261.710533719
tag=TAG20100209T182757
channel prmy2: datafile copy complete, elapsed time: 00:02:15
Practice 2-2: Creating the Physical Standby Database
(continued)
Oracle Database 11g: Data Guard Administration A - 26
Finished backup at 09-FEB-10

sql statement: alter system archive log current

contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafile copy RECID=1 STAMP=710533855 file
name=+SBDAT/pc01sby1/datafile/system.258.710533719
datafile 2 switched to datafile copy
input datafile copy RECID=2 STAMP=710533855 file
name=+SBDAT/pc01sby1/datafile/sysaux.261.710533719
datafile 3 switched to datafile copy
input datafile copy RECID=3 STAMP=710533855 file
name=+SBDAT/pc01sby1/datafile/undotbs1.259.710533719
datafile 4 switched to datafile copy
input datafile copy RECID=4 STAMP=710533855 file
name=+SBDAT/pc01sby1/datafile/users.262.710533773
datafile 5 switched to datafile copy
input datafile copy RECID=5 STAMP=710533855 file
name=+SBDAT/pc01sby1/datafile/example.260.710533719
Finished Duplicate Db at 09-FEB-10
released channel: prmy1
released channel: prmy2
released channel: prmy3
released channel: prmy4
released channel: stby

RMAN> **end-of-file**

RMAN>
17) Exit your RMAN session and log in to SQL*Plus on your primary database system.
RMAN> exit


Recovery Manager complete.
[oracle@EDBVR6P1-pc01prmy labs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 9 18:32:18
2010

Copyright (c) 1982, 2009, Oracle. All rights reserved.


Connected to:
Practice 2-2: Creating the Physical Standby Database
(continued)
Oracle Database 11g: Data Guard Administration A - 27
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -
Production
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining
and Real Application Testing options

SQL>
18) Perform a log switch on the primary database.
SQL> alter system switch logfile;

System altered.

SQL>
19) Open a terminal window for the system that your physical standby database is on.
Add an entry for the pc<nn>sby1 standby database to the /etc/oratab file. Use
the oraenv utility to set your environment variables. Change to the labs directory.
Log in to SQL*Plus as the SYSDBA user. Start Redo Apply.
[oracle@EDBVR6P1-pc01prmy ~]$ ssh edbvr6p2
oracle@edbvr6p2's password: oracle
Last login: Tue Feb 9 18:14:31 2010 from
edBVr6p1.us.oracle.com
[oracle@EDBVR6P2- ~]$ vi /etc/oratab
<< insert a new entry per instructions >>
[oracle@EDBVR6P2- ~]$ cat /etc/oratab
..
+ASM:/u01/app/oracle/product/11.2.0/grid:N
pc02db11:/u01/app/oracle/product/11.2.0/dbhome_1:N
# line added by Agent
pc02prmy:/u01/app/oracle/product/11.2.0/dbhome_1:N
# line added by Agent
pc01sby1:/u01/app/oracle/product/11.2.0/dbhome_1:N

[oracle@EDBVR6P2-pc01sby1 ~]$ . oraenv
ORACLE_SID = [+ASM] ? pc01sby1
The Oracle base for
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is
/u01/app/oracle
[oracle@EDBVR6P2-pc01sby1 ~]$ cd $HOME/labs
[oracle@EDBVR6P2-pc01sby1 labs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 9 18:39:01
2010

Copyright (c) 1982, 2009, Oracle. All rights reserved.


Connected to:
Practice 2-2: Creating the Physical Standby Database
(continued)
Oracle Database 11g: Data Guard Administration A - 28
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -
Production
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining
and Real Application Testing options

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

Database altered.

Oracle Database 11g: Data Guard Administration A - 29
Practice 2-3: Verifying That the Physical Standby Database Is
Performing Correctly
In this practice, you verify that the standby database is performing correctly.
1) On the standby database, identify the existing archived redo log files. Use the
query_archived_log.sql file. Note: The starting number of archived redo
logs and their sequence numbers can vary.
SQL> @query_archived_log
SQL> SELECT sequence#, first_time, next_time
2 FROM v$archived_log
3 ORDER BY sequence#
4 /

SEQUENCE# FIRST_TIM NEXT_TIME
---------- --------- ---------
12 09-FEB-10 09-FEB-10
13 09-FEB-10 09-FEB-10
14 09-FEB-10 09-FEB-10
2) On the primary database, perform a few log switches.
SQL> alter system switch logfile;

System altered.

SQL> alter system switch logfile;

System altered.

SQL> alter system switch logfile;

System altered.
3) On the standby database, verify that the new redo data was received and archived.
SQL> @query_archived_log
SQL> SET echo ON
SQL> SELECT sequence#, first_time, next_time
2 FROM v$archived_log
3 ORDER BY sequence#
4 /

SEQUENCE# FIRST_TIM NEXT_TIME
---------- --------- ---------
12 09-FEB-10 09-FEB-10
13 09-FEB-10 09-FEB-10
14 09-FEB-10 09-FEB-10
15 09-FEB-10 09-FEB-10
16 09-FEB-10 09-FEB-10
17 09-FEB-10 09-FEB-10

6 rows selected.
Practice 2-3: Verifying That the Physical Standby Database Is
Performing Correctly (continued)
Oracle Database 11g: Data Guard Administration A - 30
4) On the standby database, verify that the new archived redo log files were applied.
You can use the query_applied_log.sql file.
SQL> @query_applied_log
SQL> SET echo ON
SQL> SELECT sequence#, applied
2 FROM v$archived_log
3 /

SEQUENCE# APPLIED
---------- ---------
13 YES
12 YES
14 YES
15 YES
16 YES
17 IN-MEMORY

6 rows selected.

SQL>



Oracle Database 11g: Data Guard Administration A - 31
Practices for Lesson 3: Oracle Data Guard Broker:
Overview
There are no practices for Lesson 3, Oracle Data Guard Broker: Overview.


Oracle Database 11g: Data Guard Administration A - 32
Practices for Lesson 4: Creating a Data Guard Broker
Configuration
In the practices for Lesson 4, Creating a Data Guard Broker Configuration, you create a
broker configuration.


Oracle Database 11g: Data Guard Administration A - 33
Practice 4-1: Setting the DG_BROKER_START Initialization
Parameter
In this practice, you set the DG_BROKER_START initialization parameter to TRUE for
your primary database and physical standby database.
1) Invoke SQL*Plus on your primary database system. Connect to your primary
database as the SYSDBA user and check the value of DG_BROKER_START.
[oracle@EDBVR6P1-pc01prmy labs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 9 18:43:41
2010

Copyright (c) 1982, 2009, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -
Production
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining
and Real Application Testing options

SQL> show parameter dg_broker_start

NAME TYPE VALUE
------------------------------------ ----------- -------------
dg_broker_start boolean FALSE
2) Set the DG_BROKER_START parameter to TRUE.
SQL> alter system set dg_broker_start=true;

System altered.

SQL> show parameter dg_broker_start

NAME TYPE VALUE
------------------------------------ ----------- -------------
dg_broker_start boolean TRUE
3) Open a terminal window for the system that your standby database is on. Use the
oraenv utility to set the environment variables for your standby database. The
oraenv utility requires that the /etc/oratab file includes an entry for the
standby database. Invoke SQL*Plus on your standby database system. Connect to
your physical standby database as the SYSDBA user and check the value of
DG_BROKER_START.
[oracle@EDBVR6P1-pc01prmy ~]$ ssh edbvr6p2
oracle@edbvr6p2's password: oracle
Last login: Tue Feb 9 18:34:04 2010 from
edbvr6p1.us.oracle.com
Practice 4-1: Setting the DG_BROKER_START Initialization
Parameter (continued)
Oracle Database 11g: Data Guard Administration A - 34
[oracle@EDBVR6P2- ~]$ . oraenv
ORACLE_SID = [oracle] ? pc01sby1
The Oracle base for
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is
/u01/app/oracle
[oracle@EDBVR6P2-pc01sby1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 9 18:47:04
2010

Copyright (c) 1982, 2009, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -
Production
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining
and Real Application Testing options

SQL> show parameter dg_broker_start

NAME TYPE VALUE
------------------------------------ ----------- ------------
dg_broker_start boolean FALSE
SQL>
4) Set the value of DG_BROKER_START to TRUE on your standby database.
SQL> alter system set dg_broker_start=true;

System altered.

SQL> show parameter dg_broker_start

NAME TYPE VALUE
------------------------------------ ----------- -------------
dg_broker_start boolean TRUE

SQL> exit


Oracle Database 11g: Data Guard Administration A - 35
Practice 4-2: Configuring Listener to Allow Data Guard Broker to
Restart Primary Database Instance Server Setup
In this practice, you define a listener service for the primary database that includes the
db_unique_name_DGMGRL.db_domain values for GLOBAL_DBNAME.
Note: Be sure to verify the information that you enter into fields in Oracle Net Manager
before proceeding to the next page.
1) Open a terminal window to the system that your primary database is on. Set the
environment variables for the Grid Infrastructure (ASM instance and default listener).
[oracle@EDBVR6P1-pc01prmy labs]$ . oraenv
ORACLE_SID = [pc01prmy] ? +ASM
The Oracle base for
ORACLE_HOME=/u01/app/oracle/product/11.2.0/grid is
/u01/app/oracle
2) Launch Oracle Net Manager.
[oracle@EDBVR6P1-+ASM labs]$ netmgr
3) Expand Local.
4) Expand Listeners.
5) Select LISTENER.
6) Select Database Services in the list.
7) Click Add Database.
8) Enter pc<nn>prmy_DGMGRL.us.oracle.com in the Global Database Name
field. You will need to override the value for the Oracle Home Directory. You are
editing the networking files in the
/u01/app/oracle/product/11.2.0/grid/network/admin directory,
but the database is in /u01/app/oracle/product/11.2.0/dbhome_1/.
Enter pc<nn>prmy in the SID field.

9) Select File > Save Network Configuration.
10) Select File > Exit.
11) Shut down the listener. Restart the listener.
[oracle@EDBVR6P1-+ASM labs]$ lsnrctl stop

Practice 4-2: Configuring Listener to Allow Data Guard Broker to
Restart Primary Database Instance Server Setup (continued)
Oracle Database 11g: Data Guard Administration A - 36
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 09-FEB-
2010 18:51:34

Copyright (c) 1991, 2009, Oracle. All rights reserved.

Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=edbvr6p1.us.oracle.c
om)(PORT=12001)))
The command completed successfully

[oracle@EDBVR6P1-+ASM labs]$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 22-FEB-
2010 09:52:05

Copyright (c) 1991, 2009, Oracle. All rights reserved.

Starting /u01/app/oracle/product/11.2.0/grid/bin/tnslsnr:
please wait...

TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is
/u01/app/oracle/product/11.2.0/grid/network/admin/listener.ora
Log messages written to
/u01/app/oracle/diag/tnslsnr/EDBVR6P1/listener/alert/log.xml
Listening on:
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on:
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=edBVr6p1.us.oracle.c
om)(PORT=1521)))

Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version
11.2.0.1.0 - Production
Start Date 22-FEB-2010 09:52:06
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File
/u01/app/oracle/product/11.2.0/grid/network/admin/listener.ora
Listener Log File
/u01/app/oracle/diag/tnslsnr/EDBVR6P1/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Practice 4-2: Configuring Listener to Allow Data Guard Broker to
Restart Primary Database Instance Server Setup (continued)
Oracle Database 11g: Data Guard Administration A - 37

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=edBVr6p1.us.oracle.c
om)(PORT=1521)))
Services Summary...
Service "pc01prmy_DGMGRL.us.oracle.com" has 1 instance(s).
Instance "pc01prmy", status UNKNOWN, has 1 handler(s) for
this service...
The command completed successfully
[oracle@EDBVR6P1-+ASM labs]$
Practice 4-2: Configuring Listener to Allow Data Guard Broker to
Restart Primary Database Instance Server Setup (continued)
Oracle Database 11g: Data Guard Administration A - 38
12) Ensure that your listener.ora file contains entries similar to the following:
[oracle@EDBVR6P1-+ASM labs]$ cat
$ORACLE_HOME/network/admin/listener.ora

# listener.ora Network Configuration File:
/u01/app/oracle/product/11.2.0/grid/network/admin/listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = pc01prmy_DGMGRL.us.oracle.com)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = pc01prmy)
)
)

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST =
edBVr6p1.us.oracle.com)(PORT = 1521))
)
)

ADR_BASE_LISTENER = /u01/app/oracle

ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER = ON




Oracle Database 11g: Data Guard Administration A - 39
Practice 4-3: Configuring Listener to Allow Data Guard Broker to
Restart Standby Database Instance Server Setup
In this practice, you define a listener service for the standby database that includes the
db_unique_name_DGMGRL.db_domain value for GLOBAL_DBNAME.
Note: Be sure to verify the information you enter into fields in Oracle Net Manager
before proceeding to the next page.
1) Open a terminal window to the system that your standby database is on. Launch
Oracle Net Manager.
[oracle@EDBVR6P1-pc01prmy labs]$ xhost +
access control disabled, clients can connect from any host
[oracle@EDBVR6P1-pc01prmy labs]$ ssh edbvr6p2
oracle@edbvr6p2's password: oracle
Last login: Tue Feb 9 18:46:41 2010 from
edbvr6p1.us.oracle.com
[oracle@EDBVR6P2- ~]$ . oraenv
ORACLE_SID = [oracle] ? pc01sby1
The Oracle base for
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is
/u01/app/oracle
[oracle@EDBVR6P2-pc01sby1 ~]$ export DISPLAY=edbvr6p1:2
[oracle@EDBVR6P2-pc01sby1 ~]$ netmgr
2) Expand Local.
3) Expand Listeners.
4) Select LISTENER1.
5) Select Database Services in the list.
6) Click Add Database.
7) Enter pc<nn>sby1_DGMGRL.us.oracle.com in the Global Database Name
field. Accept the default value for the Oracle Home Directory. Enter pc<nn>sby1
in the SID field.
Practice 4-3: Configuring Listener to Allow Data Guard Broker to
Restart Standby Database Instance Server Setup (continued)
Oracle Database 11g: Data Guard Administration A - 40

8) Select File > Save Network Configuration.
9) Select File > Exit.
10) Shut down the LISTENER1 listener. Restart the LISTENER1 listener.
[oracle@EDBVR6P2-pc01sby1 ~]$ lsnrctl stop listener1

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 09-FEB-
2010 18:57:51

Copyright (c) 1991, 2009, Oracle. All rights reserved.

Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=edbvr6p2.us.oracle.c
om)(PORT=12001)))
The command completed successfully
[oracle@EDBVR6P2-pc01sby1 ~]$ lsnrctl start listener1

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 09-FEB-
2010 18:57:59

Copyright (c) 1991, 2009, Oracle. All rights reserved.

Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr:
please wait...

TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is
/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener
.ora
Practice 4-3: Configuring Listener to Allow Data Guard Broker to
Restart Standby Database Instance Server Setup (continued)
Oracle Database 11g: Data Guard Administration A - 41
Log messages written to
/u01/app/oracle/diag/tnslsnr/EDBVR6P2/listener1/alert/log.xml
Listening on:
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=edBVr6p2.us.oracle.c
om)(PORT=12001)))

Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=edbvr6p2.us.oracle.c
om)(PORT=12001)))
STATUS of the LISTENER
------------------------
Alias listener1
Version TNSLSNR for Linux: Version
11.2.0.1.0 - Production
Start Date 09-FEB-2010 18:57:59
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File
/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener
.ora
Listener Log File
/u01/app/oracle/diag/tnslsnr/EDBVR6P2/listener1/alert/log.xml
Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=edBVr6p2.us.oracle.c
om)(PORT=12001)))
Services Summary...
Service "pc01sby1.us.oracle.com" has 1 instance(s).
Instance "pc01sby1", status UNKNOWN, has 1 handler(s) for
this service...
Service "pc01sby1_DGMGRL.us.oracle.com" has 1 instance(s).
Instance "pc01sby1", status UNKNOWN, has 1 handler(s) for
this service...
The command completed successfully
[oracle@EDBVR6P2-pc01sby1 ~]$
11) Ensure that your listener.ora file (in $ORACLE_HOME/network/admin)
contains entries similar to the following:
[oracle@EDBVR6P2-pc01sby1 ~]$ cat
$ORACLE_HOME/network/admin/listener.ora

# listener.ora Network Configuration File:
/u01/app/oracle/product/11.2.0/dbhome
_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER1 =
(DESCRIPTION =
Practice 4-3: Configuring Listener to Allow Data Guard Broker to
Restart Standby Database Instance Server Setup (continued)
Oracle Database 11g: Data Guard Administration A - 42
(ADDRESS = (PROTOCOL = TCP)(HOST =
edbvr6p2.us.oracle.com)(PORT = 12001))
)

SID_LIST_LISTENER1 =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = pc01sby1.us.oracle.com)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = pc01sby1)
)
(SID_DESC =
(GLOBAL_DBNAME = pc01sby1_DGMGRL.us.oracle.com)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = pc01sby1)
)
)

ADR_BASE_LISTENER1 = /u01/app/oracle


Oracle Database 11g: Data Guard Administration A - 43
Practice 4-4: Creating an Oracle Net Service Name to Allow
Standby Database Instance to Connect to Primary Database
Instance Client Setup
In this practice, you define an Oracle Net service name for the primary database on the
system on which your physical standby database is created.
Note: Be sure to verify the information you enter into fields in Oracle Net Manager
before proceeding to the next page.
1) On the system on which your physical standby database is created, invoke Oracle Net
Manager.
2) Expand Local. Select Service Naming and click the green plus sign in the left
navigation pane.
3) Enter pc<nn>prmy in the Net Service Name field and click Next.

4) Select TCP/IP (Internet Protocol) and click Next.
5) Enter the fully qualified host name of the machine that your primary database is on
with a port number of 1521 and click Next. The screenshot shows an example. Be
sure to enter the host name that you are using.


Practice 4-4: Creating an Oracle Net Service Name to Allow
Standby Database Instance to Connect to Primary Database
Instance Client Setup (continued)
Oracle Database 11g: Data Guard Administration A - 44


6) Enter pc<nn>prmy.us.oracle.com in the Service Name field and click Next.

7) Click Finish.
8) Select File > Save Network Configuration to save the information to the
tnsnames.ora file.
Practice 4-4: Creating an Oracle Net Service Name to Allow
Standby Database Instance to Connect to Primary Database
Instance Client Setup (continued)
Oracle Database 11g: Data Guard Administration A - 45
9) Exit Oracle Net Manager.
10) Ensure that your tnsnames.ora file has entries similar to the following:
[oracle@EDBVR6P2-pc01sby1 ~]$ cat
$ORACLE_HOME/network/admin/tnsnames.ora

# tnsnames.ora Network Configuration File:
/u01/app/oracle/product/11.2.0/dbhome
_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

PC02PRMY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
edbvr6p2.us.oracle.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pc02prmy.us.oracle.com)
)
)

PC01PRMY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
edbvr6p1.us.oracle.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = pc01prmy.us.oracle.com)
)
)

PC02DB11 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
edbvr6p2.us.oracle.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pc02db11.us.oracle.com)
)
)

[oracle@EDBVR6P2-pc01sby1 ~]$


Oracle Database 11g: Data Guard Administration A - 46
Practice 4-5: Creating an Oracle Net Service Name for the
Standby Database for Non-Standard Dynamic Registration
In this practice, you define an Oracle Net service name for the standby database on the
system on which the standby database is created.
Note: Be sure to verify the information you enter into fields in Oracle Net Manager
before proceeding to the next page.
1) On the system on which your physical standby database is created, invoke Oracle Net
Manager.
2) Expand Local. Select Service Naming and click the green plus sign.
3) Enter pc<nn>sby1 in the Net Service Name field and click Next.

4) Select TCP/IP (Internet Protocol) and click Next.
5) Enter the fully qualified host name of the machine that your physical standby
database is on. Change the port number to 12001. Click Next.

Practice 4-5: Creating an Oracle Net Service Name for the
Standby Database for Non-Standard Dynamic Registration
(continued)
Oracle Database 11g: Data Guard Administration A - 47

6) Enter pc<nn>sby1.us.oracle.com in the Service Name field and click Next.

7) Click Finish.
8) Select File > Save Network Configuration to save the information to the
tnsnames.ora file.
9) Exit Oracle Net Manager.
Practice 4-5: Creating an Oracle Net Service Name for the
Standby Database for Non-Standard Dynamic Registration
(continued)
Oracle Database 11g: Data Guard Administration A - 48
10) Ensure that your tnsnames.ora file has entries similar to the following:
[oracle@EDBVR6P2-pc01sby1 ~]$ cat
$ORACLE_HOME/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File:
/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames
.ora
# Generated by Oracle configuration tools.

PC02PRMY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
edbvr6p2.us.oracle.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pc02prmy.us.oracle.com)
)
)

PC01PRMY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
edbvr6p1.us.oracle.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = pc01prmy.us.oracle.com)
)
)

PC02DB11 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
edbvr6p2.us.oracle.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pc02db11.us.oracle.com)
)
)

PC01SBY1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
edbvr6p2.us.oracle.com)(PORT = 12001))
Practice 4-5: Creating an Oracle Net Service Name for the
Standby Database for Non-Standard Dynamic Registration
(continued)
Oracle Database 11g: Data Guard Administration A - 49
)
(CONNECT_DATA =
(SERVICE_NAME = pc01sby1.us.oracle.com)
)
)

[oracle@EDBVR6P2-pc01sby1 ~]$
11) Invoke SQL*Plus for your physical standby database and set the LOCAL_LISTENER
parameter to pc<nn>sby1. Be sure to set the ORACLE_SID environment variable
to pc<nn>sby1 before invoking SQL*Plus.
[oracle@EDBVR6P2-pc01sby1 ~]$ echo $ORACLE_SID
pc01sby1
[oracle@EDBVR6P2-pc01sby1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 9 19:14:59
2010

Copyright (c) 1982, 2009, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -
Production
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining
and Real Application Testing options

SQL> alter system set local_listener=pc01sby1;

System altered.

SQL> exit


Oracle Database 11g: Data Guard Administration A - 50
Practice 4-6: Creating the Broker Configuration
In this practice, you create a Data Guard broker configuration.
1) On your primary database system, invoke DGMGRL and connect to your primary
database.
[oracle@EDBVR6P1-pc01prmy labs]$ dgmgrl
DGMGRL for Linux: Version 11.2.0.1.0 - Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/oracle_4U
Connected.
DGMGRL>
2) Create a broker configuration named DGConfig1 and include a profile for the
primary database.
DGMGRL> create configuration 'DGConfig1' as
> primary database is 'pc01prmy'
> connect identifier is pc01prmy;
Configuration "DGConfig1" created with primary database
"pc01prmy"
DGMGRL>
3) Display information about the configuration.
DGMGRL> show configuration

Configuration - DGConfig1

Protection Mode: MaxPerformance
Databases:
pc01prmy - Primary database

Fast-Start Failover: DISABLED

Configuration Status:
DISABLED

DGMGRL>
4) Add your physical standby database to the broker configuration.
DGMGRL> add database 'pc01sby1' as
> connect identifier is pc01sby1;
Database "pc01sby1" added
DGMGRL>
Practice 4-6: Creating the Broker Configuration (continued)
Oracle Database 11g: Data Guard Administration A - 51
5) Verify that the pc<nn>sby1 database was added to the configuration.
DGMGRL> show configuration

Configuration - DGConfig1

Protection Mode: MaxPerformance
Databases:
pc01prmy - Primary database
pc01sby1 - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
DISABLED

DGMGRL>



Oracle Database 11g: Data Guard Administration A - 52
Practice 4-7: Enabling the Broker Configuration
In this practice, you enable the broker configuration.
1) Enable the entire configuration.
DGMGRL> enable configuration;
Enabled.
2) Verify that the configuration was successfully enabled. If you receive a warning
message (WARNING: ORA-16610 Set Property in Progress) or
(WARNING: ORA-16610 Command "Broken automatic health
check" in Progress), wait for a few minutes and issue the SHOW
CONFIGURATION command again.
DGMGRL> show configuration

Configuration - DGConfig1

Protection Mode: MaxPerformance
Databases:
pc01prmy - Primary database
pc01sby1 - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

DGMGRL> exit
[oracle@EDBVR6P1-pc01prmy labs]$

Note: If you receive one of the following messages Warning: ORA-16607: one
or more databases have failed or Warning: ORA-16792:
configurable property value is inconsistent with database
setting, you may need to restart one or both of your database instances. Discuss your
situation with your course instructor.

Oracle Database 11g: Data Guard Administration A - 53
Practices for Lesson 5: Creating a Physical Standby
Database by Using Enterprise Manager Grid Control
In the practices for Lesson 5, Creating a Physical Standby Database by Using Enterprise
Manager Grid Control, you use Enterprise Manager Grid Control to create a physical
standby database.

Oracle Database 11g: Data Guard Administration A - 54
Practice 5-1: Installing the Oracle Management Agent
In this practice, you install the Oracle Management Agent so that you can use Enterprise
Manager Grid Control. The Oracle Management Agent was installed with Enterprise
Manager 10.2.0.1.0 on the Grid Control Server, and then the 10.2.0.5.0 patch was applied
to AGENT_HOME along with the agent merge patch 9138201. You will be using the
cloning technique to install the Oracle Management Agent on your machine. The entire
AGENT_HOME from a successful installation of the Grid Control Server has been
compressed and stored in the /stage/10.2.0.5.0/agent directory on your
machine.

Your instructor will provide the name of the machine that Enterprise Manager Grid
Control is installed on. Record the name of the machine here and in step 7:
______________________________________________________________________
1) On your primary database host machine, open a terminal window and log on as the
oracle user with a password of oracle. Verify that you have not set environment
variables such as ORACLE_HOME or ORACLE_SID pointed to the database software.
Use the "unset ORACLE_HOME" command to remove them.
[oracle@EDBVR6P1- ~]$ set | grep ORA
ORACLE_BASE=/u01/app/oracle
PS1='[\u@\h-`echo $ORACLE_SID` \W]$ '
2) Change directories to the root ( / ) file system and uncompress the stage Oracle
Management Agent software. Note: You must be in the root ( / ) file system to ensure
that the uncompressed software goes into the correct directories.
[oracle@EDBVR6P1- ~]$ cd /
[oracle@EDBVR6P1- /]$ tar zxvf
/stage/10.2.0.5.0/agent/agent.tar.gz
..
..
u01/app/oracle/OracleHomes/agent10g/rdbms/install/
u01/app/oracle/OracleHomes/agent10g/rdbms/install/sbs/
u01/app/oracle/OracleHomes/agent10g/rdbms/install/sbs/olsadmin
tool.sbs
u01/app/oracle/OracleHomes/agent10g/rdbms/install/sbs/olsoidsy
nc.sbs
[oracle@EDBVR6P1- /]$
3) Remove all files in the upload and state directories for the cloned Oracle Management
Agent. You can use the clean_agent_dir.sh script to perform this step.
[oracle@EDBVR6P1- /]$ cd $HOME/labs
[oracle@EDBVR6P1- labs]$ ./clean_agent_dirs.sh
rm: cannot remove
`/u01/app/oracle/OracleHomes/agent10g/sysman/emd/state/storage
': Is a directory

or you may execute the individual commands

Practice 5-1: Installing the Oracle Management Agent
(continued)
Oracle Database 11g: Data Guard Administration A - 55
[oracle@EDBVR6P1- /]$ rm
/u01/app/oracle/OracleHomes/agent10g/sysman/emd/upload/*
[oracle@EDBVR6P1- /]$
[oracle@EDBVR6P1- /]$ rm
/u01/app/oracle/OracleHomes/agent10g/sysman/emd/state/*
rm: cannot remove
`/u01/app/oracle/OracleHomes/agent10g/sysman/emd/state/storage
': Is a directory
[oracle@EDBVR6P1- /]$
4) Use the Oracle Universal Installer to perform the clone installation of the Oracle
Management Agent. You can use the oui_agent.sh script to perform this step:
[oracle@EDBVR6P1- labs]$ ./oui_agent.sh

Or you may execute the individual command

[oracle@EDBVR6P1- /]$
/u01/app/oracle/OracleHomes/agent10g/oui/bin/runInstaller
-clone -forceClone
ORACLE_HOME=/u01/app/oracle/OracleHomes/agent10g
ORACLE_HOME_NAME=OHOME1 -noconfig silent
b_chainedInstall=false
oracle.sysman.top.agent:s_installType=AGENT
..
..
.. <Output Truncated>
--------------------------------------
The cloning of OHOME1 was successful.
Please check '/u01/app/oraInventory/logs/cloneActions2010-02-
09_07-29-41PM.log' for more details.
5) Use a text editor to modify the emd.properties file and change the URL for the
Grid Control Server to the one used in the classroom. Your instructor can provide you
with the address. You can turn on line numbers in the vi utility with the command
":set number". Change the value of REPOSITORY_URL (around line number
34) and emdWalletSrcUrl (around line number 158) to the Grid Control Server
address provided by your instructor. Save your changes after editing the file.
[oracle@EDBVR6P1- labs]$ vi
/u01/app/oracle/OracleHomes/agent10g/sysman/config/emd.propert
ies
..
33 #
34 REPOSITORY_URL=http://vx0326.us.oracle.com:4889/em/upload
35
..
..
157 #
158 emdWalletSrcUrl =
http://vx0326.us.oracle.com:4889/em/wallets/emd
Practice 5-1: Installing the Oracle Management Agent
(continued)
Oracle Database 11g: Data Guard Administration A - 56
159 emdWalletDest =
/u01/app/oracle/OracleHomes/agent10g/sysman/config/server
6) Run the root.sh script from the Oracle home directory of the Management Agent.
Note: Do not overwrite the files in the /usr/local/bin directory because the
versions in the Agent home are 10g versions, and the installed scripts are 11g
versions.
[oracle@EDBVR6P1- labs]$ su -
Password: oracle
[root@EDBVR6P1 ~]#
/u01/app/oracle/OracleHomes/agent10g/root.sh
Running Oracle10 root.sh script...

The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/OracleHomes/agent10g

Enter the full pathname of the local bin directory:
[/usr/local/bin]:
The file "dbhome" already exists in /usr/local/bin. Overwrite
it? (y/n)
[n]:
The file "oraenv" already exists in /usr/local/bin. Overwrite
it? (y/n)
[n]:
The file "coraenv" already exists in /usr/local/bin.
Overwrite it? (y/n)
[n]:

Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
Finished product-specific root actions.
Finished product-specific root actions.

[root@EDBVR6P1 ~]# exit

7) Run the Agent Configuration Assistant utility (agentca) with the reconfigure
option (-f).
[oracle@EDBVR6P1- labs]$
/u01/app/oracle/OracleHomes/agent10g/bin/agentca f

Stopping the agent using
/u01/app/oracle/OracleHomes/agent10g/bin/emctl stop agent
Oracle Enterprise Manager 10g Release 5 Grid Control
10.2.0.5.0.
Practice 5-1: Installing the Oracle Management Agent
(continued)
Oracle Database 11g: Data Guard Administration A - 57
Copyright (c) 1996, 2009 Oracle Corporation. All rights
reserved.
Running agentca using
/u01/app/oracle/OracleHomes/agent10g/oui/bin/runConfig.sh
ORACLE_HOME=/u01/app/oracle/OracleHomes/agent10g
ACTION=Configure MODE=Perform
RESPONSE_FILE=/u01/app/oracle/OracleHomes/agent10g/response_fi
le RERUN=TRUE
INV_PTR_LOC=/u01/app/oracle/OracleHomes/agent10g/oraInst.loc
COMPONENT_XML={oracle.sysman.top.agent.10_2_0_1_0.xml}
Perform - mode is starting for action: Configure


Perform - mode finished for action: Configure

You can see the log file:
/u01/app/oracle/OracleHomes/agent10g/cfgtoollogs/oui/configAct
ions2010-02-09_07-34-56-PM.log
[oracle@EDBVR6P1- labs]$
8) Set up the environment variables for the Agent home and secure the agent. The
/usr/local/bin/agent.env script has been provided to assist in setting the
environment variables.
[oracle@EDBVR6P1- labs]$ . agent.env
[oracle@EDBVR6P1- labs]$ emctl secure agent
Oracle Enterprise Manager 10g Release 5 Grid Control
10.2.0.5.0.
Copyright (c) 1996, 2009 Oracle Corporation. All rights
reserved.
Agent successfully stopped... Done.
Securing agent... Started.
Enter Agent Registration Password : oracle1
Agent successfully restarted... Done.
Securing agent... Successful.
[oracle@EDBVR6P1- labs]$
9) Verify that the agent is running. Continue to reexecute the 'emctl status
agent' command until Number of XML files pending upload goes to
zero.
[oracle@EDBVR6P1- labs]$ emctl status agent
Oracle Enterprise Manager 10g Release 5 Grid Control
10.2.0.5.0.
Copyright (c) 1996, 2009 Oracle Corporation. All rights
reserved.
--------------------------------------------------------------
-
Agent Version : 10.2.0.5.0
OMS Version : 10.2.0.5.0
Protocol Version : 10.2.0.5.0
Practice 5-1: Installing the Oracle Management Agent
(continued)
Oracle Database 11g: Data Guard Administration A - 58
Agent Home : /u01/app/oracle/OracleHomes/agent10g
Agent binaries : /u01/app/oracle/OracleHomes/agent10g
Agent Process ID : 31034
Parent Process ID : 31014
Agent URL :
https://edBVr6p1.us.oracle.com:3872/emd/main/
Repository URL :
https://vx0326.us.oracle.com:1159/em/upload
Started at : 2010-04-06 18:16:43
Started by user : oracle
Last Reload : 2010-04-06 18:16:43
Last successful upload : 2010-04-06
18:19:23
Total Megabytes of XML files uploaded so far : 10.49
Number of XML files pending upload : 0
Size of XML files pending upload(MB) : 0.00
Available disk space on upload filesystem : 59.61%
Last successful heartbeat to OMS : 2010-04-06
18:18:47
--------------------------------------------------------------
-
Agent is Running and Ready

Oracle Database 11g: Data Guard Administration A - 59
Practice 5-2: Configuring Monitoring Credentials for Your
Primary Database
In this practice, you configure monitoring credentials for your primary database.
1) Open your browser and invoke Enterprise Manager by entering the following URL:
http://<oms_host>:4889/em
2) Log in to Enterprise Manager Grid Control with a username of SYSMAN and
password of oracle1.
3) The Grid Control home page appears. Click the Targets tab.
4) The Hosts page appears. Ensure that your primary database host appears in the list.
Click Databases.
5) The Databases page appears. Select the Search List option. Select your primary
database from the list of databases (by clicking the option button and not the database
name link) and click Configure.
6) Select sysdba in the Role list. Enter sys in the Monitor Username field. Enter
oracle_4U in the Monitor Password field. Click Test Connection.
7) After you receive a message that the connection test was successful, click Next.
8) The Configure Database Instance: Review page appears. Click Submit on this page.
9) A page displays the message Target saving is in progress.
10) You receive a message that the properties were updated. Click OK.
11) The Databases page is updated with the status for your configured database. Ensure
that the status for your database is Up before proceeding to the next practice.
12) Repeat steps 5 through 11 for the pc<nn>db11 database.




Oracle Database 11g: Data Guard Administration A - 60
Practice 5-3: Configuring Monitoring Credentials for Your
Standby Database
In this practice, you configure credentials for monitoring your standby database.

Note: Before beginning this practice, you must confirm that the Oracle Management
Agent is successfully installed on your standby database host.
1) On the Databases page, select your standby database (by clicking the option button)
and click Configure.
2) Select SYSDBA in the Role list. Enter sys in the Monitor Username field and
oracle_4U in the Monitor Password field. Enter 12001 in the Port field.
3) Click Test Connection. You should receive a message indicating that the connection
test was successful. Click Next.
4) On the Configure Database Instance: Review page, click Submit. A page displays the
message Target saving is in progress.
5) The Database Instance Configuration Result page appears. Click OK.
6) You are returned to the Databases page. Ensure that the status for your database is
Up before proceeding to the next practice."

Oracle Database 11g: Data Guard Administration A - 61
Practice 5-4: Configuring Preferred Credentials for Your Host
Machine
In this practice, you configure the preferred credentials for your host machine.
1) On the home page, click Preferences at the top-right corner of the page.
2) Click Preferred Credentials from the Preferences menu.
3) Click the Set Credentials Icon for the Host Target Type.
4) Under the Target Credentials sections, enter the following for your primary database
host machine:
a) Normal Username: oracle
b) Normal Password: oracle
c) Privileged Username: root
d) Privileged Password: oracle
5) Click Test to verify the credentials.
6) Click Apply to save the credentials if verification was successful.

Oracle Database 11g: Data Guard Administration A - 62
Practice 5-5: Adding a Physical Standby Database to Your
Configuration
In this practice, you add a new physical standby database to your configuration by using
Enterprise Manager Grid Control. Note: The agent must be running on your standby
host machine before you can continue with this step!
1) Select your primary database by clicking the link on the Databases page.
2) Click Availability. Select Setup and Manage in the Data Guard section of the
Availability page.
3) Enter database login credentials (sys/oracle_4U as sysdba) if requested. Click
on the box to save as preferred credentials.
4) Click Add Standby Database.

5) On the Add Standby Database page, select Create a new physical standby database
and click Continue.

Practice 5-5: Adding a Physical Standby Database to Your
Configuration (continued)
Oracle Database 11g: Data Guard Administration A - 63

6) On the Add Standby Database: Backup Type page, select Perform an online backup
of the primary database with Use Recovery Manager (RMAN) to copy datafiles,
and click Next.


Practice 5-5: Adding a Physical Standby Database to Your
Configuration (continued)
Oracle Database 11g: Data Guard Administration A - 64
7) On the Add Standby Database: Backup Options page, accept the default number of
Concurrent File Copy Processes. Enter the Primary Host Credentials (Username:
oracle and Password: oracle) and select Save as Preferred Credential. Click
Next.

8) On the Add Standby Database: Database Location page, enter pc<nn>sby2 in the
Instance Name field. Select the same host that you used for your other physical
standby database using the flashlight icon. Select the Oracle Database software home
and not the Grid Infrastructure software home. Enter the Standby Host Credentials
(Username: oracle and Password: oracle) if needed, and select Save as
Preferred Credential. Click Next.
Practice 5-5: Adding a Physical Standby Database to Your
Configuration (continued)
Oracle Database 11g: Data Guard Administration A - 65

9) On the Add Standby Database: ASM Instance Login page, enter the SYS password
for the ASM instance on the standby host (Password: oracle_4U) and click Login.

Practice 5-5: Adding a Physical Standby Database to Your
Configuration (continued)
Oracle Database 11g: Data Guard Administration A - 66

10) In the Standby Database File Locations section, select the SBDAT ASM disk group
for the Database Area using the flashlight icon. Select the SBFRA ASM disk group
for the Flash Recovery Area using the flashlight icon. Leave all other settings at the
default value and click Next.

Practice 5-5: Adding a Physical Standby Database to Your
Configuration (continued)
Oracle Database 11g: Data Guard Administration A - 67

11) On the Add Standby Database Configuration page, enter pc<nn>sby2 in the
Database Unique Name and Target Name fields. Select Use SYSDBA monitoring
credentials and click Next.

Practice 5-5: Adding a Physical Standby Database to Your
Configuration (continued)
Oracle Database 11g: Data Guard Administration A - 68

Practice 5-5: Adding a Physical Standby Database to Your
Configuration (continued)
Oracle Database 11g: Data Guard Administration A - 69

12) On the Add Standby Database Review page, review the information about the
standby database to be created. If you are satisfied with the configuration information,
click Finish or click Back to make changes. The Processing: Add Standby Database
page appears.

Note: If Enterprise Manager remains on this page for more than 10 minutes, click the
Jobs tab to verify that the job is started.

Practice 5-5: Adding a Physical Standby Database to Your
Configuration (continued)
Oracle Database 11g: Data Guard Administration A - 70

13) You are returned to the Data Guard Overview page. Select Real Time: 1 Minute
Refresh in the View Data list to easily view the progress of standby database
creation. You can also click the Creation in progress link to monitor standby
database creation.

Practice 5-5: Adding a Physical Standby Database to Your
Configuration (continued)
Oracle Database 11g: Data Guard Administration A - 71

14) After the standby database creation is completed, note that the new physical standby
database is listed in the Standby Databases section.





Oracle Database 11g: Data Guard Administration A - 72
Practice 5-6: Verifying the Broker Configuration
In this practice, you use Enterprise Manager Grid Control to verify your configuration.
1) In the Additional Administration section of the Data Guard Overview page, click
Verify Configuration. The Processing: Verify page is displayed. The Processing:
Verify Completed page displays the results of the verify operation.




Practice 5-6: Verifying the Broker Configuration (continued)
Oracle Database 11g: Data Guard Administration A - 73


2) Click OK to return to the Data Guard Overview page.
3) As indicated in the Detailed Results pane, you must verify a second time. Click
Verify Configuration.
Practice 5-6: Verifying the Broker Configuration (continued)
Oracle Database 11g: Data Guard Administration A - 74



Oracle Database 11g: Data Guard Administration A - 75
Practice 5-7: Deleting the Database
In this practice, you delete the pc<nn>sby2 database in preparation for later practices.

1) Select your pc<nn>sby2 database (by clicking the option button) on the Data
Guard Overview page and click Remove to remove your pc<nn>sby2 database
from Data Guard broker control.

2) On the Confirmation page, click Yes. You receive a confirmation message that the
database has been removed from the Data Guard configuration.

Practice 5-7: Deleting the Database (continued)
Oracle Database 11g: Data Guard Administration A - 76



3) Click the Databases tab to return to the Databases page.
4) Click the link for your pc<nn>sby2 database.
5) The database home page is displayed. Click the Shutdown button to shut down your
pc<nn>sby2 database instance.
6) Enter the host credentials (Username: oracle, Password: oracle) and the
database credentials (Username: sys, Password: oracle_4U). Click OK.
7) On the Startup/Shutdown: Specify Operation page, select Shutdown the database
and click Continue.

8) Click Yes to confirm the shutdown operation. The Startup/Shutdown: Activity
Information page is displayed.
Practice 5-7: Deleting the Database (continued)
Oracle Database 11g: Data Guard Administration A - 77
9) When the shutdown operation is complete, you are returned to the database home
page. You receive a message that your database has been shut down. Click the
Databases tab to return to the Databases page.


Oracle Database 11g: Data Guard Administration A - 78
Practices for Lesson 6: Creating a Logical Standby
Database

In the practices for Lesson 6, Creating a Logical Standby Database, you use Enterprise
Manager Grid Control to create a logical standby database.

Oracle Database 11g: Data Guard Administration A - 79
Practice 6-1: Creating a Logical Standby Database
In this practice, you create a logical standby database and add it to your configuration.
1) Select your primary database on the Databases pages.
2) Select Setup and Manage in the Data Guard section of the Availability page.
3) Click Add Standby Database.
4) On the Add Standby Database page, select Create a new logical standby database
and click Continue.

5) In the Add Standby Database: Backup Type section, accept the default of Perform an
online backup of the primary database and to Use Recovery Manager (RMAN)
to copy database files. In the SQL Apply Unsupported Tables section, select Table
Columns and Data Types in the list and click Go to see the unsupported tables.
6) For this practice, you can accept the unsupported columns. Click Next.

Practice 6-1: Creating a Logical Standby Database (continued)
Oracle Database 11g: Data Guard Administration A - 80

7) On the Add Standby Database: Backup Options page, accept the default number of
Concurrent File Copy Processes. Enter the Primary Host Credentials (Username:
oracle and Password: oracle) and select Save as Preferred Credential. Click
Next.
8) On the Add Standby Database: Database Location page, enter pc<nn>sby3 in the
Instance Name field. Select the same host that you used for your physical standby
databases using the flashlight icon. Enter the Standby Host Credentials (Username:
oracle and Password: oracle) and select Save as Preferred Credential. Click
Next.
9) On the Add Standby Database: ASM Instance Login page, enter the password for the
SYS user (Password: oracle_4U) for the ASM instance on the standby host. Click
Login.
10) On the Add Standby Database: File Locations page, in the Standby Database File
Locations section, select the SBDAT ASM disk group for the Database Area using the
flashlight icon. Select the SBFRA ASM disk group for the Flash Recovery Area using
the flashlight icon. Leave all other settings at the default value and click Next.
11) On the Add Standby Database Configuration page, enter pc<nn>sby3 in the
Database Name, Database Unique Name, and Target Name fields. Select the Use
SYSDBA monitoring credentials option. Click Next.
Practice 6-1: Creating a Logical Standby Database (continued)
Oracle Database 11g: Data Guard Administration A - 81

12) On the Add Standby Database Review page, review the information about the logical
standby database to be created. If you are satisfied with the configuration information,
click Finish. Otherwise, click Back to make changes. The Processing: Add Standby
Database page appears.

Practice 6-1: Creating a Logical Standby Database (continued)
Oracle Database 11g: Data Guard Administration A - 82


13) You are returned to the Data Guard Overview page. Select Real Time: 1 Minute
Refresh in the View Data list to easily view the progress of the logical standby
database creation.
14) After the standby database creation is completed, the new logical standby database is
listed in the Standby Databases section. Proceed to the next step when the status for
your logical standby database is Normal. Note: The Data Guard Status may show
normal, and then return to Creation in Progress twice. The creation job should be
finished when the Data Guard Status is normal and both the Last Received Log and
Last Applied Log both show the status.




Practice 6-1: Creating a Logical Standby Database (continued)
Oracle Database 11g: Data Guard Administration A - 83



15) Verify your configuration by clicking Verify Configuration.
16) Click OK to return to the Data Guard page.




Oracle Database 11g: Data Guard Administration A - 84
Practice 6-2: Implementing SQL Apply Filtering
In this practice, you test SQL Apply filtering. Because the users want to use some tables
in the logical standby database to report against for historical purposes, you need to
configure SQL Apply so that certain DML statements are not executed against those
tables on the logical standby database. You decide to test this feature by creating a new
table on the primary database.
1) Open a terminal window for your primary database and change to the labs
directory. Use the oraenv utility to set the environment variables for the primary
database.
[oracle@EDBVR6P1- ~]$ cd $HOME/labs
[oracle@EDBVR6P1- labs]$ . oraenv
ORACLE_SID = [oracle] ? pc01prmy
The Oracle base for
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is
/u01/app/oracle
[oracle@EDBVR6P1-pc01prmy labs]$
2) Invoke SQL*Plus and connect as the hr user (Password: hr).
[oracle@EDBVR6P1-pc01prmy labs]$ sqlplus hr/hr

SQL*Plus: Release 11.2.0.1.0 Production on Thu Feb 11 20:16:44
2010

Copyright (c) 1982, 2009, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -
Production
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining
and Real Application Testing options

SQL>
3) Execute the cr_emp_name.sql script to create a table named HR.EMP_NAME.
You use this table to test the SQL Apply filtering feature. Exit SQL*Plus.
SQL> @cr_emp_name
SQL> CREATE TABLE hr.emp_name
2 AS SELECT first_name, last_name
3 FROM hr.employees
4 WHERE 1=2
5 /

Table created.
4) Return to Enterprise Manager Grid Control and navigate to the Data Guard page.
5) Select your logical standby database and click Edit.
Practice 6-2: Implementing SQL Apply Filtering (continued)
Oracle Database 11g: Data Guard Administration A - 85
6) Click Standby Role Properties.
7) Expand Show Advanced Properties.


8) Click Add in the Skip Table Entries section.





















Practice 6-2: Implementing SQL Apply Filtering (continued)
Oracle Database 11g: Data Guard Administration A - 86

9) Enter information as shown in the following screen so that SQL Apply does not
execute DML statements for the HR.EMP_NAME table:


10) Click OK.
11) Verify the information in the Skip Table Entries section and click Apply. A success
message is displayed.

Practice 6-2: Implementing SQL Apply Filtering (continued)
Oracle Database 11g: Data Guard Administration A - 87



12) In your primary database session, log in to DGMGRL as the SYS user.
13) Verify the setting of the LsbyASkipCfgPr property. Exit DGMGRL.
DGMGRL> show database pc01sby3 LsbyAskipCfgPr;
LsbyASkipCfgPr = ''DML', 'HR', 'EMP_NAME', null'
14) In your primary database session, log in to SQL*Plus as the HR user again. Execute
the ins_emp_name.sql script to insert two rows in the HR.EMP_NAME table.
SQL> @ins_emp_name
SQL> INSERT INTO hr.emp_name
2 VALUES ('Mark', 'Fuller')
3 /

1 row created.

SQL> INSERT INTO hr.emp_name
2 VALUES ('Donna', 'Keesling')
3 /

1 row created.

SQL> COMMIT
2 /

Commit complete.
15) Connect to your primary database as the SYSDBA user.
SQL> connect / as sysdba
Connected.
16) Force a log switch on your primary database.
SQL> alter system switch logfile;

System altered.
Practice 6-2: Implementing SQL Apply Filtering (continued)
Oracle Database 11g: Data Guard Administration A - 88
17) Open a terminal window and ssh to the machine that your standby database is on.
Log in as the oracle user with a password of oracle.
18) Change to the labs directory. Use the oraenv utility to set the environment
variables to pc<nn>sby3.
[oracle@EDBVR6P2- ~]$ . oraenv
ORACLE_SID = [oracle] ? pc01sby3
The Oracle base for
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is
/u01/app/oracle
[oracle@EDBVR6P2-pc01sby3 ~]$
19) Invoke SQL*Plus on your logical standby database and log in as the HR user.
[oracle@EDBVR6P2-pc01sby3 ~]$ sqlplus hr/hr

SQL*Plus: Release 11.2.0.1.0 Production on Thu Feb 11 20:31:50
2010

Copyright (c) 1982, 2009, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -
Production
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining
and Real Application Testing options

SQL>
20) Query the HR.EMP_NAME table to verify that no rows were inserted in the table.
SQL> SELECT count(*) FROM emp_name;

COUNT(*)
----------
0
21) Exit SQL*Plus on your standby database.


Oracle Database 11g: Data Guard Administration A - 89
Practices for Lesson 7: Creating and Managing a
Snapshot Standby Database
In the practices for Lesson 7, Creating and Managing a Snapshot Standby Database,
you create a snapshot standby database.

Oracle Database 11g: Data Guard Administration A - 90
Practice 7-1: Verifying Flashback Database on the Physical
Standby Database
In this practice, you verify that Flashback Database is configured on your physical
standby database.
1) On the system that your physical standby database is on, invoke SQL*Plus and
connect as the SYSDBA user.
[oracle@EDBVR6P2- ~]$ . oraenv
ORACLE_SID = [oracle] ? pc01sby1
The Oracle base for
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is
/u01/app/oracle
[oracle@EDBVR6P2-pc01sby1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Fri Feb 12 13:34:14
2010

Copyright (c) 1982, 2009, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -
Production
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining
and Real Application Testing options
2) Determine if Flashback Database is enabled for the physical standby database by
querying V$DATABASE. Exit SQL*Plus.
SQL> select flashback_on from v$database;

FLASHBACK_ON
------------------
NO
3) If Flashback Database is enabled, proceed to Practice 7-2.
4) If Flashback Database is not enabled for the physical standby database, enable it by
using the ALTER DATABASE command.
a) Invoke DGMGRL and connect as user sys with password oracle. Disable
Redo Apply (the MRP process).
DGMGRL> connect sys/oracle_4U
Connected.
DGMGRL> edit database 'pc01sby1' set state='apply-off';
Succeeded.
DGMGRL> exit
Practice 7-1: Verifying Flashback Database on the Physical
Standby Database (continued)
Oracle Database 11g: Data Guard Administration A - 91
b) Invoke SQL*Plus and connect as SYSDBA. Execute the ALTER DATABASE
command to enable Flashback Database.
[oracle@EDBVR6P2-pc01sby1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Fri Feb 12 13:37:33
2010

Copyright (c) 1982, 2009, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -
Production
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining
and Real Application Testing options

SQL> alter database flashback on;

Database altered.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition
Release 11.2.0.1.0 - Production
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining
and Real Application Testing options
[oracle@EDBVR6P2-pc01sby1 ~]
c) Invoke DGMGRL again and restart the MRP process.
[oracle@EDBVR6P2-pc01sby1 ~]$ dgmgrl
DGMGRL for Linux: Version 11.2.0.1.0 - Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/oracle_4U
Connected.
DGMGRL> edit database 'pc01sby1' set state='apply-on';
Succeeded.
DGMGRL> exit
[oracle@EDBVR6P2-pc01sby1 ~]$



Oracle Database 11g: Data Guard Administration A - 92
Practice 7-1: Converting the Physical Standby Database to a
Snapshot Standby Database
In this practice, you convert your physical standby database to a snapshot standby
database.
1) Invoke DGMGRL in your primary database window and connect to the primary
database.
[oracle@EDBVR6P1-pc01prmy labs]$ dgmgrl
DGMGRL for Linux: Version 11.2.0.1.0 - Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/orace_4U
Connected.
DGMGRL>
2) Convert the physical standby database to a snapshot standby database by executing
the CONVERT DATABASE TO SNAPSHOT STANDBY DATABASE DGMGRL
command.
DGMGRL> convert database pc01sby1 to snapshot standby;
Converting database "pc01sby1" to a Snapshot Standby database,
please wait...
Database "pc01sby1" converted successfully
3) Verify that the database was successfully converted by executing the SHOW
CONFIGURATION command.
DGMGRL> show configuration

Configuration - DGConfig1

Protection Mode: MaxPerformance
Databases:
pc01prmy - Primary database
pc01sby1 - Snapshot standby database
pc01sby3 - Logical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS



Oracle Database 11g: Data Guard Administration A - 93
Practice 7-2: Updating the Databases and Verifying Redo
Shipment
In this practice, you update your database and verify the shipment of redo data.
1) Open a terminal window for the system that your snapshot standby database is on.
Use the oraenv utility to set environment variables for pc<nn>sby1. Log in to
SQL*Plus as the SYSDBA user. To demonstrate that redo data is being received by
the standby database, query V$MANAGED_STANDBY on the snapshot standby
database and record the value in the BLOCK# column:
__________________________
SQL> select status, sequence#, block#
2 from v$managed_standby
3 where client_process='LGWR';

STATUS SEQUENCE# BLOCK#
------------ ---------- ----------
IDLE 48 172
2) Invoke SQL*Plus in your primary database window and connect as SYSDBA. Insert a
row in the HR.REGIONS table on the primary database as follows. Exit SQL*Plus.
[oracle@EDBVR6P1-pc01prmy labs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Fri Feb 12 13:44:49
2010

Copyright (c) 1982, 2009, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -
Production
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining
and Real Application Testing options

SQL> INSERT INTO hr.regions
2 VALUES (10, 'Australia');

1 row created.

SQL> COMMIT;

Commit complete.
3) Return to your SQL*Plus session in your standby database window. Insert a row in
the HR.REGIONS table on the snapshot standby database:
SQL> INSERT INTO hr.regions
2 VALUES (20, 'Australia');
1 row created.
Practice 7-2: Updating the Databases and Verifying Redo
Shipment (continued)
Oracle Database 11g: Data Guard Administration A - 94
SQL> COMMIT;

Commit complete.
4) Query the HR.REGIONS table in your snapshot standby database.
SQL> SELECT * FROM hr.regions;

REGION_ID REGION_NAME
---------- -------------------------
20 Australia
1 Europe
2 Americas
3 Asia
4 Middle East and Africa
5) On the standby database, verify that redo data is being shipped to the snapshot
standby database by querying V$MANAGED_STANDBY again. Record the value in the
BLOCK# column: __________________. Exit SQL*Plus.
SQL> select status, sequence#, block#
2 from v$managed_standby
3 where client_process='LGWR';

STATUS SEQUENCE# BLOCK#
------------ ---------- ----------
IDLE 48 438




Oracle Database 11g: Data Guard Administration A - 95
Practice 7-3: Converting the Snapshot Standby Database to a
Physical Standby Database
In this practice, you convert the snapshot standby database back to a physical standby
database.
1) Invoke DGMGRL on your primary database system and connect as user sys with
password oracle.
[oracle@EDBVR6P1-pc01prmy labs]$ dgmgrl
DGMGRL for Linux: Version 11.2.0.1.0 - Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/oracle_4U
Connected.
2) Convert the snapshot standby database back to a physical standby database.
DGMGRL> convert database pc01sby1 to physical standby;
Converting database "pc01sby1" to a Physical Standby database,
please wait...
Operation requires shutdown of instance "pc01sby1" on database
"pc01sby1"
Shutting down instance "pc01sby1"...
Database closed.
Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "pc01sby1" on database
"pc01sby1"
Starting instance "pc01sby1"...
ORACLE instance started.
Database mounted.
Continuing to convert database "pc01sby1" ...
Operation requires shutdown of instance "pc01sby1" on database
"pc01sby1"
Shutting down instance "pc01sby1"...
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "pc01sby1" on database
"pc01sby1"
Starting instance "pc01sby1"...
ORACLE instance started.
Database mounted.
Database "pc01sby1" converted successfully
DGMGRL>
3) Verify the status of the standby database by executing the SHOW CONFIGURATION
command.
Practice 7-3: Converting the Snapshot Standby Database to a
Physical Standby Database (continued)
Oracle Database 11g: Data Guard Administration A - 96
DGMGRL> show configuration

Configuration - DGConfig1

Protection Mode: MaxPerformance
Databases:
pc01prmy - Primary database
pc01sby1 - Physical standby database
pc01sby3 - Logical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

DGMGRL>
4) Exit from DGMGRL and invoke SQL*Plus in your primary database window.
[oracle@EDBVR6P1-pc01prmy labs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Fri Feb 12 13:52:46
2010

Copyright (c) 1982, 2009, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -
Production
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining
and Real Application Testing options
5) Perform a log switch on the primary database.
SQL> alter system switch logfile;

System altered.

6) Check the HR.REGIONS table to verify that the change made to the primary database
was propagated to the physical standby database and to verify that the row inserted in
the HR.REGIONS table when it was a snapshot standby database is no longer in the
table. Invoke DGMGRL in your standby database window and connect as the SYS
user.
[oracle@EDBVR6P2-pc01sby1 ~]$ dgmgrl
DGMGRL for Linux: Version 11.2.0.1.0 - Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Practice 7-3: Converting the Snapshot Standby Database to a
Physical Standby Database (continued)
Oracle Database 11g: Data Guard Administration A - 97
Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/oracle_4U
Connected.
7) So that you can open the database to query the HR.REGIONS table, stop Redo
Apply. Exit DGMGRL.
DGMGRL> edit database pc01sby1 set state='apply-off';
Succeeded.
DGMGRL> exit
8) Invoke SQL*Plus in your standby database window and connect as the SYSDBA user.
Open the physical standby database in read-only mode.
[oracle@EDBVR6P2-pc01sby1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Fri Feb 12 14:49:22
2010

Copyright (c) 1982, 2009, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -
Production
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining
and Real Application Testing options

SQL> alter database open read only;

Database altered.
9) Query the HR.REGIONS table in your standby database.
Note that the change you made when the database was a snapshot standby database is
not present in the table. Note that the row that you inserted into the HR.REGIONS on
the primary database is present in the table.
SQL> select * from hr.regions;

REGION_ID REGION_NAME
---------- -------------------------
10 Australia
1 Europe
2 Americas
3 Asia
4 Middle East and Africa
10) Shut down the physical standby database and restart it in MOUNT mode. Exit
SQL*Plus.
SQL> shutdown immediate
Practice 7-3: Converting the Snapshot Standby Database to a
Physical Standby Database (continued)
Oracle Database 11g: Data Guard Administration A - 98
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area 439406592 bytes
Fixed Size 1337072 bytes
Variable Size 322963728 bytes
Database Buffers 109051904 bytes
Redo Buffers 6053888 bytes
Database mounted.
11) Exit from SQL*Plus and invoke DGMGRL on your standby system and connect as
the SYS user.
[oracle@EDBVR6P2-pc01sby1 ~]$ dgmgrl
DGMGRL for Linux: Version 11.2.0.1.0 - Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/oracle_4U
Connected.
12) Start Redo Apply on your physical standby database.
DGMGRL> edit database pc01sby1 set state='apply-on';
Succeeded.
13) Verify that Redo Apply is started.
DGMGRL> show database pc01sby1

Database - pc01sby1

Enterprise Manager Name: pc01sby1.us.oracle.com
Role: PHYSICAL STANDBY
Intended State: APPLY-ON
Transport Lag: 0 seconds
Apply Lag: 0 seconds
Real Time Query: OFF
Instance(s):
pc01sby1

Database Status:
SUCCESS
14) Verify the status of your configuration.
DGMGRL> show configuration

Configuration - DGConfig1
Practice 7-3: Converting the Snapshot Standby Database to a
Physical Standby Database (continued)
Oracle Database 11g: Data Guard Administration A - 99

Protection Mode: MaxPerformance
Databases:
pc01prmy - Primary database
pc01sby1 - Physical standby database
pc01sby3 - Logical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS



Oracle Database 11g: Data Guard Administration A - 100
Practices for Lesson 8: Using Oracle Active Data Guard
In the practices for Lesson 8, Using Oracle Active Data Guard, you enable Real-Time
Query and perform queries against your physical standby database while Redo Apply is
active. You also enable block change tracking.


Oracle Database 11g: Data Guard Administration A - 101
Practice 8-1: Using Real-Time Query
In this practice, you enable Real-Time Query so that you can perform queries against
your physical standby database while Redo Apply is active.
1) In your standby database window, invoke DGMGRL and connect as the SYS user
with a password of oracle_4U.
[oracle@EDBVR6P2-pc01sby1 ~]$ dgmgrl
DGMGRL for Linux: Version 11.2.0.1.0 - Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/oracle_4U
Connected.
2) Disable Redo Apply on your physical standby database.
DGMGRL> edit database 'pc01sby1' set state='apply-off';
Succeeded.
3) Confirm your change. Exit DGMGRL.
DGMGRL> show database pc01sby1

Database - pc01sby1

Enterprise Manager Name: pc01sby1.us.oracle.com
Role: PHYSICAL STANDBY
Intended State: APPLY-OFF
Transport Lag: 0 seconds
Apply Lag: 0 seconds
Real Time Query: OFF
Instance(s):
pc01sby1

Database Status:
SUCCESS

DGMGRL> exit
[oracle@EDBVR6P2-pc01sby1 ~]$
4) In your standby database window, invoke SQL*Plus and connect as SYSDBA.
[oracle@EDBVR6P2-pc01sby1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Mon Feb 15 13:36:23
2010

Copyright (c) 1982, 2009, Oracle. All rights reserved.


Connected to:
Practice 8-1: Using Real-Time Query (continued)
Oracle Database 11g: Data Guard Administration A - 102
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -
Production
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
5) Open your physical standby database in read-only mode. Exit SQL*Plus.
SQL> alter database open read only;

Database altered.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition
Release 11.2.0.1.0 - Production
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining
and Real Application Testing options
[oracle@EDBVR6P2-pc01sby1 ~]$
6) In your standby database window, invoke DGMGRL and connect as the SYS user
with a password of oracle_4U.
[oracle@EDBVR6P2-pc01sby1 ~]$ dgmgrl
DGMGRL for Linux: Version 11.2.0.1.0 - Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/oracle_4U
Connected.
DGMGRL>
Practice 8-1: Using Real-Time Query (continued)
Oracle Database 11g: Data Guard Administration A - 103
7) Restart Redo Apply and confirm your change. Exit DGMGRL.
DGMGRL> edit database 'pc01sby1' set state='apply-on';
Succeeded.
DGMGRL> show database pc01sby1

Database - pc01sby1

Enterprise Manager Name: pc01sby1.us.oracle.com
Role: PHYSICAL STANDBY
Intended State: APPLY-ON
Transport Lag: 0 seconds
Apply Lag: 4 minutes 29 seconds
Real Time Query: ON
Instance(s):
pc01sby1

Database Status:
SUCCESS

DGMGRL> exit
[oracle@EDBVR6P2-pc01sby1 ~]$
8) In your standby database window, invoke SQL*Plus and connect as SYSDBA. Query
the HR.REGIONS table.
[oracle@EDBVR6P2-pc01sby1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Mon Feb 15 13:40:14
2010

Copyright (c) 1982, 2009, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -
Production
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining
and Real Application Testing options

SQL> SELECT * FROM hr.regions;

REGION_ID REGION_NAME
---------- -------------------------
10 Australia
1 Europe
2 Americas
3 Asia
4 Middle East and Africa

SQL>
Practice 8-1: Using Real-Time Query (continued)
Oracle Database 11g: Data Guard Administration A - 104
9) In your primary database window, invoke SQL*Plus and connect as SYSDBA. Insert
a row in the HR.REGIONS table.
[oracle@EDBVR6P1-pc01prmy labs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Mon Feb 15 13:40:30
2010

Copyright (c) 1982, 2009, Oracle. All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -
Production
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining
and Real Application Testing options

SQL> INSERT INTO hr.regions
2 VALUES (20, 'Antarctica');

1 row created.

SQL> COMMIT;

Commit complete.
10) Return to your standby database window and query the HR.REGIONS table again. In
your standby database, you should see the new row that you inserted in the
HR.REGIONS table on your primary database.
SQL> SELECT * FROM hr.regions;

REGION_ID REGION_NAME
---------- -------------------------
10 Australia
1 Europe
2 Americas
3 Asia
4 Middle East and Africa
20 Antarctica

6 rows selected.
11) Return your physical standby database to MOUNT mode. Exit SQL*Plus.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area 439406592 bytes
Practice 8-1: Using Real-Time Query (continued)
Oracle Database 11g: Data Guard Administration A - 105
Fixed Size 1337072 bytes
Variable Size 327158032 bytes
Database Buffers 104857600 bytes
Redo Buffers 6053888 bytes
Database mounted.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition
Release 11.2.0.1.0 - Production
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining
and Real Application Testing options
[oracle@EDBVR6P2-pc01sby1 ~]$
12) Invoke DGMGRL in your primary database window and connect to your primary
database. Verify the status of your configuration.
[oracle@EDBVR6P1-pc01prmy labs]$ dgmgrl
DGMGRL for Linux: Version 11.2.0.1.0 - Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/oracle_4U
Connected.
DGMGRL> show database pc01sby1

Database - pc01sby1

Enterprise Manager Name: pc01sby1.us.oracle.com
Role: PHYSICAL STANDBY
Intended State: APPLY-ON
Transport Lag: 0 seconds
Apply Lag: 0 seconds
Real Time Query: OFF
Instance(s):
pc01sby1

Database Status:
SUCCESS




Oracle Database 11g: Data Guard Administration A - 106
Practice 8-2: Enabling Block Change Tracking
In this practice, you enable block change tracking on your physical standby database for
fast incremental backups.
1) In your physical standby database window, invoke SQL*Plus and connect to your
physical standby database as the SYSDBA user.
[oracle@EDBVR6P2-pc01sby1 labs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Mon Feb 15 13:47:17
2010

Copyright (c) 1982, 2009, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -
Production
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining
and Real Application Testing options
2) Enable block change tracking.
SQL> alter database enable block change tracking;

Database altered.
3) Query V$BLOCK_CHANGE_TRACKING to confirm that block change tracking is
enabled.
SQL> select filename, status, bytes
2 from v$block_change_tracking;

FILENAME STATUS BYTES

------------------------------------------------- -------- ---------
+SBDAT/pc01sby1/changetracking/ctf.319.711035279 ENABLED 11599872
4) Exit SQL*Plus.



Oracle Database 11g: Data Guard Administration A - 107

Practices for Lesson 9: Configuring Data
Protection Modes
In the practices for Lesson 9, Configuring Data Protection Modes, you configure
protection modes based on specific business requirements.


Oracle Database 11g: Data Guard Administration A - 108
Practice 9-1: Setting the Data Protection Mode by Using
DGMGRL
In this practice, you set the data protection mode as appropriate to the business
requirements.
Maximum performance is the default protection mode and provides the highest level of
data protection that is possible without affecting the performance of the primary database.
This is accomplished by allowing a transaction to commit as soon as the redo data needed
to recover that transaction is written to the local online redo log.
You have determined that you need to change the data protection mode to ensure that the
redo data needed to recover each transaction is written to both the local online redo log
and the standby redo log on at least one standby database before the transaction commits.
You also want to configure the protection mode so that the primary database does not
shut down if a fault prevents it from writing its redo stream to a remote standby redo log.
Change the protection mode to maximum availability so that your configuration meets
these requirements.
1) Invoke DGMGRL on your primary database host and connect to your primary
database.
[oracle@EDBVR6P2-pc01sby1 labs]$ dgmgrl
DGMGRL for Linux: Version 11.2.0.1.0 - Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/oracle_4U
Connected.
2) Use the SHOW CONFIGURATION command to check the current protection mode for
your configuration.
DGMGRL> show configuration

Configuration - DGConfig1

Protection Mode: MaxPerformance
Databases:
pc01prmy - Primary database
pc01sby1 - Physical standby database
pc01sby3 - Logical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS
Practice 9-1: Setting the Data Protection Mode by Using
DGMGRL (continued)
Oracle Database 11g: Data Guard Administration A - 109
3) Use the SHOW DATABASE command to view the current setting for the
LogXptMode database property for your physical standby database.
DGMGRL> show database pc01sby1 LogXptMode;
LogXptMode = 'ASYNC'
4) Open another terminal window on your primary database host. Invoke SQL*Plus and
log in as the SYS user. Use the SHOW PARAMETER command to view the value of
LOG_ARCHIVE_DEST.
SQL> show parameter log_archive_dest
<< Output formatted below for display >>
NAME TYPE VALUE
--------------------- ------- ----------------------------
log_archive_dest_1 string LOCATION=
USE_DB_RECOVERY_FILE_DEST

log_archive_dest_2 string service=pc01sby1 async valid_for
(online_logfile,primary_role)
db_unique_name=pc01sby1

log_archive_dest_3 string service="(DESCRIPTION=(ADDRESS=
(PROTOCOL=tcp)(HOST=edBVr6p2.
us.oracle.com)(PORT=12001))
(CONNECT_DATA=(SERVICE_NAME=
pc01sby3.us.oracle.com)(SERVER=
DEDICATED)))", LGWR ASYNC
NOAFFIRM delay=0 optional
compression=disable max_failure=
0 max_connections=1 reopen=300
db_unique_name="pc01sby3"
net_timeouot-30, valid_for
(all_logfiles,primary_role)
5) Return to your DGMGRL window and set the LogXptMode database property to
SYNC for your pc<nn>sby1 database.
DGMGRL> edit database 'pc01sby1' set property
'LogXptMode'='SYNC';
Property "LogXptMode" updated
DGMGRL>
6) In your DGMGRL window, change the protection mode to MAXAVAILABILITY.
DGMGRL> edit configuration set protection mode as
maxavailability;
Succeeded.
DGMGRL>
7) Use the SHOW CONFIGURATION command to verify your change to the protection
mode.
Practice 9-1: Setting the Data Protection Mode by Using
DGMGRL (continued)
Oracle Database 11g: Data Guard Administration A - 110
DGMGRL> show configuration

Configuration - DGConfig1

Protection Mode: MaxAvailability
Databases:
pc01prmy - Primary database
pc01sby1 - Physical standby database
pc01sby3 - Logical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS
8) Return to your SQL*Plus window and check the value of LOG_ARCHIVE_DEST_2
again. Note the changes made by the Data Guard broker.
SQL> show parameter log_archive_dest_2
<<Output formated for display>>
NAME TYPE VALUE
--------------------- ------- ----------------------------
log_archive_dest_2 string service="pc01sby1",LGWR SYNC
AFFIRM delay=0 OPTIONAL
compression=DISABLE
max_failure=0 max_connections=1
reopen=300
db_unique_name="pc01sby1"
net_timeout=30, valid_for=
(online_logfiles,primary_role)
9) Return to your DGMGRL window. In preparation for the next practice, set the
protection mode back to MAXPERFORMANCE.
DGMGRL> edit configuration set protection mode as
maxperformance;
Succeeded.
10) Set the LogXptMode back to ASYNC.
DGMGRL> edit database pc01sby1 set property
'LogXptMode'='ASYNC';
Property "LogXptMode" updated
11) Use the SHOW CONFIGURATION command to verify your change to the protection
mode.
DGMGRL> show configuration

Configuration - DGConfig1

Protection Mode: MaxPerformance
Databases:
Practice 9-1: Setting the Data Protection Mode by Using
DGMGRL (continued)
Oracle Database 11g: Data Guard Administration A - 111
pc01prmy - Primary database
pc01sby1 - Physical standby database
pc01sby3 - Logical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

Oracle Database 11g: Data Guard Administration A - 112
Practice 9-2: Setting the Data Protection Mode by Using
Enterprise Manager Grid Control
In this practice, you set the protection mode to maximum availability by using Enterprise
Manager Grid Control.
1) Invoke Enterprise Manager Grid Control and log on as the SYSMAN user with the
password oracle1.
2) Click the Targets tab and click the Databases submenu link to access the Databases
page and select your primary database.
3) Click the Availability tab followed by Setup and Manage in the Data Guard section
to access the Data Guard Overview page.
4) On the Data Guard Overview page, select your physical standby database and click
Edit.


Practice 9-2: Setting the Data Protection Mode by Using
Enterprise Manager Grid Control (continued)
Oracle Database 11g: Data Guard Administration A - 113

5) Click the Standby Role Properties tab. Note down the Log Transport Mode setting
(displays as Redo Transport Mode in Enterprise Manager and LogXptMode in
DGMGRL): __________________________


6) Click the Data Guard link to return to the Data Guard Overview page.
7) On the Data Guard Overview page, click the Protection Mode link.


Practice 9-2: Setting the Data Protection Mode by Using
Enterprise Manager Grid Control (continued)
Oracle Database 11g: Data Guard Administration A - 114
8) On the Change Protection Mode: Select Mode page, select Maximum Availability
and click Continue.


9) On the Change Protection Mode: Standby Databases and Standby Redo Log Files
page, review the information and click Continue.


10) On the Confirmation: Change Protection Mode page, click Yes. The Processing:
Change Protection Mode page is displayed.
Practice 9-2: Setting the Data Protection Mode by Using
Enterprise Manager Grid Control (continued)
Oracle Database 11g: Data Guard Administration A - 115

11) After the processing is completed, you are returned to the Data Guard Overview page
and receive a confirmation message. Select your physical standby database and click
Edit.
12) Click the Standby Role Properties tab. Note that the Log Transport Mode setting
has changed.


13) Click the Data Guard link to return to the Data Guard Overview page.
14) For the best network performance in the classroom, change the protection mode for
the standby database back to maximum performance.



Oracle Database 11g: Data Guard Administration A - 116
Practices for Lesson 10: Performing Role Transitions
In the practices for Lesson 10, Performing Role Transitions, you perform a switchover
operation by using DGMGRL and Enterprise Manager Grid Control.


Oracle Database 11g: Data Guard Administration A - 117
Practice 10-1: Performing Switchover by Using DGMGRL
In this practice, you perform a switchover operation by using DGMGRL.
1) Invoke SQL*Plus on your primary database and connect as the HR user.
[oracle@EDBVR6P1-pc01prmy labs]$ sqlplus hr/hr

SQL*Plus: Release 11.2.0.1.0 Production on Mon Feb 15 15:03:11
2010

Copyright (c) 1982, 2009, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -
Production
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining
and Real Application Testing options
2) Execute the cr_emp_hist.sql script to create a new table named
HR.EMP_HIST.
SQL> set echo on
SQL> @cr_emp_hist
SQL> CREATE TABLE emp_hist
2 AS SELECT * FROM employees
3 /

Table created.
3) Connect to your database as the SYSDBA user and perform a log switch on your
primary database. Exit SQL*Plus.
SQL> connect / as sysdba
Connected.
SQL> alter system switch logfile;

System altered.
4) Query the switchover_status column from v$database.
SQL> select switchover_status from v$database;

SWITCHOVER_STATUS
--------------------
TO STANDBY
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition
Release 11.2.0.1.0 - Production
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining
and Real Application Testing options
Practice 10-1: Performing Switchover by Using DGMGRL
(continued)
Oracle Database 11g: Data Guard Administration A - 118
5) Invoke DGMGRL on your primary database host and connect as the SYS user with
the password oracle_4U.
[oracle@EDBVR6P1-pc01prmy labs]$ dgmgrl
DGMGRL for Linux: Version 11.2.0.1.0 - Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/oracle_4U
Connected.
6) Check the state, health, and properties of the primary database by using the SHOW
DATABASE VERBOSE command.
DGMGRL> show database verbose 'pc01prmy';

Database - pc01prmy

Enterprise Manager Name: pc01prmy.us.oracle.com
Role: PRIMARY
Intended State: TRANSPORT-ON
Instance(s):
pc01prmy

Properties:
DGConnectIdentifier = 'pc01prmy'
ObserverConnectIdentifier = ''
LogXptMode = 'ASYNC'
DelayMins = '0'
Binding = 'optional'
MaxFailure = '0'
MaxConnections = '1'
ReopenSecs = '300'
NetTimeout = '30'
RedoCompression = 'DISABLE'
LogShipping = 'ON'
PreferredApplyInstance = ''
ApplyInstanceTimeout = '0'
ApplyParallel = 'AUTO'
LsbyASkipTxnCfgPr = '0,0,0'
LsbyDSkipTxnCfgPr = '0,0,0'
LsbyASkipCfgPr = ''
LsbyDSkipCfgPr = ''
LsbyASkipErrorCfgPr = ''
LsbyDSkipErrorCfgPr = ''
LsbyMaxEventsRecorded = '0'
LsbyPreserveCommitOrder = ''
LsbyRecordSkipErrors = ''
LsbyRecordSkipDdl = ''
LsbyRecordAppliedDdl = ''
Practice 10-1: Performing Switchover by Using DGMGRL
(continued)
Oracle Database 11g: Data Guard Administration A - 119
StandbyFileManagement = 'MANUAL'
ArchiveLagTarget = '0'
LogArchiveMaxProcesses = '4'
LogArchiveMinSucceedDest = '1'
DbFileNameConvert = ''
LogFileNameConvert = ''
FastStartFailoverTarget = ''
StatusReport = '(monitor)'
InconsistentProperties = '(monitor)'
InconsistentLogXptProps = '(monitor)'
SendQEntries = '(monitor)'
LogXptStatus = '(monitor)'
RecvQEntries = '(monitor)'
LsbyParameters = '(monitor)'
LsbySkipTxnTable = '(monitor)'
LsbySkipTable = '(monitor)'
LsbyFailedTxnInfo = '(monitor)'
HostName = 'EDBVR6P1'
SidName = 'pc01prmy'
StaticConnectIdentifier =
'(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=EDBVR6P1)(PORT=1521
))(CONNECT_DATA=(SERVICE_NAME=pc01prmy_DGMGRL.us.oracle.com)(I
NSTANCE_NAME=pc01prmy)(SERVER=DEDICATED)))'
StandbyArchiveLocation =
'USE_DB_RECOVERY_FILE_DEST'
AlternateLocation = ''
LogArchiveTrace = '0'
LogArchiveFormat = '%t_%s_%r.dbf'
LsbyMaxSga = '0'
LsbyMaxServers = '0'
TopWaitEvents = '(monitor)'

Database Status:
SUCCESS
7) Check the state, health, and properties of the physical standby database by using the
SHOW DATABASE VERBOSE command.
DGMGRL> show database verbose 'pc01sby1';

Database - pc01sby1

Enterprise Manager Name: pc01sby1.us.oracle.com
Role: PHYSICAL STANDBY
Intended State: APPLY-ON
Transport Lag: 0 seconds
Apply Lag: 0 seconds
Real Time Query: OFF
Instance(s):
pc01sby1

Practice 10-1: Performing Switchover by Using DGMGRL
(continued)
Oracle Database 11g: Data Guard Administration A - 120
Properties:
DGConnectIdentifier = 'pc01sby1'
ObserverConnectIdentifier = ''
LogXptMode = 'ASYNC'
DelayMins = '0'
Binding = 'OPTIONAL'
MaxFailure = '0'
MaxConnections = '1'
ReopenSecs = '300'
NetTimeout = '30'
RedoCompression = 'DISABLE'
LogShipping = 'ON'
PreferredApplyInstance = ''
ApplyInstanceTimeout = '0'
ApplyParallel = 'AUTO'
StandbyFileManagement = 'AUTO'
ArchiveLagTarget = '0'
LogArchiveMaxProcesses = '5'
LogArchiveMinSucceedDest = '1'
DbFileNameConvert = ''
LogFileNameConvert = ''
FastStartFailoverTarget = ''
StatusReport = '(monitor)'
InconsistentProperties = '(monitor)'
InconsistentLogXptProps = '(monitor)'
SendQEntries = '(monitor)'
LogXptStatus = '(monitor)'
RecvQEntries = '(monitor)'
HostName = 'EDBVR6P2'
SidName = 'pc01sby1'
StaticConnectIdentifier =
'(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=edbvr6p2.us.oracle.
com)(PORT=12001))(CONNECT_DATA=(SERVICE_NAME=pc01sby1_DGMGRL.u
s.oracle.com)(INSTANCE_NAME=pc01sby1)(SERVER=DEDICATED)))'
StandbyArchiveLocation =
'USE_DB_RECOVERY_FILE_DEST'
AlternateLocation = ''
LogArchiveTrace = '0'
LogArchiveFormat = '%t_%s_%r.dbf'
TopWaitEvents = '(monitor)'

Database Status:
SUCCESS
8) Execute the switchover command to make your physical standby database your
primary database.
DGMGRL> switchover to pc01sby1
Performing switchover NOW, please wait...
New primary database "pc01sby1" is opening...
Practice 10-1: Performing Switchover by Using DGMGRL
(continued)
Oracle Database 11g: Data Guard Administration A - 121
Operation requires shutdown of instance "pc01prmy" on database
"pc01prmy"
Shutting down instance "pc01prmy"...
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "pc01prmy" on database
"pc01prmy"
Starting instance "pc01prmy"...
ORACLE instance started.
Database mounted.
Switchover succeeded, new primary is "pc01sby1"

9) Execute the SHOW CONFIGURATION command to verify the status of the
configuration:
DGMGRL> show configuration

Configuration - DGConfig1

Protection Mode: MaxAvailability
Databases:
pc01sby1 - Primary database
pc01prmy - Physical standby database
pc01sby3 - Logical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

Note: The original choice for instance names during these labs was selected to
facilitate students sharing each other's machines, resulting in both primary databases
and standby databases on the same machine. Switchover does not rename the
instances, and the result of switchover now shows the database named "prmy" is
actually a standby, and the database named "sby1" is now a primary. Consider this
when choosing your own names.
10) Open a terminal window to the system that your new primary database is on (the
system that your standby database had been on). Set the environment variables for
your new primary database (pc<nn>sby1). Invoke SQL*Plus on your new primary
database host. Verify that the HR.EMP_HIST table exists. Exit SQL*Plus.
[oracle@EDBVR6P1- ~]$ ssh edbvr6p2
oracle@edbvr6p2's password: oracle
Last login: Mon Feb 15 15:18:51 2010 from
edbvr6p1.us.oracle.com
[oracle@EDBVR6P2- ~]$ . oraenv
Practice 10-1: Performing Switchover by Using DGMGRL
(continued)
Oracle Database 11g: Data Guard Administration A - 122
ORACLE_SID = [oracle] ? pc01sby1
The Oracle base for
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is
/u01/app/oracle
[oracle@EDBVR6P2-pc01sby1 ~]$ sqlplus hr/hr

SQL*Plus: Release 11.2.0.1.0 Production on Mon Feb 15 15:28:22
2010

Copyright (c) 1982, 2009, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -
Production
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> SELECT count(*) FROM emp_hist;

COUNT(*)
----------
107
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition
Release 11.2.0.1.0 - Production
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options



Oracle Database 11g: Data Guard Administration A - 123
Practice 10-2: Performing Switchover by Using Enterprise
Manager
In this practice, you perform another switchover by using Enterprise Manager Database
Control to return to your original configuration.
1) Invoke Enterprise Manager Grid Control and log in as the SYSMAN user with the
password oracle1.
2) Navigate to the Databases page and select your new primary database
(pc<nn>sby1) by clicking the appropriate Name link.
3) Click the Availability tab, and then click Setup and Manage link in the Data Guard
section. Enter the database login information if prompted. (Username: SYS,
Password: oracle_4U, Connect As: SYSDBA) and select the Save Credentials
check box.
4) Select your new physical standby database (pc<nn>prmy) and click Switchover.


5) Provide your host login credentials if prompted and click Continue.
6) Click Yes on the Confirmation page. The Processing: Switchover page is displayed.

Practice 10-2: Performing Switchover by Using Enterprise
Manager (continued)
Oracle Database 11g: Data Guard Administration A - 124




7) Note that the Data Guard page displays a message indicating that the switchover
operation was completed successfully.




Oracle Database 11g: Data Guard Administration A - 125
Practices for Lesson 11: Using Flashback Database in a
Data Guard Configuration
In the practices for Lesson 11, Using Flashback Database in a Data Guard
Configuration, you configure Flashback Database on your primary database and your
physical standby database.


Oracle Database 11g: Data Guard Administration A - 126
Practice 11-1: Configuring Flashback Database on the Primary
Database
In this practice, you configure Flashback Database on your primary database.
1) Invoke SQL*Plus and log in as the SYSDBA user.
2) Verify that your database is in ARCHIVELOG mode.
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 108
Next log sequence to archive 110
Current log sequence 110
3) Shut down your primary database instance and restart it in MOUNT mode.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area 439406592 bytes
Fixed Size 1337072 bytes
Variable Size 411044112 bytes
Database Buffers 20971520 bytes
Redo Buffers 6053888 bytes
Database mounted.
4) Execute the ALTER DATABASE FLASHBACK ON command to enable the flashback
database.
SQL> alter database flashback on;

Database altered.
5) Open the database.
SQL> alter database open;

Database altered.
6) Verify that the Flash Recovery Area size is 5 GB.
SQL> show parameter db_recovery_file_dest_size

NAME TYPE VALUE
------------------------------------ ----------- -------------
db_recovery_file_dest_size big integer 5G

Oracle Database 11g: Data Guard Administration A - 127
Practice 11-2: Configuring Flashback Database on the Standby
Database
In this practice, you configure Flashback Database on your physical standby database.
1) Invoke DGMGRL and connect as the SYS user with a password of oracle_4U.
Disable Redo Apply (the MRP process). Exit from DGMGRL.
DGMGRL> connect sys/oracle_4U
Connected.
DGMGRL> edit database 'pc01sby1' set state='apply-off';
Succeeded.
DGMGRL> exit
2) Invoke SQL*Plus and connect as SYSDBA. Execute the ALTER DATABASE
FLASHBACK ON command to enable Flashback Database. Exit from SQL*Plus.
Note: If you receive an error message that Flashback Database logging is already on,
ignore it.

SQL> alter database flashback on;

Database altered.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition
Release 11.2.0.1.0 - Production
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining
and Real Application Testing options
[oracle@EDBVR6P2-pc01sby1 ~]$
3) Invoke DGMGRL again and restart Redo Apply.
DGMGRL> edit database 'pc01sby1' set state='apply-on';
Succeeded.
DGMGRL> exit





Oracle Database 11g: Data Guard Administration A - 128
Practices for Lesson 12: Enabling Fast-Start Failover
In the practices for Lesson 12, Enabling Fast-Start Failover, you enable fast-start
failover and test your implementation.


Oracle Database 11g: Data Guard Administration A - 129
Practice 12-1: Enabling Fast-Start Failover
In this practice, you set fast-start failover properties and enable fast-start failover.
1) On your primary database host, invoke DGMGRL and connect as the SYS user. Set
the FastStartFailoverTarget database property on the primary database and
your chosen target standby database (pc<nn>sby1).
DGMGRL> edit database pc01prmy
> set property FastStartFailoverTarget = pc01sby1;
Property "faststartfailovertarget" updated
DGMGRL> edit database pc01sby1
> set property FastStartFailoverTarget = pc01prmy;
Property "faststartfailovertarget" updated
2) Verify that the protection mode is set to maximum performance.
DGMGRL> show configuration

Configuration - DGConfig1

Protection Mode: MaxPerformance
Databases:
pc01prmy - Primary database
pc01sby1 - Physical standby database
pc01sby3 - Logical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS
3) Verify that the LogXptMode property is set to ASYNC for the primary database and
the physical standby database.
DGMGRL> show database pc01prmy LogXptMode
LogXptMode = 'ASYNC'
DGMGRL> show database pc01sby1 LogXptMode
LogXptMode = 'ASYNC'
4) Set the fast-start failover threshold to 90 seconds.
DGMGRL> edit configuration
> set property FastStartFailoverThreshold=90;
Property "faststartfailoverthreshold" updated
5) Set the lag-time limit to 60 seconds by setting the
FastStartFailoverLagLimit broker property.
DGMGRL> edit configuration
> set property FastStartFailoverLagLimit=60;
Property "faststartfailoverlaglimit" updated
6) Enable fast-start failover.
Practice 12-1: Enabling Fast-Start Failover (continued)
Oracle Database 11g: Data Guard Administration A - 130
DGMGRL> enable fast_start failover;
Enabled.
7) Check the status of the configuration by executing the SHOW CONFIGURATION
VERBOSE command.
DGMGRL> show configuration verbose

Configuration - DGConfig1

Protection Mode: MaxPerformance
Databases:
pc01prmy - Primary database
Warning: ORA-16819: fast-start failover observer not
started

pc01sby1 - (*) Physical standby database
Warning: ORA-16819: fast-start failover observer not
started

pc01sby3 - Logical standby database

(*) Fast-Start Failover target

Fast-Start Failover: ENABLED

Threshold: 90 seconds
Target: pc01sby1
Observer: (none)
Lag Limit: 60 seconds (not in use)
Shutdown Primary: TRUE
Auto-reinstate: TRUE

Configuration Status:
WARNING
Note: You start the observer in the next practice.



Oracle Database 11g: Data Guard Administration A - 131
Practice 12-2: Starting the Observer
In this practice, you start the observer. Note that, for this exercise, you start the observer
on the same system that your standby database is on. In a real-world situation, the
observer should be started on another system, separate from the primary database and
standby database.
1) Invoke DGMGRL on the system that your physical standby database is located on
and connect to your physical standby database. Be sure to set the ORACLE_SID
environment variable to pc<nn>sby1.
[oracle@EDBVR6P2- ~]$ . oraenv
ORACLE_SID = [oracle] ? pc01sby1
The Oracle base for
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is
/u01/app/oracle
[oracle@EDBVR6P2-pc01sby1 ~]$ dgmgrl
DGMGRL for Linux: Version 11.2.0.1.0 - Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/oracle_4U
Connected.
2) Start the observer. Remember that control is not returned after starting the observer.
Leave this window open with the observer running.
DGMGRL> start observer
Observer started
3) Return to your DGMGRL session on your primary database system and verify the
status of your configuration.
DGMGRL> show configuration verbose

Configuration - DGConfig1

Protection Mode: MaxPerformance
Databases:
pc01prmy - Primary database
pc01sby1 - (*) Physical standby database
pc01sby3 - Logical standby database

(*) Fast-Start Failover target

Fast-Start Failover: ENABLED

Threshold: 90 seconds
Target: pc01sby1
Observer: EDBVR6P2
Lag Limit: 60 seconds
Shutdown Primary: TRUE
Practice 12-2: Starting the Observer (continued)
Oracle Database 11g: Data Guard Administration A - 132
Auto-reinstate: TRUE

Configuration Status:
SUCCESS
Practice 12-2: Starting the Observer (continued)
Oracle Database 11g: Data Guard Administration A - 133
4) Use the SHOW FAST_START FAILOVER command to further verify your
configuration.
DGMGRL> show fast_start failover

Fast-Start Failover: ENABLED

Threshold: 90 seconds
Target: pc01sby1
Observer: EDBVR6P2
Lag Limit: 60 seconds
Shutdown Primary: TRUE
Auto-reinstate: TRUE

Configurable Failover Conditions
Health Conditions:
Corrupted Controlfile YES
Corrupted Dictionary YES
Inaccessible Logfile NO
Stuck Archiver NO
Datafile Offline YES

Oracle Error Conditions:
(none)


Oracle Database 11g: Data Guard Administration A - 134
Practice 12-3: Testing Fast-Start Failover
In this practice, you test fast-start failover.
1) On the computer that your primary database is on, invoke SQL*Plus and log in as the
SYSDBA user.
[oracle@EDBVR6P1-pc01prmy ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Feb 17 09:51:58
2010

Copyright (c) 1982, 2009, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -
Production
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
2) To simulate a failure of the primary database, shut down your primary database
instance with the ABORT option.
SQL> shutdown abort
ORACLE instance shut down.
3) Return to the window on your physical standby database system where you started
the observer. View the actions. The failover make take a few minutes.
09:55:05.99 Wednesday, February 17, 2010
Initiating Fast-Start Failover to database "pc01sby1"...
Performing failover NOW, please wait...
Failover succeeded, new primary is "pc01sby1"
09:55:56.14 Wednesday, February 17, 2010
4) Open another terminal window for the system that your physical standby database is
on. Set the environment variables for pc<nn>sby1. Invoke DGMGRL and connect
as the SYS user.
[oracle@EDBVR6P2-pc01sby1 ~]$ dgmgrl
DGMGRL for Linux: Version 11.2.0.1.0 - Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/oracle_4U
Connected.
5) Verify the status of your configuration.
DGMGRL> show configuration

Configuration - DGConfig1

Practice 12-3: Testing Fast-Start Failover (continued)
Oracle Database 11g: Data Guard Administration A - 135
Protection Mode: MaxPerformance
Databases:
pc01sby1 - Primary database
Warning: ORA-16829: fast-start failover configuration is
lagging

pc01prmy - (*) Physical standby database (disabled)
ORA-16661: the standby database needs to be reinstated

pc01sby3 - Logical standby database

Fast-Start Failover: ENABLED

Configuration Status:
WARNING
6) Further investigate the configuration.
DGMGRL> show database pc01sby1

DGMGRL> show database pc01sby1

Database - pc01sby1

Enterprise Manager Name: pc01sby1.us.oracle.com
Role: PRIMARY
Intended State: TRANSPORT-ON
Instance(s):
pc01sby1

Database Warning(s):
ORA-16829: fast-start failover configuration is lagging

Database Status:
WARNING
7) Investigate the status of your new standby database.
DGMGRL> show database pc01prmy

Database - pc01prmy

Enterprise Manager Name: pc01prmy.us.oracle.com
Role: PHYSICAL STANDBY
Intended State: APPLY-ON
Transport Lag: (unknown)
Apply Lag: (unknown)
Real Time Query: OFF
Instance(s):
pc01prmy

Database Status:
ORA-16661: the standby database needs to be reinstated
Practice 12-3: Testing Fast-Start Failover (continued)
Oracle Database 11g: Data Guard Administration A - 136
8) Invoke SQL*Plus on the system that your pc<nn>prmy database is on and connect
as the SYSDBA user.
[oracle@EDBVR6P1-pc01prmy ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Feb 17 10:02:03
2010

Copyright (c) 1982, 2009, Oracle. All rights reserved.

Connected to an idle instance.
9) Start the instance and MOUNT the database. Note that you may see messages in the
observer window.
SQL> startup mount
ORACLE instance started.

Total System Global Area 439406592 bytes
Fixed Size 1337072 bytes
Variable Size 411044112 bytes
Database Buffers 20971520 bytes
Redo Buffers 6053888 bytes
Database mounted.
SQL>
10) Return to the DGMGRL session for your pc<nn>sby1 database and reinstate the
pc<nn>prmy database if needed. You receive an error if it is already reinstated.
DGMGRL> REINSTATE DATABASE 'pc01prmy';
Reinstating database "pc01prmy", please wait...
Reinstatement of database "pc01prmy" succeeded
Note: It may be necessary to repeat steps 8, 9, and 10 a second time.
11) Monitor the window that you started the observer in and note that the broker may be
reinstating the database for you.
15:27:50.07 Tuesday, February 23, 2010
Initiating reinstatement for database "pc01prmy"...
Reinstating database "pc01prmy", please wait...
Error: ORA-16657: reinstatement of database in progress

Failed.
Database reinstatement for "pc01prmy" in progress.
15:27:50.07 Tuesday, February 23, 2010
12) Verify the status of your configuration.
DGMGRL> show configuration

Configuration - DGConfig1

Protection Mode: MaxPerformance
Databases:
Practice 12-3: Testing Fast-Start Failover (continued)
Oracle Database 11g: Data Guard Administration A - 137
pc01sby1 - Primary database
pc01prmy - (*) Physical standby database
pc01sby3 - Logical standby database

Fast-Start Failover: ENABLED

Configuration Status:
SUCCESS



Oracle Database 11g: Data Guard Administration A - 138
Practice 12-4: Switching Back to Your Primary Database
In this practice, you perform a switchover to reestablish your original primary database in
preparation for later practices.
1) In a DGMGRL session, while you are connected to your pc<nn>sby1 database,
verify the status of your configuration.
DGMGRL> show configuration

Configuration - DGConfig1

Protection Mode: MaxPerformance
Databases:
pc01sby1 - Primary database
pc01prmy - (*) Physical standby database
pc01sby3 - Logical standby database

Fast-Start Failover: ENABLED

Configuration Status:
SUCCESS
2) Perform a switchover to your pc<nn>prmy database.
DGMGRL> switchover to pc01prmy;
Performing switchover NOW, please wait...
New primary database "pc01prmy" is opening...
Operation requires shutdown of instance "pc01sby1" on database
"pc01sby1"
Shutting down instance "pc01sby1"...
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "pc01sby1" on database
"pc01sby1"
Starting instance "pc01sby1"...
ORACLE instance started.
Database mounted.
Database opened.
Switchover succeeded, new primary is "pc01prmy"
3) Verify the status of your configuration.
DGMGRL> show configuration

Configuration - DGConfig1

Protection Mode: MaxPerformance
Databases:
pc01prmy - Primary database
Warning: ORA-16829: fast-start failover configuration is
lagging
Practice 12-4: Switching Back to Your Primary Database
(continued)
Oracle Database 11g: Data Guard Administration A - 139

pc01sby1 - (*) Physical standby database
Warning: ORA-16829: fast-start failover configuration is
lagging

pc01sby3 - Logical standby database

Fast-Start Failover: ENABLED

Configuration Status:
WARNING

Oracle Database 11g: Data Guard Administration A - 140
Practice 12-5: Stopping the Observer and Disabling Fast-Start
Failover
In this practice, you stop the observer and disable fast-start failover in preparation for
later practices.
1) Invoke DGMGRL and connect to your primary database.
[oracle@EDBVR6P1-pc01prmy ~]$ dgmgrl
DGMGRL for Linux: Version 11.2.0.1.0 - Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/oracle_4U
Connected.
2) Stop the observer.
DGMGRL> stop observer
Done.
3) Note what happens to the DGMGRL session that you used to start the observer.
Observer stopped
[oracle@EDBVR6P2-pc01sby1 ~]$
4) Check the status of fast-start failover.
DGMGRL> show fast_start failover

Fast-Start Failover: ENABLED

Threshold: 90 seconds
Target: pc01sby1
Observer: (none)
Lag Limit: 60 seconds
Shutdown Primary: TRUE
Auto-reinstate: TRUE

Configurable Failover Conditions
Health Conditions:
Corrupted Controlfile YES
Corrupted Dictionary YES
Inaccessible Logfile NO
Stuck Archiver NO
Datafile Offline YES

Oracle Error Conditions:
(none)
5) Disable fast-start failover.
DGMGRL> disable fast_start failover;
Disabled.
Practice 12-5: Stopping the Observer and Disabling Fast-Start
Failover (continued)
Oracle Database 11g: Data Guard Administration A - 141
6) Check the status of fast-start failover.
DGMGRL> show fast_start failover

Fast-Start Failover: DISABLED

Threshold: 90 seconds
Target: (none)
Observer: (none)
Lag Limit: 60 seconds
Shutdown Primary: TRUE
Auto-reinstate: TRUE

Configurable Failover Conditions
Health Conditions:
Corrupted Controlfile YES
Corrupted Dictionary YES
Inaccessible Logfile NO
Stuck Archiver NO
Datafile Offline YES

Oracle Error Conditions:
(none)

7) Display the configuration.
DGMGRL> show configuration

Configuration - DGConfig1

Protection Mode: MaxPerformance
Databases:
pc01prmy - Primary database
pc01sby1 - Physical standby database
pc01sby3 - Logical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS



Oracle Database 11g: Data Guard Administration A - 142
Practices for Lesson 13: Managing Client Connectivity
In the practices for Lesson 13, Managing Client Connectivity, you implement client
failover methods.

Oracle Database 11g: Data Guard Administration A - 143
Practice 13-1: Creating a Service for PC<nn>PRMY Instance
In this practice, you create a service for the pc<nn>prmy instance that will be active
only when the database role is primary.
1) Invoke SQL*Plus on your primary database host and connect as the SYSDBA user.
2) View the value of the SERVICE_NAMES initialization parameter.
SQL> show parameter service_names

NAME TYPE VALUE
-------------- ------- ----------------------
service_names string pc01prmy.us.oracle.com
3) Use the host command to temporarily exit SQL*Plus to an operating system
prompt. Create a new service named pc<nn>prod for the pc<nn>prmy database
with the BASIC failover method, SELECT failover type, failover delay of 1 second,
and failover retries of 180. The service should be active only if the pc<nn> database
is in the primary role. The "srvctl add service help" command displays
the syntax for service creation.
SQL> host
[oracle@EDBVR6P1-pc01prmy ~]$ srvctl add service -d pc01prmy
-s pc01prod -l PRIMARY -m BASIC -e SELECT -w 1 -z 180
4) Check to see if the listener knows about the new service by executing the lsnrctl
services command. Although you created the service, you have not yet started it,
so the listener does not know about it.
[oracle@EDBVR6P1-pc01prmy ~]$ lsnrctl services

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 17-FEB-
2010 16:23:50

Copyright (c) 1991, 2009, Oracle. All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM", status READY, has 1 handler(s) for this
service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
LOCAL SERVER
Service "pc01db11.us.oracle.com" has 1 instance(s).
Instance "pc01db11", status READY, has 1 handler(s) for this
service...
Handler(s):
"DEDICATED" established:65459 refused:0 state:ready
LOCAL SERVER
...
Practice 13-1: Creating a Service for PC<nn>PRMY Instance
(continued)
Oracle Database 11g: Data Guard Administration A - 144
5) Start the PC<nn>PROD service using the srvctl utility.
[oracle@EDBVR6P1-pc01prmy ~]$ srvctl start service -d pc01prmy
-s pc01prod
6) Check again to see if the listener knows about the new service by executing the
lsnrctl services command. The listener now knows about the PC<nn>PROD
service.
[oracle@EDBVR6P1-pc01prmy ~]$ lsnrctl services

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 17-FEB-
2010 16:31:21

Copyright (c) 1991, 2009, Oracle. All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
Services Summary...
...
...
Service "pc01prod.us.oracle.com" has 1 instance(s).
Instance "pc01prmy", status READY, has 1 handler(s) for this
service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
LOCAL SERVER
The command completed successfully
7) Return to SQL*Plus and check the value of the SERVICE_NAMES initialization
parameter again. It is important to validate the pc<nn>prod entry created from the
above two steps. Additional service names may or may not exist.
[oracle@EDBVR6P1-pc01prmy ~]$ exit
SQL> show parameter service_names

NAME TYPE VALUE
------------------------------------ ----------- -------------
service_names string pc01prmy.us.
oracle.com,
pc01prod
SQL> exit



Oracle Database 11g: Data Guard Administration A - 145
Practice 13-2: Creating a Service for the PC<nn>SBY1 Instance
In this practice, you create a service for the pc<nn>sby1 instance that will be active
only when the database role is primary.
1) Invoke SQL*Plus on your standby database host and connect as the SYSDBA user.
2) View the value of the SERVICE_NAMES initialization parameter and exit SQL*Plus.
SQL> show parameter service_names

NAME TYPE VALUE
-------------- ------- ----------------------
service_names string pc01sby1.us.oracle.com

SQL> exit
3) Add the pc<nn>sby1 database to the Oracle Restart configuration. The "srvctl
add database help" command displays the syntax for database registration.
[oracle@EDBVR6P2-pc01sby1 ~]$ srvctl add database -d pc01sby1
-o /u01/app/oracle/product/11.2.0/dbhome_1 -m us.oracle.com p
/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfilepc01sby1.ora
-r PHYSICAL_STANDBY -a "SBDAT,SBFRA"
4) Create a new service named pc<nn>prod for the pc<nn>sby1 database with the
BASIC failover method, SELECT failover type, failover delay of 1 second, and
failover retries of 180. The service should be active only if the pc<nn>sby1
database is in the primary role. The "srvctl add service help" command
displays the syntax for service creation.
[oracle@EDBVR6P2-pc01sby1 ~]$ srvctl add service -d pc01sby1
-s pc01prod -l PRIMARY -m BASIC -e SELECT -w 1 -z 180
5) Check to see if the listener knows about the new service by executing the lsnrctl
services command. Although you created the service, you have not yet started it,
so the listener does not know about it.
[oracle@EDBVR6P2-pc01sby1 ~]$ lsnrctl services listener1

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 23-FEB-
2010 17:30:29

Copyright (c) 1991, 2009, Oracle. All rights reserved.

Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=edbvr6p2.us.oracle.c
om)(PORT=12001)))
Services Summary...
Service "pc01sby1.us.oracle.com" has 2 instance(s).
Instance "pc01sby1", status UNKNOWN, has 1 handler(s) for
this service...
Handler(s):
"DEDICATED" established:60 refused:52
Practice 13-2: Creating a Service for the PC<nn>SBY1 Instance
(continued)
Oracle Database 11g: Data Guard Administration A - 146
LOCAL SERVER
Instance "pc01sby1", status READY, has 1 handler(s) for this
service...
Handler(s):
"DEDICATED" established:186 refused:0 state:ready
LOCAL SERVER
Service "pc01sby1_DGB.us.oracle.com" has 1 instance(s).
Instance "pc01sby1", status READY, has 1 handler(s) for this
service...
Handler(s):
"DEDICATED" established:186 refused:0 state:ready
LOCAL SERVER
Service "pc01sby1_DGMGRL.us.oracle.com" has 1 instance(s).
Instance "pc01sby1", status UNKNOWN, has 1 handler(s) for
this service...
Handler(s):
"DEDICATED" established:9 refused:0
LOCAL SERVER
Service "pc01sby2_DGMGRL.us.oracle.com" has 1 instance(s).
Instance "pc01sby2", status UNKNOWN, has 1 handler(s) for
this service...
Handler(s):
"DEDICATED" established:406 refused:0
LOCAL SERVER
Service "pc01sby3.us.oracle.com" has 1 instance(s).
Instance "pc01sby3", status READY, has 1 handler(s) for this
service...
Handler(s):
"DEDICATED" established:12631 refused:0 state:ready
LOCAL SERVER
Service "pc01sby3_DGB.us.oracle.com" has 1 instance(s).
Instance "pc01sby3", status READY, has 1 handler(s) for this
service...
Handler(s):
"DEDICATED" established:12631 refused:0 state:ready
LOCAL SERVER
Service "pc01sby3_DGMGRL.us.oracle.com" has 1 instance(s).
Instance "pc01sby3", status UNKNOWN, has 1 handler(s) for
this service...
Handler(s):
"DEDICATED" established:15 refused:10
LOCAL SERVER
The command completed successfully.
6) Start the PC<nn>PROD service using the srvctl utility. The service should not
start because it is defined to be active for the primary role.
[oracle@EDBVR6P2-pc01sby1 ~]$ srvctl start service -d pc01sby1
-s pc01prod
PRCR-1079 : Failed to start resource ora.pc01sby1.pc01prod.svc
Practice 13-2: Creating a Service for the PC<nn>SBY1 Instance
(continued)
Oracle Database 11g: Data Guard Administration A - 147
CRS-2664: Resource 'ora.pc01sby1.db' is already running on
'edbvr6p2'
7) Validate that the newly created service is enabled.
[oracle@EDBVR6P2-pc01sby1 ~]$ srvctl config service -d
pc01sby1 -s pc01prod
Service name: pc01prod
Service is enabled
Cardinality: SINGLETON
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: SELECT
Failover method: BASIC
TAF failover retries: 180
TAF failover delay: 1
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: NONE


Oracle Database 11g: Data Guard Administration A - 148
Practice 13-3: Creating an Oracle Net Service Name on Your
Primary Database Host
In this practice, you define a new Oracle Net service name on your primary database
host.
1) Invoke Oracle Net Manager on your primary database system.
2) Expand Local. Select Service Naming and click the green plus sign.
3) Enter pc<nn>prod in the Net Service Name field and click Next.
4) Select TCP/IP (Internet Protocol) and click Next.
5) Enter the fully qualified host name of the machine that your primary database is on.
Click Next.
6) Enter pc<nn>prod.us.oracle.com in the Service Name field and click Next.
7) Click Finish.
8) Click the green plus sign in the Address Configuration section.

9) On the Address 2 tab, enter the fully qualified host name of the machine that your
physical standby database is on. Enter 12001 in the Port Number field.

Practice 13-3: Creating an Oracle Net Service Name on Your
Primary Database Host (continued)
Oracle Database 11g: Data Guard Administration A - 149

10) Select File > Save Network Configuration to save the information to the
tnsnames.ora file.
11) Exit Oracle Net Manager.
12) Ensure that your updated $ORACLE_HOME/network/admin/tnsnames.ora
file contains an entry similar to the following for PC<nn>PROD.
PC01PROD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)
(HOST = edbvr6p1.us.oracle.com)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)
(HOST = edbvr6p2.us.oracle.com)(PORT = 12001))
)
(CONNECT_DATA =
(SERVICE_NAME = pc01prod.us.oracle.com)
)
)

Oracle Database 11g: Data Guard Administration A - 150
Practice 13-4: Creating an Oracle Net Service Name on Your
Standby Database Host
In this practice, you create a new Oracle Net service name on your physical standby
database host.
1) Invoke Oracle Net Manager on your physical standby database system.
2) Expand Local. Select Service Naming and click the green plus sign.
3) Enter pc<nn>prod in the Net Service Name field and click Next.
4) Select TCP/IP (Internet Protocol) and click Next.
5) Enter the fully qualified host name of the machine that your primary database is on.
Click Next.
6) Enter pc<nn>prod.us.oracle.com in the Service Name field and click Next.
7) Click Finish.
8) Click the green plus sign in the Address Configuration section.
9) On the Address 2 tab, enter the fully qualified host of the machine that your physical
standby database is on. Enter 12001 in the port number field.
10) Select File > Save Network Configuration to save the information to the
tnsnames.ora file.
11) Exit Oracle Net Manager.
12) Ensure that your updated $ORACLE_HOME/network/admin/tnsnames.ora
file contains an entry similar to the following for PC<nn>PROD.
PC01PROD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)
(HOST = edbvr6p1.us.oracle.com)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)
(HOST = edbvr6p2.us.oracle.com)(PORT = 12001))
)
(CONNECT_DATA =
(SERVICE_NAME = pc01prod.us.oracle.com)
)
)


Oracle Database 11g: Data Guard Administration A - 151
Practice 13-5: Testing Your Implementation
In this practice, you test your implementation of client failover.
1) In your SQL*Plus session, on your primary database host, create a user named
DGTEST with a password of DGTEST. Grant CREATE SESSION and
SELECT_CATALOG_ROLE to DGTEST.
SQL> create user dgtest identified by dgtest;

User created.

SQL> grant create session to dgtest;

Grant succeeded.

SQL> grant select_catalog_role to dgtest;

Grant succeeded.
2) On your physical standby database host, connect to the primary database as the
DGTEST user by using the pc<nn>PROD service.
[oracle@EDBVR6P2-pc01sby1 ~]$ sqlplus dgtest/dgtest@pc01prod

SQL*Plus: Release 11.2.0.1.0 Production on Thu Feb 18 18:20:49
2010

Copyright (c) 1982, 2009, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -
Production
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining
and Real Application Testing options
3) Query V$INSTANCE to determine which host you are connected to.
SQL> select host_name from v$instance;

HOST_NAME
-----------------------------------------------------------
EDBVR6P1
4) Query V$SESSION to determine how you are connected. You can use the
query_session.sql script.
SQL> select failover_type, failover_method, failed_over
2 from v$session
3 where username = 'DGTEST';


Practice 13-5: Testing Your Implementation (continued)
Oracle Database 11g: Data Guard Administration A - 152
FAILOVER_TYPE FAILOVER_M FAI
------------- ---------- ---
SELECT BASIC NO
5) Return to your primary database host and invoke DGMGRL. Connect as the SYS user
with a password of ORACLE and perform a switchover to your PC<nn>SBY1
database. It may be necessary to restart the instance. Exit from DGMGRL.
[oracle@EDBVR6P1-pc01prmy labs]$ dgmgrl
DGMGRL for Linux: Version 11.2.0.1.0 - Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/oracle_4U
Connected.
DGMGRL> switchover to pc01sby1;
Performing switchover NOW, please wait...
New primary database "pc01sby1" is opening...
Operation requires shutdown of instance "pc01prmy" on database
"pc01prmy"
Shutting down instance "pc01prmy"...
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "pc01prmy" on database
"pc01prmy"
Starting instance "pc01prmy"...
ORA-01031: insufficient privileges

Warning: You are no longer connected to ORACLE.

Please complete the following steps to finish switchover:
start up and mount instance "pc01prmy" of database
"pc01prmy"
DGMGRL> connect sys/oracle_4U
Connected.
DGMGRL> startup mount
ORACLE instance started.
Database mounted.
DGMGRL> exit
6) On your primary database host, check the listener services again. PC<nn>PROD is no
longer listed.
[oracle@edbvr6p1-pc01prmy labs]$ lsnrctl services

LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 20-FEB-
2008 01:49:42

Copyright (c) 1991, 2007, Oracle. All rights reserved.
Practice 13-5: Testing Your Implementation (continued)
Oracle Database 11g: Data Guard Administration A - 153

Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
Services Summary...
Service "pc01db11.us.oracle.com" has 1 instance(s).
Instance "pc01db11", status READY, has 1 handler(s) for this
service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
LOCAL SERVER


7) Return to your (original) physical standby database host. In your existing SQL*Plus
session, query V$INSTANCE to determine what host you are now connected to.
SQL> select host_name from v$instance;

HOST_NAME
-----------------------------------------------------------
EDBVR6P2
8) Query V$SESSION again. You can use the query_session.sql script.
SQL> select failover_type, failover_method, failed_over
2 from v$session
3 where username = 'DGTEST';

FAILOVER_TYPE FAILOVER_M FAI
------------- ---------- ---
SELECT BASIC YES
9) In the SQL*Plus session, on your original physical standby database host, view the
value of the SERVICE_NAMES parameter. Exit SQL*Plus.
SQL> show parameter service

NAME TYPE VALUE
------------- --------- --------------------------------
service_names string PC01PROD
10) Execute the lsnrctl services listener1 command on your original standby
database host. Note that PC01PROD is now started on this host.
[oracle@EDBVR6P2-pc01sby1 ~]$ lsnrctl services listener1

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 23-FEB-
2010 17:59:38

Copyright (c) 1991, 2009, Oracle. All rights reserved.

Practice 13-5: Testing Your Implementation (continued)
Oracle Database 11g: Data Guard Administration A - 154
Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=edbvr6p2.us.oracle.c
om)(PORT=12001)))
Services Summary...
Service "pc01prod.us.oracle.com" has 1 instance(s).
Instance "pc01sby1", status READY, has 1 handler(s) for this
service...
Handler(s):
"DEDICATED" established:116 refused:0 state:ready
LOCAL SERVER
Service "pc01sby1.us.oracle.com" has 2 instance(s).
Instance "pc01sby1", status UNKNOWN, has 1 handler(s) for
this service...
Handler(s):
"DEDICATED" established:60 refused:52
LOCAL SERVER
Instance "pc01sby1", status READY, has 1 handler(s) for this
service...
Handler(s):
"DEDICATED" established:116 refused:0 state:ready
LOCAL SERVER
...
The command completed successfully
11) Return to your (original) primary database host and log in to SQL*Plus as the
SYSDBA user. View the value of the SERVICE_NAMES parameter.
SQL> show parameter service

NAME TYPE VALUE
------------- ------- --------------------------------
service_names string pc01prmy.us.oracle.com
12) Exit SQL*Plus.
13) On your original standby database host, invoke DGMGRL again and connect as the
SYS user with password oracle. Perform a switchover to restore your
PC<nn>PRMY database as the primary database.
[oracle@EDBVR6P2-pc01sby1 ~]$ dgmgrl
DGMGRL for Linux: Version 11.2.0.1.0 - Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/oracle_4U
Connected.
DGMGRL> switchover to pc01prmy;
Performing switchover NOW, please wait...
New primary database "pc01prmy" is opening...
Operation requires shutdown of instance "pc01sby1" on database
"pc01sby1"
Shutting down instance "pc01sby1"...
Practice 13-5: Testing Your Implementation (continued)
Oracle Database 11g: Data Guard Administration A - 155
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "pc01sby1" on database
"pc01sby1"
Starting instance "pc01sby1"...
ORACLE instance started.
Database mounted.
Switchover succeeded, new primary is "pc01prmy"
14) Verify the status of your configuration. Exit DGMGRL.
DGMGRL> show configuration

Configuration - DGConfig1

Protection Mode: MaxPerformance
Databases:
pc01prmy - Primary database
pc01sby1 - Physical standby database
pc01sby3 - Logical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

DGMGRL> exit
[oracle@EDBVR6P2-pc01sby1 ~]$


Oracle Database 11g: Data Guard Administration A - 156
Practices for Lesson 14: Backup and Recovery
Considerations in an Oracle Data Guard Configuration
In the practices for Lesson 14, Backup and Recovery Considerations in an Oracle Data
Guard Configuration, you create a recovery catalog and register the databases in your
Data Guard configuration. You also configure RMAN parameters on the primary and
standby database. Finally, you create an incremental backup of your physical standby
database.


Oracle Database 11g: Data Guard Administration A - 157
Practice 14-1: Creating the Recovery Catalog
In this practice, you configure the database for the recovery catalog, create the recovery
catalog owner, and create the recovery catalog. In addition to your primary database,
pc<nn>prmy, there is a database named pc<nn>db11 that is precreated on your host
machine. You create the recovery catalog in the pc<nn>db11 database in this practice.
1) Open a new terminal window on your assigned PC and set the environment variables
to pc<nn>db11.
[oracle@EDBVR6P1-pc01prmy labs]$ . oraenv
ORACLE_SID = [pc01prmy] ? pc01db11
The Oracle base for
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is
/u01/app/oracle
2) Change to the labs directory.
[oracle@EDBVR6P1-pc01db11 ~]$ cd labs
[oracle@EDBVR6P1-pc01db11 labs]$
3) Invoke SQL*Plus and connect as SYSDBA.
[oracle@EDBVR6P1-pc01db11 labs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 23 20:32:43
2010

Copyright (c) 1982, 2009, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -
Production
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

4) Create a tablespace named RCTS to hold the recovery catalog data. Specify a data file
with the name '+DATA' and size 30 MB. You can use the rcts_create.sql
script.
SQL> set echo on
SQL> @rcts_create
SQL> create tablespace rcts
2 datafile '+DATA' size 30M
3 /

Tablespace created.

SQL>
Practice 14-1: Creating the Recovery Catalog (continued)
Oracle Database 11g: Data Guard Administration A - 158
5) Create the recovery catalog owner user named RCOWNER with a password of
rcpass. The default tablespace for the user is RCTS. Provide unlimited quota on the
RCTS tablespace to the user. You can use the rcowner_create.sql script.
SQL> @rcowner_create
SQL> create user rcowner identified by rcpass
2 default tablespace rcts
3 quota unlimited on rcts
4 /

User created.
6) Grant the RECOVERY_CATALOG_OWNER role to the RCOWNER user. Exit
SQL*Plus.
SQL> grant recovery_catalog_owner to rcowner;

Grant succeeded.
7) Invoke RMAN and connect to the pcnndb11 database as the recovery catalog
owner. Remember that the password for RCOWNER is rcpass.
[oracle@EDBVR6P1-pc01db11 labs]$ rman catalog rcowner

Recovery Manager: Release 11.2.0.1.0 - Production on Tue Feb
23 19:24:11 2010

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All
rights reserved.

recovery catalog database Password: rcpass
connected to recovery catalog database

8) Create the recovery catalog.
RMAN> create catalog;

recovery catalog created

RMAN> exit


Recovery Manager complete.
[oracle@EDBVR6P1-pc01db11 labs]$

Oracle Database 11g: Data Guard Administration A - 159
Practice 14-2: Registering Your Database in the Recovery
Catalog
In this practice, you register your primary database in the recovery catalog.
1) Open a terminal window and verify that the ORACLE_SID environment variable is
set to pc<nn>prmy.
[oracle@EDBVR6P1-pc01db11 labs]$ . oraenv
ORACLE_SID = [pc01db11] ? pc01prmy
The Oracle base for
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is
/u01/app/oracle
2) Invoke RMAN and connect to your primary database and the recovery catalog
database. Supply the rcpass password when prompted.
[oracle@EDBVR6P1-pc01prmy labs]$ rman target / catalog
rcowner@pc01db11

Recovery Manager: Release 11.2.0.1.0 - Production on Tue Feb
23 19:33:45 2010

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All
rights reserved.

connected to target database: PC01PRMY (DBID=2581955083)
recovery catalog database Password: rcpass
connected to recovery catalog database

RMAN>
3) Register your primary database.
RMAN> register database;

database registered in recovery catalog
starting full resync of recovery catalog
full resync complete

RMAN>
4) Use the LIST DB_UNIQUE_NAME command to verify your registration.
RMAN> list db_unique_name of database;


List of Databases
DB Key DB Name DB ID Database Role Db_unique_name
------- ------- -------------- --------------- --------------
1 PC01PRMY 2581955083 PRIMARY PC01PRMY

5) Use the REPORT SCHEMA FOR DB_UNIQUE_NAME command to verify the files.
Practice 14-2: Registering Your Database in the Recovery
Catalog (continued)
Oracle Database 11g: Data Guard Administration A - 160
RMAN> report schema for db_unique_name pc01prmy;

Report of database schema for database with db_unique_name
PC01PRMY

List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
---- -------- -------------------- ------- -------------------
1 700 SYSTEM YES
+DATA/pc01prmy/datafile/system.256.711476551
2 540 SYSAUX NO
+DATA/pc01prmy/datafile/sysaux.257.711476553
3 85 UNDOTBS1 YES
+DATA/pc01prmy/datafile/undotbs1.258.711476553
4 5 USERS NO
+DATA/pc01prmy/datafile/users.259.711476553
5 150 EXAMPLE NO
+DATA/pc01prmy/datafile/example.276.711477317

List of Temporary Files
=======================
File Size(MB) Tablespace Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- ---------------
1 29 TEMP 32767
+DATA/pc01prmy/tempfile/temp.264.711476753

6) Use the LIST ARCHIVELOG ALL FOR DB_UNIQUE_NAME command to verify that
the archived log files are registered.
RMAN> list archivelog all for db_unique_name pc01prmy;

List of Archived Log Copies for database with db_unique_name
PC01PRMY
==============================================================

Key Thrd Seq S Low Time
------- ---- ------- - ---------
261 1 35 A 23-FEB-10
Name:
+FRA/pc01prmy/archivelog/2010_02_23/thread_1_seq_35.376.711745
947

262 1 36 A 23-FEB-10
Name:
+FRA/pc01prmy/archivelog/2010_02_23/thread_1_seq_36.377.711745
981
...
Practice 14-2: Registering Your Database in the Recovery
Catalog (continued)
Oracle Database 11g: Data Guard Administration A - 161
7) Use the SHOW ALL FOR DB_UNIQUE_NAME command to display the RMAN
configuration parameters for your primary database.
RMAN> show all for db_unique_name pc01prmy;

RMAN configuration parameters for database with db_unique_name
PC01PRMY are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK
TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO
BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; #
default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1;
# default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE
'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO
'/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_pc01prmy.f
'; # default




Oracle Database 11g: Data Guard Administration A - 162
Practice 14-3: Configuring RMAN Parameters
In this practice, you configure RMAN parameters for your primary and physical standby
database.
1) In your RMAN session (connected to your primary database), configure the backup
retention policy to allow for recovery for seven days.
RMAN> configure retention policy to
2> recovery window of 7 days;

old RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO NONE;
new RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete

RMAN>
2) Specify that archived redo log files can be deleted after they are applied to the
standby database.
RMAN> configure archivelog deletion policy to
2> applied on all standby;

new RMAN configuration parameters:
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL
STANDBY;
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete

RMAN>
3) Configure the connect identifier for your primary database.
RMAN> configure db_unique_name pc01prmy
2> connect identifier 'pc01prmy';

new RMAN configuration parameters:
CONFIGURE DB_UNIQUE_NAME 'pc01prmy' CONNECT IDENTIFIER
'pc01prmy';
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete

RMAN>
4) Configure the connect identifier for your physical standby database.
RMAN> configure db_unique_name pc01sby1
2> connect identifier 'pc01sby1';

Practice 14-3: Configuring RMAN Parameters (continued)
Oracle Database 11g: Data Guard Administration A - 163
new RMAN configuration parameters:
CONFIGURE DB_UNIQUE_NAME 'pc01sby1' CONNECT IDENTIFIER
'pc01sby1';
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete

RMAN>
5) Your physical standby database is registered with the recovery catalog. Use the LIST
DB_UNIQUE command to see the registration information about your primary and
standby databases.
RMAN> list db_unique_name of database;


List of Databases
DB Key DB Name DB ID Database Role Db_unique_name
------- ------- ------------- ------------- -------------
1 PC01PRMY 2581955083 PRIMARY PC01PRMY
1 PC01PRMY 2581955083 STANDBY PC01SBY1

RMAN>
6) Use the REPORT SCHEMA command to view additional information about your
physical standby database.
Note: Your output may vary from this example and may not include the actual data
file names.
RMAN> report schema for db_unique_name pc01sby1;

Report of database schema for database with db_unique_name
PC01SBY1

List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
---- -------- -------------------- ------- -----------------
1 700 SYSTEM YES
2 540 SYSAUX NO
3 85 UNDOTBS1 YES
4 5 USERS NO
5 150 EXAMPLE NO

RMAN>
7) Exit RMAN.
8) Invoke RMAN again and connect to your physical standby database and the recovery
catalog.
[oracle@EDBVR6P1-pc01prmy labs]$ rman target
sys/oracle_4U@pc01sby1 catalog rcowner/rcpass@pc01db11
Practice 14-3: Configuring RMAN Parameters (continued)
Oracle Database 11g: Data Guard Administration A - 164

Recovery Manager: Release 11.2.0.1.0 - Production on Tue Feb
23 19:44:21 2010

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All
rights reserved.

connected to target database: PC01PRMY (DBID=2581955083, not
open)
connected to recovery catalog database

RMAN>
9) Execute the SHOW ALL command to view the configuration parameters for your
physical standby database.
RMAN> show all for db_unique_name pc01sby1;

RMAN configuration parameters for database with db_unique_name
PC01SBY1 are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK
TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO
BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; #
default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1;
# default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE
'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE DB_UNIQUE_NAME 'pc01prmy' CONNECT IDENTIFIER
'pc01prmy';
CONFIGURE DB_UNIQUE_NAME 'pc01sby1' CONNECT IDENTIFIER
'pc01sby1';
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL
STANDBY;
CONFIGURE SNAPSHOT CONTROLFILE NAME TO
'/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_pc01sby1.f
'; # default

RMAN>
10) Configure automatic backup of the control file and the server parameter file.
RMAN> configure controlfile autobackup on;
new RMAN configuration parameters:
Practice 14-3: Configuring RMAN Parameters (continued)
Oracle Database 11g: Data Guard Administration A - 165
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored

RMAN>
11) Configure backup optimization.
RMAN> configure backup optimization on;

new RMAN configuration parameters:
CONFIGURE BACKUP OPTIMIZATION ON;
new RMAN configuration parameters are successfully stored

RMAN>
12) Set the archived log deletion policy to BACKED UP 1 TIMES TO DEVICE TYPE
DISK.
RMAN> configure archivelog deletion policy to backed up 1
times to device type disk;

old RMAN configuration parameters:
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL
STANDBY;
new RMAN configuration parameters:
CONFIGURE ARCHIVELOG DELETION POLICY TO BACKED UP 1 TIMES TO
DISK;
new RMAN configuration parameters are successfully stored

RMAN>







Oracle Database 11g: Data Guard Administration A - 166
Practice 14-4: Recovering a Data File in Your Primary Database
In this practice, you recover a data file in your primary database by using a data file from
your physical standby database. ASM will not let you delete or rename a data file being
used by the database. For this reason, you will create a new data file outside of ASM in
order to simulate a disaster.
1) Set your environment variables for your primary database and log in as the SYS user.
Create a new tablespace EXAMPLE2 with a data file
/home/oracle/labs/example2.dbf and a size of 5 MB.
[oracle@EDBVR6P1-pc01prmy labs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 23 19:52:49
2010

Copyright (c) 1982, 2009, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -
Production
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining
and Real Application Testing options

SQL> create tablespace example2 datafile
'/home/oracle/labs/example2.dbf' size 5M;

Tablespace created.

SQL>
2) Connect to your standby instance as the SYSDBA user and show the
standby_file_management parameter.
SQL> connect sys/oracle_4U@pc01sby1 as sysdba
Connected.
SQL> show parameter standby_file_management

NAME TYPE VALUE
------------------------------------ ----------- ------------
standby_file_management string AUTO
3) Verify that the data file has successfully been created on the standby database.
SQL> select file#,name from v$datafile;
FILE# NAME
------ -------------------------------
1 +SBDAT/pc01sby1/datafile/system.258.711624777
2 +SBDAT/pc01sby1/datafile/sysaux.259.711624777
3 +SBDAT/pc01sby1/datafile/undotbs1.260.711624779
4 +SBDAT/pc01sby1/datafile/users.262.711624835
Practice 14-4: Recovering a Data File in Your Primary Database
(continued)
Oracle Database 11g: Data Guard Administration A - 167
5 +SBDAT/pc01sby1/datafile/example.261.711624779
6 +SBDAT/pc01sby1/datafile/example2.320.711748401

6 rows selected.
4) Reconnect to your primary database and create the hr.employees2 table as a copy
of the hr.employees table into the newly created tablespace. Exit SQL*Plus.
SQL> connect / as sysdba
Connected.
SQL> create table hr.employees2 tablespace example2 as select
* from hr.employees;

Table created.

SQL> exit
5) In your primary database terminal window, display the data file in the labs
directory.
[oracle@EDBVR6P1-pc01prmy labs]$ ls -la example2.dbf
-rw-r----- 1 oracle dba 5251072 Feb 23 20:03 example2.dbf
6) Move the example2.dbf file to example2.sav to simulate a failure in the
primary database. Note: ASM prevents mistakes like this from happening!
[oracle@EDBVR6P1-pc01prmy labs]$ mv example2.dbf example2.sav
[oracle@EDBVR6P1-pc01prmy labs]$
7) Log in to SQL*Plus as the HR user.
[oracle@EDBVR6P1-pc01prmy labs]$ sqlplus hr/hr

SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 23 20:08:01
2010

Copyright (c) 1982, 2009, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -
Production
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
8) Query the HR.EMPLOYEES2 table. Because you moved the data file, you receive an
error.
SQL> select count(*) from employees2;
select count(*) from employees2
*
ERROR at line 1:
ORA-01116: error in opening database file 6
Practice 14-4: Recovering a Data File in Your Primary Database
(continued)
Oracle Database 11g: Data Guard Administration A - 168
ORA-01110: data file 6: '/home/oracle/labs/example2.dbf'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3
9) Exit SQL*Plus.
10) Invoke RMAN and connect to your physical standby database as the target and your
primary database as the auxiliary database.
[oracle@EDBVR6P1-pc01prmy labs]$ rman

Recovery Manager: Release 11.2.0.1.0 - Production on Tue Feb
23 20:10:49 2010

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All
rights reserved.

RMAN> connect target sys/oracle_4U@pc01sby1

connected to target database: PC01PRMY (DBID=2581955083, not
open)

RMAN> connect auxiliary sys/oracle_4U@pc01prmy

connected to auxiliary database: PC01PRMY (DBID=2581955083)
11) Back up data file 6 from the physical standby database host to a new location named
/home/oracle/labs/newex01.dbf on your primary database host.
RMAN> backup as copy datafile 6
2> auxiliary format '/home/oracle/labs/newex01.dbf';

Starting backup at 23-FEB-10
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=135 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00006
name=+SBDAT/pc01sby1/datafile/example2.320.711748401
output file name=/home/oracle/labs/newex01.dbf
tag=TAG20100223T201354
channel ORA_DISK_1: datafile copy complete, elapsed time:
00:00:03
Finished backup at 23-FEB-10
12) Exit RMAN.
RMAN> exit

Recovery Manager complete.
[oracle@EDBVR6P1-pc01prmy labs]$
Practice 14-4: Recovering a Data File in Your Primary Database
(continued)
Oracle Database 11g: Data Guard Administration A - 169
13) Invoke RMAN again. Connect to your primary database as the target and to the
recovery catalog.
[oracle@EDBVR6P1-pc01prmy labs]$ rman target / catalog
rcowner/rcpass@pc01db11

Recovery Manager: Release 11.2.0.1.0 - Production on Tue Feb
23 20:14:57 2010

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All
rights reserved.

connected to target database: PC01PRMY (DBID=2581955083)
connected to recovery catalog database

RMAN>
14) Catalog the data file copy that you made in step 11 in the recovery catalog.
RMAN> catalog datafilecopy '/home/oracle/labs/newex01.dbf';

starting full resync of recovery catalog
full resync complete
cataloged datafile copy
datafile copy file name=/home/oracle/labs/newex01.dbf RECID=4
STAMP=711749736

RMAN>
15) Use the RMAN SET NEWNAME and SWITCH DATAFILE commands to update the
data file name in the RMAN repository.
RMAN> run {
2> set newname for datafile 6 to
'/home/oracle/labs/newex01.dbf';
3> switch datafile 6;
4> }

executing command: SET NEWNAME

RMAN-06169: could not read file header for datafile 6 error
reason 5
RMAN-
00571:=====================================================
RMAN-00569:======== ERROR MESSAGE STACK FOLLOWS============
RMAN-00571:================================================
RMAN-03009: failure of switch command on default channel at
02/23/2010 20:17:23
ORA-19623: file 6 is open
16) Take the tablespace offline to perform step 11. Take the EXAMPLE tablespace offline.
Practice 14-4: Recovering a Data File in Your Primary Database
(continued)
Oracle Database 11g: Data Guard Administration A - 170
RMAN> sql 'alter tablespace example2 offline immediate';

sql statement: alter tablespace example2 offline immediate
17) Try once again to execute the SET NEWNAME and SWITCH DATAFILE commands.
RMAN> run {
2> set newname for datafile 6 to
'/home/oracle/labs/newex01.dbf';
3> switch datafile 6;
4> }

executing command: SET NEWNAME

RMAN-06169: could not read file header for datafile 6 error
reason 4
datafile 6 switched to datafile copy
input datafile copy RECID=4 STAMP=711749736 file
name=/home/oracle/labs/newex01.dbf
starting full resync of recovery catalog
full resync complete
18) Bring the EXAMPLE2 tablespace back online.
RMAN> sql 'alter tablespace example2 online';
sql statement: alter tablespace example2 online
RMAN-00571:==================================================
RMAN-00569:=============== ERROR MESSAGE STACK FOLLOWS ======
RMAN-00571:==================================================
RMAN-03009: failure of sql command on default channel at
02/23/2010 20:22:14
RMAN-11003: failure during parse/execution of SQL statement:
alter tablespace example2 online
ORA-01113: file 6 needs media recovery
ORA-01110: data file 6: '/home/oracle/labs/newex01.dbf'

RMAN>
19) Because you took the tablespace offline with the IMMEDIATE option, you must
recover the tablespace. Recover the EXAMPLE2 tablespace.
RMAN> recover tablespace example2;
Starting recover at 23-FEB-10
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=152 device type=DISK

starting media recovery
media recovery complete, elapsed time: 00:00:01

Finished recover at 23-FEB-10
RMAN>
Practice 14-4: Recovering a Data File in Your Primary Database
(continued)
Oracle Database 11g: Data Guard Administration A - 171
20) Again try to bring the EXAMPLE2 tablespace online. Exit from RMAN.
RMAN> sql 'alter tablespace example2 online';
sql statement: alter tablespace example2 online

RMAN> exit


Recovery Manager complete.
21) Invoke SQL*Plus and connect as the HR user. Query HR.EMPLOYEES21 again.
SQL> select count(*) from employees2;

COUNT(*)
----------
107
22) You now need to recover the same data file on the pc<nn>sby3 database. Open a
terminal window to your standby host and set the environment variables.
[oracle@EDBVR6P2-pc03sby1 ~]$ . oraenv
ORACLE_SID = [pc03sby1] ? pc01sby3
The Oracle base for
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is
/u01/app/oracle
23) In SQL*Plus, connected as the SYSDBA user, attempt to bring the tablespace online.
[oracle@EDBVR6P2-pc01sby3 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Feb 24 10:26:42
2010

Copyright (c) 1982, 2009, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -
Production
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining
and Real Application Testing options

SQL> alter tablespace example2 online;
alter tablespace example2 online
*
ERROR at line 1:
ORA-01113: file 6 needs media recovery
ORA-01110: data file 6: '/home/oracle/labs/example2.dbf'

SQL> exit
Practice 14-4: Recovering a Data File in Your Primary Database
(continued)
Oracle Database 11g: Data Guard Administration A - 172
24) Use Recovery Manager to repair the data file.
[oracle@EDBVR6P2-pc01sby3 ~]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Wed Feb
24 10:27:50 2010

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All
rights reserved.

connected to target database: PC01SBY3 (DBID=1504250089)

RMAN> recover datafile 6;

Starting recover at 24-FEB-10
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=158 device type=DISK

starting media recovery
media recovery complete, elapsed time: 00:00:00

Finished recover at 24-FEB-10
RMAN> exit


Recovery Manager complete.
[oracle@EDBVR6P2-pc01sby3 ~]$
25) Bring the tablespace online after it has been recovered.
[oracle@EDBVR6P2-pc01sby3 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Feb 24 10:28:30
2010

Copyright (c) 1982, 2009, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -
Production
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining
and Real Application Testing options

SQL> alter tablespace example2 online;

Tablespace altered.
26) Restart the SQL Apply services for the logical standby database.
SQL> alter database start logical standby apply immediate;

Database altered.

Oracle Database 11g: Data Guard Administration A - 173
Practices for Lesson 15: Patching and Upgrading
Databases in a Data Guard Configuration
There are no practices for Lesson 15, Patching and Upgrading Databases in a Data
Guard Configuration.

Oracle Database 11g: Data Guard Administration A - 174

Practices for Lesson 16: Monitoring a Data Guard
Broker Configuration
In the practices for Lesson 16, Monitoring a Data Guard Broker Configuration, you use
various techniques to monitor your Data Guard configuration. In later practices, you use
these techniques to resolve issues in your configuration.

































Oracle Database 11g: Data Guard Administration A - 175
Practice 16-1: Viewing Log File Details
In this practice, you use Enterprise Manager Grid Control to view information about Log
Transport and Log Apply services.
1) On the Data Guard Overview page, click Log File Details in the Performance
section.


2) The Log File Details page is displayed. Note the state of Log Transport and Log
Apply services in your configuration.

3) Invoke DGMGRL on your primary database host and log in as SYS with a password
oracle.
[oracle@EDBVR6P1-pc01prmy ~]$ dgmgrl
DGMGRL for Linux: Version 11.2.0.1.0 - Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.


Oracle Database 11g: Data Guard Administration A - 176
Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/oracle_4U
Connected.
DGMGRL>
4) Set the state of your physical standby database to APPLY-OFF.
DGMGRL> edit database 'pc01sby1' set state='APPLY-OFF';
Succeeded.
5) Exit DGMGRL.
6) Invoke SQL*Plus on your primary database host and log in as SYS with a password
of oracle.
[oracle@EDBVR6P1-pc01prmy ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Feb 24 11:02:35
2010

Copyright (c) 1982, 2009, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -
Production
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
7) Perform a log switch.
SQL> alter system switch logfile;

System altered.
8) Exit SQL*Plus.
9) Return to Enterprise Manager Grid Control and refresh your page. Note the status for
Log Apply Services and the status of the log files. (Your results may vary slightly
from what is shown.)




Oracle Database 11g: Data Guard Administration A - 177
10) Invoke DGMGRL again on your primary database host and log in as SYS with the
password oracle.
11) Set the state of your physical standby database to APPLY-ON.
DGMGRL> edit database 'pc01sby1' set state='APPLY-ON';
Succeeded.
12) Exit DGMGRL.
13) Return to Enterprise Manager Grid Control and refresh your page. Note the status of
Log Apply Services. All logs should have been received and applied.






Oracle Database 11g: Data Guard Administration A - 178
Practice 16-2: Using DGMGRL to Monitor the Configuration
In this practice, you use DGMGRL to monitor your configuration.
1) Invoke DGMGRL on your primary database host and connect as SYS with the
password oracle.
[oracle@EDBVR6P1-pc01prmy ~]$ dgmgrl
DGMGRL for Linux: Version 11.2.0.1.0 - Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/oracle_4U
Connected.
2) Execute the SHOW CONFIGURATION command to check your configuration status.
DGMGRL> show configuration

Configuration - DGConfig1

Protection Mode: MaxPerformance
Databases:
pc01prmy - Primary database
pc01sby1 - Physical standby database
pc01sby3 - Logical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS
3) Open a terminal window for your standby database system host. Set the environment
variables for pc<nn>sby1. Log in to SQL*Plus as the SYS user. Stop the Redo
Apply process for the purpose of evaluating the impact on your configuration.
[oracle@EDBVR6P2-pc01sby3 ~]$ . oraenv
ORACLE_SID = [pc01sby3] ? pc01sby1
The Oracle base for
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is
/u01/app/oracle
[oracle@EDBVR6P2-pc01sby1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Feb 24 11:09:15
2010

Copyright (c) 1982, 2009, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -
Production
Practice 16-2: Using DGMGRL to Monitor the Configuration
(continued)
Oracle Database 11g: Data Guard Administration A - 179
With the Partitioning, Automatic Storage Management, OLAP,
Data Mining
and Real Application Testing options

SQL> alter database recover managed standby database cancel;

Database altered.
4) Return to your primary database window and check your configuration status.
DGMGRL> show configuration

Configuration - DGConfig1

Protection Mode: MaxPerformance
Databases:
pc01prmy - Primary database
pc01sby1 - Physical standby database
Error: ORA-16766: Redo Apply is stopped

pc01sby3 - Logical standby database

Fast-Start Failover: DISABLED

Configuration Status:
ERROR
5) Now check the status of your Data Guard configuration by navigating to the Data
Guard Overview page.

Practice 16-2: Using DGMGRL to Monitor the Configuration
(continued)
Oracle Database 11g: Data Guard Administration A - 180
6) Click the ORA-16766: Redo Apply is stopped link in the Data Guard Status column.
7) Click the Reset button to restart Redo Apply.



8) You receive a message that the reset was successful. Click the Data Guard link to
return to the Data Guard Overview page. The Status for the physical standby database
now is Normal.



9) Return to your DGMGRL session and execute the SHOW CONFIGURATION
command again.
DGMGRL> show configuration

Practice 16-2: Using DGMGRL to Monitor the Configuration
(continued)
Oracle Database 11g: Data Guard Administration A - 181
Configuration - DGConfig1

Protection Mode: MaxPerformance
Databases:
pc01prmy - Primary database
pc01sby1 - Physical standby database
pc01sby3 - Logical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS


Oracle Database 11g: Data Guard Administration A - 182
Practices for Lesson 17: Optimizing a Data Guard
Configuration
In the practice for Lesson 17, Optimizing a Data Guard Configuration, you configure
network compression of redo data.

Oracle Database 11g: Data Guard Administration A - 183
Practice 17-1: Configuring Network Compression of Redo Data
In this practice, you set the RedoCompression property to configure network
compression of redo data.
1) Invoke SQL*Plus on your primary database and determine if redo compression is
enabled by querying V$ARCHIVE_DEST.
SQL> col dest_name format a30
SQL> select dest_name, compression
2 from v$archive_dest;

DEST_NAME COMPRES
------------------------------ -------
LOG_ARCHIVE_DEST_1 DISABLE
LOG_ARCHIVE_DEST_2 DISABLE
LOG_ARCHIVE_DEST_3 DISABLE
LOG_ARCHIVE_DEST_4 DISABLE
LOG_ARCHIVE_DEST_5 DISABLE
LOG_ARCHIVE_DEST_6 DISABLE
...
LOG_ARCHIVE_DEST_30 DISABLE
LOG_ARCHIVE_DEST_31 DISABLE

31 rows selected.
2) Invoke DGMGRL on your primary database host.
[oracle@EDBVR6P1-pc01prmy ~]$ dgmgrl
DGMGRL for Linux: Version 11.2.0.1.0 - Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/oracle_4U
Connected.
3) Enable redo compression by setting the RedoCompression property for your
standby database.
DGMGRL> edit database pc01sby1
> set property 'RedoCompression'='ENABLE';
Property "RedoCompression" updated
4) Return to your SQL*Plus session and query V$ARCHIVE_DEST again. Note that
compression is set for LOG_ARCHIVE_DEST_1.
SQL> select dest_name, compression
2 from v$archive_dest;

DEST_NAME COMPRES
------------------------------ -------
LOG_ARCHIVE_DEST_1 DISABLE
LOG_ARCHIVE_DEST_2 ENABLE
Practice 17-1: Configuring Network Compression of Redo Data
(continued)
Oracle Database 11g: Data Guard Administration A - 184
...
LOG_ARCHIVE_DEST_30 DISABLE
LOG_ARCHIVE_DEST_31 DISABLE

31 rows selected.

You might also like