Sie sind auf Seite 1von 282

HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY.

COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

D67579
May 2010
Edition 3.0
D52161GC30
Activity Guide
Administration
Oracle Database 11g: Data Guard

unarski inzenjering d.o.o use only


Authors Copyright © 2010, Oracle and/or its affiliates. All rights reserved.

Mark Fuller Disclaimer


HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Donna K. Keesling This document contains proprietary information and is protected by copyright and
other intellectual property laws. You may copy and print this document solely for your
own use in an Oracle training course. The document may not be modified or altered in
Technical Contributors any way. Except where your use constitutes "fair use" under copyright law, you may
and Reviewers not use, share, download, upload, copy, print, display, perform, reproduce, publish,
license, post, transmit, or distribute this document in whole or in part without the
Todd Bao express authorization of Oracle.
Harald van Breederode The information contained in this document is subject to change without notice. If you
Michael Cebulla find any problems in the document, please report them in writing to: Oracle University,
500 Oracle Parkway, Redwood Shores, California 94065 USA. This document is not
Joel Goodman warranted to be error-free.
Uwe Hesse
Restricted Rights Notice
Pete Jones
If this documentation is delivered to the United States Government or anyone using
Nitin Karkhanis
the documentation on behalf of the United States Government, the following notice is
Frank Kobylanski applicable:
Sadhana Kyathappala U.S. GOVERNMENT RIGHTS
Stephen Moriarty The U.S. Government’s rights to use, modify, reproduce, release, perform, display, or
disclose these training materials are restricted by the terms of the applicable Oracle
Javier Saiz license agreement and/or the applicable U.S. Government contract.
Madhavi Siddireddy
Trademark Notice
Jim Spiller
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names
Milgred Tumolo
may be trademarks of their respective owners.
Branislav Valny
Jean-Francois Verrier
Pam Welford

Editors
Aju Kumar
Amitha Narayan
Nita Pavitran

Graphic Designer
Satish Bettegowda

Publishers
Syed Imtiaz Ali
Sumesh Koshy
Veena Narasimhan
unarski inzenjering d.o.o use only
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Practices and Solutions


Appendix A

Oracle University and Digit racunarski inzenjering d.o.o use only


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
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
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration A - 2


Practice 9-1: Setting the Data Protection Mode by Using DGMGRL ........................ 108

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 9-2: Setting the Data Protection Mode by Using Enterprise Manager Grid
Control ........................................................................................................................ 112
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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

Oracle University and Digit racunarski inzenjering d.o.o use only


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-3


HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A-4
There are no practices for Lesson 1, “Introduction to Oracle Data Guard.”
Practices for Lesson 1: Introduction to Oracle
Data Guard

Oracle University and Digit racunarski inzenjering d.o.o use only


Practices for Lesson 2: Creating a Physical Standby
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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.

Oracle University and Digit racunarski inzenjering d.o.o use only


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-5


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 you are using in the classroom.nn>prmy, wherenn represents the number of the

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
-66connect as to your primary database. Determine if
mode.FORCELOGGING is
enabled. If it is not enabled, enable FORCE LOGGING
-120[oracle@EDBVR6P1- ~]$
[oracle@EDBVR6P1- labs]$. oraenv
ORACLE_SID = [oracle] ? pc01prmy

ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 isThe Oracle base for

[oracle@EDBVR6P1-pc01prmy labs]$ /u01/app/oracle

[[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.

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Connected to:

With the Partitioning, Automatic Storage Management, OLAP,Production

and Real Application Testing options Data Mining

SQL> SELECT force_logging FROM v$database;


FOR
---
NO
SQL> ALTER DATABASE FORCE LOGGING;
Database altered.
SQL> SELECT force_logging FROM v$database;
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A-6

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 2-1: Preparing the Primary Database (continued)
FOR
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

---
YES
2) Configure the standby redo logs on the primary database. You can use the
cr_sby_redologs.sql script.
SQL>
SQL> ALTER DATABASE ADD STANDBY LOGFILE '+DATA' size 52428800
2 /

Oracle University and Digit racunarski inzenjering d.o.o use only


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)

Oracle Database 11g: Data Guard Administration A-7


Practice 2-1: Preparing the Primary Database (continued)

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>
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.
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Database altered.
SQL> ALTER DATABASE OPEN;

Oracle Database 11g: Data Guard Administration


A-8

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 2-1: Preparing the Primary Database (continued)
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>
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

using target database control file instead of recovery catalog current log archived
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

channel ORA_DISK_1: starting piece 1 at 09-FEB-10 STAMP=710531518


channel ORA_DISK_1: finished piece 1 at 09-FEB-10

handle=+FRA/pc01prmy/backupset/2010_02_09/annnf0_tag20100209t1piece
75159_0.267.710531519 tag=TAG20100209T175159 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time:

Finished backup at 09-FEB-10 00:00:03


HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Starting backup at 09-FEB-10

Oracle Database 11g: Data Guard Administration


A-9
channel ORA_DISK_1: starting full datafile backup set using channel ORA_DISK_1

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 2-1: Preparing the Primary Database (continued)
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

handle=+FRA/pc01prmy/backupset/2010_02_09/nnndf0_tag20100209t1piece
75202_0.268.710531523 tag=TAG20100209T175202 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time:

channel ORA_DISK_1: starting full datafile backup set 00:01:15


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

handle=+FRA/pc01prmy/backupset/2010_02_09/ncsnf0_tag20100209t1piece
75202_0.269.710531601 tag=TAG20100209T175202 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time:

Finished backup at 09-FEB-10 00:00:03


Starting backup at 09-FEB-10
current log archived

channel ORA_DISK_1: starting archived log backup set using channel ORA_DISK_1
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=11 RECID=4

channel ORA_DISK_1: starting piece 1 at 09-FEB-10 STAMP=710531604


channel ORA_DISK_1: finished piece 1 at 09-FEB-10
handle=+FRA/pc01prmy/backupset/2010_02_09/annnf0_tag20100209t1piece
75324_0.271.710531605 tag=TAG20100209T175324 comment=NONE
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

channel ORA_DISK_1: backup set complete, elapsed time:

Finished backup at 09-FEB-10 00:00:01

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

Oracle Database 11g: Data Guard Administration A - 10

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 2-2: Creating the Physical Standby Database
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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

Oracle University and Digit racunarski inzenjering d.o.o use only


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.

Oracle Database 11g: Data Guard Administration A - 11


Practice 2-2: Creating the Physical Standby Database
(continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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.

Oracle University and Digit racunarski inzenjering d.o.o use only


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.

Oracle Database 11g: Data Guard Administration A - 12


Practice 2-2: Creating the Physical Standby Database
(continued)
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

# Generated by Oracle configuration tools. .ora


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))
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

)
)
(CONNECT_DATA =

(SERVICE_NAME =

i) Exit Oracle Net Manager.


)

[oracle@EDBVR6P1-pc01prmy labs]$
pc01sby1.us.oracle.com)

Oracle Database 11g: Data Guard Administration


A - 13

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 2-2: Creating the Physical Standby Database
(continued)
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.

cc:b1:11:60:dd:4c:28:43:4a:ab:66:a1:b7:1f:d7:0c. RSA key fingerprint is

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- ~]$
ORACLE_SID = [oracle] ?
pc02prmy

ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 isThe Oracle base for


/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.
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A - 14

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 2-2: Creating the Physical Standby Database
(continued)

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

/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listenerSystem parameter file is


.ora
Log messages written to
/u01/app/oracle/diag/tnslsnr/EDBVR6P2/listener1/alert/log.xml

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=edBVr6p2.us.oracle.cListening on:

om)(PORT=12001)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=edbvr6p2.us.oracle.cConnecting to

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
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A - 15

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 2-2: Creating the Physical Standby Database
(continued)

/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listenerListener Parameter File


.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]$lscd $ORACLE_HOME/dbs
[oracle@EDBVR6P1-pc01prmy dbs]$
hc_DBUA0.dat initpc01db11.ora orapwpc01db11

hc_pc01db11.dat initpc01prmy.ora orapwpc01prmy peshm_pc01prmy_0

hc_pc01prmy.dat lkPC01DB11 peshm_DBUA0_0 snapcf_pc01prmy.f


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]$
Connected to edBVr6p2.us.oracle.com.
220 edBVr6p2.us.oracle.com FTP server (Version wu-2.6.1-20)

530 Please login with USER and PASS. ready.


530 Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Name (edbvr6p2:oracle):
331 Password required for
oracle

230 User oracle logged in. Password:


Remote system type is UNIX.
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

ftp>
Using binary mode to transfer files.

Oracle Database 11g: Data Guard Administration


A - 16

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 2-2: Creating the Physical Standby Database
(continued)
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.

1536 bytes sent in 4.3e-05 seconds (3.5e+04 Kbytes/s) 226 Transfer complete.
-120ftp>
221-You have transferred 1536 bytes in 1 files.
221-Total traffic for this session was 2046 bytes in 1

221 Thank you for using the FTP service ontransfers.


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 ~]$
[oracle@EDBVR6P2-pc02prmy dbs]$
ls
hc_DBUA0.dat initpc02db11.ora orapwpc01sby1

hc_pc02db11.dat initpc02prmy.ora orapwpc02db11 peshm_pc02db11_0

hc_pc02prmy.dat lkPC02DB11 orapwpc02prmy peshm_pc02prmy_0


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.
<< add a new line per instructions >> [oracle@EDBVR6P2-pc02prmy dbs]$ vi initpc01sby1.ora
[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.


HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

[oracle@EDBVR6P2-pc02prmy dbs]$
[oracle@EDBVR6P2-pc02prmy admin]$
+ASM pc02db11 pc02prmy ls

[oracle@EDBVR6P2-pc02prmy admin]$ mkdir pc01sby1

Oracle Database 11g: Data Guard Administration A - 17

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 2-2: Creating the Physical Standby Database
(continued)
11) Change to the pc<nn>sby1 directory and create the adump, dpdump, and pfile
directories.
[oracle@EDBVR6P2-pc02prmy admin]$
[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
-106pc01sby1 sqlplus / as sysdba
[oracle@EDBVR6P2-pc01sby1
pc01sby1]$
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

Disconnected from Oracle Database 11g Enterprise EditionSQL> exit


Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application
Testing options exit
[oracle@EDBVR6P2-pc01sby1
pc01sby1]$

Connection to edbvr6p2 closed. logout

[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

[oracle@EDBVR6P1-pc01prmy dbs]$ pc01prmy


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
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

standby databases.

Oracle Database 11g: Data Guard Administration A - 18

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 2-2: Creating the Physical Standby Database
(continued)
[oracle@EDBVR6P1-pc01prmy dbs]$
[oracle@EDBVR6P1-pc01prmy labs]$
cat cr_phys_sby1.txt

allocate channel prmy1 type disk; run {


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

parameter_value_convert 'pc01prmy','pc01sby1' spfile


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)


HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

RMAN>

16) Execute the cr_phys_sby1.txt script.

Oracle Database 11g: Data Guard Administration A - 19

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 2-2: Creating the Physical Standby Database
(continued)
RMAN> @cr_phys_sby1.txt

2> allocate channel prmy1 type disk; RMAN> run {


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

9> parameter_value_convert 'pc01prmy','pc01sby1' 8> spfile


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'

log_archive_config='dg_config=(pc01prmy,pc01sby1)' 19> set


20> set log_archive_dest_2='service=pc01prmy ASYNC
21> valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE)
db_unique_name=pc01prmy'
22> ;

using target database control file instead of recovery catalog 23> }


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
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

backup as copy reuse


{
contents of Memory Script:
Starting Duplicate Db at 09-FEB-10

Oracle Database 11g: Data Guard Administration


A - 20

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 2-2: Creating the Physical Standby Database
(continued)

'/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwpc01prmy' targetfile

'/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwpc01sby1' auxiliary format

'+DATA/pc01prmy/spfilepc01prmy.ora' auxiliary format targetfile


'/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfilepc01sby1.or

sql clone "alter system set spfile=a' ;


''/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=

sql clone "alter system set dispatchers = '''' scope=spfile";


''(PROTOCOL=TCP) (SERVICE=pc01sby1XDB)'' comment=

sql clone "alter system set db_unique_name = '''' scope=spfile";


''pc01sby1'' comment=

sql clone "alter system set db_create_file_dest = '''' scope=spfile";


''+SBDAT'' comment=

sql clone "alter system set db_recovery_file_dest = '''' scope=spfile";


''+SBFRA'' comment=

sql clone "alter system set db_recovery_file_dest_size = '''' scope=spfile";


5G comment=

sql clone "alter system set control_files = '''' scope=spfile";


''+SBDAT'' comment=
sql clone "alter system set log_archive_max_processes = '''' scope=spfile";
5 comment=
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

sql clone "alter system set fal_client = '''' scope=spfile";


''pc01sby1'' comment=
Oracle Database 11g: Data Guard Administration A - 21

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 2-2: Creating the Physical Standby Database
(continued)

sql clone "alter system set fal_server = '''' scope=spfile";


''pc01prmy'' comment=

sql clone "alter system set standby_file_management = '''' scope=spfile";


''AUTO'' comment=

sql clone "alter system set log_archive_config = '''' scope=spfile";


''dg_config=(pc01prmy,pc01sby1)'' comment=

sql clone "alter system set log_archive_dest_2 = '''' scope=spfile";

''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
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A - 22

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 2-2: Creating the Physical Standby Database
(continued)
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''

''Set by RMAN'' scope=spfile"; comment=


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''

''Set by RMAN'' scope=spfile"; comment=


shutdown clone immediate;
startup clone nomount;
}
executing Memory Script
sql statement: alter system set control_files =
''+SBDAT/pc01sby1/controlfile/current.256.710533699'' comment=
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

''Set by RMAN'' scope=spfile


Starting backup at 09-FEB-10
channel prmy1: starting datafile copy
Oracle Database 11g: Data Guard Administration
A - 23

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 2-2: Creating the Physical Standby Database
(continued)
copying standby control file

name=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_pc01proutput file
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
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

datafile 5 auxiliary format new


datafile 4 auxiliary format new

sql 'alter system archive log current';


;
Oracle Database 11g: Data Guard Administration
A - 24

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 2-2: Creating the Physical Standby Database
(continued)
}
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

name=+SBDAT/pc01sby1/datafile/undotbs1.259.710533719output file

channel prmy4: datafile copy complete, elapsed time: 00:00:46 tag=TAG20100209T182757


channel prmy4: starting datafile copy
input datafile file number=00004
name=+DATA/pc01prmy/datafile/users.259.710507263

name=+SBDAT/pc01sby1/datafile/example.260.710533719output file

channel prmy3: datafile copy complete, elapsed time: 00:01:13 tag=TAG20100209T182757


output file name=+SBDAT/pc01sby1/datafile/users.262.710533773

channel prmy4: datafile copy complete, elapsed time: 00:00:38 tag=TAG20100209T182757


output file name=+SBDAT/pc01sby1/datafile/system.258.710533719
channel prmy1: datafile copy complete, elapsed time: 00:02:05 tag=TAG20100209T182757

output file name=+SBDAT/pc01sby1/datafile/sysaux.261.710533719


HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

channel prmy2: datafile copy complete, elapsed time: 00:02:15 tag=TAG20100209T182757

Oracle Database 11g: Data Guard Administration A - 25

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 2-2: Creating the Physical Standby Database
(continued)
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
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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

Oracle Database 11g: Data Guard Administration


A - 26

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 2-2: Creating the Physical Standby Database
(continued)
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -

With the Partitioning, Automatic Storage Management, OLAP,Production

and Real Application Testing options Data Mining


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 standby database to the
utility to set your environment variables. Change to the /etc/oratab file. Use
the oraenv labs directory.
Log in to SQL*Plus as the SYSDBA user. Start Redo Apply.
[oracle@EDBVR6P1-pc01prmy ~]$oraclessh edbvr6p2
oracle@edbvr6p2's password:
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

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 # line added by Agent

[oracle@EDBVR6P2-pc01sby1 ~]$pc01sby1. oraenv


ORACLE_SID = [+ASM] ?

ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 isThe Oracle base for


/u01/app/oracle
[oracle@EDBVR6P2-pc01sby1 ~]$
[oracle@EDBVR6P2-pc01sby1 labs]$
sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 9 18:39:01
2010
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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

Oracle Database 11g: Data Guard Administration


A - 27

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 2-2: Creating the Physical Standby Database
(continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -

With the Partitioning, Automatic Storage Management, OLAP,Production

and Real Application Testing options Data Mining


SQL>
2
using current logfile disconnect;
Database altered.

Oracle University and Digit racunarski inzenjering d.o.o use only

Oracle Database 11g: Data Guard Administration A - 28


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> SELECT sequence#, first_time, next_time SQL> SET echo ON


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
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

6 rows selected.
17 09-FEB-10 09-FEB-10

Oracle Database 11g: Data Guard Administration


A - 29

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 2-3: Verifying That the Physical Standby Database Is
Performing Correctly (continued)
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>
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A - 30

Oracle University and Digit racunarski inzenjering d.o.o use only


HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A - 31
There are no practices for Lesson 3, “Oracle Data Guard Broker: Overview.”
Practices for Lesson 3: Oracle Data Guard Broker:
Overview

Oracle University and Digit racunarski inzenjering d.o.o use only


Practices for Lesson 4: Creating a Data Guard Broker
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Configuration
In the practices for Lesson 4, “Creating a Data Guard Broker Configuration,” you create a
broker configuration.

Oracle University and Digit racunarski inzenjering d.o.o use only

Oracle Database 11g: Data Guard Administration A - 32


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.

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Connected to:

With the Partitioning, Automatic Storage Management, OLAP,Production

and Real Application Testing options Data Mining

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 ~]$oraclessh edbvr6p2
oracle@edbvr6p2's password:
Last login: Tue Feb 9 18:34:04 2010 from
edbvr6p1.us.oracle.com
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED
Oracle Database 11g: Data Guard Administration
A - 33

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 4-1: Setting the DG_BROKER_START Initialization
Parameter (continued)
[oracle@EDBVR6P2- ~]$
ORACLE_SID = [oracle] ?
pc01sby1

ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 isThe Oracle base for


/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.

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Connected to:

With the Partitioning, Automatic Storage Management, OLAP,Production

and Real Application Testing options Data Mining

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
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A - 34

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 4-2: Configuring Listener to Allow Data Guard Broker to
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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 University and Digit racunarski inzenjering d.o.o use only


ORACLE_SID = [pc01prmy] ? +ASM

ORACLE_HOME=/u01/app/oracle/product/11.2.0/grid isThe Oracle base for


/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

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 (continued)
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.

(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=edbvr6p1.us.oracle.cConnecting to
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

/u01/app/oracle/product/11.2.0/grid/network/admin/listener.ora System parameter file is

/u01/app/oracle/diag/tnslsnr/EDBVR6P1/listener/alert/log.xml Log messages written to

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) Listening on:

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=edBVr6p1.us.oracle.cListening on:
om)(PORT=1521)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521))) Connecting to
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

/u01/app/oracle/product/11.2.0/grid/network/admin/listener.ora Listener Parameter File

/u01/app/oracle/diag/tnslsnr/EDBVR6P1/listener/alert/log.xml Listener Log File


HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Listening Endpoints Summary...

Oracle Database 11g: Data Guard Administration


A - 36
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 4-2: Configuring Listener to Allow Data Guard Broker to
Restart Primary Database Instance – Server Setup (continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=edBVr6p1.us.oracle.c

om)(PORT=1521)))
Services Summary...
Instance "Service "pc01prmy_DGMGRL.us.oracle.com" has 1 instance(s).
pc01prmy", status UNKNOWN, has 1 handler(s) for

The command completed successfully this service...

Oracle University and Digit racunarski inzenjering d.o.o use only


[oracle@EDBVR6P1-+ASM labs]$

Oracle Database 11g: Data Guard Administration A - 37


Practice 4-2: Configuring Listener to Allow Data Guard Broker to
Restart Primary Database Instance – Server Setup (continued)
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 =

(GLOBAL_DBNAME = pc01prmy_DGMGRL.us.oracle.com) (SID_DESC =


(ORACLE_HOME =
(SID_NAME = pc01prmy) )
)
)
LISTENER =
(DESCRIPTION_LIST =

(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) (DESCRIPTION =


-40 ) (DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST =
edBVr6p1.us.oracle.com)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /u01/app/oracle

ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER = ON
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A - 38

Oracle University and Digit racunarski inzenjering d.o.o use only


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]$oraclessh edbvr6p2
oracle@edbvr6p2's password:
Last login: Tue Feb 9 18:46:41 2010 from
edbvr6p1.us.oracle.com
[oracle@EDBVR6P2- ~]$
ORACLE_SID = [oracle] ?
pc01sby1

ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 isThe Oracle base for


/u01/app/oracle
-360[oracle@EDBVR6P2-pc01sby1 ~]$
[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.
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A - 39

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 4-3: Configuring Listener to Allow Data Guard Broker to
Restart Standby Database Instance – Server Setup (continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle University and Digit racunarski inzenjering d.o.o use only


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.

(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=edbvr6p2.us.oracle.cConnecting to

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

/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listenerSystem parameter file is


.ora

Oracle Database 11g: Data Guard Administration A - 40


Practice 4-3: Configuring Listener to Allow Data Guard Broker to
Restart Standby Database Instance – Server Setup (continued)

/u01/app/oracle/diag/tnslsnr/EDBVR6P2/listener1/alert/log.xml Log messages written to

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=edBVr6p2.us.oracle.cListening on:
om)(PORT=12001)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=edbvr6p2.us.oracle.cConnecting to
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

/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listenerListener Parameter File


.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)))

Service "pc01sby1.us.oracle.com" has 1 instance(s). Services Summary...


Instance "pc01sby1", status UNKNOWN, has 1 handler(s) for

Service "pc01sby1_DGMGRL.us.oracle.com" has 1 instance(s). this service...


Instance "pc01sby1", status UNKNOWN, has 1 handler(s) for

The command completed successfully this service...


[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
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

LISTENER1 =
(DESCRIPTION =
_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

A - 41 Oracle Database 11g: Data Guard Administration

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 4-3: Configuring Listener to Allow Data Guard Broker to
Restart Standby Database Instance – Server Setup (continued)
(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
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A - 42

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 4-4: Creating an Oracle Net Service Name to Allow
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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.

Oracle University and Digit racunarski inzenjering d.o.o use only


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.

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
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Instance – Client Setup (continued)

Oracle University and Digit racunarski inzenjering d.o.o use only


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.

Oracle Database 11g: Data Guard Administration A - 44


Practice 4-4: Creating an Oracle Net Service Name to Allow
Standby Database Instance to Connect to Primary Database
Instance – Client Setup (continued)
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 = (PROTOCOL = TCP)(HOST = (ADDRESS_LIST =


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))
-253 (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)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

)
)

[oracle@EDBVR6P2-pc01sby1 ~]$

Oracle Database 11g: Data Guard Administration


A - 45

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 4-5: Creating an Oracle Net Service Name for the
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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.

Oracle University and Digit racunarski inzenjering d.o.o use only


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.

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
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

(continued)

Oracle University and Digit racunarski inzenjering d.o.o use only


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.

Oracle Database 11g: Data Guard Administration A - 47


Practice 4-5: Creating an Oracle Net Service Name for the
Standby Database for Non-Standard Dynamic Registration
(continued)
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

# Generated by Oracle configuration tools. .ora


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))
-373 -120 (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)
)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

)
PC01SBY1 =
(DESCRIPTION =
(ADDRESS_LIST =

edbvr6p2.us.oracle.com)(PORT =
(ADDRESS = (PROTOCOL = TCP)(HOST =
12001))

Oracle Database 11g: Data Guard Administration


A - 48

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 4-5: Creating an Oracle Net Service Name for the
Standby Database for Non-Standard Dynamic Registration
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

(continued)
)
(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

Oracle University and Digit racunarski inzenjering d.o.o use only


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
sqlplus / as sysdba
-186pc01sby1
[oracle@EDBVR6P2-
pc01sby1 ~]$
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.

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Connected to:

With the Partitioning, Automatic Storage Management, OLAP,Production

and Real Application Testing options Data Mining

SQL> alter system set local_listener=pc01sby1;


System altered.
SQL> exit

Oracle Database 11g: Data Guard Administration A - 49


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>
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

pc01prmy - Primary database Databases:


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>
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED
Oracle Database 11g: Data Guard Administration
A - 50

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 4-6: Creating the Broker Configuration (continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

5) Verify that the pc<nn>sby1 database was added to the configuration.


DGMGRL> show configuration

Configuration - DGConfig1

Protection Mode: MaxPerformance

pc01prmy - Primary database Databases:


pc01sby1 - Physical standby database

Oracle University and Digit racunarski inzenjering d.o.o use only


Fast-Start Failover: DISABLED
Configuration Status:
DISABLED
DGMGRL>

Oracle Database 11g: Data Guard Administration A - 51


Practice 4-7: Enabling the Broker Configuration
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

In this practice, you enable the broker configuration.


1) Enable the entire configuration.
DGMGRL>
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

Oracle University and Digit racunarski inzenjering d.o.o use only


check" in Progress), wait for a few minutes and issue the SHOW
CONFIGURATION command again.
DGMGRL> show configuration
Configuration - DGConfig1
Protection Mode: MaxPerformance

pc01prmy - Primary database Databases:


pc01sby1 - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
DGMGRL>
[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 - 52


Practices for Lesson 5: Creating a Physical Standby
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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 University and Digit racunarski inzenjering d.o.o use only

Oracle Database 11g: Data Guard Administration A - 53


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- ~]$
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

u01/app/oracle/OracleHomes/agent10g/rdbms/install/sbs/olsoidsytool.sbs

[oracle@EDBVR6P1- /]$ nc.sbs


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.
-346[oracle@EDBVR6P1- /]$
[oracle@EDBVR6P1- labs]$./clean_agent_dirs.sh

`/u01/app/oracle/OracleHomes/agent10g/sysman/emd/state/storagerm: cannot remove


': Is a directory
or you may execute the individual commands
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED
Oracle Database 11g: Data Guard Administration
A - 54

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 5-1: Installing the Oracle Management Agent
(continued)
[oracle@EDBVR6P1- /]$
/u01/app/oracle/OracleHomes/agent10g/sysman/emd/upload/*
[oracle@EDBVR6P1- /]$
[oracle@EDBVR6P1- /]$
/u01/app/oracle/OracleHomes/agent10g/sysman/emd/state/*

`/u01/app/oracle/OracleHomes/agent10g/sysman/emd/state/storagerm: cannot remove


': 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

/u01/app/oracle/OracleHomes/agent10g/oui/bin/runInstaller [oracle@EDBVR6P1- /]$

ORACLE_HOME=/u01/app/oracle/OracleHomes/agent10g-clone -forceClone

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]$
/u01/app/oracle/OracleHomes/agent10g/sysman/config/emd.propert
ies
..

34 REPOSITORY_URL=http:// 33 # vx0326.us.oracle.com:4889/em/upload
35
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

..
..

158 emdWalletSrcUrl = 157 #


http://vx0326.us.oracle.com:4889/em/wallets/emd
Oracle Database 11g: Data Guard Administration
A - 55

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 5-1: Installing the Oracle Management Agent
(continued)

/u01/app/oracle/OracleHomes/agent10g/sysman/config/server 159 emdWalletDest =

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

/u01/app/oracle/OracleHomes/agent10g/root.sh[root@EDBVR6P1 ~]#
Running Oracle10 root.sh script...
The following environment variables are set as:

ORACLE_HOME= /u01/app/oracle/OracleHomes/agent10g ORACLE_OWNER= oracle


Enter the full pathname of the local bin directory:

The file "dbhome" already exists in /usr/local/bin. Overwrite[/usr/local/bin]:


it? (y/n)

The file "oraenv" already exists in /usr/local/bin. Overwrite[n]:

it? (y/n)

The file "coraenv" already exists in /usr/local/bin. [n]:


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).

/u01/app/oracle/OracleHomes/agent10g/bin/agentca –f [oracle@EDBVR6P1- labs]$

/u01/app/oracle/OracleHomes/agent10g/bin/emctl stop agent Stopping the agent using


Oracle Enterprise Manager 10g Release 5 Grid Control
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

10.2.0.5.0.

Oracle Database 11g: Data Guard Administration


A - 56

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 5-1: Installing the Oracle Management Agent
(continued)
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

RESPONSE_FILE=/u01/app/oracle/OracleHomes/agent10g/response_fiACTION=Configure MODE=Perform

INV_PTR_LOC=/u01/app/oracle/OracleHomes/agent10g/oraInst.locle RERUN=TRUE
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

/u01/app/oracle/OracleHomes/agent10g/cfgtoollogs/oui/configActYou can see the log file:

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

Copyright (c) 1996, 2009 Oracle Corporation. All rights10.2.0.5.0.

Agent successfully stopped... Done. reserved.


Securing agent... Started.
Enter Agent Registration Password :
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

Copyright (c) 1996, 2009 Oracle Corporation. All rights10.2.0.5.0.

--------------------------------------------------------------reserved.
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

OMS Version
Agent Version

Protocol Version : 10.2.0.5.0


: 10.2.0.5.0
-

: 10.2.0.5.0

Oracle Database 11g: Data Guard Administration


A - 57

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 5-1: Installing the Oracle Management Agent
(continued)
Agent Home : /u01/app/oracle/OracleHomes/agent10g
Agent binaries : /u01/app/oracle/OracleHomes/agent10g
Agent Process ID : 31034
Parent Process ID : 31014

https://edBVr6p1.us.oracle.com:3872/emd/main/ Agent URL :

https://vx0326.us.oracle.com:1159/em/upload Repository URL :


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

Total Megabytes of XML files uploaded so far : 10.49 18:19:23

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
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A - 58

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 5-2: Configuring Monitoring Credentials for Your
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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.

Oracle University and Digit racunarski inzenjering d.o.o use only


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 - 59


Practice 5-3: Configuring Monitoring Credentials for Your
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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 University and Digit racunarski inzenjering d.o.o use only


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 - 60


Practice 5-4: Configuring Preferred Credentials for Your Host
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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

Oracle University and Digit racunarski inzenjering d.o.o use only


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 - 61


Practice 5-5: Adding a Physical Standby Database to Your
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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 (

Oracle University and Digit racunarski inzenjering d.o.o use only


on the box to save as preferred credentials. as sysdba) if requested. Click

4) Click Add Standby Database.

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

Oracle Database 11g: Data Guard Administration A - 62


Practice 5-5: Adding a Physical Standby Database to Your
Configuration (continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle University and Digit racunarski inzenjering d.o.o use only


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.

Oracle Database 11g: Data Guard Administration A - 63


Practice 5-5: Adding a Physical Standby Database to Your
Configuration (continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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.

Oracle University and Digit racunarski inzenjering d.o.o use only


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.

Oracle Database 11g: Data Guard Administration A - 64


Practice 5-5: Adding a Physical Standby Database to Your
Configuration (continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle University and Digit racunarski inzenjering d.o.o use only


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.

Oracle Database 11g: Data Guard Administration A - 65


Practice 5-5: Adding a Physical Standby Database to Your
Configuration (continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle University and Digit racunarski inzenjering d.o.o use only


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.

Oracle Database 11g: Data Guard Administration A - 66


Practice 5-5: Adding a Physical Standby Database to Your
Configuration (continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle University and Digit racunarski inzenjering d.o.o use only


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.

Oracle Database 11g: Data Guard Administration A - 67


HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Configuration (continued)

Oracle Database 11g: Data Guard Administration


Practice 5-5: Adding a Physical Standby Database to Your

A - 68
Oracle University and Digit racunarski inzenjering d.o.o use only
Practice 5-5: Adding a Physical Standby Database to Your
Configuration (continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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.

Oracle University and Digit racunarski inzenjering d.o.o use only


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

Oracle Database 11g: Data Guard Administration A - 69


Practice 5-5: Adding a Physical Standby Database to Your
Configuration (continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle University and Digit racunarski inzenjering d.o.o use only


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.

Oracle Database 11g: Data Guard Administration A - 70


Practice 5-5: Adding a Physical Standby Database to Your
Configuration (continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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

Oracle University and Digit racunarski inzenjering d.o.o use only

Oracle Database 11g: Data Guard Administration A - 71


Practice 5-6: Verifying the Broker Configuration
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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.

Oracle University and Digit racunarski inzenjering d.o.o use only

Oracle Database 11g: Data Guard Administration A - 72


Practice 5-6: Verifying the Broker Configuration (continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle University and Digit racunarski inzenjering d.o.o use only


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.

Oracle Database 11g: Data Guard Administration A - 73


HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A - 74
Practice 5-6: Verifying the Broker Configuration (continued)

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 5-7: Deleting the Database
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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.

Oracle University and Digit racunarski inzenjering d.o.o use only


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

Oracle Database 11g: Data Guard Administration A - 75


Practice 5-7: Deleting the Database (continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle University and Digit racunarski inzenjering d.o.o use only


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_4Uoracle) and the
database credentials (Username: sys, Password: ). 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.

Oracle Database 11g: Data Guard Administration A - 76


Practice 5-7: Deleting the Database (continued)
9) When the shutdown operation is complete, you are returned to the database home
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

page. You receive a message that your database has been shut down. Click the
Databases tab to return to the Databases page.

Oracle University and Digit racunarski inzenjering d.o.o use only

Oracle Database 11g: Data Guard Administration A - 77


Practices for Lesson 6: Creating a Logical Standby
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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 University and Digit racunarski inzenjering d.o.o use only

Oracle Database 11g: Data Guard Administration A - 78


Practice 6-1: Creating a Logical Standby Database
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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.

Oracle University and Digit racunarski inzenjering d.o.o use only


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.

Oracle Database 11g: Data Guard Administration A - 79


Practice 6-1: Creating a Logical Standby Database (continued)

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.
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED
Oracle Database 11g: Data Guard Administration
A - 80

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 6-1: Creating a Logical Standby Database (continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle University and Digit racunarski inzenjering d.o.o use only


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.

Oracle Database 11g: Data Guard Administration A - 81


Practice 6-1: Creating a Logical Standby Database (continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle University and Digit racunarski inzenjering d.o.o use only


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.

Oracle Database 11g: Data Guard Administration A - 82


Practice 6-1: Creating a Logical Standby Database (continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle University and Digit racunarski inzenjering d.o.o use only


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 - 83


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- ~]$
[oracle@EDBVR6P1- labs]$
. oraenv
ORACLE_SID = [oracle] ? pc01prmy

ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 isThe Oracle base for

[oracle@EDBVR6P1-pc01prmy labs]$ /u01/app/oracle

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.

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Connected to:

With the Partitioning, Automatic Storage Management, OLAP,Production

and Real Application Testing options Data Mining


SQL>
3)Execute the script to create a table named
You use this table to test the SQL Apply filtering feature. Exit SQL*Plus.
HR.EMP_NAME.

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.
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A - 84

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 6-2: Implementing SQL Apply Filtering (continued)
6) Click Standby Role Properties.
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

7) Expand Show Advanced Properties.

Oracle University and Digit racunarski inzenjering d.o.o use only


8) Click Add in the Skip Table Entries section.

Oracle Database 11g: Data Guard Administration A - 85


Practice 6-2: Implementing SQL Apply Filtering (continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle University and Digit racunarski inzenjering d.o.o use only


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.

Oracle Database 11g: Data Guard Administration A - 86


Practice 6-2: Implementing SQL Apply Filtering (continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle University and Digit racunarski inzenjering d.o.o use only


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>
Connected.
16) Force a log switch on your primary database.
SQL> alter system switch logfile;

System altered.

Oracle Database 11g: Data Guard Administration A - 87


Practice 6-2: Implementing SQL Apply Filtering (continued)
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- ~]$
ORACLE_SID = [oracle] ?
pc01sby3

ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 isThe Oracle base for


/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.

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Connected to:

With the Partitioning, Automatic Storage Management, OLAP,Production

and Real Application Testing options Data Mining


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.
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED
Oracle Database 11g: Data Guard Administration
A - 88

Oracle University and Digit racunarski inzenjering d.o.o use only


Practices for Lesson 7: Creating and Managing a
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Snapshot Standby Database


In the practices for Lesson 7, “Creating and Managing a Snapshot Standby Database,”
you create a snapshot standby database.

Oracle University and Digit racunarski inzenjering d.o.o use only

Oracle Database 11g: Data Guard Administration A - 89


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- ~]$
ORACLE_SID = [oracle] ?
pc01sby1

ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 isThe Oracle base for


/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.

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Connected to:

With the Partitioning, Automatic Storage Management, OLAP,Production

and Real Application Testing options Data Mining


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>
Connected.
DGMGRL>
Succeeded.

DGMGRL> exit
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A - 90

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 7-1: Verifying Flashback Database on the Physical
Standby Database (continued)
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.

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Connected to:

With the Partitioning, Automatic Storage Management, OLAP,Production

and Real Application Testing options Data Mining

SQL> alter database flashback on;


Database altered.
SQL>
Disconnected from Oracle Database 11g Enterprise Edition
Release 11.2.0.1.0 - Production
With the Partitioning, Automatic Storage Management, OLAP,

and Real Application Testing options Data Mining


[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>
Connected.
DGMGRL>
Succeeded.
DGMGRL>
[oracle@EDBVR6P2-pc01sby1 ~]$
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A - 91

Oracle University and Digit racunarski inzenjering d.o.o use only


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>
Connected.
DGMGRL>
2) Convert the physical standby database to a snapshot standby database by executing
command.the CONVERT DATABASE TO SNAPSHOT STANDBY DATABASE DGMGRL

DGMGRL> convert database pc01sby1 to snapshot standby;

Converting database "pc01sby1" to a Snapshot Standby database,

Database "pc01sby1" converted successfully please wait...

3) Verify that the database was successfully converted by executing the SHOW
CONFIGURATION command.
DGMGRL> show configuration
Configuration - DGConfig1

Protection Mode: MaxPerformance

pc01prmy - Primary database Databases:


pc01sby1 - Snapshot standby database
pc01sby3 - Logical standby database
Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A - 92

Oracle University and Digit racunarski inzenjering d.o.o use only


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
database and record the value in the on the snapshot standby
BLOCK# column:
__________________________
SQL>
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.

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Connected to:

With the Partitioning, Automatic Storage Management, OLAP,Production

and Real Application Testing options Data Mining


SQL>
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>
2
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

1 row created.
VALUES (20, 'Australia');

Oracle Database 11g: Data Guard Administration


A - 93

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 7-2: Updating the Databases and Verifying Redo
Shipment (continued)
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

4 Middle East and Africa 3 Asia


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.
-
26SQL>
2
from v$managed_standby
3 where client_process='LGWR';
STATUS SEQUENCE# BLOCK#
------------ ---------- ----------
IDLE 48 438
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A - 94

Oracle University and Digit racunarski inzenjering d.o.o use only


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>
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,

Operation requires shutdown of instance "pc01sby1" on databaseplease wait...

Shutting down instance "pc01sby1"... "pc01sby1"


Database closed.
Database dismounted.

Operation requires startup of instance "pc01sby1" on databaseORACLE instance shut down.

Starting instance "pc01sby1"... "pc01sby1"


ORACLE instance started.

Continuing to convert database "pc01sby1" ... Database mounted.


Operation requires shutdown of instance "pc01sby1" on database

Shutting down instance "pc01sby1"... "pc01sby1"


ORA-01109: database not open
Database dismounted.

Operation requires startup of instance "pc01sby1" on databaseORACLE instance shut down.

Starting instance "pc01sby1"... "pc01sby1"


ORACLE instance started.

Database "pc01sby1" converted successfully Database mounted.


DGMGRL>
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

command.

Oracle Database 11g: Data Guard Administration


A - 95
3) Verify the status of the standby database by executing the SHOW CONFIGURATION

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 7-3: Converting the Snapshot Standby Database to a
Physical Standby Database (continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

DGMGRL> show configuration

Configuration - DGConfig1

Protection Mode: MaxPerformance

pc01prmy - Primary database Databases:


pc01sby1 - Physical standby database
pc01sby3 - Logical standby database

Oracle University and Digit racunarski inzenjering d.o.o use only


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.

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Connected to:

With the Partitioning, Automatic Storage Management, OLAP,Production

and Real Application Testing options Data Mining


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.

Oracle Database 11g: Data Guard Administration A - 96


Practice 7-3: Converting the Snapshot Standby Database to a
Physical Standby Database (continued)
Welcome to DGMGRL, type "help" for information.
DGMGRL>
Connected.

7) So that you can open the database to query the HR.REGIONS table, stop Redo
Apply. Exit DGMGRL.
DGMGRL>
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.

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Connected to:

With the Partitioning, Automatic Storage Management, OLAP,Production

and Real Application Testing options Data Mining

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

4 Middle East and Africa 3 Asia

10) Shut down the physical standby database and restart it in MOUNT mode. Exit
SQL*Plus.
SQL> shutdown immediate
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A - 97

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 7-3: Converting the Snapshot Standby Database to a
Physical Standby Database (continued)
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>
Connected.
12) Start Redo Apply on your physical standby database.
DGMGRL>
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.
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Configuration - DGConfig1
DGMGRL> show configuration

Oracle Database 11g: Data Guard Administration


A - 98

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 7-3: Converting the Snapshot Standby Database to a
Physical Standby Database (continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Protection Mode: MaxPerformance

pc01prmy - Primary database Databases:


pc01sby1 - Physical standby database
pc01sby3 - Logical standby database
Fast-Start Failover: DISABLED

Configuration Status:

Oracle University and Digit racunarski inzenjering d.o.o use only


SUCCESS

Oracle Database 11g: Data Guard Administration A - 99


Practices for Lesson 8: Using Oracle Active Data Guard
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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 University and Digit racunarski inzenjering d.o.o use only

Oracle Database 11g: Data Guard Administration A - 100


Practice 8-1: Using Real-Time Query
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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.

Oracle University and Digit racunarski inzenjering d.o.o use only


Welcome to DGMGRL, type "help" for information.
DGMGRL>
Connected.
2) Disable Redo Apply on your physical standby database.
DGMGRL>
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>
[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:

Oracle Database 11g: Data Guard Administration A - 101


Practice 8-1: Using Real-Time Query (continued)
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -

With the Partitioning, Automatic Storage Management, OLAP,Production


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>
Disconnected from Oracle Database 11g Enterprise Edition
Release 11.2.0.1.0 - Production
With the Partitioning, Automatic Storage Management, OLAP,

and Real Application Testing options Data Mining


[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>
Connected.
DGMGRL>
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A - 102

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 8-1: Using Real-Time Query (continued)
7) Restart Redo Apply and confirm your change. Exit DGMGRL.
DGMGRL>
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

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

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.

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Connected to:

With the Partitioning, Automatic Storage Management, OLAP,Production

and Real Application Testing options Data Mining

SQL> SELECT * FROM hr.regions;


REGION_ID REGION_NAME
---------- -------------------------
10 Australia
1 Europe
2 Americas

4 Middle East and Africa 3 Asia


HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

SQL>

Oracle Database 11g: Data Guard Administration


A - 103

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 8-1: Using Real-Time Query (continued)
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.

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Connected to:

With the Partitioning, Automatic Storage Management, OLAP,Production

and Real Application Testing options Data Mining


SQL>
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

4 Middle East and Africa 3 Asia


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.
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Total System Global Area 439406592 bytes

Oracle Database 11g: Data Guard Administration


A - 104

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 8-1: Using Real-Time Query (continued)
Fixed Size 1337072 bytes
Variable Size 327158032 bytes
Database Buffers 104857600 bytes
Redo Buffers 6053888 bytes
Database mounted.
-133SQL>
Disconnected from Oracle Database 11g Enterprise Edition
Release 11.2.0.1.0 - Production
With the Partitioning, Automatic Storage Management, OLAP,

and Real Application Testing options Data Mining


[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>
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
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A - 105

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 8-2: Enabling Block Change Tracking
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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

Oracle University and Digit racunarski inzenjering d.o.o use only


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

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Connected to:

With the Partitioning, Automatic Storage Management, OLAP,Production

and Real Application Testing options Data Mining


2) Enable block change tracking.
SQL> alter database enable block change tracking;
Database altered.

3) Queryenabled. V$BLOCK_CHANGE_TRACKING to confirm that block change tracking is

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 - 106


HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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 University and Digit racunarski inzenjering d.o.o use only

Oracle Database 11g: Data Guard Administration A - 107


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>
Connected.

2) Use the your configuration. SHOW CONFIGURATION command to check the current protection

mode for

DGMGRL> show configuration

Configuration - DGConfig1
Protection Mode: MaxPerformance

pc01prmy - Primary database Databases:


pc01sby1 - Physical standby database
pc01sby3 - Logical standby database
Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A - 108

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 9-1: Setting the Data Protection Mode by Using
DGMGRL (continued)
3) Use the LogXptModeSHOW DATABASE command to view the current setting for the
database property for your physical standby database.
DGMGRL>
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
--------------------- ------- ----------------------------

USE_DB_RECOVERY_FILE_DEST

log_archive_dest_1 string LOCATION=


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.
'LogXptMode'='SYNC';DGMGRL> edit database 'pc01sby1' set property
Property "LogXptMode" updated
DGMGRL>

6) In your DGMGRL window, change the protection mode to MAXAVAILABILITY.


maxavailability;DGMGRL> edit configuration set protection mode as
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

mode.
Succeeded.
DGMGRL>

Oracle Database 11g: Data Guard Administration


A - 109
7) Use the SHOW CONFIGURATION command to verify your change to the protection

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 9-1: Setting the Data Protection Mode by Using
DGMGRL (continued)
DGMGRL> show configuration

Configuration - DGConfig1
Protection Mode: MaxAvailability

pc01prmy - Primary database Databases:


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
delay=0 OPTIONAL
AFFIRM
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.
maxperformance; DGMGRL> edit configuration set protection mode as
Succeeded.

10) Set the LogXptMode back to ASYNC.


'LogXptMode'='ASYNC';DGMGRL> edit database pc01sby1 set property
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


HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Databases:

Oracle Database 11g: Data Guard Administration


A - 110

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 9-1: Setting the Data Protection Mode by Using
DGMGRL (continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

pc01prmy - Primary database


pc01sby1 - Physical standby database
pc01sby3 - Logical standby database
Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

Oracle University and Digit racunarski inzenjering d.o.o use only

Oracle Database 11g: Data Guard Administration A - 111


Practice 9-2: Setting the Data Protection Mode by Using
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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

Oracle University and Digit racunarski inzenjering d.o.o use only


to access the Data Guard Overview page.
4) On the Data Guard Overview page, select your physical standby database and click
Edit.

Oracle Database 11g: Data Guard Administration A - 112


Practice 9-2: Setting the Data Protection Mode by Using
Enterprise Manager Grid Control (continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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): __________________________

Oracle University and Digit racunarski inzenjering d.o.o use only


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.

Oracle Database 11g: Data Guard Administration A - 113


Practice 9-2: Setting the Data Protection Mode by Using
Enterprise Manager Grid Control (continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

8) On the Change Protection Mode: Select Mode page, select Maximum Availability
and click Continue.

Oracle University and Digit racunarski inzenjering d.o.o use only


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.

Oracle Database 11g: Data Guard Administration A - 114


Practice 9-2: Setting the Data Protection Mode by Using
Enterprise Manager Grid Control (continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle University and Digit racunarski inzenjering d.o.o use only


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 - 115


Practices for Lesson 10: Performing Role Transitions
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

In the practices for Lesson 10, “Performing Role Transitions,” you perform a switchover
operation by using DGMGRL and Enterprise Manager Grid Control.

Oracle University and Digit racunarski inzenjering d.o.o use only

Oracle Database 11g: Data Guard Administration A - 116


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.

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Connected to:

With the Partitioning, Automatic Storage Management, OLAP,Production

and Real Application Testing options Data Mining

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 primary database. Exit SQL*Plus. SYSDBA user and perform a log
switch on your

SQL>
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
-13SQL>
Disconnected from Oracle Database 11g Enterprise Edition
Release 11.2.0.1.0 - Production
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

and Real Application Testing options Data Mining


With the Partitioning, Automatic Storage Management, OLAP,

Oracle Database 11g: Data Guard Administration


A - 117

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 10-1: Performing Switchover by Using DGMGRL
(continued)
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>
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

DGConnectIdentifier = 'pc01prmy' Properties:


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'
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

LsbyPreserveCommitOrder = ''
LsbyRecordSkipErrors = ''
LsbyRecordSkipDdl = ''
LsbyRecordAppliedDdl = ''
Oracle Database 11g: Data Guard Administration A - 118

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 10-1: Performing Switchover by Using DGMGRL
(continued)
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
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Intended State: APPLY-ON


Transport Lag: 0 seconds
Apply Lag: 0 seconds
Real Time Query: OFF
Instance(s):
pc01sby1

Oracle Database 11g: Data Guard Administration A - 119

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 10-1: Performing Switchover by Using DGMGRL
(continued)

DGConnectIdentifier = 'pc01sby1' Properties:


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'
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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

Oracle University and Digit racunarski inzenjering d.o.o use only


Oracle Database 11g: Data Guard Administration A - 120
Practice 10-1: Performing Switchover by Using DGMGRL
(continued)
Operation requires shutdown of instance "pc01prmy" on database

Shutting down instance "pc01prmy"... "pc01prmy"


ORA-01109: database not open
Database dismounted.

Operation requires startup of instance "pc01prmy" on databaseORACLE instance shut down.

Starting instance "pc01prmy"... "pc01prmy"


ORACLE instance started.

Switchover succeeded, new primary is "pc01sby1" Database mounted.

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

Protection Mode: MaxAvailability

pc01sby1 - Primary database Databases:


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
database host. Verify that the your new primary database (pc<nn>sby1). Invoke SQL*Plus on your
new primary
HR.EMP_HIST table exists. Exit SQL*Plus.
[oracle@EDBVR6P1- ~]$
oracle@edbvr6p2's password:
oracle
Last login: Mon Feb 15 15:18:51 2010 from
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

edbvr6p1.us.oracle.com
[oracle@EDBVR6P2- ~]$
. oraenv

Oracle Database 11g: Data Guard Administration


A - 121

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 10-1: Performing Switchover by Using DGMGRL
(continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

ORACLE_SID = [oracle] ? pc01sby1

ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 isThe Oracle base for


/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

Oracle University and Digit racunarski inzenjering d.o.o use only


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

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Connected to:

With the Partitioning, Automatic Storage Management, OLAP,Production


Data Mining and Real Application Testing options
SQL> SELECT count(*) FROM emp_hist;
COUNT(*)
----------
107
SQL>
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 - 122


Practice 10-2: Performing Switchover by Using Enterprise
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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.

Oracle University and Digit racunarski inzenjering d.o.o use only


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,
check box. Password: oracle_4U, Connect As: SYSDBA) and select the Save Credentials

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.

Oracle Database 11g: Data Guard Administration A - 123


Practice 10-2: Performing Switchover by Using Enterprise
Manager (continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle University and Digit racunarski inzenjering d.o.o use only


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 - 124


Practices for Lesson 11: Using Flashback Database in a
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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 University and Digit racunarski inzenjering d.o.o use only

Oracle Database 11g: Data Guard Administration A - 125


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>
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


------------------------------------ ----------- -------------
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

db_recovery_file_dest_size
big integer 5G

Oracle Database 11g: Data Guard Administration


A - 126

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 11-2: Configuring Flashback Database on the Standby
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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>
Connected.
DGMGRL>
Succeeded.

Oracle University and Digit racunarski inzenjering d.o.o use only


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>
Disconnected from Oracle Database 11g Enterprise Edition
Release 11.2.0.1.0 - Production
With the Partitioning, Automatic Storage Management, OLAP,

and Real Application Testing options Data Mining


[oracle@EDBVR6P2-pc01sby1 ~]$
3) Invoke DGMGRL again and restart Redo Apply.
DGMGRL>
Succeeded.
DGMGRL> exit

Oracle Database 11g: Data Guard Administration A - 127


Practices for Lesson 12: Enabling Fast-Start Failover
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

In the practices for Lesson 12, “Enabling Fast-Start Failover,” you enable fast-start
failover and test your implementation.

Oracle University and Digit racunarski inzenjering d.o.o use only

Oracle Database 11g: Data Guard Administration A - 128


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

pc01prmy - Primary database Databases:


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>
LogXptMode =
'ASYNC'
DGMGRL>
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;


HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

6) Enable fast-start failover.


Property "faststartfailoverlaglimit" updated

Oracle Database 11g: Data Guard Administration


A - 129

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 12-1: Enabling Fast-Start Failover (continued)
DGMGRL>
Enabled.

7) Check the status of the configuration by executing the SHOW CONFIGURATION


VERBOSE command.
DGMGRL> show configuration verbose
Configuration - DGConfig1
Protection Mode: MaxPerformance

pc01prmy - Primary database Databases:


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.
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A - 130

Oracle University and Digit racunarski inzenjering d.o.o use only


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- ~]$
ORACLE_SID = [oracle] ?
pc01sby1

ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 isThe Oracle base for


/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>
Connected.
2) Start the observer. Remember that control is not returned after starting the observer.
Leave this window open with the observer running.
DGMGRL>
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

pc01prmy - Primary database Databases:


pc01sby1 - (*) Physical standby database
pc01sby3 - Logical standby database
(*) Fast-Start Failover target

Fast-Start Failover: ENABLED

Threshold: 90 seconds
Target: pc01sby1
Observer: EDBVR6P2
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Lag Limit:
Shutdown Primary: TRUE
60 seconds

Oracle Database 11g: Data Guard Administration


A - 131

Oracle University and Digit racunarski inzenjering d.o.o use only


HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

SUCCESS
Auto-reinstate:

Configuration Status:
TRUE
Practice 12-2: Starting the Observer (continued)

Oracle Database 11g: Data Guard Administration


A - 132
Oracle University and Digit racunarski inzenjering d.o.o use only
Practice 12-2: Starting the Observer (continued)
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)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED
Oracle Database 11g: Data Guard Administration
A - 133

Oracle University and Digit racunarski inzenjering d.o.o use only


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.

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Connected to:

With the Partitioning, Automatic Storage Management, OLAP,Production


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>
Connected.
5) Verify the status of your configuration.

DGMGRL> show configuration

Configuration - DGConfig1
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A - 134

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 12-3: Testing Fast-Start Failover (continued)
Protection Mode: MaxPerformance

pc01sby1 - Primary database Databases:


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

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


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

ORA-16661: the standby database needs to be reinstated Database Status:


HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A - 135

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 12-3: Testing Fast-Start Failover (continued)
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

Database reinstatement for "pc01prmy" in progress. Failed.


15:27:50.07 Tuesday, February 23, 2010
12) Verify the status of your configuration.
DGMGRL> show configuration

Configuration - DGConfig1

Protection Mode: MaxPerformance


HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Databases:

Oracle Database 11g: Data Guard Administration


A - 136

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 12-3: Testing Fast-Start Failover (continued)
pc01sby1 - Primary database
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

pc01prmy - (*) Physical standby database


pc01sby3 - Logical standby database
Fast-Start Failover: ENABLED

Configuration Status:
SUCCESS

Oracle University and Digit racunarski inzenjering d.o.o use only

Oracle Database 11g: Data Guard Administration A - 137


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

pc01sby1 - Primary database Databases:


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

Shutting down instance "pc01sby1"... "pc01sby1"


ORA-01109: database not open
Database dismounted.

Operation requires startup of instance "pc01sby1" on databaseORACLE instance shut down.

Starting instance "pc01sby1"... "pc01sby1"


ORACLE instance started.
Database mounted.

Switchover succeeded, new primary is "pc01prmy" Database opened.


3) Verify the status of your configuration.
DGMGRL> show configuration
Configuration - DGConfig1
Protection Mode: MaxPerformance

pc01prmy - Primary database Databases:


Warning: ORA-16829: fast-start failover configuration is
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

lagging

Oracle Database 11g: Data Guard Administration


A - 138

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 12-4: Switching Back to Your Primary Database
(continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

pc01sby1 - (*) Physical standby database


Warning: ORA-16829: fast-start failover configuration is
lagging
pc01sby3 - Logical standby database
Fast-Start Failover: ENABLED

Configuration Status:

Oracle University and Digit racunarski inzenjering d.o.o use only


WARNING

Oracle Database 11g: Data Guard Administration A - 139


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>
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>
Disabled. ;
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A - 140

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 12-5: Stopping the Observer and Disabling Fast-Start
Failover (continued)
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

pc01prmy - Primary database Databases:


pc01sby1 - Physical standby database
pc01sby3 - Logical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A - 141

Oracle University and Digit racunarski inzenjering d.o.o use only


Practices for Lesson 13: Managing Client Connectivity
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

In the practices for Lesson 13, “Managing Client Connectivity,” you implement client
failover methods.

Oracle University and Digit racunarski inzenjering d.o.o use only

Oracle Database 11g: Data Guard Administration A - 142


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
-386is in the primary role. The "
the syntax for service creation." command displays

[oracle@EDBVR6P1-pc01prmy ~]$SQL> host 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...

"DEDICATED" established:0 refused:0 state:ready Handler(s):

Service "pc01db11.us.oracle.com" has 1 instance(s). LOCAL SERVER


Instance "pc01db11", status READY, has 1 handler(s) for this
service...

"DEDICATED" established:65459 refused:0 state:ready Handler(s):


HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

...
LOCAL SERVER

Oracle Database 11g: Data Guard Administration


A - 143

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 13-1: Creating a Service for PC<nn>PRMY Instance
(continued)
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...

"DEDICATED" established:0 refused:0 state:ready Handler(s):


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,

SQL> exit pc01prod


HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A - 144

Oracle University and Digit racunarski inzenjering d.o.o use only


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
-146database is in the primary role. The "
displays the syntax for service creation. " command
[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.

(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=edbvr6p2.us.oracle.cConnecting to

om)(PORT=12001)))

Service "pc01sby1.us.oracle.com" has 2 instance(s). Services Summary...


Instance "pc01sby1", status UNKNOWN, has 1 handler(s) for
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

this service...

"DEDICATED" established:60 refused:52


Oracle Database 11g: Data Guard Administration
Handler(s):
A - 145

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 13-2: Creating a Service for the PC<nn>SBY1 Instance
(continued)

Instance "pc01sby1", status READY, has 1 handler(s) for this LOCAL SERVER
service...

"DEDICATED" established:186 refused:0 state:ready Handler(s):

Service "pc01sby1_DGB.us.oracle.com" has 1 instance(s). LOCAL SERVER

Instance "pc01sby1", status READY, has 1 handler(s) for this


service...

"DEDICATED" established:186 refused:0 state:ready Handler(s):

Service "pc01sby1_DGMGRL.us.oracle.com" has 1 instance(s). LOCAL SERVER


Instance "pc01sby1", status UNKNOWN, has 1 handler(s) for
this service...

"DEDICATED" established:9 refused:0 Handler(s):

Service "pc01sby2_DGMGRL.us.oracle.com" has 1 instance(s). LOCAL SERVER


Instance "pc01sby2", status UNKNOWN, has 1 handler(s) for
this service...

"DEDICATED" established:406 refused:0 Handler(s):

Service "pc01sby3.us.oracle.com" has 1 instance(s). LOCAL SERVER


Instance "pc01sby3", status READY, has 1 handler(s) for this
service...

"DEDICATED" established:12631 refused:0 state:ready Handler(s):

Service "pc01sby3_DGB.us.oracle.com" has 1 instance(s). LOCAL SERVER


Instance "pc01sby3", status READY, has 1 handler(s) for this
service...

"DEDICATED" established:12631 refused:0 state:ready Handler(s):

Service "pc01sby3_DGMGRL.us.oracle.com" has 1 instance(s). LOCAL SERVER


Instance "pc01sby3", status UNKNOWN, has 1 handler(s) for
this service...

"DEDICATED" established:15 refused:10 Handler(s):


LOCAL SERVER
The command completed successfully.

6) Start the PC<nn>PROD service using the srvctl utility. The service should not
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

start because it is defined to be active for the primary role.


[oracle@EDBVR6P2-pc01sby1 ~]$ srvctl start service -d pc01sby1

PRCR-1079 : Failed to start resource ora.pc01sby1.pc01prod.svc -s pc01prod

Oracle Database 11g: Data Guard Administration A - 146

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 13-2: Creating a Service for the PC<nn>SBY1 Instance
(continued)
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
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A - 147

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 13-3: Creating an Oracle Net Service Name on Your
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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.

Oracle University and Digit racunarski inzenjering d.o.o use only


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.

Oracle Database 11g: Data Guard Administration A - 148


Practice 13-3: Creating an Oracle Net Service Name on Your
Primary Database Host (continued)

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
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))
-133 (CONNECT_DATA =
(SERVICE_NAME = pc01prod.us.oracle.com)
)
)
)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g:


Data Guard Administration
A - 149

Oracle University and Digit racunarski inzenjering d.o.o use only


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
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))
-506 -253 (CONNECT_DATA =
) (SERVICE_NAME = pc01prod.us.oracle.com)
)
)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g:


Data Guard Administration
A - 150

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 13-5: Testing Your Implementation
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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;

Oracle University and Digit racunarski inzenjering d.o.o use only


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.

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Connected to:

With the Partitioning, Automatic Storage Management, OLAP,Production

and Real Application Testing options Data Mining

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>
2
from v$session
3 where username = 'DGTEST';

Oracle Database 11g: Data Guard Administration A - 151


Practice 13-5: Testing Your Implementation (continued)
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>
Connected.
DGMGRL> switchover to pc01sby1;
Performing switchover NOW, please wait...
New primary database "pc01sby1" is opening...
Operation requires shutdown of instance "pc01prmy" on database

Shutting down instance "pc01prmy"... "pc01prmy"


ORA-01109: database not open
Database dismounted.

Operation requires startup of instance "pc01prmy" on databaseORACLE instance shut down.

Starting instance "pc01prmy"... "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>
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-
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

2008 01:49:42
Copyright (c) 1991, 2007, Oracle. All rights reserved.

Oracle Database 11g: Data Guard Administration


A - 152

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 13-5: Testing Your Implementation (continued)

(DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521))) Connecting to

Service "pc01db11.us.oracle.com" has 1 instance(s). Services Summary...


Instance "pc01db11", status READY, has 1 handler(s) for this
service...

"DEDICATED" established:0 refused:0 state:ready Handler(s):


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.


-
173SQL
>
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 database host. Note that lsnrctl services listener1 command on your original standby
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.
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A - 153

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 13-5: Testing Your Implementation (continued)

(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=edbvr6p2.us.oracle.cConnecting to
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...

"DEDICATED" established:116 refused:0 state:ready Handler(s):


LOCAL SERVER
Service "pc01sby1.us.oracle.com" has 2 instance(s).
Instance "pc01sby1", status UNKNOWN, has 1 handler(s) for
this service...

"DEDICATED" established:60 refused:52 Handler(s):

Instance "pc01sby1", status READY, has 1 handler(s) for this LOCAL SERVER
service...

"DEDICATED" established:116 refused:0 state:ready Handler(s):


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>
Connected.
DGMGRL> switchover to pc01prmy;
Performing switchover NOW, please wait...
New primary database "pc01prmy" is opening...
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Operation requires shutdown of instance "pc01sby1" on database

Shutting down instance "pc01sby1"... "pc01sby1"


Oracle Database 11g: Data Guard Administration A - 154

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 13-5: Testing Your Implementation (continued)
ORA-01109: database not open
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Database dismounted.

Operation requires startup of instance "pc01sby1" on databaseORACLE instance shut down.

Starting instance "pc01sby1"... "pc01sby1"


ORACLE instance started.

Switchover succeeded, new primary is "pc01prmy" Database mounted.

Oracle University and Digit racunarski inzenjering d.o.o use only


14) Verify the status of your configuration. Exit DGMGRL.
DGMGRL> show configuration
Configuration - DGConfig1
Protection Mode: MaxPerformance

pc01prmy - Primary database Databases:


pc01sby1 - Physical standby database
pc01sby3 - Logical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS

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

Oracle Database 11g: Data Guard Administration A - 155


Practices for Lesson 14: Backup and Recovery
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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 University and Digit racunarski inzenjering d.o.o use only

Oracle Database 11g: Data Guard Administration A - 156


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]$pc01db11. oraenv
ORACLE_SID = [pc01prmy] ?

ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 isThe Oracle base for


/u01/app/oracle

2) Change to the labs directory.


[oracle@EDBVR6P1-pc01db11 ~]$
[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.

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Connected to:

With the Partitioning, Automatic Storage Management, OLAP,Production


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>
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A - 157

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 14-1: Creating the Recovery Catalog (continued)
5)Create the recovery catalog owner user named
. The default tablespace for the user is with a password of
rcpass RCTS. Provide unlimited quota on the

RCTS tablespace to the user. You can use the rcowner_create.sql script.
SQL>
SQL> create user rcowner identified by rcpass
2 default tablespace rcts
3 quota unlimited on rcts
4 /
User created.

6) Grant the SQL*Plus.RECOVERY_CATALOG_OWNER role to the RCOWNER user. Exit

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:
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]$
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED
Oracle Database 11g: Data Guard Administration
A - 158

Oracle University and Digit racunarski inzenjering d.o.o use only


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]$pc01prmy. oraenv
ORACLE_SID = [pc01db11] ?

ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 isThe Oracle base for


/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:
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;

DB Key DB Name DB ID Database Role Db_unique_name List of Databases


------- ------- -------------- --------------- --------------
1 PC01PRMY 2581955083 PRIMARY PC01PRMY

5) Use the REPORT SCHEMA FOR DB_UNIQUE_NAME command to verify the files.
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED
Oracle Database 11g: Data Guard Administration
A - 159

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 14-2: Registering Your Database in the Recovery
Catalog (continued)
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 ARCHIVELOGALL


the archived log files are registered. FORDB_UNIQUE_NAME command to verify that

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

+FRA/pc01prmy/archivelog/2010_02_23/thread_1_seq_35.376.711745 Name:
947
262 1 36 A 23-FEB-10

+FRA/pc01prmy/archivelog/2010_02_23/thread_1_seq_36.377.711745 Name:
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

...
981

Oracle Database 11g: Data Guard Administration


A - 160

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 14-2: Registering Your Database in the Recovery
Catalog (continued)
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

CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default PC01PRMY are:


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

CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TOTO '%F'; # default

CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; #BACKUPSET; # default

CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1;default

CONFIGURE MAXSETSIZE TO UNLIMITED; # default # 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
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A - 161

Oracle University and Digit racunarski inzenjering d.o.o use only


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

new RMAN configuration parameters are successfully stored STANDBY;


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

new RMAN configuration parameters are successfully stored 'pc01prmy';


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';


HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A - 162

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 14-3: Configuring RMAN Parameters (continued)
new RMAN configuration parameters:
CONFIGURE DB_UNIQUE_NAME 'pc01sby1' CONNECT IDENTIFIER

new RMAN configuration parameters are successfully stored 'pc01sby1';


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

DB Key DB Name DB ID Database Role Db_unique_name List of Databases

------- ------- ------------- ------------- -------------


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
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


sys/oracle_4U@pc01sby1 catalog rcowner/rcpass@pc01db11

A - 163

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 14-3: Configuring RMAN Parameters (continued)

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

connected to recovery catalog database open)


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

CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS; PC01SBY1 are:


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

CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TOTO '%F'; # default

CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; #BACKUPSET; # default

CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1;default

CONFIGURE MAXSETSIZE TO UNLIMITED; # default # 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

CONFIGURE DB_UNIQUE_NAME 'pc01sby1' CONNECT IDENTIFIER 'pc01prmy';

CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL'pc01sby1';

CONFIGURE SNAPSHOT CONTROLFILE NAME TOSTANDBY;


'/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;
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

new RMAN configuration parameters:


Oracle Database 11g: Data Guard Administration A - 164

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 14-3: Configuring RMAN Parameters (continued)
CONFIGURE CONTROLFILE AUTOBACKUP ON;
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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

Oracle University and Digit racunarski inzenjering d.o.o use only


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

new RMAN configuration parameters: STANDBY;


CONFIGURE ARCHIVELOG DELETION POLICY TO BACKED UP 1 TIMES TO

new RMAN configuration parameters are successfully stored DISK;


RMAN>

Oracle Database 11g: Data Guard Administration A - 165


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.

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Connected to:

With the Partitioning, Automatic Storage Management, OLAP,Production

and Real Application Testing options Data Mining

SQL> create tablespace example2 datafile


'/home/oracle/labs/example2.dbf' size 5M;
Tablespace created.
SQL>
2)Connect to your standby instance as the
parameter. user and show the
standby_file_management
SQL>
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>
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
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A - 166

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 14-4: Recovering a Data File in Your Primary Database
(continued)
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>
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 primary database. example2.dbf file to example2.sav to simulate a failure in the
Note: ASM prevents mistakes like this from happening!
[oracle@EDBVR6P1-pc01prmy labs]$
[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.

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Connected to:

With the Partitioning, Automatic Storage Management, OLAP,Production


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
*

ORA-01116: error in opening database file 6 ERROR at line 1:


HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED
Oracle Database 11g: Data Guard Administration
A - 167

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 14-4: Recovering a Data File in Your Primary Database
(continued)
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';

using target database control file instead of recovery catalog Starting backup at 23-FEB-10
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

channel ORA_DISK_1: datafile copy complete, elapsed time:tag=TAG20100223T201354

Finished backup at 23-FEB-10 00:00:03


12) Exit RMAN.
RMAN> exit
Recovery Manager complete.
[oracle@EDBVR6P1-pc01prmy labs]$
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED
Oracle Database 11g: Data Guard Administration
A - 168

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 14-4: Recovering a Data File in Your Primary Database
(continued)
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

datafile copy file name=/home/oracle/labs/newex01.dbf RECID=4cataloged datafile copy


STAMP=711749736
RMAN>
15)Use the RMANNEWNAME and
data file name in the RMAN repository. SWITCHDATAFILE commands to update the
RMAN>
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

00571:===================================================== RMAN-
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.
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A - 169

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 14-4: Recovering a Data File in Your Primary Database
(continued)
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>
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

datafile 6 switched to datafile copy reason 4


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

RMAN-11003: failure during parse/execution of SQL statement:02/23/2010 20:22:14


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
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

RMAN>
Finished recover at 23-FEB-10
media recovery complete, elapsed time: 00:00:01

Oracle Database 11g: Data Guard Administration


A - 170

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 14-4: Recovering a Data File in Your Primary Database
(continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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.

Oracle University and Digit racunarski inzenjering d.o.o use only


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 ~]$pc01sby3. oraenv
ORACLE_SID = [pc03sby1] ?

ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 isThe Oracle base for


/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.

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Connected to:

With the Partitioning, Automatic Storage Management, OLAP,Production

and Real Application Testing options Data Mining

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

Oracle Database 11g: Data Guard Administration A - 171


Practice 14-4: Recovering a Data File in Your Primary Database
(continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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)

Oracle University and Digit racunarski inzenjering d.o.o use only


RMAN> recover datafile 6;

using target database control file instead of recovery catalog Starting recover at 24-FEB-10
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.

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Connected to:

With the Partitioning, Automatic Storage Management, OLAP,Production

and Real Application Testing options Data Mining

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 - 172


Practices for Lesson 15: Patching and Upgrading
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Databases in a Data Guard Configuration


There are no practices for Lesson 15, “Patching and Upgrading Databases in a Data
Guard Configuration.”

Oracle University and Digit racunarski inzenjering d.o.o use only

Oracle Database 11g: Data Guard Administration A - 173


HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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 University and Digit racunarski inzenjering d.o.o use only

Oracle Database 11g: Data Guard Administration A - 174


Practice 16-1: Viewing Log File Details
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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.

Oracle University and Digit racunarski inzenjering d.o.o use only


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 - 175


Welcome to DGMGRL, type "help" for information.
DGMGRL>
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Connected.
DGMGRL>
4) Set the state of your physical standby database to APPLY-OFF.
Succeeded. DGMGRL> edit database 'pc01sby1' set state='APPLY-OFF';

5) Exit DGMGRL.
6) Invoke SQL*Plus on your primary database host and log in as SYS with a password

Oracle University and Digit racunarski inzenjering d.o.o use only


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.

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Connected to:

With the Partitioning, Automatic Storage Management, OLAP,Production


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 - 176


10) Invoke DGMGRL again on your primary database host and log in as SYS with the
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

password oracle.
11) Set the state of your physical standby database to APPLY-ON.
DGMGRL>
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 University and Digit racunarski inzenjering d.o.o use only

Oracle Database 11g: Data Guard Administration A - 177


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>
Connected.

2) Execute the SHOW CONFIGURATION command to check your configuration status.


DGMGRL> show configuration

Configuration - DGConfig1

Protection Mode: MaxPerformance

pc01prmy - Primary database Databases:


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 ~]$pc01sby1. oraenv
ORACLE_SID = [pc01sby3] ?

ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 isThe Oracle base for


/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.

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Connected to:

Production
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Oracle Database 11g: Data Guard Administration


A - 178

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 16-2: Using DGMGRL to Monitor the Configuration
(continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

With the Partitioning, Automatic Storage Management, OLAP,

and Real Application Testing options Data Mining

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

Oracle University and Digit racunarski inzenjering d.o.o use only


Configuration - DGConfig1

Protection Mode: MaxPerformance

pc01prmy - Primary database Databases:


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.

Oracle Database 11g: Data Guard Administration A - 179


Practice 16-2: Using DGMGRL to Monitor the Configuration
(continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

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.

Oracle University and Digit racunarski inzenjering d.o.o use only


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

Oracle Database 11g: Data Guard Administration A - 180


Practice 16-2: Using DGMGRL to Monitor the Configuration
(continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Configuration - DGConfig1
Protection Mode: MaxPerformance

pc01prmy - Primary database Databases:


pc01sby1 - Physical standby database
pc01sby3 - Logical standby database
Fast-Start Failover: DISABLED

Oracle University and Digit racunarski inzenjering d.o.o use only


Configuration Status:
SUCCESS

Oracle Database 11g: Data Guard Administration A - 181


Practices for Lesson 17: Optimizing a Data Guard
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

Configuration
In the practice for Lesson 17, “Optimizing a Data Guard Configuration,” you configure
network compression of redo data.

Oracle University and Digit racunarski inzenjering d.o.o use only

Oracle Database 11g: Data Guard Administration A - 182


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>
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>
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.
-
93SQL>
2
from v$archive_dest;
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

DEST_NAME

LOG_ARCHIVE_DEST_2
------------------------------ -------

LOG_ARCHIVE_DEST_1
COMPRES

ENABLE
DISABLE

Oracle Database 11g: Data Guard Administration


A - 183

Oracle University and Digit racunarski inzenjering d.o.o use only


Practice 17-1: Configuring Network Compression of Redo Data
(continued)
HESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED

LOG_ARCHIVE_DEST_30 DISABLE ...


LOG_ARCHIVE_DEST_31 DISABLE
31 rows selected.

Oracle University and Digit racunarski inzenjering d.o.o use only

Oracle Database 11g: Data Guard Administration A - 184

Das könnte Ihnen auch gefallen