You are on page 1of 244

Edutronic Global Services EฺIฺRฺL

Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
m ) ha
l ฺ o
cData
i
Oracle Database 12c:
a
gm ideฺ
Guard Administration
z 9 9@ t Gu
r ui den
Activity Guide
p
O N ( is Stu
A RR se th
I Z B ou
R U se t
T H icen
A BE ble l
E LIZ sfera
I C IA -tran
A TR non
P

D79232GC10
Edition 1.0
February 2014
D85498
Edutronic Global Services EฺIฺRฺL

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

Disclaimer

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 any way.
Except where your use constitutes "fair use" under copyright law, you may 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 express authorization
of Oracle.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

The information contained in this document is subject to change without notice. If you 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
warranted to be error-free.

Restricted Rights Notice

If this documentation is delivered to the United States Government or anyone using the documentation on behalf of the United
States Government, the following notice is applicable:

U.S. GOVERNMENT RIGHTS


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 license agreement and/or the applicable U.S. Government contract.

s a
) ha
Trademark Notice

om
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective
owners.
l ฺ c
m ai ฺ
Author
9 @ g
u ide
Mark Fuller i z 9 nt G
u
pr tude
(
Technical Contributors and Reviewers
R ON hisBreederode,
S
AR usUwe e tHesse, Nitin Karkhanis, Donna
Christopher Andrews, Maria Billings, Trevor Bowen, Harald van Larry Carpenter, Al
Flournoy, Joe Fong, Gerlinde Frenzen, JoelBGoodman,
Keesling, Sean Kim, Jerry Lee, Stephen
U IZMoriarty,
e t oJuan Quezada Nunez, Veerabhadra Rao
Putrevu, Puneet Sangar, Thorsten
H R ns
Senft, Ira Singer, Branislav Valny
ET le lic e
B
IZA ferusing:
This book was published
L ab Oracle Tutor
A E ns
I
IC n-tra
T R no
PA
Edutronic Global Services EฺIฺRฺL

Table of Contents
Practices for Lesson 1: Introduction to Oracle Data Guard .........................................................................1-1
Practices for Lesson 1: Overview ...................................................................................................................1-2
Practice 1-1: Laboratory Introduction .............................................................................................................1-3
Practices for Lesson 2: Creating a Physical Standby Database by Using Enterprise Manager Cloud
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Control ..............................................................................................................................................................2-1
Practices for Lesson 2: Overview ...................................................................................................................2-2
Practice 2-1: Creating a Physical Standby Database Using Enterprise Manager ..........................................2-3
Practice 2-2: Verify and Examine the Data Guard Environment ....................................................................2-7
Practice 2-3: Generating a Test Workload .....................................................................................................2-10
Practice 2-4: Preparing for Command-line Practices .....................................................................................2-11
Practice 2-5: Primary Database Creation .......................................................................................................2-16
Practices for Lesson 3: Oracle Net Services in a Data Guard Environment ...............................................3-1
Practices for Lesson 3: Overview ...................................................................................................................3-2
Practice 3-1: Modifying the tnsnames.ora Configuration File .........................................................................3-3
s a
Practice 3-2: Modifying the listener.ora Configuration File .............................................................................3-12
) ha
Practice 3-3: Correcting Entries to Best Practice Values ...............................................................................3-21
l ฺ c om
Practices for Lesson 4: Creating a Physical Standby Database by Using SQL and RMAN
m ai ฺ
g ide
Commands .......................................................................................................................................................4-1

9 @ u
Practices for Lesson 4: Overview ...................................................................................................................4-2
9 nt G
i z
Practice 4-1: Prepare the Primary Database to Support Data Guard .............................................................4-3
u
( pr tude
Practice 4-2: Prepare Host and Create Physical Standby Database..............................................................4-6

ON his S
Practice 4-3: Start Redo Transport and Verify Operation ...............................................................................4-16
R
AR use t
Practices for Lesson 5: Using Oracle Active Data Guard .............................................................................5-1

IZ QueryB
Practices for Lesson 5: Overview ...................................................................................................................5-2
o
U
Practice 5-1: Enable Active Data Guard Real-Time
e t............................................................................5-3
Practice 5-2: Enable Change TrackingR n s
T H on the Physical
e Standby Database ...................................................5-8
EthetoData
Practice 5-3: Add Far Sync to
BSync l e lic Environment ..........................................................................5-9
Guard
Practice 5-4: Add 2ndA b Guard Environment ...................................................................5-16
L I Z Far
r a the Data

E 6:nCreating
Practices for Lesson
A s fe and Managing a Snapshot Standby Database .......................................6-1
I C I
Practices
t r
for Lesson
- a6: Overview ...................................................................................................................6-2

TRPracticen6-1:
onConvert Physical Standby to a Snapshot Standby ....................................................................6-3
PA Practice 6-2: Convert Snapshot Standby Back to Physical Standby ..............................................................6-8
Practices for Lesson 7: Creating a Logical Standby Database ....................................................................7-1
Practices for Lesson 7: Overview ...................................................................................................................7-2
Practice 7-1: Identify Unsupported Objects for Logical Standbys ..................................................................7-3
Practice 7-2: Create a Logical Standby (Temporarily a Physical) ..................................................................7-6
Practice 7-3: Start Redo Transport and Verify Operation ...............................................................................7-9
Practice 7-4: Convert Physical Standby to Logical Standby ...........................................................................7-11
Practices for Lesson 8: Oracle Data Guard Broker: Overview .....................................................................8-1
Practices for Lesson 8: Overview ...................................................................................................................8-2
Practices for Lesson 9: Creating a Data Guard Broker Configuration ........................................................9-1
Practices for Lesson 9: Overview ...................................................................................................................9-2
Practice 9-1: Establishing Local and Remote Connections with DGMGRL ....................................................9-3
Practice 9-2: Create and Enable a Data Guard Broker Configuration ............................................................9-6

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

Oracle Database 12c: Data Guard Administration Table of Contents


i
Edutronic Global Services EฺIฺRฺL

Practices for Lesson 10: Monitoring a Data Guard Broker Configuration ..................................................10-1
Practices for Lesson 10: Overview .................................................................................................................10-2
Practice 10-1: Monitoring the Physical Standby Database .............................................................................10-3
Practice 10-2: Examining Data Guard Log and Trace Files ...........................................................................10-7
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Practices for Lesson 11: Configuring Data Protection Modes .....................................................................11-1


Practices for Lesson 11: Overview .................................................................................................................11-2
Practice 11-1: Examining the Maximum Availability Protection Mode ............................................................11-3
Practice 11-2: Examining the Maximum Protection Mode ..............................................................................11-10
Practices for Lesson 12: Performing Role Transitions .................................................................................12-1
Practices for Lesson 12: Overview .................................................................................................................12-2
Practice 12-1: Performing Switchover ............................................................................................................12-3
Practices for Lesson 13: Using Flashback Database in a Data Guard Configuration ................................13-1
Practices for Lesson 13: Overview .................................................................................................................13-2
Practice 13-1: Configuring Flashback Database on the Primary Database ....................................................13-3
s a
) ha
Practice 13-2: Configuring Flashback Database on the Physical Standby Database.....................................13-5

om
Practice 13-3: Configuring Flashback Database on the Logical Standby Database ......................................13-8

l ฺ c
Practices for Lesson 14: Enabling Fast-Start Failover .................................................................................14-1
m ai ฺ
g ide
Practices for Lesson 14: Overview .................................................................................................................14-2

9 @
Practice 14-1: Enabling Fast-Start Failover ....................................................................................................14-3
9 nt G u
i z
Practice 14-2: Testing Fast-Start Failover ......................................................................................................14-8
u
( pr tude
Practice 14-3: Switchover to Reinstated Database ........................................................................................14-13
Practices for Lesson 15: Backup and Recovery Considerations in
R ONan Oracle h i s SData Guard Configuration

AR use t
...........................................................................................................................................................................15-1

Practice 15-1: Creating a Recovery ManagerICatalog


B
Practices for Lesson 15: Overview .................................................................................................................15-2
Z ...................................................................................15-3
R U e toCatalog ..............................................................15-6
Practice 15-2: Registering Your Database
H n s
in the Recovery
e
T l i c
BaEData File
Practice 15-3: Configuring RMAN Parameters ...............................................................................................15-9
Practice 15-4: Recovering
Z A a b leon Your Primary Database.................................................................15-12
I
L 16: sEnhanced f er Client Connectivity in a Data Guard Environment ............................16-1
Practices for Lesson
E n Overview.................................................................................................................16-2
Practices
I C IAfor Lesson - t r a16:
TR non
Practice 16-1: Creating and Testing Primary Database Services...................................................................16-3

PA Practices for Lesson 17: Patching and Upgrading Databases in a Data Guard Configuration .................17-1
Practices for Lesson 17: Overview .................................................................................................................17-2
Practices for Lesson 18: Optimizing a Data Guard Configuration...............................................................18-1
Practices for Lesson 18: Overview .................................................................................................................18-2
Practice 18-1: Configuring Network Compression of Redo Data ...................................................................18-3

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

Oracle Database 12c: Data Guard Administration Table of Contents


ii
Edutronic Global Services EฺIฺRฺL
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
Practices for Lesson g 1: ide
Introduction ito 9 @
9Oracle G u
Data
z n t
Guard (pru tude
R O1N his S
AR use t
Chapter
B
IZ e to
U
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 1: Introduction to Oracle Data Guard


Chapter 1 - Page 1
Edutronic Global Services EฺIฺRฺL

Practices for Lesson 1: Overview


Practices Overview
In these practices, you will examine the lab environment to become familiar with the lab
architecture.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 1: Introduction to Oracle Data Guard


Chapter 1 - Page 2
Edutronic Global Services EฺIฺRฺL

Practice 1-1: Laboratory Introduction


Overview
In this practice you will become familiar with the laboratory environment.

Assumptions
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Access to your laboratory environment will be through a graphical display running on your
classroom workstation or hosted on a remote machine. Your instructor will provide you with the
instructions to access your practice environment. Depending on how you connect to the console
for the graphical display, you could be logged in as the root, oracle, or vncuser account
initially. The lab practices will indicate which user is needed to perform a particular task. Use the
switch user command (su – username) to change from the default login account to the
account needed for a particular task when necessary. The default password for all three
accounts is oracle.
The practice environment for this course is hosted on a server (desktop) running Oracle VM
Server for x86 as the base installed operating system. Oracle VM Server (OVS) allows for the s a
creation of multiple virtual machines (VMs). Each VM is a logically separate server running a
) ha
distinct version of Oracle Linux, along with Oracle Database 12c Release 1 software and
l ฺ c om
components from Oracle Enterprise Manager Cloud Control 12c.
m ai ฺ
g ide
Note: The Oracle VM server is running on your desktop computer, and there are 5 virtual
@ u
machines running within the Oracle VM server, each running one or more database instances
9
9 nt G
i z
and agent software. Your desktop machines were not sized for this type of workload, so there
u
pr tude
will be some delays in running the lab tasks. Previous editions of this course required many
(
environments for a single classroom. R ON his S
students to share a single resource. The new architecture allows significantly more Data Guard

B AR use t
Tasks
U IZ e to
1. Open a terminal window andR determinen swhat account name is the login account. If needed,
T H verify. e
B E le lic
switch to the root user and
$ id Z A
I ferabgid=500(vncuser) groups=500(vncuser)
L
E ns
uid=500(vncuser)
I A
R IC n-t–ra
$ su
T o
nPassword:
PA
oracle
# id
uid=0(root) gid=0(root) groups=0(root), 1(bin), 2(daemon),
3(sys), 4(adm), 6(disk), 10(wheel)
Note: Each classroom where this course is taught could be running a different version of
Oracle Virtual Server (OVS). This does not have any effect on the virtual machines running
within the OVS, but can impact the desktop being presented to the student. To launch a
terminal window, you may be able to right-click anywhere on the desktop background and
select a menu item to open a terminal. If this is not available, then try clicking on the top
menu bar Applications, Accessories, and then Terminal. Please ask you instructor if these
methods do not work.

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

Practices for Lesson 1: Introduction to Oracle Data Guard


Chapter 1 - Page 3
Edutronic Global Services EฺIฺRฺL

2. Execute the command xm list. You should see output similar to the example below.
Domain-0 is the Oracle VM Server and is hosting five additional domains.
# xm list
Name ID Mem VCPUs State Time(s)
Domain-0 0 1024 2 r----- 25202.6
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

em12 1 6656 1 -b---- 49533.8


host01 2 2048 1 -b---- 1988.1
host02 3 1536 1 -b---- 1957.8
host03 4 2048 1 -b---- 1939.4
host04 5 1536 1 -b---- 1965.7
3. Determine the hostname of Domain-0, the Oracle VM Server that you are currently using.
Your output should be different from the example output shown. This will be referred to as
dom0 in the lab prompts used for this document.
# hostname
s a
) ha
edrsr48p1
Note: Throughout the labs you will be required to run commands using a terminal window
l ฺ c om
m ai ฺ
on specific virtual machines. This lab document will list the user account and hostname of
the machine that each command should be run on. Your actual prompts will be different.
4. @ g
Examine the /etc/oracle-release and /etc/redhat-release files of Domain-0 to
9 u ide
i z 9 nt G
determine the Oracle VM Server for x86 version and also the version of Oracle Linux that it
u
pr tude
(
is built with. Additionally, the uname -a command will report the kernel version being used.
[root@dom0]# cat /etc/oracle-release
R ON his S
Oracle VM Server release 5.7
B AR use t
IZ e to
[root@dom0]# cat /etc/redhat-release
U
R s
TH -alicen
Oracle VM server release 3.2.1
[root@dom0]#Euname
Z AB rab2.6.39-300.22.2.el5uek
Linux edrsr48p1
I
le #1 SMP Fri Jan 4 12:40:29
L
E nsfe
PST 2013 x86_64 x86_64 x86_64 GNU/Linux
I A
C Your a of Oracle VM Server may be different than what is shown. Your
rversion
R INote: n -
installation
tmay also not include the oracle-release file depending on your versions. It could
PA
T no
also be named ovs-release or enterprise-release. The above example is using Oracle VM
Server release 3.2.1 that was built using Oracle Linux x86_64 version 5.7 as a baseline.
The Unbreakable Enterprise Kernel Release 2 is being used.
5. (Optional) Domain-0 normally does not install sufficient RPM packages to allow for a
graphical desktop or display. In the lab environment, additional RPMs have been installed
into Domain-0 to provide for a basic gnome desktop environment along with a few
applications such as the Firefox web browser. This is an unsupported environment for
Oracle VM Server. Determine the version of Firefox running from Domain-0. To launch
Firefox from Domain-0, click the menu items for Applications, Internet, and then Firefox
Web Browser. When the application Firefox is running, click the menu item Help then
About Firefox to determine the version of Firefox being used. Close down the Firefox
application when the version has been determined.

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

Practices for Lesson 1: Introduction to Oracle Data Guard


Chapter 1 - Page 4
Edutronic Global Services EฺIฺRฺL
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
Note: The version of Firefox is limited by the available libraries and RPMs that have been ) ha
installed into Domain-0, and cannot be upgraded to the newest available versions. You m
coeven
may
be running a different version of Firefox than what is shown here, or Firefox mayinot l ฺ
be installed into your Domain-0. g ma deฺ
6. Using the SSH client, connect to host01 as the root OS user. Enter 9 @oracle u i you
when
9 G
izuse thee-Xntoption of SSH to
are prompted for the password. In the lab environment, always
r u
enable X11 forwarding back to the Domain-0 console window.
N (p Stud
[root@dom0]# ssh -X root@host01 O is
R R t h
root@host01's password: oracle
B A use
U Z
7. Verify that you are on host01 andI execute the to command firefox. Determine which
R
version of Firefox is being used n s e
on host01. Exit Firefox when done and also exit the SSH
T H e
session.
B E le lic
I A b
Z erahostname
[root@host01]#
L
E nsf
host01
I A
R IC n-tra
[root@host01]# firefox

PA
T n…o
[root@host01]# exit
logout
Connection to host01 closed.

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

Practices for Lesson 1: Introduction to Oracle Data Guard


Chapter 1 - Page 5
Edutronic Global Services EฺIฺRฺL
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
Note: An icon has been created on the desktop of Domain-0 that will invoke the newer

l ฺ om
version of Firefox on host01 running under the oracle account and displaying back to
c
Domain-0 for your convenience. For reference, the command being executed by the icon is:
ai ฺ
plink –X –ssh –pw oracle –l oracle host01 firefox. All of the VMs are
m
9 @ g
running Oracle Linux Release 6.3 for the base operating system.
u ide
8. z 9 nt G
You will now learn how to shutdown virtual machines. Open a terminal window on the
i
u
pr tude
Domain-0 console and switch to the root user if needed. Execute the command xm
(
R ON his S
shutdown host04 to stop the host04 virtual machine. Verify it has been stopped with
the xm list command. You may need to reissue the xm list command to allow time for
host04 to completely shutdown. B AR use t
U
[root@dom0]# xm shutdown IZ host04
e to
[root@dom0]# xm H
R n s
T list
l i c e
Name
A BE ble ID Mem VCPUs State Time(s)

E LIZ sfera
Domain-0 0 1200 4 r----- 25509.4

C I Aem12 tran 7 5120 2 -b---- 5.5


I host01
TR non-
8 1536 1 -b---- 9.0
PA host02
host03
9
10
1536
1536
1
1
-b----
-b----
8.3
8.3
Note: Any of the other virtual machines can be shutdown using similar syntax and replacing
the virtual machine name <host04> with the other virtual machine names. This is equivalent
to an operating system shutdown command. Prior to shutting down the virtual machines, it
would be best to first stop any Oracle Database resources and Oracle Enterprise Manager
Cloud Control resources that may be running.

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

Practices for Lesson 1: Introduction to Oracle Data Guard


Chapter 1 - Page 6
Edutronic Global Services EฺIฺRฺL

9. Restart the host04 virtual machine with the following command: xm create host04
/OVS/running_pool/host04/vm.cfg. Verify with the xm list command.
[root@dom0]# xm create /OVS/running_pool/host04/vm.cfg
Using config file "/OVS/running_pool/host04/vm.cfg".
Started domain host04 (id=12)
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

[root@dom0]# xm list
Name ID Mem VCPUs State Time(s)
Domain-0 0 1200 4 r----- 25509.4
em12 7 5120 2 -b---- 5.5
host01 8 1536 1 -b---- 9.0
host02 9 1536 1 -b---- 8.3
host03 10 1536 1 -b---- 8.3
host04 12 1536 1 r----- 5.9
Note: Any of the other virtual machines can be started up using similar syntax and
s a
) ha
replacing the virtual machine name <host04> with any other virtual machine name in the
command.
l ฺ c om
m ai ฺ
10. Verify that the Oracle Management Server and Oracle Agent are running on the em12
virtual machine. You can do this from the Domain-0 with the following commands:
plink -X -ssh -pw oracle -l oracle em12 9 @ g
u ide
i z 9 nt G
/u01/app/oracle/middleware/oms/bin/emctl status oms
u
pr tude
plink -X -ssh -pw oracle -l oracle em12(
ON his S
/u01/app/oracle/agent/agent_inst/bin/emctl status agent
R
R se t
Note: If you are asked to store the key in the cache, then type "y" at the prompt.
A
[root@dom0]# plink -X -ssh B u -l oracle em12
IZ e-pwtooracle
R U s
/u01/app/oracle/middleware/oms/bin/emctl status oms
TH Manager c n
e Cloud Control 12c Release 3
Oracle Enterprise
E l i
Copyright
I Z AB b le 2013 Oracle Corporation. All rights
(c) 1996,
a
L sfer
reserved.
E
C I A tranis Up
WebTier
I
on- Management Server is Up
TR nOracle
PA [root@dom0]# plink -X -ssh -pw oracle -l oracle em12
/u01/app/oracle/agent/agent_inst/bin/emctl status agent
Oracle Enterprise Manager Cloud Control 12c Release 3
Copyright (c) 1996, 2013 Oracle Corporation. All rights
reserved.
------------------------------------------------------------
Agent Version : 12.1.0.3.0
OMS Version : 12.1.0.3.0
Protocol Version : 12.1.0.1.0
Agent Home : /u01/app/oracle/agent/agent_inst
Agent Binaries : /u01/app/oracle/agent/core/12.1.0.3.0
Agent Process ID : 1880
Parent Process ID : 1833
Agent URL : https://em12.example.com:3872/emd/main/
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 1: Introduction to Oracle Data Guard


Chapter 1 - Page 7
Edutronic Global Services EฺIฺRฺL

Repository URL : https://em12.example.com:4903/empbs/upload


Started at : 2013-05-14 21:08:33
Started by user : oracle
Last Reload : (none)
Last successful upload : 2013-05-14
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

22:13:58
Last attempted upload : 2013-05-14
22:13:58
Total Megabytes of XML files uploaded so far : 0.11
Number of XML files pending upload : 0
Size of XML files pending upload(MB) : 0
Available disk space on upload filesystem : 60.99%
Collection Status : Collections
enabled
Heartbeat Status : Ok s a
Last attempted heartbeat to OMS : 2013-05-14 ) ha
22:13:58
l ฺ c om
Last successful heartbeat to OMS : 2013-05-14
m ai ฺ
22:13:58
9 @ g
u ide
Next scheduled heartbeat to OMS 9 nt G
: 2013-05-14
i z
22:14:58 u
pr tude
(
R ON his S
AR use t
-------------------------------------------------------------
Agent is Running and Ready B
IZ eandtoOracle Agent are not running, they can be
Note: If the Oracle Management U Server
R ofncommands:
s
started with the following H
sequence
T ic e
E le l(Password
B
a. ssh –X oracle@em12
A b
is oracle)

LIZ sfera
b. . oraenv
E
IAlsnrctl anstart
emrep
I C
c. - t r
TR d. nsqlplus
on / as sysdba
PA startup
quit
e. /u01/app/oracle/middleware/oms/bin/emctl start oms
f. /u01/app/oracle/agent/agent_inst/bin/emctl start agent

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

Practices for Lesson 1: Introduction to Oracle Data Guard


Chapter 1 - Page 8
Edutronic Global Services EฺIฺRฺL

Note: The following commands can be used to shutdown Oracle Enterprise Manager Cloud
Control 12c on the em12 virtual machine.
a. ssh –X oracle@em12 (Password is oracle)
b. /u01/app/oracle/middleware/oms/bin/emctl stop oms -all
c. /u01/app/oracle/agent/agent_inst/bin/emctl stop agent
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

d. . oraenv
emrep
e. sqlplus / as sysdba
shutdown
quit
f. lsnrctl stop
11. Use the icon on the desktop to launch Firefox on host01. The default web page should be
stored as https://em12.example.com:7802/em and prompt for a login to Enterprise Manager
Cloud Control 12c. The URL will change after it is entered and used. Log in to the
application with the credentials of sysman for user name and oracle_4U for the s a
password. The password is case sensitive. Select from the menu Targets and then Hosts, ) ha
and verify that the agent is running on all five virtual machines.
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
R Clickno"Log
T12. n Out" in the upper right corner of the application and then exit Enterprise Manager
PA Cloud Control 12c when done.

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

Practices for Lesson 1: Introduction to Oracle Data Guard


Chapter 1 - Page 9
Edutronic Global Services EฺIฺRฺL
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 1: Introduction to Oracle Data Guard


Chapter 1 - Page 10
Edutronic Global Services EฺIฺRฺL
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
Practices for Lesson g 2: ide
Creating a Physical 9 @ Gu
9 nStandby
i z
ru Using t
Database(pby t u de Enterprise
R ON hCloud
Manager i s S Control
R se t
AChapter
I Z B o u2
R U se t
T H icen
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 2: Creating a Physical Standby Database by Using Enterprise Manager Cloud Control
Chapter 2 - Page 1
Edutronic Global Services EฺIฺRฺL

Practices for Lesson 2: Overview


Practices Overview
In these practices, you will use Oracle Enterprise Manager Cloud Control 12c Release 3
(12.1.0.3.0) to create a physical standby database. You will then use Oracle Enterprise
Manager Cloud Control 12c to verify, examine, test, and monitor the Data Guard Environment.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 2: Creating a Physical Standby Database by Using Enterprise Manager Cloud Control
Chapter 2 - Page 2
Edutronic Global Services EฺIฺRฺL

Practice 2-1: Creating a Physical Standby Database Using Enterprise


Manager
Overview
In this practice you create a physical standby database using Oracle Enterprise Manager Cloud
Control 12c Release 3 (12.1.0.3.0). In preparation for this lab and to save time, Enterprise
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Manager has already been installed on the virtual machine em12.example.com. On the other
4 virtual machines (host01, host02, host03, host04), the Oracle Database 12c Release 1
(12.1.0.1.0) software binaries have been installed into the following directory:
/u01/app/oracle/product/12.1.0/dbhome_1. In addition to the Oracle Database
software binaries, the Oracle Enterprise Manager agent has been deployed on each machine to
the following directory: /u01/app/oracle/agent. Global default and target preferred
credentials were defined for each host.

Tasks
1. Use the icon on the desktop to launch Firefox on host01. The default web page should be s a
stored as https://em12.example.com:7802/em and prompt for a login to Enterprise Manager
) ha
Cloud Control 12c. Log in to the application with the credentials of sysman for user name
l ฺ c om
and oracle_4U for the password. The password is case sensitive.
m ai Itฺ is
Note: The default home page displayed to the user when logging in can be
currently set to display the All Targets web page. To change the home 9 @ g ideuser,
changed.
page foruthe
click the username in the top right corner (SYSMAN), and then i z 9 Welcome
select n t GPage from
the drop down menu that appears. You can change your(p
u
r home depage if desired. This
is a matter of job role and personal preference. InO
default
t
Nlab document,
this
u
S navigation instructions
R h i s
will be provided using the top level menu bar
A R se t
that is available on all personal home pages.
2. Navigate to the Databases page by selecting
I Z B oTargets, u and then Databases from the drop
down menu that appears. You should
R U see t
etwo databases that have been discovered by
n s
Oracle Enterprise Manager
repository database E THby Oracle
used
Cloud
l i c
Control. The emrep.example.com database is the
eEnterprise Manager Cloud Control. Do not make any
modifications toA B database.
l e
L Z erab
Ithe this
3. Navigate
A
to s f
E nboston.example.com specific database page by clicking on its name
I I
C n-tra page.
from the databases
R no the Add Standby Database wizard by selecting it from the Availability menu.
T4. Launch
PA

5. On the Add Standby Database Wizard page, select the option to "Create a new physical
standby database" and then click Continue.

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

Practices for Lesson 2: Creating a Physical Standby Database by Using Enterprise Manager Cloud Control
Chapter 2 - Page 3
Edutronic Global Services EฺIฺRฺL

6. On the Add Standby Database: Backup Type page (step 1 of 6), select "Online Backup",
the option to "Use Recovery Manager (RMAN) to copy database files" and then click
Next.
7. On the Add Standby Database: Backup Options page (step 2 of 6), set the degree of
parallelism to 1. In the Primary Host Credentials section, select the "Named" option for the
type of credential and then set the credential name to "NC_HOST_ORACLE." In the Primary
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Database Standby Redo Log Files section, uncheck the box to use Oracle-managed files
(OMF). Provide the following file names for the Standby Redo Logs that will be created on
the primary database:
Log File Location
/u01/app/oracle/oradata/boston/stbyredo01.log
/u01/app/oracle/oradata/boston/stbyredo02.log
/u01/app/oracle/oradata/boston/stbyredo03.log
/u01/app/oracle/oradata/boston/stbyredo04.log a
s
Click Next to Continue
) ha
l ฺ c om
8. On the Add Standby Database: Database Location page (step 3 of 6), change the Instance
ai ฺ
Name in the Standby Database Attributes section to "london" and verify that the Database
m
9 @ g
u ide
Storage option is set to File System. In the Standby Database Location section, change the
Host field to host03.example.com and verify the Oracle Home is set to
i z 9 nt G
/u01/app/oracle/product/12.1.0/dbhome_1. In the Standby host Credentials
u
pr tude
(
section, verify that the Named credential option is selected and that the Credential Name is
ON his S
set to NC_HOST_ORACLE. Click Next to continue.
R
B AR use t
9. On the Add Standby Database: File Locations page (step 4 of 6), verify that the "Use
Oracle Optimal Flexible Architecture-compliant directory structure (OFA) is selected
U IZ e to
and then click the Customize button within that section. A table of the Primary Database
H R icens
Names mapped to corresponding Standby Database Names is displayed for datafiles,
T
A BE ble l
tempfiles, logfiles, and control files. For each of entries, the primary name "boston" is
converted to the standby name "london". Click OK to return to the previous page.
E LIZ sfera
Note: A Warning message is displayed indicating that 2 files already exist on the standby
I C IA -tran
database host and will be overwritten. Those files are sale1v3.dat and qopiprep.bat.
TR non The warning message also indicates that the Fast Recovery Area directory does not exist
PA on the standby database host and that it will be created automatically. Click Continue.
10. While still on the Add Standby Database: File Location page (step 4 of 6), enter LISTENER
for the Listener Name and 1521 the Primary Database Port. Click Next.
11. On the Add Standby Database: Configuration page (step 5 of 6), change the Database
Unique Name to "london" and the Target Name to "london.example.com". Verify that
the Standby Archive Location is set to the value:
/u01/app/oracle/oradata/london/arc. The Use Data Guard Broker should be
checked in the Data Guard Broker section. Click Next.

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

Practices for Lesson 2: Creating a Physical Standby Database by Using Enterprise Manager Cloud Control
Chapter 2 - Page 4
Edutronic Global Services EฺIฺRฺL

12. On the Add Standby Database: Review page (Step 6 of 6), verify the accuracy of the typed
entries. If any entry has been typed incorrectly, click the back button as many times as
needed and correct it. When satisfied, click Finish.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
13. An information dialog is returned containing a link "View Job." Click the View Job link to ) ha

navigate to the Job Activity page for the boston.example.com database. The Auto
l c om
ai ฺ
Refresh option is currently set to "Off." Change this to a 30 second refresh interval.
m
@ g ide
14. Expand the Task: Create Standby Database by clicking the triangle next to the task as
9 u
shown in the picture below.
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
IZ fwill
Lprocess
Note: This e ratake several minutes to complete. Avoid using the desktop
E nstasks while this is running. You may need to expand the items again
A fortraother
C I
computer
Ieach time the page refreshes.
TR non-
PA

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

Practices for Lesson 2: Creating a Physical Standby Database by Using Enterprise Manager Cloud Control
Chapter 2 - Page 5
Edutronic Global Services EฺIฺRฺL

15. The job will fail at the last step. Verify that steps 1 through 11 have succeeded as shown in
the pictures below. You will need to click the link "Next 11 - 12 of 12" to display the
remaining two steps.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
H R ns
16. Click the link "Previous E T 1 - 10 of l i c e to redisplay the first 10 steps. In the Status column,
12"
click the Succeeded
I Z AB link a b
forlethe row "Step: Destination Preparation." The output log
shows theL
E s f er being started
network listener on the standby host, along with a static service

C I A tran
"london_DGMGRL.example.com" that was created. Scroll to the beginning of the page if
I
TR the nfirston10- steps.
necessary and click the link "Task: Create Standby Database" to return to the display of

PA 17. In the Status column, click the Succeeded link for the row "Step: Duplicate Database."
The output log contains the Recovery Manager (RMAN) script that was used to perform the
online backup of the primary database.
18. On the main Enterprise Manager menu, click Targets and then Databases. You should
now see an entry for the london.example.com physical standby database instance.

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

Practices for Lesson 2: Creating a Physical Standby Database by Using Enterprise Manager Cloud Control
Chapter 2 - Page 6
Edutronic Global Services EฺIฺRฺL

Practice 2-2: Verify and Examine the Data Guard Environment


Overview
In this practice you will verify the Data Guard configuration and examine some of the changes
implemented by the Add Standby Database wizard.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Tasks
1. While still on the Targets -> Databases page from the last lab step, click on the link for the
primary database instance boston.example.com to navigate to its home page. Click on
the Availability menu item and note that the only Data Guard related item is the Add
Standby Database wizard as shown in the picture of Practice 2-1 Step 4. Click the "Log
Out" menu item in the top right corner. When prompted, select the option to "Logout of
Enterprise Manager and all targets."
2. Login to Enterprise Manager Cloud Control 12c. Log in to the application with the
credentials of sysman for user name and oracle_4U for the password. The password is
case sensitive. Navigate to the Databases page by selecting Targets, and then Databases
s a
from the drop down menu that appears. On the Databases page, click the link for the
boston.example.com target. m ) ha
l ฺ c o
3. ai ฺ
On the boston.example.com database home page, click the Availability menu item and note
m
g ide
the additional menu entries.
9 @
9 nt G u
u i z
( pr tude
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IAIf only
Note:
- t r athen"Add Standby Database" link is visible, then select it. It will not launch the
TR "AddnoStandby
n Database" wizard, but instead will navigate to the Data Guard home page.
PA

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

Practices for Lesson 2: Creating a Physical Standby Database by Using Enterprise Manager Cloud Control
Chapter 2 - Page 7
Edutronic Global Services EฺIฺRฺL

4. Select the "Verify Data Guard Configuration" item from the menu. The picture below shows
the steps performed while verifying the configuration. After verification completes, detailed
results are then displayed.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

a
Note: If your menu does not have the link "Verify Data Guard Configuration", then use the) h
as
link "Verify Configuration" located in the bottom section of the page. The verify process
l ฺ c om
will complete with warnings. You can ignore the 2 warnings regarding the stepa toi check the
agent status.
@ g m
i d eฺ
5. Click OK. The Data Guard Administration page is then displayed.99 G u
6. Examine initialization parameter changes implemented by the i z t
en Database
ru AdduStandby
wizard for the primary database. Click Administration >(p d
O St Parameters.
Initialization
N isparameters
the Show All button to display a complete list of initialization
Click
on a single web
R to tsort
Rcolumn h the values by Name.
page. You can click the triangle in the Name
A
B o us Value e
Name I
U se t Z
R n
dg_broker_config_file1 H/u01/app/oracle/fast_recovery_area/dr1boston.dat
T l i c e
BE b/u01/app/oracle/fast_recovery_area/dr2boston.dat
dg_broker_config_file2
A le
I Z
L sfer TRUE a
E
dg_broker_start

I C IA -tran
log_archive_config dg_config=(boston,london)
TR log_archive_dest_2
n o n
PA 'valid_for=(online_logfile,all_roles)',
'service="(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)
(HOST=host03.example.com)(PORT=1521))(CONNECT_DA
TA=(SERVICE_NAME=london.example.com)(SERVER=DEDI
CATED)))"', 'ASYNC NOAFFIRM delay=0 optional
compression=disable max_failure=0 max_connections=1
reopen=300 db_unique_name="london" net_timeout=30'
Additional Data Guard related initialization parameters include (not a complete list):
archive_lag_target, db_file_name_convert, fal_client, fal_server,
log_file_name_convert, log_archive_max_processes,
log_archive_min_succeed_dest, log_archive_dest_n,
log_archive_dest_state_n, and standby_file_management.

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

Practices for Lesson 2: Creating a Physical Standby Database by Using Enterprise Manager Cloud Control
Chapter 2 - Page 8
Edutronic Global Services EฺIฺRฺL

7. Select Targets > All Targets from the menu. It may be necessary to click the red 'X' icon in
the refine search section to remove any search filters. This will allow a complete list of
targets to be displayed. You can also click the Home icon in the top right corner since the
personal home page was set to display all targets. Select Target Type of Listener in the
refine search section. Notice that only 2 listeners have been discovered by Enterprise
Manager. They include LISTENER_em12.example.com and
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

LISTENER_host01.example.com.
8. Discover the network listener that was created on host03. Select Setup > Add Target >
Configure Auto Discovery from the menu. In the Agent-based Auto Discovery Section,
click the wrench icon next to the row item "All Discovery Modules." To highlight the row,
click on the gray background area within the first un-named column next to Agent Host
Name host03.example.com or within the row section underneath "Enabled Discovery
Modules." Avoid clicking the active links that will navigate away from this page. With the
row highlighted, click the "Run Discovery Now" link. Click "Yes" on the dialog window that
appears. Click Close on the completion dialog window that appears.
9. For the row with the Agent Host Name of "host03.example.com", click the number 1 in the
column "Discovered Targets." You should now see the network listener for host03. s a
Highlight the row containing LISTENER_host03.example.com and click the Promote link. ) ha
l ฺ c om
On the Promote Unmanaged Target page that appears, click the Promote button leaving all
ai ฺ
fields with default values. Click Close on the promote target confirmation dialog that
m
ide
appears. Click Targets > All Targets to return to the list of Listeners. Select the
g
@ u
LISTENER_host03.example.com link to navigate to its web page.
9
9 nt G
i z
10. On the LISTENER_host03.example.com page, select from the menu Oracle Listener >
u
( pr tude
Edit Listener. Select the Named option for the Credential and then select
ON his S
NC_HOST_ORACLE for the Credential Name. Click the Login button. Click the "Static
R
AR use t
Database Registration" tab to view the Service Name entry
B
(london_DGMGRL.example.com) that was created for the Data Guard broker. Click Cancel
IZ e to
to exit out of the Edit Listener page.
U
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 2: Creating a Physical Standby Database by Using Enterprise Manager Cloud Control
Chapter 2 - Page 9
Edutronic Global Services EฺIฺRฺL

Practice 2-3: Generating a Test Workload


Overview
In this practice, you will generate a test workload on the primary database that will cause log
switches to occur. Enterprise Manager graphs will then be examined to display redo generation
rates, lag times, and apply rates.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Tasks
1. With the navigation techniques learned from previous steps, navigate to the
boston.example.com database home page. From the menu, select Availability > Data
Guard Performance.
Note: If the menu doesn't show this link, then select Availability > Add Standby
Database. If you are taken to the Add Standby Database wizard, then click the Cancel
button. You will then be taken to the Data Guard home page for the boston primary
database. From there, you can find a Data Guard Performance link in the lower left section
of the web page.
s a
2. In the Test Application section, click the Start button to generate a load on the primary
) ha
database.
l ฺ c om
3. ai ฺ
Click the Refresh Page icon periodically located next to the View Data field. After running
m
9 @ g
u ide
for a few minutes, the 3 graphs on the Data Guard Performance page should begin to
reflect the workload being generated for the Data Guard environment. You should see the
i z 9 nt G
Transactions per second number increase. You can click any of the charts to display
u
pr tude
historical metrics. (
4. ON his S
When you have finished analyzing the graphs, click the Stop button in the Test Application
R
section.
A R se t
5. B
IZ e to u
You can explore using Enterprise Manager in a Data Guard environment for the current two
U
databases. Both databases (boston.example.com and london.example.com) will be deleted
H R icens
in the next section in preparation for learning to manage a Data Guard environment using
T
BE ble l
command-line tools.
A
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 2: Creating a Physical Standby Database by Using Enterprise Manager Cloud Control
Chapter 2 - Page 10
Edutronic Global Services EฺIฺRฺL

Practice 2-4: Preparing for Command-line Practices


Overview
In this practice, you will remove the boston.example.com from host01 and the
london.example.com database from host03 in preparation for command-line practices.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Tasks
1. Navigate to the boston.example.com database home page. Click Availability > Data
Guard Administration from the menu. In the Standby Databases section, click the
Remove button. Click "Yes" on the confirmation page.
Note: If the menu doesn't show this link, then select Availability > Add Standby
Database. If you are taken to the Add Standby Database wizard, then click the Cancel
button. You will then be taken to the Data Guard home page for the boston primary
database.
2. Navigate to Targets > Databases. Highlight the row for the london.example.com
database and click the Remove link. Click the Yes button on the Warning page. Highlight s a
the row for the boston.example.com database and click the Remove link. Click the Yes ) ha
button on the Warning page.
l ฺ c om
3. ai ฺ
Click Targets > All Targets on the menu. Remove any filters in the Refine Search area if
m
9 @ g
u ide
needed to display a complete list of targets. Click the "Listener (3)" link found under the
tree structure Target Type > Databases > Listener within the Refine Search section. The
i z 9 nt G
u
three listeners should be listed: LISTENER_em12.example.com,
pr tude
(
LISTENER_host01.example.com, and LISTENER_host03.example.com.
4. ON his S
Without clicking, hover the mouse pointer on top of the row
R
AR use t
LISTENER_host01.example.com. The row should highlight. Right-click using the
B
U IZ e to
mouse button to display a context menu. Select Target Setup > Remove Target from the
menu. Click the Yes button on the confirmation window that appears. Click OK.
5. T H R icens
Repeat step 6 and remove LISTENER_host03.example.com.
6. BE ble l
Click the "Log Out" menu item in the top right corner. Close down the Firefox browser
A
LIZ sfera
session and return to the Domain-0 console desktop.
E
7.
I C IA -tran
Open a terminal session if needed. Switch to the root account. In the home directory,
launch the stopcloudcontrol.sh script. Enter "y" to Store the key in cache if you are
TR non
PA
prompted on each machine.
[anyuser@dom0]$ su -
Password: oracle

[root@dom0]$ ./stopcloudcontrol.sh
***** Stopping agent on host01 *****
Oracle Enterprise Manager Cloud Control 12c Release 3
Copyright (c) 1996, 2013 Oracle Corporation. All rights
reserved.
Stopping agent ..... stopped.
***** Stopping agent on host02 *****
Oracle Enterprise Manager Cloud Control 12c Release 3
Copyright (c) 1996, 2013 Oracle Corporation. All rights
reserved.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 2: Creating a Physical Standby Database by Using Enterprise Manager Cloud Control
Chapter 2 - Page 11
Edutronic Global Services EฺIฺRฺL

Stopping agent ..... stopped.


***** Stopping agent on host03 *****
Oracle Enterprise Manager Cloud Control 12c Release 3
Copyright (c) 1996, 2013 Oracle Corporation. All rights
reserved.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Stopping agent ..... stopped.


***** Stopping agent on host04 *****
Oracle Enterprise Manager Cloud Control 12c Release 3
Copyright (c) 1996, 2013 Oracle Corporation. All rights
reserved.
Stopping agent ..... stopped.
***** Stopping OMS on em12 *****
Oracle Enterprise Manager Cloud Control 12c Release 3
Copyright (c) 1996, 2013 Oracle Corporation. All rights
reserved. s a
Stopping WebTier... ) ha
WebTier Successfully Stopped
l ฺ c om
Stopping Oracle Management Server...
m ai ฺ
Oracle Management Server Successfully Stopped
9 @ g
u ide
AdminServer Successfully Stopped i z 9 nt G
u
pr tude
Oracle Management Server is Down (
***** Stopping agent on em12 *****
R ON his S
AR use t
Oracle Enterprise Manager Cloud Control 12c Release 3
B
IZ e to
Copyright (c) 1996, 2013 Oracle Corporation. All rights
U
H R icens
reserved.
T
Stopping agent ..... stopped.
l Cloud Control will not be used again in this course, but
A BE Manager
l e
Note: Oracle Enterprise
L
the configuration r abpreserved if needed.
IZ hasfebeen
A E nvirtuals machine. Verify that the VM has been stopped.
8. Stop
I C I the em12
t r a
on-
TR n[root@dom0]# xm shutdown em12
PA [root@dom0]# xm list
Name ID Mem VCPUs State Time(s)
Domain-0 0 810 4 r----- 10855.2
host01 7 2048 1 -b---- 4313.0
host02 8 1536 1 -b---- 338.3
host03 9 2048 1 -b---- 2771.5
host04 10 1536 1 -b---- 339.9
Note: You may need to reissue the XM LIST command if needed while waiting on the
virtual machine to stop.

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

Practices for Lesson 2: Creating a Physical Standby Database by Using Enterprise Manager Cloud Control
Chapter 2 - Page 12
Edutronic Global Services EฺIฺRฺL

9. Open a terminal session to host03 using the oracle operating system account.
[root@dom0]# ssh -X oracle@host03
oracle@host03's password: oracle
Last login: Wed Jul 24 01:11:30 2013 from 192.0.2.1
10. Use the oraenv utility to set the environment variables for the london database instance.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

[oracle@host03]$ . oraenv
ORACLE_SID = [oracle] ? london
The Oracle base has been set to /u01/app/oracle
11. Startup the London database using SQL*Plus, open the database and then exit SQL*Plus.
[oracle@host03]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Wed Jul 24 04:52:07
2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to: s a
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - ) ha
64bit Production
l ฺ c om
With the Partitioning, OLAP, Advanced Analytics and Real
m ai ฺ
Application Testing options
9 @ g
u ide
i z 9 nt G
SQL> alter database open; u
pr tude
(
Database altered.
R ON his S
SQL> exit B AR use t
Disconnected from OracleU IZ Database
e to 12c Enterprise Edition Release
R
H Production n s
12.1.0.1.0 - 64bit
T l i c e
A BETesting
With the Partitioning,
b l e OLAP, Advanced Analytics and Real

LIZ sfConfiguration
era
Application options
12. Start theEDatabase
n Assistant (DBCA) utility.
I A tr a
IC [oracle@host03]$
TR non-
dbca

PA a. Select Delete Database on the Database Operation window. Click Next.


b. Select the 'london' database on the Delete Database window. Click Next.
c. Uncheck the box to deregister from Enterprise Manager on the Management Options
window. The database has already been deleted from Enterprise Manager. Click Next.
d. Click Finish on the Summary window.
e. Click Yes on the information dialog that appears.
f. Click OK on the information dialog that appears.
g. Click Close to exit the DBCA utility.

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

Practices for Lesson 2: Creating a Physical Standby Database by Using Enterprise Manager Cloud Control
Chapter 2 - Page 13
Edutronic Global Services EฺIฺRฺL

13. Stop the network listener on machine host03.


[oracle@host03]$ lsnrctl stop
LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 24-JUL-
2013 04:57:11
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=host03.example.com)(PO
RT=1521)))
The command completed successfully
14. Navigate to the $ORACLE_HOME/network/admin directory and delete the network
configuration files.
[oracle@host03]$ cd $ORACLE_HOME/network/admin
[oracle@host03]$ rm tnsnames*
[oracle@host03]$ rm listener*
s a
) ha
[oracle@host03]$ rm sqlnet*
15. Exit the SSH client session to host03, returning the session to Domain-0.
l ฺ c om
[oracle@host03]$ exit
m ai ฺ
g ide
logout
Connection to host03 closed. 9 @
9 nt G u
u i z
[root@dom0]#
( pr system
t u deaccount.
16. Open a terminal session to host01 using the oracle
O N is S
operating
[root@dom0]# ssh -X oracle@host01 R
R se th
oracle@host01's password: B
A
oracle u
Last login: Wed Jul U
I Z to 2013 from 192.0.2.1
R s e
24 01:12:18
n
to H
17. Use the oraenv utility T c e
set theienvironment variables for the 'boston' database instance.
B E le l
Z A rab. oraenv
[oracle@host01]$
I
L
E nsf=e[oracle] ? boston
ORACLE_SID
I A tra base has been set to /u01/app/oracle
R IC Then-Oracle
T18. Startnothe Database Configuration Assistant (DBCA) utility.
PA [oracle@host01]$ dbca
a. Select Delete Database on the Database Operation window. Click Next.
b. Select the 'boston' database on the Delete Database window. Click Next.
c. Uncheck the box to deregister from Enterprise Manager on the Management Options
window. The database has already been deleted from Enterprise Manager. Click Next.
d. Click Finish on the Summary window.
e. Click Yes on the information dialog that appears.
f. Click OK on the information dialog that appears.
g. Click Close to exit the DBCA utility.

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

Practices for Lesson 2: Creating a Physical Standby Database by Using Enterprise Manager Cloud Control
Chapter 2 - Page 14
Edutronic Global Services EฺIฺRฺL

19. Stop the network listener on machine host01.


[oracle@host01]$ lsnrctl stop
LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 24-JUL-
2013 04:57:11
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=host03.example.com)(PO
RT=1521)))
The command completed successfully
20. Navigate to the $ORACLE_HOME/network/admin directory and delete the network
configuration files.
[oracle@host01]$ cd $ORACLE_HOME/network/admin
[oracle@host01]$ rm listener*
[oracle@host01]$ rm sqlnet*
s a
) ha
21. Exit the SSH client session to host01, returning the session to Domain-0.
[oracle@host01]$ exit
l ฺ c om
logout
m ai ฺ
g ide
Connection to host01 closed.
[root@dom0]# 9 @
9 nt G u
u i z
( pr tude
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 2: Creating a Physical Standby Database by Using Enterprise Manager Cloud Control
Chapter 2 - Page 15
Edutronic Global Services EฺIฺRฺL

Practice 2-5: Primary Database Creation


Overview
In this practice, you will create a fresh database for the remainder of the command-line labs in
this course.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Assumptions
The system administrator has provided a server, host01, located in the city of Boston to be used
for the new database to be created. Oracle Linux 6.3 has already been installed on the server
along with the oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.x86_64.rpm file
to prepare the machine for database software installation. A software only install of the Oracle
database software has been performed into the default location of
/u01/app/oracle/product/12.1.0/dbhome_1. The server was also integrated into the
Oracle Enterprise Manager Cloud Control management infrastructure for monitoring with the
installation of the agent software into the /u01/app/oracle/agent/agent_inst home
directory.
s a
Tasks ) ha
l ฺ c om
1.
ai ฺ
Open a terminal window and use the SSH client to connect to host01 as the oracle OS
user. Enter oracle when you are prompted for the password. m
9 @ g
u ide
[root@dom0]# ssh -X oracle@host01
i z 9 nt G
oracle@host01's password: oracle u
pr tude directory. Invoke
(
N is S
2. Navigate to the /u01/app/oracle/product/12.1.0/dbhome_1/bin
the Database Configuration Assistant utility. RO
A R e th
I Z B o us
[oracle@host01]$ cd /u01/app/oracle/product/12.1.0/dbhome_1/bin
[oracle@host01]$ ./dbca
R U se t
T Hthereicareenno entries in the /etc/oratab file that can be used
Note: At this starting point,
E lesuch
to set environmentBvariables l as ORACLE_HOME.
A
IZ Operation
r a b window, select the Create Database option and then click
L
3. On the Database
E nsf e
Next.
I A tra Mode window, select the Advanced Mode option and then click Next.
C the Creation
4.RIOn n -
PA
T 5. no
On the Database Template window, select the General Purpose or Transaction
Processing option and then click Next.
6. On the Database Identification window, enter boston.example.com for the Global
Database Name. Check the box to Create As Container Database. With the Create a
Container Database with one or more PDBs selected, enter 1 for the Number of PDBs, and
enter dev1 as the PDB Name. Click Next.
7. On the Management Options window, verify that the box is checked for the option to
"Configure Enterprise Manager (EM) Database Express." Click Next.
8. On the Database Credentials window, select the option to "Use the Same Administrative
Password for All Accounts." Enter oracle_4U for the Password and Confirm Password
fields. Click Next.
9. On the Network Configuration window, check the box to select the Database home software
location. Enter LISTENER in the name field, and 1521 in the port field. Click Next.

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

Practices for Lesson 2: Creating a Physical Standby Database by Using Enterprise Manager Cloud Control
Chapter 2 - Page 16
Edutronic Global Services EฺIฺRฺL

10. On the Storage Locations window, select the option to "Use Common Location for All
Database Files." Verify that the "Specify Fast Recovery Area" box is checked, and adjust
the Fast Recovery Area Size field to 10G bytes. Check the Enable Archiving box. Click the
"Edit Archive Mode Parameters" button and change the name of the Archive Log File
Format to "arch_%t_%s_%r.log" and then OK. Click Next.
11. On the Database Options window, check the Sample Schemas box and click Next.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

12. On the Initialization Parameters window, change the Memory Size (SGA and PGA) to
496MB. Verify that the Use Automatic Memory Management box is checked. Click on the
Character Sets tab, and select the Use Unicode (AL32UTF8) option. Click Next.
13. On the Creation Options window, verify that the Create Database box is checked and then
click Next.
14. On the Summary window, click Finish. It will take some time for the database to create.
15. When a dialog window appears stating that database creation is complete, click Exit.
16. Click Close to exit the Database Configuration Assistant utility.
17. Use the icon on the desktop to launch Firefox on host01. The home page that is mapped to
https://em12.example.com:7802/em will not display since Enterprise Manager Cloud s a
Control has been stopped. Change the URL to https://host01.example.com:5500/em in ) ha
l ฺ c om
order to connect to the Enterprise Manager Database Express 12c application.
ai ฺ
18. You should receive a web page indicating that the connection is un-trusted is this is the
m
9 @ g
u ide
very first time you are accessing it. Click on the link "I Understand the Risks" and then
click the "Add Exception" button. In the Add Security Exception window that appears, click
the Confirm Security Exception button. i z 9 nt G
u
pr tude
(
19. Login to the Enterprise Manager Database Express 12c application with the username SYS,
ON his S
password oracle_4U, and with the "as sysdba" box checked. You are now connected to
R
B AR use t
the CDB$ROOT container database for the boston.example.com instance. The resources
graph and SQL monitor graph will give errors after some time. Exit the Firefox application. It
U IZ e to
is not necessary to wait for the graphs to give the error.
H R icens
20. In the terminal window that was used to run the Database Configuration Assistant utility on
T
BE ble l
host01, set the environment variables to the boston instance.
A
LIZ sfera . oraenv
[oracle@host01]$
E
C I AORACLE_SID
t r a n = [oracle] ? boston
I
TR nThe on-Oracle base has been set to /u01/app/oracle
PA 21. Invoke SQL*Plus connecting with operating system authentication.
[oracle@host01]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Wed Jul 24 20:14:33
2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -
64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real
Application Testing options
SQL>

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

Practices for Lesson 2: Creating a Physical Standby Database by Using Enterprise Manager Cloud Control
Chapter 2 - Page 17
Edutronic Global Services EฺIฺRฺL

22. Display a list of all pluggable databases and their open mode.
SQL> select name,open_mode from v$pdbs;
NAME OPEN_MODE
------------------------------ ----------
PDB$SEED READ ONLY
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

DEV1 READ WRITE


23. Use the ALTER SESSION statement to switch to the PDB Dev1 container and verify that it
is the current container.
SQL> alter session set container = dev1;
Session altered.
SQL> SELECT SYS_CONTEXT ('USERENV', 'CON_NAME') FROM DUAL;
SYS_CONTEXT('USERENV','CON_NAME')
----------------------------------------------------------
DEV1 a
24. Setup Enterprise Manager Database Express 12c for the pluggable database by defining a) h
as
distinct port number for it. Exit SQL*Plus when done.
l ฺ c om
SQL> exec dbms_xdb_config.sethttpsport(5501);
m ai ฺ
PL/SQL procedure successfully completed.
9 @ g
u ide
SQL> exit
i z 9 nt G
u
pr tudeEdition Release
Disconnected from Oracle Database 12c Enterprise
12.1.0.1.0 - 64bit Production
(
N is S
With the Partitioning, OLAP, R RO tAnalytics
Advanced h and Real
Application Testing options A
B o us e
25. Use the icon on the desktop to launch I Z
U Firefox t on host01. Change the URL to
R s e
n in order to connect to the Enterprise Manager
T H icfor
https://host01.example.com:5501/em
e
Database Express 12c
B E le l
application the Dev1 container.
A bpage indicating that the connection is un-trusted is this is the
LIZyousare
26. You should receive
very firstEtime f
a web
e r a
accessing it. Click on the link "I Understand the Risks" and then
C I
click A
the "Add
t r a n
Exception" button. In the Add Security Exception window that appears, click
I -
TR the nConfirm
on Security Exception button.
PA 27. Login to the Enterprise Manager Database Express 12c application with the username SYS,
password oracle_4U, and with the "as sysdba" box checked. You are now connected to
the Dev1 container database for the boston.example.com instance. All graphs on the home
page should now display properly. Exit the Firefox application.

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

Practices for Lesson 2: Creating a Physical Standby Database by Using Enterprise Manager Cloud Control
Chapter 2 - Page 18
Edutronic Global Services EฺIฺRฺL
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
Practices for Lesson g 3: ide
Oracle Net Services 9 @
9 ntinGauData
i z
pru tude
Guard Environment
(
R O3N his S
AR use t
Chapter
B
IZ e to
U
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 1
Edutronic Global Services EฺIฺRฺL

Practices for Lesson 3: Overview


Practices Overview
In these practices, you will use graphical utilities to create and modify the Oracle network
configuration files. You will manually edit the files with a text editor to bypass the current
limitations of the Oracle Net Manager utility, and then propagate the resulting files to each
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

server in the Data Guard environment.

s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 2
Edutronic Global Services EฺIฺRฺL

Practice 3-1: Modifying the tnsnames.ora Configuration File


Overview
In this practice you will modify the tnsnames.ora configuration file using the Graphical Oracle
Net Manager utility. You will create service name entries for each database instance that will be
used in this course. The following chart summarizes the entries that should be created:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Service Name Host Port SDU *_BUF_SIZE


boston host01.example.com 1521 65535 10485760
bostonFS host02.example.com 1521 65535 10485760
london host03.example.com 1521 65535 10485760
londonFS host04.example.com 1521 65535 10485760
london2 host03.example.com 1521 65535 10485760
prmy host01.example.com 1521 65535 10485760
s a
host03.example.com ) ha
emrep em12.example.com 1521
l ฺ c om
ai listed
Note: Due to a limitation of the Oracle Net Manager utility, the best practice
@
m values
g by Oracle
i d eฺNetin
the documentation cannot be entered. The maximum value for SDU9allowed
9 Net G u utility
Manager is 32767. This will need to be corrected after using the i zOracle
en t Manager
by manually editing the configuration files in practice 3-3.pru d
(
N is St u
R O
Tasks
A R e th
1. If you closed the terminal window fromB the previousspractice, then open a terminal window
and use the SSH client to connectIto Z t o u
as the oracle OS user. Enter oracle when
U
R nse
you are prompted for the password.
host01
H
T ssh l-Xiceoracle@host01
E
AB rabpassword:
[anyuser@dom0]$
Z le
L I
oracle@host01's
e
oracle
f to set the environment variables for the boston instance.
2. UseA theE n sutility
I
IC The
oraenv
a
r in the lab exercises will now show the user and host for the machine that
-tprompt
TR Note: o n
younshould be connected to. Throughout labs, you will use 5 different hosts and 2 different
PA operating system accounts. Your actual operating system prompt may display additional
information such as the current directory. This will not be shown in labs. If the prompt does
not show the user and machine as in the above step, it indicates that you should be using
the main console window on Domain-0. The Domain-0 name is unique for each student.
[oracle@host01]$ . oraenv
ORACLE_SID = [oracle] ? boston
The Oracle base has been set to /u01/app/oracle
3. Use the lsnrctl utility to check the status of the network listener.
[oracle@host01]$ lsnrctl status
LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 04-JUN-
2013 20:02:49

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


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

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 3
Edutronic Global Services EฺIฺRฺL

Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=host01.example.com)(PO
RT=1521)))
STATUS of the LISTENER
------------------------
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.1.0
- Production
Start Date 03-JUN-2013 20:02:58
Uptime 0 days 23 hr. 59 min. 51 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File s a
/u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.o
) ha
ra
l ฺ c om
Listener Log File
m ai ฺ
g ide
/u01/app/oracle/diag/tnslsnr/host01/listener/alert/log.xml
Listening Endpoints Summary... 9 @
9 nt G u
u i z
RT=1521))) ( pr tude
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=host01.example.com)(PO

R ON his S
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

B AR use t
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=host01.example.com)(P
IZ e to
ORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/admin/b
U
H R icens
oston/xdb_wallet))(Presentation=HTTP)(Session=RAW))
T
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=host01.example.com)(P
A BE ble l
ORT=5501))(Security=(my_wallet_directory=/u01/app/oracle/admin/b

E LIZ sfera
oston/xdb_wallet))(Presentation=HTTP)(Session=RAW))

I C IA -tran
Services Summary...

TR non
Service "boston.example.com" has 1 instance(s).

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


service...
Service "bostonXDB.example.com" has 1 instance(s).
Instance "boston", status READY, has 1 handler(s) for this
service...
Service "dev1.example.com" has 1 instance(s).
Instance "boston", status READY, has 1 handler(s) for this
service...
The command completed successfully
Note: Notice that the entry Listener Parameter File indicates the location of the
configuration files. The location can be set with the ORACLE_HOME or TNS_ADMIN
environment variables when starting the listener.

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

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 4
Edutronic Global Services EฺIฺRฺL

4. Navigate to the $ORACLE_HOME/network/admin directory and examine the contents of


the network configuration files (sqlnet.ora, listener.ora, or tnsnames.ora).
[oracle@host01]$ cd $ORACLE_HOME/network/admin
[oracle@host01]$ cat sqlnet.ora
# sqlnet.ora Network Configuration File:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

/u01/app/oracle/product/12.1.0/dbhome_1/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.

NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME)


[oracle@host01]$ cat listener.ora
# listener.ora Network Configuration File:
/u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.o
ra
# Generated by Oracle configuration tools.
s a
LISTENER = ) ha
(DESCRIPTION_LIST =
l ฺ c om
(DESCRIPTION =
m ai ฺ
(ADDRESS = (PROTOCOL = TCP)(HOST =
9 @ g
u ide
host01.example.com)(PORT = 1521))
i z 9 nt G
u
pr tude
(
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
R ON his S
)
B AR use t
IZ e to
[oracle@host01]$ cat tnsnames.ora
U
H R icens
# tnsnames.ora Network Configuration File:
T
/u01/app/oracle/product/12.1.0/dbhome_1/network/admin/tnsnames.o
ra
A BE ble l
E LIZ sfera
# Generated by Oracle configuration tools.

I C IABOSTON
- t r a=n
TR no(DESCRIPTION
n
PA =
(ADDRESS = (PROTOCOL = TCP)(HOST = host01.example.com)(PORT
= 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = boston.example.com)
)
)
5. Invoke the Oracle Net Manager utility to prepare the networking files for Data Guard. Adjust
the tnsnames.ora configuration file by modifying the “boston” service name entry. Set the
Session Data Unit to 64K bytes, and both the Send Buffer Size and Receive Buffer Size to
10M bytes.
[oracle@host01]$ netmgr
a. Expand the Local menu tree item underneath Oracle Net Configuration
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 5
Edutronic Global Services EฺIฺRฺL

b. Click on the Profile menu tree item


c. Highlight the EZCONNECT method under the available methods
d. Click the '>' button to add it to the Selected Methods list
e. Expand the Service Naming menu tree item
f. Highlight the “boston” entry
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

g. Click the Advanced button in the Service Identification section


h. Enter 32767 for the Session Data Unit (Note: The documentation recommends a value
of 65535, but the Oracle Net Manager utility currently limits this value to 32767)
i. Click the OK button
j. Click the Show Advanced button in the Address Configuration section
k. Enter 10485760 for both the Send Buffer Size and the Receive Buffer Size in the
Advanced Protocol Parameters section
6. Create a new Service Name “bostonFS” on host02.example.com. Set the Session
Data Unit to 64K bytes, and both the Send Buffer Size and Receive Buffer Size to 10M
bytes. s a
a. Click the green "+" button at the top-left of the form to create a new Service Name ) ha
entry
l ฺ c om
b. Enter bostonFS as the Net Service Name and click the Next button
m ai ฺ
c. Highlight TCP/IP (Internet Protocol) and click the Next button @g
9 u ide
d. Enter host02.example.com for the Host Name i z 9 nt G
u de
prNexttbutton
e. Leave the port to its default value of 1521 and click(the u
f. Enter bostonFS.example.com as the Service
R ONName
h i s Sclick the Next button
and
g. Click the Finish button
B AR use t
h. Highlight the "bostonFS" entry
U IZ e to
i. Click the Advanced button
H R in thenService
s Identification section
j. Enter 32767 for E T e
c Unit (Note: The documentation recommends a value
SessionliData
A
of 65535, but BthetheOracle
l e
b Manager utility currently limits this value to 32767)
Net
L I Z r a
k. Click
A fe
Ethe OKnsbutton
I
C Clickn-the
Il.m. traShow Advanced button in the Address Configuration section
T R o 10485760 for both the Send Buffer Size and the Receive Buffer Size in the
nEnter
PA Advanced Protocol Parameters section
7. Create a new Service Name “london” on host03.example.com. Set the Session Data
Unit to 64K bytes, and both the Send Buffer Size and Receive Buffer Size to 10M bytes.
a. Click the green "+" button at the top-left of the form to create a new Service Name
entry
b. Enter london as the Net Service Name and click the Next button
c. Highlight TCP/IP (Internet Protocol) and click the Next button
d. Enter host03.example.com for the Host Name
e. Leave the port to its default value of 1521 and click the Next button
f. Enter london.example.com as the Service Name and click the Next button
g. Click the Finish button
h. Highlight the "london" entry
i. Click the Advanced button in the Service Identification section
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 6
Edutronic Global Services EฺIฺRฺL

j. Enter 32767 for the Session Data Unit (Note: The documentation recommends a value
of 65535, but the Oracle Net Manager utility currently limits this value to 32767)
k. Click the OK button
l. Click the Show Advanced button in the Address Configuration section
m. Enter 10485760 for both the Send Buffer Size and the Receive Buffer Size in the
Advanced Protocol Parameters section
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

8. Create a new Service Name “londonFS” on host04.example.com. Set the Session


Data Unit to 64K bytes, and both the Send Buffer Size and Receive Buffer Size to 10M
bytes.
a. Click the green "+" button at the top-left of the form to create a new Service Name
entry
b. Enter londonFS as the Net Service Name and click the Next button
c. Highlight TCP/IP (Internet Protocol) and click the Next button
d. Enter host04.example.com for the Host Name
e. Leave the port to its default value of 1521 and click the Next button
s a
f. Enter londonFS.example.com as the Service Name and click the Next button ) ha
g. Click the Finish button
l ฺ c om
h. Highlight the "londonFS" entry
m ai ฺ
i. Click the Advanced button in the Service Identification section @
9
g
u ide
j. Enter 32767 for the Session Data Unit (Note: The documentation i z n G a value
9 recommends
t
of 65535, but the Oracle Net Manager utility currently u e to 32767)
r thisudvalue
plimits
( t
k. Click the OK button
R ON his S
l. Click the Show Advanced button in theR
A e t
Address Configuration section
B s
u and the Receive Buffer Size in the
m. Enter 10485760 for both the Send
U IZsection
Buffer Size
t o
R nse
Advanced Protocol Parameters
H
9. Create a new Service Name
E T “london2”
l i c e on host03.example.com. Set the Session Data
Unit to 64K bytes,B e Send Buffer Size and Receive Buffer Size to 10M bytes.
and both lthe
a. Click L I Z A a b
the green "+"r button at the top-left of the form to create a new Service Name
E
entry
A n s fe
I
Ib.C Enter - tra as the Net Service Name and click the Next button
T R no n london2

PA c. Highlight TCP/IP (Internet Protocol) and click the Next button


d. Enter host03.example.com for the Host Name
e. Leave the port to its default value of 1521 and click the Next button
f. Enter london2.example.com as the Service Name and click the Next button
g. Click the Finish button
h. Highlight the "london2" entry
i. Click the Advanced button in the Service Identification section
j. Enter 32767 for the Session Data Unit (Note: The documentation recommends a value
of 65535, but the Oracle Net Manager utility currently limits this value to 32767)
k. Click the OK button
l. Click the Show Advanced button in the Address Configuration section
m. Enter 10485760 for both the Send Buffer Size and the Receive Buffer Size in the
Advanced Protocol Parameters section

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

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 7
Edutronic Global Services EฺIฺRฺL

10. Create a new Service Name “prmy” on host01.example.com and


host03.example.com simultaneously. Set the Session Data Unit to 64K bytes, and both
the Send Buffer Size and Receive Buffer Size to 10M bytes.
a. Click the green "+" button at the top-left of the form to create a new Service Name
entry
b. Enter prmy as the Net Service Name and click the Next button
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

c. Highlight TCP/IP (Internet Protocol) and click the Next button


d. Enter host01.example.com for the Host Name
e. Leave the port to its default value of 1521 and click the Next button
f. Enter prmy.example.com as the Service Name and click the Next button
g. Click the Finish button
h. Highlight the "prmy" entry
i. Click the Advanced button in the Service Identification section
j. Enter 32767 for the Session Data Unit (Note: The documentation recommends a value
s a
) ha
of 65535, but the Oracle Net Manager utility currently limits this value to 32767)
k. Click the OK button
l. Click the Show Advanced button in the Address Configuration section l ฺ c om
m ai ฺ
m. Enter 10485760 for both the Send Buffer Size and the Receive Buffer Size in the
Advanced Protocol Parameters section
9 @ g
u ide
i z 9 nt G
n. Click the green + sign within the Address Configuration section to add a second
u
pr tude
address. (
ON his S
o. Change the Host Name field to a value of host03.example.com and the Port Number
R
field to 1521.
B AR use t
p. Click the Show Advanced button in the Address Configuration section
U IZ e to
q. Enter 10485760 for both the Send Buffer Size and the Receive Buffer Size in the
H R icens
Advanced Protocol Parameters section
T
A BE ble l
LIZService
11. Create a new
E f e a “emrep” on em12.example.com.
rName
a. IA
C Click thea
t r ns "+" button at the top-left of the form to create a new Service Name
green
I entry
TR non-
PA b. Enter emrep as the Net Service Name and click the Next button
c. Highlight TCP/IP (Internet Protocol) and click the Next button
d. Enter em12.example.com for the Host Name
e. Leave the port to its default value of 1521 and click the Next button
f. Enter emrep.example.com as the Service Name and click the Next button
g. Click the Finish button
12. Click File > Save Network Configuration from the menu.
13. Do not exit the Oracle Net Manager utility. Open a terminal window and use the SSH client
to connect to host01 as the oracle OS user. Enter oracle when you are prompted for
the password.
$ ssh -X oracle@host01
oracle@host01's password: oracle

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

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 8
Edutronic Global Services EฺIฺRฺL

14. Use the oraenv utility to set the environment variables for the boston instance.
[oracle@host01]$ . oraenv
ORACLE_SID = [oracle] ? boston
The Oracle base has been set to /u01/app/oracle
15. Navigate to the $ORACLE_HOME/network/admin directory and examine the contents of
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

the sqlnet.ora and tnsnames.ora network configuration files verifying the changes
made.
[oracle@host01]$ cd $ORACLE_HOME/network/admin
[oracle@host01]$ cat sqlnet.ora
# sqlnet.ora Network Configuration File:
/u01/app/oracle/product/12.1.0/dbhome_1/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.
NAMES.DIRECTORY_PATH= (TNSNAMES, HOSTNAME, EZCONNECT)
ADR_BASE = /u01/app/oracle
s a
) ha
om
[oracle@host01]$ cat tnsnames.ora
l ฺ c
ai ฺ
# tnsnames.ora Network Configuration File:
m
/u01/app/oracle/product/12.1.0/dbhome_1/network/admin/tnsnames.o
ra
9 @ g
u ide
i
# Generated by Oracle configuration tools. z 9 nt G
u
pr tude
(
LONDONFS =
R ON his S
AR use t
(DESCRIPTION =
(ADDRESS_LIST = B
IZ e= TCP)(HOST
R U
(ADDRESS = (PROTOCOL to =
host04.example.com)(PORT n=s
H ice= 10485760))
1521)(SEND_BUF_SIZE =
T l
BE ble
10485760)(RECV_BUF_SIZE
) IZA
E L era
(SDU =sf32767)
I C t an
IA -(CONNECT_DATA
r =
TR non (SERVICE_NAME = londonFS.example.com)
PA )
)

BOSTONFS =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
host02.example.com)(PORT = 1521)(SEND_BUF_SIZE =
10485760)(RECV_BUF_SIZE = 10485760))
)
(SDU = 32767)
(CONNECT_DATA =
(SERVICE_NAME = bostonFS.example.com)

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

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 9
Edutronic Global Services EฺIฺRฺL

)
)

EMREP =
(DESCRIPTION =
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = em12.example.com)(PORT
= 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = emrep.example.com)
)
)

BOSTON = s a
(DESCRIPTION = ) ha
(ADDRESS_LIST =
l ฺ c om
m
(ADDRESS = (PROTOCOL = TCP)(HOST = ai ฺ
@ g ide
host01.example.com)(PORT = 1521)(SEND_BUF_SIZE =
9 u
i z 9 nt G
10485760)(RECV_BUF_SIZE = 10485760))
) u
pr tude
(
(SDU = 32767)
R ON his S
AR use t
(CONNECT_DATA =
B
(SERVER = DEDICATED)
IZ e to
U
(SERVICE_NAME = boston.example.com)

T
) H R icens
A BE ble l
)

E LIZ sfera
PRMY =

I C IA -tran (DESCRIPTION =

TR non (ADDRESS_LIST =
PA (ADDRESS = (PROTOCOL = TCP)(HOST =
host01.example.com)(PORT = 1521)(SEND_BUF_SIZE =
10485760)(RECV_BUF_SIZE = 10485760))
(ADDRESS = (PROTOCOL = TCP)(HOST =
host03.example.com)(PORT = 1521)(SEND_BUF_SIZE =
10485760)(RECV_BUF_SIZE = 10485760))
)
(SDU = 32767)
(CONNECT_DATA =
(SERVICE_NAME = prmy.example.com)
)
)
LONDON2 =
(DESCRIPTION =

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

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 10
Edutronic Global Services EฺIฺRฺL

(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
host03.example.com)(PORT = 1521)(SEND_BUF_SIZE =
10485760)(RECV_BUF_SIZE = 10485760))
)
(SDU = 32767)
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

(CONNECT_DATA =
(SERVICE_NAME = london2.example.com)
)
)

LONDON =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = s a
host03.example.com)(PORT = 1521)(SEND_BUF_SIZE =
) ha
10485760)(RECV_BUF_SIZE = 10485760))
l ฺ c om
)
m ai ฺ
(SDU = 32767)
9 @ g
u ide
(CONNECT_DATA =
i z 9 nt G
u
pr tude
(SERVICE_NAME = london.example.com)
(
)
R ON his S
AR use t
)
B
IZ e to
U
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 11
Edutronic Global Services EฺIฺRฺL

Practice 3-2: Modifying the listener.ora Configuration File


Overview
In this practice you will modify the listener.ora configuration files on each server in the
Oracle Data Guard environment using the Graphical Oracle Net Manager utility. You will create
static entries for the “boston” , “london” , and “london2” service names. A static entry is
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

required for RMAN to make a connection after shutting down the instance during physical or
logical standby database creation. You will also create entries that are required later in the
course for Data Guard Broker operations. The following chart summarizes the entries that need
to be created on each server host respectively:
Host Global Database Name Oracle Home Directory SID
host01 boston.example.com /u01/app/oracle/product/12.1.0/dbhome_1 boston
host01 boston_DGMGRL.example.com /u01/app/oracle/product/12.1.0/dbhome_1 boston
host02 bostonFS.example.com /u01/app/oracle/product/12.1.0/dbhome_1 bostonFS a
host02 bostonFS_DGMGRL.example.com /u01/app/oracle/product/12.1.0/dbhome_1 bostonFS
) has
host03 london.example.com /u01/app/oracle/product/12.1.0/dbhome_1
l ฺ c om
london
i
host03 london_DGMGRL.example.com ma deฺ london
/u01/app/oracle/product/12.1.0/dbhome_1
g
host03 london2.example.com 9 @ Gui london2
/u01/app/oracle/product/12.1.0/dbhome_1
9
host03 london2_DGMGRL.example.com r u iz ent
/u01/app/oracle/product/12.1.0/dbhome_1 london2
( p tud
host04 londonFS.example.com ON his S
/u01/app/oracle/product/12.1.0/dbhome_1
R londonFS
R se t
host04 londonFS_DGMGRL.example.com A/u01/app/oracle/product/12.1.0/dbhome_1 londonFS
B
IZ e to u
U
Tasks T H R icens
BEManager l e l
1. Using the Oracle
I Z ANet
r a b utility that is still open from practice 3-1 for host01, set the
L
E Size sand
Send Buffer fetnsnames.ora
Receive Buffer Size advanced protocol parameters to match the
I
sizesAenteredainnthe configuration.
I C - t r
A TR a.b. nExpand
on the Listeners menu tree item
P Highlight the LISTENER entry
c. Under the Listening Locations, Address 1 section, click the Show Advanced button
for the TCP/IP protocol entry
d. Enter 65535 for both the Send Buffer Size and the Receive Buffer Size (Note: The
documentation recommends a minimum value of 10485760, but the Oracle Net
Manager utility currently limits this value to 65535.)
2. Create static listener entries for host01 identified by the table in the overview section of
this practice.
a. Under the Listening locations drop down menu, select the Database Services entry.
Currently no database services are explicitly configured for this listener.
b. Click the Add Database button. Enter boston.example.com for the Global
Database Name and boston for the SID. The Oracle Home Directory should default to
the correct location.

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

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 12
Edutronic Global Services EฺIฺRฺL

c. Click the Add Database button. Enter boston_DGMGRL.example.com for the Global
Database Name and boston for the SID. The Oracle Home Directory should default to
the correct location.
3. Click File > Save Network Configuration from the menu.
4. Do not exit the Oracle Net Manager utility. If you closed the terminal window from the
previous practice, open a terminal window and use the SSH client to connect to host01 as
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

the oracle OS user. Enter oracle when you are prompted for the password.
$ ssh -X oracle@host01
oracle@host01's password: oracle
5. Use the oraenv utility to set the environment variables for the boston instance.
[oracle@host01]$ . oraenv
ORACLE_SID = [oracle] ? boston
The Oracle base has been set to /u01/app/oracle
6. Navigate to the $ORACLE_HOME/network/admin directory and examine the contents of
s a
the listener.ora network configuration file verifying the changes made.
) ha
[oracle@host01]$ cd $ORACLE_HOME/network/admin
l ฺ c om
[oracle@host01]$ cat listener.ora
m ai ฺ
# listener.ora Network Configuration File:
9 @ g
u ide
i z 9 nt G
/u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.o
ra u
pr tude
(
ON his S
# Generated by Oracle configuration tools.
R
SID_LIST_LISTENER =
B AR use t
(SID_LIST =
U IZ e to
(SID_DESC =
H R ns
E T l i c eboston.example.com)
AB rable= /u01/app/oracle/product/12.1.0/dbhome_1)
(GLOBAL_DBNAME =
I Z
(ORACLE_HOME
L (SID_NAME
A E n s fe = boston)
I
IC n-)tra
T R no (SID_DESC =
PA (GLOBAL_DBNAME = boston_DGMGRL.example.com)
(ORACLE_HOME = /u01/app/oracle/product/12.1.0/dbhome_1)
(SID_NAME = boston)
)
)

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST =
host01.example.com)(PORT = 1521)(SEND_BUF_SIZE =
65535)(RECV_BUF_SIZE = 65535))
)
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 13
Edutronic Global Services EฺIฺRฺL

(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

ADR_BASE_LISTENER = /u01/app/oracle
7. If the entries appear correct, then exit the Oracle Net Manager utility. Reload the modified
configuration for the listener that is now running. If the listener is not running, then start it
instead of reloading it.
[oracle@host01]$ lsnrctl reload or lsnrctl start
LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 06-JUN-
2013 06:08:02

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


s a
) ha
Connecting to
l ฺ c om
ai ฺ
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=host01.example.com)(PO
RT=1521)(SEND_BUF_SIZE=65535)(RECV_BUF_SIZE=65535)))
m
The command completed successfully
9 @ g
u ide
8. Copy the tnsnames.ora file and sqlnet.ora file to host02, i z 9host03nand
t Ghost04 as
the oracle user and place them into the same directory(p
u
asr they existdeon host01. Do not
copy the listener.ora file. Answer yes to continueO Nsupply
and
t u
S password oracle if
the
R h i s
asked.
A R se t
[oracle@host01]$ scp tnsnames.ora B
IZ e to u
U
R ns
host02:/u01/app/oracle/product/12.1.0/dbhome_1/network/admin
tnsnames.ora TH e
E l i c 100% 1934
1.9KB/s
I Z AB rabscp
00:00
le tnsnames.ora
L sfe
[oracle@host01]$
E
an
IAtnsnames.ora
host03:/u01/app/oracle/product/12.1.0/dbhome_1/network/admin
I C - t r 100% 1934
TR n1.9KB/son
PA
00:00
[oracle@host01]$ scp tnsnames.ora
host04:/u01/app/oracle/product/12.1.0/dbhome_1/network/admin
tnsnames.ora 100% 1934
1.9KB/s 00:00
[oracle@host01]$ scp sqlnet.ora
host02:/u01/app/oracle/product/12.1.0/dbhome_1/network/admin
sqlnet.ora 100% 202
0.2KB/s 00:00
[oracle@host01]$ scp sqlnet.ora
host03:/u01/app/oracle/product/12.1.0/dbhome_1/network/admin
sqlnet.ora 100% 202
0.2KB/s 00:00
[oracle@host01]$ scp sqlnet.ora
host04:/u01/app/oracle/product/12.1.0/dbhome_1/network/admin

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

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 14
Edutronic Global Services EฺIฺRฺL

sqlnet.ora 100% 202


0.2KB/s 00:00
9. Open a new terminal window and use the SSH client to connect to host02 as the oracle
OS user. Enter oracle when you are prompted for the password. You can leave open the
previous window to host01. You will soon need windows open to host01, host02,
host03, and host04.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

$ ssh -X oracle@host02
oracle@host02's password: oracle
10. Create an initial entry into the /etc/oratab file on host02 to facilitate setting
environment variables.
[oracle@host02]$ echo
bostonFS:/u01/app/oracle/product/12.1.0/dbhome_1:N >>
/etc/oratab
11. Use the newly created entry to set the ORACLE_BASE, ORACLE_HOME, ORACLE_SID,
LD_LIBRARY_PATH, and PATH environment variables. s a
) ha
[oracle@host02]$ . oraenv
l ฺ c om
ORACLE_SID = [oracle] ? bostonFS
m ai ฺ
The Oracle base has been set to /u01/app/oracle
@gandGadd e
12. Invoke the Oracle Net Manager utility on host02 to create a new9listener 9 uidstatic
listener entries specific for that server. r u iz ent
[oracle@host02]$ netmgr N (p Stud
O htheisService Naming menu tree
Rexpand
a. Expand the Local menu tree item. YouR can
Aentriesuthat t
ewere
item if you want. You should see the
Z B s manually copied from host01.
b. Expand the Listeners menu I
Utree item. e t o
There should be no entries under it at this time.
R n s
c. Highlight the Listeners
new entry. BE
TH menu l i cetree item and click the green plus (+) sign to create a
Z le the default Listener Name of LISTENER.
Abuttonratobaccept
d. Click the I OK
L sfeLocations in the drop down menu box, click Add Address button at
EListening
I
e. A
C
With
I the bottom
- t r anof the window.
TR f. nChangeon the Host entry from 'host02' to 'host02.example.com'.
PA g. Under the Listening Locations, Address 1 section, click the Show Advanced button for
the TCP/IP protocol entry
h. Enter 65535 for both the Send Buffer Size and the Receive Buffer Size (Note: The
documentation recommends a minimum value of 10485760, but the Oracle Net
Manager utility currently limits this value to 65535.)
13. Create static listener entries for host02 identified by the table in the overview section of
this practice.
a. Under the Listening locations drop down menu, select the Database Services entry.
Currently no database services are explicitly configured for this listener.
b. Click the Add Database button. Enter bostonFS.example.com for the Global
Database Name and bostonFS for the SID. The Oracle Home Directory should default
to the correct location.

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

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 15
Edutronic Global Services EฺIฺRฺL

c. Click the Add Database button. Enter bostonFS_DGMGRL.example.com for the


Global Database Name and bostonFS for the SID. The Oracle Home Directory should
default to the correct location.
14. Click File > Save Network Configuration from the menu. Exit the Oracle Net Manager
utility.
15. Start the listener.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

[oracle@host02]$ lsnrctl start



Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=host02.example.com)(PO
RT=1521)))
Services Summary...
Service "bostonFS.example.com" has 1 instance(s).
Instance "bostonFS", status UNKNOWN, has 1 handler(s) for this
s a
service...
) ha
Service "bostonFS_DGMGRL.example.com" has 1 instance(s).
l ฺ c om
Instance "bostonFS", status UNKNOWN, has 1 handler(s) for this
m ai ฺ
g ide
service...
The command completed successfully 9 @
9 nt G u
16. Open a new terminal window and use the SSH client to connect u i z
r uhost03
to e as the oracle
( p d
OS user. Enter oracle when you are prompted for N
O i s St You can leave open the
the password.
previous windows to host01 and host02 open.
A RR se th
$ ssh -X oracle@host03
I Z B ou
oracle@host03's password:
R U soracle e t
T
17. Create an initial entry into
c n
Hthe /etc/oratab
e file on host03 to facilitate setting
E
B ble
environment variables. l i
I Z A ra echo
L
[oracle@host03]$
E f e
C I t r a ns
Alondon:/u01/app/oracle/product/12.1.0/dbhome_1:N >> /etc/oratab
I
on-
TR nlondon2:/u01/app/oracle/product/12.1.0/dbhome_1:N
[oracle@host03]$ echo

PA
>> /etc/oratab

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

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 16
Edutronic Global Services EฺIฺRฺL

18. Use the newly created entry to set the ORACLE_BASE, ORACLE_HOME, ORACLE_SID,
LD_LIBRARY_PATH, and PATH environment variables.
[oracle@host03]$ . oraenv
ORACLE_SID = [oracle] ? london
The Oracle base has been set to /u01/app/oracle
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

19. Invoke the Oracle Net Manager utility on host03 to create a new listener and add static
listener entries specific for that server.
[oracle@host03]$ netmgr
a. Expand the Local menu tree item. You can expand the Service Naming menu tree
item if you want. You should see the entries that were manually copied from host01.
b. Expand the Listeners menu tree item. There should be no entries under it at this time.
c. Highlight the Listeners menu tree item and click the green plus (+) sign to create a
new entry.
d. Click the OK button to accept the default Listener Name of LISTENER.
s a
e. With Listening Locations in the drop down menu box, click Add Address button at ) ha
the bottom of the window.
l ฺ c om
f. Change the Host entry from 'host03' to 'host03.example.com'.
m ai ฺ
g. Under the Listening Locations, Address 1 section, click the Show Advanced
9 @ g
u de for
ibutton
the TCP/IP protocol entry
i z 9 nt G
h. Enter 65535 for both the Send Buffer Size and the Receive u
pr tbut e Size
Buffer
dthe (Note: The
documentation recommends a minimum value of 10485760, ( u Oracle Net
ON his S
Manager utility currently limits this value to 65535.)
R
AR usbyethet table in the overview section of
20. Create static listener entries for host03 identified
B
this practice.
U IZ e to
a. Under the Listening locationsR drop
Hservices n s down menu, select the Database Services entry.
T
Currently no database
E l e
ic explicitly configured for this listener.
are
b. Click the Add B
A Database e
l button. Enter london.example.com for the Global
blondon
L
DatabaseIZName f e r
anda for the SID. The Oracle Home Directory should default to
E s
I C IA -tran
the correct location.

TR nClick
c.
on the Add Database button. Enter london_DGMGRL.example.com for the Global
PA Database Name and london for the SID. The Oracle Home Directory should default to
the correct location.
d. Click the Add Database button. Enter london2.example.com for the Global
Database Name and london2 for the SID. The Oracle Home Directory should default
to the correct location.
e. Click the Add Database button. Enter london2_DGMGRL.example.com for the
Global Database Name and london2 for the SID. The Oracle Home Directory should
default to the correct location.
21. Click File > Save Network Configuration from the menu. Exit the Oracle Net Manager
utility.

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

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 17
Edutronic Global Services EฺIฺRฺL

22. Start the listener.


[oracle@host03]$ lsnrctl start

Listening Endpoints Summary...
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=host03.example.com)(PO
RT=1521)))
Services Summary...
Service "london.example.com" has 1 instance(s).
Instance "london", status UNKNOWN, has 1 handler(s) for this
service...
Service "london2.example.com" has 1 instance(s).
Instance "london2", status UNKNOWN, has 1 handler(s) for this
service...
Service "london2_DGMGRL.example.com" has 1 instance(s).
s a
Instance "london2", status UNKNOWN, has 1 handler(s) for this
) ha
service...
l ฺ c om
Service "london_DGMGRL.example.com" has 1 instance(s).
m ai ฺ
Instance "london", status UNKNOWN, has 1 handler(s) for this
9 @ g
u ide
service...
i z 9 nt G
u de as the oracle
(pr Stotuhost04
The command completed successfully
23. Open a new terminal window and use the SSH clientNto connect
OS user. Enter oracle when you are prompted O the password.
Rfor h is You can leave open the
R t
previous windows to host01, host02B
Z
A host03
and
u seopen.
$ ssh -X oracle@host04
R UI se to
oracle@host04's H
T password:
c e n oracle
l i
BEintobthele/etc/oratab file on host04 to facilitate setting
24. Create an initial entry
A
E LIZ
environment variables.ra
s fe echo
I A tra n
[oracle@host04]$
R IC londonFS:/u01/app/oracle/product/12.1.0/dbhome_1:N
n - >>
T o
n/etc/oratab
PA 25. Use the newly created entry to set the ORACLE_BASE, ORACLE_HOME, ORACLE_SID,
LD_LIBRARY_PATH, and PATH environment variables.
[oracle@host04]$ . oraenv
ORACLE_SID = [oracle] ? londonFS
The Oracle base has been set to /u01/app/oracle
26. Invoke the Oracle Net Manager utility on host03 to create a new listener and add static
listener entries specific for that server.
[oracle@host04]$ netmgr
a. Expand the Local menu tree item. You can expand the Service Naming menu tree
item if you want. You should see the entries that were manually copied from host01.
b. Expand the Listeners menu tree item. There should be no entries under it at this time.

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

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 18
Edutronic Global Services EฺIฺRฺL

c. Highlight the Listeners menu tree item and click the green plus (+) sign to create a
new entry.
d. Click the OK button to accept the default Listener Name of LISTENER.
e. With Listening Locations in the drop down menu box, click Add Address button at the
bottom of the window.
f. Change the Host entry from 'host04' to 'host04.example.com'.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

g. Under the Listening Locations, Address 1 section, click the Show Advanced button for
the TCP/IP protocol entry
h. Enter 65535 for both the Send Buffer Size and the Receive Buffer Size (Note: The
documentation recommends a minimum value of 10485760, but the Oracle Net
Manager utility currently limits this value to 65535.)
27. Create static listener entries for host04 identified by the table in the overview section of
this practice.
a. Under the Listening locations drop down menu, select the Database Services entry.
Currently no database services are explicitly configured for this listener.
s a
) ha
b. Click the Add Database button. Enter londonFS.example.com for the Global
Database Name and londonFS for the SID. The Oracle Home Directory should default
to the correct location. l ฺ c om
m ai ฺ
c. Click the Add Database button. Enter londonFS_DGMGRL.example.com for the
@ g
u ide
Global Database Name and londonFS for the SID. The Oracle Home Directory should
9
default to the correct location. i z 9 nt G
u
pr tude
(
28. Click File > Save Network Configuration from the menu. Exit the Oracle Net Manager
utility.
R ON his S
29. Start the listener.
A R se t
[oracle@host04]$ lsnrctl
I B
Z startto u
… U
R nse
T H i c e
E
Listening Endpoints
B ble l
Summary...

I Z A ra
L f e
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=host04.example.com)(PO
E
C I ART=1521)))
t r a ns
I Services Summary...
TR non-
PA Service "londonFS.example.com" has 1 instance(s).
Instance "londonFS", status UNKNOWN, has 1 handler(s) for this
service...
Service "londonFS_DGMGRL.example.com" has 1 instance(s).
Instance "londonFS", status UNKNOWN, has 1 handler(s) for this
service...
The command completed successfully

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

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 19
Edutronic Global Services EฺIฺRฺL

30. It is advised to keep one terminal window open to each of host01, host02, host03, and
host04. If you should close any terminal windows, log into each host as the oracle
account and set the environment variables using the oraenv utility as in previous tasks.
For host03, you could open two distinct windows: one for london and the other for
london2. The instance name to use with the oraenv utility depends on which host you are
connected to according to the following chart:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Host oraenv Utility Instance Name


host01 boston
host02 bostonFS
host03 london or london2
host04 londonFS

s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 20
Edutronic Global Services EฺIฺRฺL

Practice 3-3: Correcting Entries to Best Practice Values


Overview
In this practice, you correct the limitations imposed by the Oracle Net Manager utility by
manually editing the configuration files and entering best practice values for networking
parameters.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Tasks
1. On host01, navigate to the $ORACLE_HOME/network/admin directory and use the vi
utility to edit the tnsnames.ora network configuration file. Globally replace the SDU value
to 65535.
[oracle@host01]$ cd $ORACLE_HOME/network/admin
[oracle@host01]$ vi tnsnames.ora

:%s/SDU = 32767/SDU = 65535/g
s a
6 substitutions on 6 lines
) ha
:wq!
l ฺ c om
ai the ฺ
2. Examine the contents of the tnsnames.ora network configuration file and verify
m
changes made.
9 @ g
u ide
[oracle@host01]$ cat tnsnames.ora
i z 9 nt G
u
pr tude
# tnsnames.ora Network Configuration File:
(
ON his S
/u01/app/oracle/product/12.1.0/dbhome_1/network/admin/tnsnames.o
R
ra
AR usetools. t
B
# Generated by Oracle configuration
IZ e to
U
LONDONFS =
T H R icens
BE =ble l
(DESCRIPTION
A
Z era =
LI(ADDRESS
(ADDRESS_LIST

I A E
a n sf = (PROTOCOL = TCP)(HOST =
tr
IC host04.example.com)(PORT
on-
= 1521)(SEND_BUF_SIZE =
TR n10485760)(RECV_BUF_SIZE = 10485760))
PA )
(SDU = 65535)
(CONNECT_DATA =
(SERVICE_NAME = londonFS.example.com)
)
)

BOSTONFS =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
host02.example.com)(PORT = 1521)(SEND_BUF_SIZE =
10485760)(RECV_BUF_SIZE = 10485760))

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

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 21
Edutronic Global Services EฺIฺRฺL

)
(SDU = 65535)
(CONNECT_DATA =
(SERVICE_NAME = bostonFS.example.com)
)
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

EMREP =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = em12.example.com)(PORT
= 1521))
)
(CONNECT_DATA =
s a
) ha
(SERVICE_NAME = emrep.example.com)
)
l ฺ c om
)
m ai ฺ
9 @ g
u ide
BOSTON =
i z 9 nt G
(DESCRIPTION = u
pr tude
(
ON h=is S
(ADDRESS_LIST =

host01.example.com)(PORT = A
R
R se t
(ADDRESS = (PROTOCOL = TCP)(HOST
1521)(SEND_BUF_SIZE =
10485760)(RECV_BUF_SIZE = B
IZ e to u
10485760))
U
H R icens
)
T
BE ble= l
(SDU = 65535)
A
Z era= DEDICATED)
(CONNECT_DATA
E LI(SERVER
sf
I A a n
R IC n-)tr (SERVICE_NAME = boston.example.com)

PA
T no )
PRMY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
host01.example.com)(PORT = 1521)(SEND_BUF_SIZE =
10485760)(RECV_BUF_SIZE = 10485760))
(ADDRESS = (PROTOCOL = TCP)(HOST =
host03.example.com)(PORT = 1521)(SEND_BUF_SIZE =
10485760)(RECV_BUF_SIZE = 10485760))
)
(SDU = 65535)
(CONNECT_DATA =
(SERVICE_NAME = prmy.example.com)
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 22
Edutronic Global Services EฺIฺRฺL

)
)
LONDON2 =
(DESCRIPTION =
(ADDRESS_LIST =
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

(ADDRESS = (PROTOCOL = TCP)(HOST =


host03.example.com)(PORT = 1521)(SEND_BUF_SIZE =
10485760)(RECV_BUF_SIZE = 10485760))
)
(SDU = 65535)
(CONNECT_DATA =
(SERVICE_NAME = london2.example.com)
)
)
s a
) ha
om
LONDON =
l ฺ c
ai ฺ
(DESCRIPTION =
m
ide
(ADDRESS_LIST =
@ g
(ADDRESS = (PROTOCOL = TCP)(HOST = 9
9 nt G u
host03.example.com)(PORT = 1521)(SEND_BUF_SIZE =
u i z
10485760)(RECV_BUF_SIZE = 10485760))
( pr tude
)
R ON his S
(SDU = 65535)
B AR use t
(CONNECT_DATA =
U IZ e to
H R icens
(SERVICE_NAME = london.example.com)
) T
) A BE ble l
3. Use theE
IZ tofedit
Lutility e rathe listener.ora network configuration file. Globally replace
ns
vi
C I
both Athe SEND_BUF_SIZE
t r a and RECV_BUF_SIZE parameter values to 10485760.
I -
TR n[oracle@host01]$
on vi listener.ora
PA …
:%s/BUF_SIZE = 65535/BUF_SIZE = 10485760/g
:wq!
4. Examine the contents of the listener.ora network configuration file and verify the
changes made.
[oracle@host01]$ cat listener.ora
# listener.ora Network Configuration File:
/u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.o
ra
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
(SID_LIST =

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

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 23
Edutronic Global Services EฺIฺRฺL

(SID_DESC =
(GLOBAL_DBNAME = boston.example.com)
(ORACLE_HOME = /u01/app/oracle/product/12.1.0/dbhome_1)
(SID_NAME = boston)
)
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

(SID_DESC =
(GLOBAL_DBNAME = boston_DGMGRL.example.com)
(ORACLE_HOME = /u01/app/oracle/product/12.1.0/dbhome_1)
(SID_NAME = boston)
)
)

LISTENER =
(DESCRIPTION_LIST =
s a
(DESCRIPTION =
) ha
(ADDRESS = (PROTOCOL = TCP)(HOST =
l ฺ c om
host01.example.com)(PORT = 1521)(SEND_BUF_SIZE =
m ai ฺ
ide
10485760)(RECV_BUF_SIZE = 10485760))
@ g
) 9
9 nt G u
(DESCRIPTION =
u i z
( pr tude
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
R ON his S
)
B AR use t
U IZ e to
ADR_BASE_LISTENER R n s
T H = /u01/app/oracle
e
5. Reload the modified E licto the Listener to allow the changes to take effect.
B configuration
l e
A
IZ ferablsnrctl reload
L
[oracle@host01]$
E nfor s Linux: Version 12.1.0.1.0 - Production on 05-JUN-
C I A
LSNRCTL
t r a
I
TR non-
2013 01:07:23

PA Copyright (c) 1991, 2013, Oracle. All rights reserved.

Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=host01.example.com)(PO
RT=1521)(SEND_BUF_SIZE=10485760)(RECV_BUF_SIZE=10485760)))
The command completed successfully

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

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 24
Edutronic Global Services EฺIฺRฺL

6. On host02, navigate to the $ORACLE_HOME/network/admin directory and use the vi


utility to edit the tnsnames.ora network configuration file. Globally replace the SDU value
to 65535.
[oracle@host02]$ cd $ORACLE_HOME/network/admin
[oracle@host02]$ vi tnsnames.ora
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ


:%s/SDU = 32767/SDU = 65535/g
6 substitutions on 6 lines
:wq!
7. Examine the contents of the tnsnames.ora network configuration file and verify the
changes made.
[oracle@host02]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File:
/u01/app/oracle/product/12.1.0/dbhome_1/network/admin/tnsnames.o
s a
) ha
ra

om
# Generated by Oracle configuration tools.
l ฺ c
m ai ฺ
g ide
LONDONFS =
(DESCRIPTION = 9 @
9 nt G u
(ADDRESS_LIST = u i
r udez
(ADDRESS = (PROTOCOL = TCP)(HOST(p
O N is St =
=

RR se th
host04.example.com)(PORT = 1521)(SEND_BUF_SIZE
A
10485760)(RECV_BUF_SIZE = 10485760))
B ou
)
I Z t
(SDU = 65535) RU s e
T H = icen
BE ble l= londonFS.example.com)
(CONNECT_DATA
A
(SERVICE_NAME
E LIZ sfera
)

I C IA ) -tran
TR non
PA BOSTONFS =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
host02.example.com)(PORT = 1521)(SEND_BUF_SIZE =
10485760)(RECV_BUF_SIZE = 10485760))
)
(SDU = 65535)
(CONNECT_DATA =
(SERVICE_NAME = bostonFS.example.com)
)
)

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

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 25
Edutronic Global Services EฺIฺRฺL

EMREP =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = em12.example.com)(PORT
= 1521))
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

)
(CONNECT_DATA =
(SERVICE_NAME = emrep.example.com)
)
)

BOSTON =
(DESCRIPTION =
(ADDRESS_LIST =
s a
) ha
(ADDRESS = (PROTOCOL = TCP)(HOST =

om
host01.example.com)(PORT = 1521)(SEND_BUF_SIZE =
10485760)(RECV_BUF_SIZE = 10485760))
l ฺ c
)
m ai ฺ
(SDU = 65535)
9 @ g
u ide
(CONNECT_DATA = i z 9 nt G
u
pr tude
(
(SERVER = DEDICATED)
ON his S
(SERVICE_NAME = boston.example.com)
R
)
B AR use t
)
U IZ e to
H R icens
PRMY =
T
BE ble l
(DESCRIPTION =
A
LIZ sfera
(ADDRESS_LIST =
E (ADDRESS = (PROTOCOL = TCP)(HOST =

I C IA -tran
host01.example.com)(PORT = 1521)(SEND_BUF_SIZE =
TR non 10485760)(RECV_BUF_SIZE = 10485760))
PA (ADDRESS = (PROTOCOL = TCP)(HOST =
host03.example.com)(PORT = 1521)(SEND_BUF_SIZE =
10485760)(RECV_BUF_SIZE = 10485760))
)
(SDU = 65535)
(CONNECT_DATA =
(SERVICE_NAME = prmy.example.com)
)
)
LONDON2 =
(DESCRIPTION =
(ADDRESS_LIST =

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

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 26
Edutronic Global Services EฺIฺRฺL

(ADDRESS = (PROTOCOL = TCP)(HOST =


host03.example.com)(PORT = 1521)(SEND_BUF_SIZE =
10485760)(RECV_BUF_SIZE = 10485760))
)
(SDU = 65535)
(CONNECT_DATA =
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

(SERVICE_NAME = london2.example.com)
)
)

LONDON =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
host03.example.com)(PORT = 1521)(SEND_BUF_SIZE = s a
10485760)(RECV_BUF_SIZE = 10485760))
) ha
)
l ฺ c om
(SDU = 65535)
m ai ฺ
(CONNECT_DATA =
9 @ g
u ide
(SERVICE_NAME = london.example.com)
i z 9 nt G
u
pr tude
)
(
)
R ON his S
8. Use the vi utility to edit the listener.ora A Rnetworke t
configuration file. Globally replace
B u s
U IZ e to
both the SEND_BUF_SIZE and RECV_BUF_SIZE parameter values to 10485760.
[oracle@host02]$ vi
H R listener.ora
n s
T lic e
BE= 65535/BUF_SIZE

Z
:%s/BUF_SIZEA b l e = 10485760/g
L I r a
E nsfe
:wq!
A
I
C nthe
9. IExamine - tracontents of the listener.ora network configuration file and verify the
R no made.
T changes
PA [oracle@host02]$ cat listener.ora
# listener.ora Network Configuration File:
/u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.o
ra
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = bostonFS.example.com)
(ORACLE_HOME = /u01/app/oracle/product/12.1.0/dbhome_1)
(SID_NAME = bostonFS)
)

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

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 27
Edutronic Global Services EฺIฺRฺL

(SID_DESC =
(GLOBAL_DBNAME = bostonFS_DGMGRL.example.com)
(ORACLE_HOME = /u01/app/oracle/product/12.1.0/dbhome_1)
(SID_NAME = bostonFS)
)
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = host02.example.com)(PORT
= 1521)(SEND_BUF_SIZE = 10485760)(RECV_BUF_SIZE = 10485760))
)

ADR_BASE_LISTENER = /u01/app/oracle
s a
10. Reload the modified configuration to the Listener to allow the changes to take effect.
) ha
[oracle@host02]$ lsnrctl reload
l ฺ c om
LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 05-JUN-
m ai ฺ
2013 01:07:23
9 @ g
u ide
i z 9reserved.
n t G
Copyright (c) 1991, 2013, Oracle. All rights u
pr tude
(
R ON his S
AR use t
Connecting to
B
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=host02.example.com)(PO
IZ e to
RT=1521)(SEND_BUF_SIZE=10485760)(RECV_BUF_SIZE=10485760)))
U
R successfully
s
The command completed
T H e n
11. On host03, navigate
B lic
Eto thele$ORACLE_HOME/network/admin directory and use the vi
utility to edit theA r a b network configuration file. Globally replace the SDU value
IZ tnsnames.ora
to 65535. L
E nsf e
I A tra
R IC [oracle@host03]$
n -
[oracle@host03]$ cd $ORACLE_HOME/network/admin

PA
T no …
vi tnsnames.ora

:%s/SDU = 32767/SDU = 65535/g


6 substitutions on 6 lines
:wq!
12. Examine the contents of the tnsnames.ora network configuration file and verify the
changes made.
[oracle@host03]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File:
/u01/app/oracle/product/12.1.0/dbhome_1/network/admin/tnsnames.o
ra
# Generated by Oracle configuration tools.

LONDONFS =
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 28
Edutronic Global Services EฺIฺRฺL

(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
host04.example.com)(PORT = 1521)(SEND_BUF_SIZE =
10485760)(RECV_BUF_SIZE = 10485760))
)
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

(SDU = 65535)
(CONNECT_DATA =
(SERVICE_NAME = londonFS.example.com)
)
)

BOSTONFS =
(DESCRIPTION =
s a
) ha
(ADDRESS_LIST =

om
(ADDRESS = (PROTOCOL = TCP)(HOST =
host02.example.com)(PORT = 1521)(SEND_BUF_SIZE =
l ฺ c
10485760)(RECV_BUF_SIZE = 10485760))
m ai ฺ
)
9 @ g
u ide
(SDU = 65535)
i z 9 nt G
u
pr tude
(CONNECT_DATA =
(
ON his S
(SERVICE_NAME = bostonFS.example.com)
R
)
B AR use t
)
U IZ e to
EMREP = T H R icens
A BE =ble l
(DESCRIPTION

E LIZ sfera =
(ADDRESS_LIST

I C an
IA -tr(ADDRESS = (PROTOCOL = TCP)(HOST = em12.example.com)(PORT
TR non = 1521))
PA )
(CONNECT_DATA =
(SERVICE_NAME = emrep.example.com)
)
)

BOSTON =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =

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

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 29
Edutronic Global Services EฺIฺRฺL

host01.example.com)(PORT = 1521)(SEND_BUF_SIZE =
10485760)(RECV_BUF_SIZE = 10485760))
)
(SDU = 65535)
(CONNECT_DATA =
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

(SERVER = DEDICATED)
(SERVICE_NAME = boston.example.com)
)
)
PRMY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
host01.example.com)(PORT = 1521)(SEND_BUF_SIZE =
10485760)(RECV_BUF_SIZE = 10485760)) s a
(ADDRESS = (PROTOCOL = TCP)(HOST = ) ha
host03.example.com)(PORT = 1521)(SEND_BUF_SIZE
l ฺ c om =
10485760)(RECV_BUF_SIZE = 10485760))
m ai ฺ
)
9 @ g
u ide
(SDU = 65535)
i z 9 nt G
(CONNECT_DATA = u
pr tude
(
ON his S
(SERVICE_NAME = prmy.example.com)
R
AR use t
)
) B
IZ e to
LONDON2 = U
T H R icens
(DESCRIPTION =

A BE ble l
(ADDRESS_LIST =

E LIZ sfera(ADDRESS = (PROTOCOL = TCP)(HOST =


I A tr a n
host03.example.com)(PORT = 1521)(SEND_BUF_SIZE
=
IC
TR non-
10485760)(RECV_BUF_SIZE = 10485760))

PA
)
(SDU = 65535)
(CONNECT_DATA =
(SERVICE_NAME = london2.example.com)
)
)

LONDON =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
host03.example.com)(PORT = 1521)(SEND_BUF_SIZE =
10485760)(RECV_BUF_SIZE = 10485760))
)
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 30
Edutronic Global Services EฺIฺRฺL

(SDU = 65535)
(CONNECT_DATA =
(SERVICE_NAME = london.example.com)
)
)
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

13. Use the vi utility to edit the listener.ora network configuration file. Globally replace
both the SEND_BUF_SIZE and RECV_BUF_SIZE parameter values to 10485760.
[oracle@host03]$ vi listener.ora

:%s/BUF_SIZE = 65535/BUF_SIZE = 10485760/g
:wq!
14. Examine the contents of the listener.ora network configuration file and verify the
changes made.
[oracle@host03]$ cat listener.ora s a
# listener.ora Network Configuration File: ) ha
c om
/u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.o
l ฺ
ra
m ai ฺ
# Generated by Oracle configuration tools.
9 @ g
u ide
i z 9 nt G
SID_LIST_LISTENER = u
pr tude
(
(SID_LIST =
R ON his S
AR use t
(SID_DESC =
B
(GLOBAL_DBNAME = london.example.com)
IZ e to
(ORACLE_HOME =U /u01/app/oracle/product/12.1.0/dbhome_1)
(SID_NAME H
R ns
E T = london)
l i c e
)
I Z AB ra= ble
E L sfe
(SID_DESC

C I a n
A tr(GLOBAL_DBNAME = london_DGMGRL.example.com)
I
TR non- (ORACLE_HOME = /u01/app/oracle/product/12.1.0/dbhome_1)
PA )
(SID_NAME = london)

(SID_DESC =
(GLOBAL_DBNAME = london2.example.com)
(ORACLE_HOME = /u01/app/oracle/product/12.1.0/dbhome_1)
(SID_NAME = london2)
)
(SID_DESC =
(GLOBAL_DBNAME = london2_DGMGRL.example.com)
(ORACLE_HOME = /u01/app/oracle/product/12.1.0/dbhome_1)
(SID_NAME = london2)
)
)

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

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 31
Edutronic Global Services EฺIฺRฺL

LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = host03.example.com)(PORT
= 1521)(SEND_SDU = 10485760)(RECV_SDU = 10485760))
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

ADR_BASE_LISTENER = /u01/app/oracle
15. Reload the modified configuration to the Listener to allow the changes to take effect.
[oracle@host03]$ lsnrctl reload
LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 05-JUN-
2013 01:07:23

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


s a
) ha
Connecting to
l ฺ c om
ai ฺ
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=host03.example.com)(PO
RT=1521)(SEND_BUF_SIZE=10485760)(RECV_BUF_SIZE=10485760))) m
The command completed successfully
9 @ g
u ide
i z 9 nand t Guse the vi
16. On host04, navigate to the $ORACLE_HOME/network/admin u directory
prGlobally e the SDU value
dreplace
(
utility to edit the tnsnames.ora network configuration file. t u
to 65535.
R ON his S
AR use t
[oracle@host04]$ cd $ORACLE_HOME/network/admin
B
IZ e to
[oracle@host04]$ vi tnsnames.ora
U

T H R =ic65535/g
e ns
BE bonle6l lines
:%s/SDU = 32767/SDU
A
LIZ sfera
6 substitutions
:wq!E n of the tnsnames.ora network configuration file and verify the
C IA the
17. IExamine - t r acontents
TR changes nonmade.
PA [oracle@host04]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File:
/u01/app/oracle/product/12.1.0/dbhome_1/network/admin/tnsnames.o
ra
# Generated by Oracle configuration tools.

LONDONFS =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
host04.example.com)(PORT = 1521)(SEND_BUF_SIZE =
10485760)(RECV_BUF_SIZE = 10485760))
)

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

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 32
Edutronic Global Services EฺIฺRฺL

(SDU = 65535)
(CONNECT_DATA =
(SERVICE_NAME = londonFS.example.com)
)
)
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

BOSTONFS =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
host02.example.com)(PORT = 1521)(SEND_BUF_SIZE =
10485760)(RECV_BUF_SIZE = 10485760))
)
(SDU = 65535)
s a
) ha
(CONNECT_DATA =

om
(SERVICE_NAME = bostonFS.example.com)
l ฺ c
ai ฺ
)
m
ide
)
@ g
9
9 nt G u
EMREP =
u i z
(DESCRIPTION = ( pr tude
(ADDRESS_LIST =
R ON his S
(ADDRESS = (PROTOCOL A= R e t = em12.example.com)(PORT
B s
TCP)(HOST
= 1521))
U IZ e to u
HR ns
)
T = lice
BE ble = emrep.example.com)
(CONNECT_DATA
A
LIZ sfera
(SERVICE_NAME
E )

I C IA ) -tran
TR non
PA BOSTON =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
host01.example.com)(PORT = 1521)(SEND_BUF_SIZE =
10485760)(RECV_BUF_SIZE = 10485760))
)
(SDU = 65535)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = boston.example.com)
)
)

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

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 33
Edutronic Global Services EฺIฺRฺL

PRMY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
host01.example.com)(PORT = 1521)(SEND_BUF_SIZE =
10485760)(RECV_BUF_SIZE = 10485760))
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

(ADDRESS = (PROTOCOL = TCP)(HOST =


host03.example.com)(PORT = 1521)(SEND_BUF_SIZE =
10485760)(RECV_BUF_SIZE = 10485760))
)
(SDU = 65535)
(CONNECT_DATA =
(SERVICE_NAME = prmy.example.com)
)
)
s a
LONDON2 =
) ha
(DESCRIPTION =
l ฺ c om
(ADDRESS_LIST =
m ai ฺ
(ADDRESS = (PROTOCOL = TCP)(HOST =
9 @ g
u ide
i z 9 nt G
host03.example.com)(PORT = 1521)(SEND_BUF_SIZE =
u
pr tude
10485760)(RECV_BUF_SIZE = 10485760))
(
ON his S
)
R
AR use t
(SDU = 65535)
(CONNECT_DATA =B
IZ e to
U
(SERVICE_NAME = london2.example.com)
)
T H R icens
)
A BE ble l
E LIZ= sfera
I C
LONDON
- t r an
IA (DESCRIPTION
TR non (ADDRESS_LIST =
=

PA (ADDRESS = (PROTOCOL = TCP)(HOST =


host03.example.com)(PORT = 1521)(SEND_BUF_SIZE =
10485760)(RECV_BUF_SIZE = 10485760))
)
(SDU = 65535)
(CONNECT_DATA =
(SERVICE_NAME = london.example.com)
)
)

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

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 34
Edutronic Global Services EฺIฺRฺL

18. Use the vi utility to edit the listener.ora network configuration file. Globally replace
both the SEND_BUF_SIZE and RECV_BUF_SIZE parameter values to 10485760.
[oracle@host04]$ vi listener.ora

:%s/BUF_SIZE = 65535/BUF_SIZE = 10485760/g
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

:wq!
19. Examine the contents of the listener.ora network configuration file and verify the
changes made.
[oracle@host04]$ cat listener.ora
# listener.ora Network Configuration File:
/u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.o
ra
# Generated by Oracle configuration tools.

s a
) ha
SID_LIST_LISTENER =
(SID_LIST =
l ฺ c om
(SID_DESC =
m ai ฺ
(GLOBAL_DBNAME = londonFS.example.com)
9 @ g
u ide
i z 9 nt G
(ORACLE_HOME = /u01/app/oracle/product/12.1.0/dbhome_1)
(SID_NAME = londonFS) u
pr tude
(
ON his S
)
R
AR use t
(SID_DESC =
B
(GLOBAL_DBNAME = londonFS_DGMGRL.example.com)
IZ e to
U
(ORACLE_HOME = /u01/app/oracle/product/12.1.0/dbhome_1)
H R icens
(SID_NAME = londonFS)
T
)
A BE ble l
E LIZ sfera
)

I C IALISTENER
- t r an=
TR no(DESCRIPTION
n
PA =
(ADDRESS = (PROTOCOL = TCP)(HOST = host04.example.com)(PORT
= 1521)( SEND_BUF_SIZE=10485760)(RECV_BUF_SIZE=10485760))
)

ADR_BASE_LISTENER = /u01/app/oracle

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

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 35
Edutronic Global Services EฺIฺRฺL

20. Reload the modified configuration to the Listener to allow the changes to take effect.
[oracle@host04]$ lsnrctl reload
LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 05-JUN-
2013 01:07:23
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

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

Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=host04.example.com)(PO
RT=1521)(SEND_BUF_SIZE=10485760)(RECV_BUF_SIZE=10485760)))
The command completed successfully

Note: At this point, if the Oracle Net Manager utility is launched it will generate errors due to
the manually increased values for SDU, SEND_BUF_SIZE, and RECV_BUF_SIZE. All future
changes to the listener.ora, tnsnames.ora, and sqlnet.ora files will need to be s a
done manually. This should be corrected with a patch when it is available. Oracle
) ha
l ฺ c om
Enterprise Manager Cloud Control 12c is capable of editing the files using the increased
best-practice values.
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 3: Oracle Net Services in a Data Guard Environment


Chapter 3 - Page 36
Edutronic Global Services EฺIฺRฺL
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
Practices for Lesson g 4: ide
Creating a Physical 9 @ Gu
9 nStandby
i z
ru Using t
Database(pby t u de SQL and
RMAN
R ONCommands
h i s S
R se t
AChapter
I Z B o u4
R U se t
T H icen
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 4: Creating a Physical Standby Database by Using SQL and RMAN Commands
Chapter 4 - Page 1
Edutronic Global Services EฺIฺRฺL

Practices for Lesson 4: Overview


Practices Overview
In these practices, you will prepare host01 to become the primary database and host03 to
become a physical standby database. You will use the RMAN utility to create the physical
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

standby database and then verify its operation.

s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 4: Creating a Physical Standby Database by Using SQL and RMAN Commands
Chapter 4 - Page 2
Edutronic Global Services EฺIฺRฺL

Practice 4-1: Prepare the Primary Database to Support Data Guard


Overview

In this practice, you verify that the primary database is configured correctly to support a physical
standby database.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Tasks
1. On host01, invoke SQL*Plus and connect as SYSDBA to your primary database (boston).
Determine if FORCE LOGGING is enabled. If it is not enabled, enable FORCE LOGGING
mode.
[oracle@host01]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Mon Jun 10 21:09:45


2013
s a
) ha
om
Copyright (c) 1982, 2013, Oracle. All rights reserved.
l ฺ c
m ai ฺ
Connected to: 9 @ g
u ide
i z n G -
9 12.1.0.1.0
t
u
pr tude
Oracle Database 12c Enterprise Edition Release
64bit Production (
ON Analytics
With the Partitioning, OLAP, Advanced
R h i s S and Real
A use t
Application Testing options R
B
U IZ FROM
e tov$database;
R
SQL> SELECT force_logging
H icen s
T
A BE ble l
FORCE_LOGGING
E LIZ sfera
---------------------------------------

I C IANO -tran
TR non
PA SQL> ALTER DATABASE FORCE LOGGING;

Database altered.

SQL> SELECT force_logging FROM v$database;

FORCE_LOGGING
---------------------------------------
YES

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

Practices for Lesson 4: Creating a Physical Standby Database by Using SQL and RMAN Commands
Chapter 4 - Page 3
Edutronic Global Services EฺIฺRฺL

2. Determine the number of online redo log groups and their current size. Create standby redo
log groups with one member for each group using the same size as the existing online redo
logs. You should create one more additional group than the number you have for online
redo log groups. Verify creation of the standby redo logs.
SQL> select group#,bytes from v$log;
GROUP# BYTES
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

---------- ----------
1 52428800
2 52428800
3 52428800

SQL> alter database add standby logfile


('/u01/app/oracle/oradata/boston/stdbyredo01.log') size 50M;
Database altered.
s a
SQL> alter database add standby logfile ) ha
('/u01/app/oracle/oradata/boston/stdbyredo02.log') size 50M;
l ฺ c om
Database altered.
m ai ฺ
9 @ g
u ide
SQL> alter database add standby logfile
i z 9 nt G
p u
r ude size 50M;
('/u01/app/oracle/oradata/boston/stdbyredo03.log')
Database altered.
(
N is St
O
A RR se th
B o logfile
SQL> alter database add standby
I Z u
R U e t
('/u01/app/oracle/oradata/boston/stdbyredo04.log') size 50M;
Database altered.H icen s
T
A BE ble l
L IZ fegroup#,bytes
SQL> select ra from v$log;
E
A GROUP# ns
C I t r a
I ---------- ----------
BYTES

TR non- 1 52428800
PA 2 52428800
3 52428800
SQL> select group#,bytes from v$standby_log;
GROUP# BYTES
---------- ----------
4 52428800
5 52428800
6 52428800
7 52428800

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

Practices for Lesson 4: Creating a Physical Standby Database by Using SQL and RMAN Commands
Chapter 4 - Page 4
Edutronic Global Services EฺIฺRฺL

3. Define the first log archive destination to use the flash recovery area and enable it. Ensure
that the changes are done both in memory and also stored the server parameter file. This
location should be valid for any role and also valid for all types of log files.
SQL> alter system set
log_archive_dest_1='location=USE_DB_RECOVERY_FILE_DEST
valid_for=(ALL_LOGFILES,ALL_ROLES) db_unique_name=boston'
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

scope=both;
System altered.

SQL> alter system set log_archive_dest_state_1='enable'


scope=both;
System altered.
4. Increase the maximum number of archive processes to 4.
SQL> alter system set log_archive_max_processes=4 scope=both;
a
System altered.
Note: The documentation suggests this parameter be set to a value of 10. We are using a) h
as
reduced number in this lab environment to reduce overhead.
l ฺ c om
5. Define the log_archive_config parameter to include entries for: boston, a i
london, londonFS, and london2. Only london is needed at this moment,
m bostonFS,
g but ithe d ฺ
eothers
can be added now in preparation for upcoming practices.
@
99 nt Gu
i z
ru ude
SQL> alter system set
( p
N is St
log_archive_config='dg_config=(boston,bostonFS,london,londonFS,l
O
ondon2)' scope=both;
A RR se th
System altered.
I Z B ou
U se so
6. Enable automatic standby file management
R t that operating system file additions and
H Foricthe
deletions on the primary database arenreplicated to the standby database. This is normally
E T
set on the standby database. l e primary database, this is set for role reversals.
I Z ABsystem a b leset standby_file_management='auto' scope=both;
er
SQL> alter
E L altered.
s f
I C IA -tran
System

TR non
PA

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

Practices for Lesson 4: Creating a Physical Standby Database by Using SQL and RMAN Commands
Chapter 4 - Page 5
Edutronic Global Services EฺIฺRฺL

Practice 4-2: Prepare Host and Create Physical Standby Database


Overview
In this practice, you will prepare host03 to receive the physical standby database and create
the physical standby database using RMAN.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Tasks
1. Use a terminal window logged in as oracle to host03 to create the initial directories
needed for a physical standby database. Since the primary database is using multi-tenant
architecture, additional directories are needed.
[oracle@host03]$ mkdir -p /u01/app/oracle/admin/london/adump
[oracle@host03]$ mkdir -p /u01/app/oracle/oradata/london
[oracle@host03]$ mkdir -p /u01/app/oracle/oradata/london/pdbseed
[oracle@host03]$ mkdir -p /u01/app/oracle/oradata/london/dev1
[oracle@host03]$ mkdir -p
s a
/u01/app/oracle/fast_recovery_area/london
) ha
l ฺ c om
ai ฺThe
2. Create a starter initialization file on host03 for the london physical standby instance.
m
only two parameters required are DB_NAME and DB_DOMAIN.
9 @ g
u ide
[oracle@host03]$ echo 'DB_NAME=london' >
i z 9 nt G
u
pr tu>>de
/u01/app/oracle/product/12.1.0/dbhome_1/dbs/initlondon.ora
(
[oracle@host03]$ echo 'DB_DOMAIN=example.com'
R ON his S
ARto the t
/u01/app/oracle/product/12.1.0/dbhome_1/dbs/initlondon.ora
e
3. Copy the password file from the primary
Z Bhost u sphysical standby host. Rename the file
accordingly. I
U se t o
R
H icen
[oracle@host03]$
T
E le l
scp
B
oracle@host01:/u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwb
A
IZ ferab
oston /u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwlondon
L
4. Startup Enomountn sthe london standby instance on host03. This assumes that the terminal
I A
C nyou a
trare using has previously set the environment variables to london. Exit
Iwindow -when
TR SQL*Plus
n o done.
PA [oracle@host03]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Tue Jun 11 03:51:01
2013

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

Connected to an idle instance.

SQL> startup nomount


ORACLE instance started.

Total System Global Area 217157632 bytes


Fixed Size 2286656 bytes
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 4: Creating a Physical Standby Database by Using SQL and RMAN Commands
Chapter 4 - Page 6
Edutronic Global Services EฺIฺRฺL

Variable Size 159386560 bytes


Database Buffers 50331648 bytes
Redo Buffers 5152768 bytes
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

12.1.0.1.0 - 64bit Production


With the Partitioning, OLAP, Advanced Analytics and Real
Application Testing options
5. Create a physical standby on host03 using the RMAN utility.
[oracle@host03]$ rman target sys/oracle_4U@boston auxiliary
sys/oracle_4U@london
Recovery Manager: Release 12.1.0.1.0 - Production on Tue Jun 11
04:15:35 2013

s a
) ha
Copyright (c) 1982, 2013, Oracle and/or its affiliates. All
rights reserved.

l ฺ c om
connected to target database: BOSTON (DBID=2507595832) ai
@ gm ideฺ
99 nt Gu
connected to auxiliary database: LONDON (not mounted)
i z
RMAN> run { ( pru tude
allocate channel prmy1 type disk;
R ON his S
allocate auxiliary channelRstby1 type
A e t disk;
Z B s
for ustandby from active database
duplicate target database
U I e to
spfile R
H icen s
E T l
parameter_value_convert 'boston','london'
B bl e
IZA
set db_unique_name='london'
L r a
fedb_file_name_convert='boston','london'
A E nset s
I C I - t r a log_file_name_convert='boston','london'
set
TR non set fal_server='boston'
PA nofilenamecheck;
allocate auxiliary channel stby type disk;
sql channel stby "alter database recover managed standby
database disconnect"; }
using target database control file instead of recovery catalog
allocated channel: prmy1
channel prmy1: SID=105 device type=DISK

allocated channel: stby1


channel stby1: SID=20 device type=DISK

Starting Duplicate Db at 13-JUN-13

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

Practices for Lesson 4: Creating a Physical Standby Database by Using SQL and RMAN Commands
Chapter 4 - Page 7
Edutronic Global Services EฺIฺRฺL

contents of Memory Script:


{
backup as copy reuse
targetfile
'/u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwboston'
auxiliary format
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

'/u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwlondon' ;
restore clone from service 'boston' spfile to
'/u01/app/oracle/product/12.1.0/dbhome_1/dbs/spfilelondon.ora';
sql clone "alter system set spfile=
''/u01/app/oracle/product/12.1.0/dbhome_1/dbs/spfilelondon.ora''
";
}
executing Memory Script

s a
Starting backup at 13-JUN-13
) ha
Finished backup at 13-JUN-13
l ฺ c om
m ai ฺ
Starting restore at 13-JUN-13
9 @ g
u ide
i z 9 nt G
channel stby1: starting datafile backuppset u
r restore de
(
channel stby1: using network backupNset from t u
S service boston
R O h i s
channel stby1: restoring SPFILE
A R se t
output file B
IZ e to u
U
name=/u01/app/oracle/product/12.1.0/dbhome_1/dbs/spfilelondon.or
a
T H R icens
BE restore
channel stby1:
l e l complete, elapsed time: 00:00:01
A
IZ restore
r a bat 13-JUN-13
L
Finished
E nsf e
I A tra
R IC sqln-statement: alter system set spfile=
T n o
PA
''/u01/app/oracle/product/12.1.0/dbhome_1/dbs/spfilelondon.ora''

contents of Memory Script:


{
sql clone "alter system set audit_file_dest =
''/u01/app/oracle/admin/london/adump'' comment=
'''' scope=spfile";
sql clone "alter system set control_files =
''/u01/app/oracle/oradata/london/control01.ctl'',
''/u01/app/oracle/fast_recovery_area/london/control02.ctl''
comment=
'''' scope=spfile";
sql clone "alter system set dispatchers =
''(PROTOCOL=TCP) (SERVICE=londonXDB)'' comment=
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 4: Creating a Physical Standby Database by Using SQL and RMAN Commands
Chapter 4 - Page 8
Edutronic Global Services EฺIฺRฺL

'''' scope=spfile";
sql clone "alter system set log_archive_dest_1 =
''location=USE_DB_RECOVERY_FILE_DEST
valid_for=(ALL_LOGFILES,ALL_ROLES) db_unique_name=london''
comment=
'''' scope=spfile";
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

sql clone "alter system set db_unique_name =


''london'' comment=
'''' scope=spfile";
sql clone "alter system set db_file_name_convert =
''boston'', ''london'' comment=
'''' scope=spfile";
sql clone "alter system set log_file_name_convert =
''boston'', ''london'' comment=
s a
) ha
'''' scope=spfile";

om
sql clone "alter system set fal_server =
l ฺ c
ai ฺ
''boston'' comment=
m
ide
'''' scope=spfile";
@ g
shutdown clone immediate; 9
9 nt G u
startup clone nomount;
u i z
} ( pr tude
executing Memory Script
R ON his S
B AR use t
IZ eset
sql statement: alter system
U t o audit_file_dest =
R ns
''/u01/app/oracle/admin/london/adump'' comment= ''''
scope=spfile TH e
A BE ble lic
E LIZ sferaalter system set control_files =
sql statement:

I C I - t r an
A''/u01/app/oracle/oradata/london/control01.ctl'',
TR ncomment=
on
''/u01/app/oracle/fast_recovery_area/london/control02.ctl''

PA
'''' scope=spfile

sql statement: alter system set dispatchers = ''(PROTOCOL=TCP)


(SERVICE=londonXDB)'' comment= '''' scope=spfile

sql statement: alter system set log_archive_dest_1 =


''location=USE_DB_RECOVERY_FILE_DEST
valid_for=(ALL_LOGFILES,ALL_ROLES) db_unique_name=london''
comment= '''' scope=spfile

sql statement: alter system set db_unique_name = ''london''


comment= '''' scope=spfile

sql statement: alter system set db_file_name_convert =


''boston'', ''london'' comment= '''' scope=spfile
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 4: Creating a Physical Standby Database by Using SQL and RMAN Commands
Chapter 4 - Page 9
Edutronic Global Services EฺIฺRฺL

sql statement: alter system set log_file_name_convert =


''boston'', ''london'' comment= '''' scope=spfile

sql statement: alter system set fal_server = ''boston''


comment= '''' scope=spfile
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Oracle instance shut down

connected to auxiliary database (not started)


Oracle instance started

Total System Global Area 517763072 bytes

s a
) ha
Fixed Size 2290216 bytes

om
Variable Size 440405464 bytes
l ฺ c
ai ฺ
Database Buffers 71303168 bytes
m
ide
Redo Buffers 3764224 bytes
@ g
allocated channel: stby1 9
9 nt G u
channel stby1: SID=20 device type=DISK
u i z
( pr tude
contents of Memory Script:
R ON his S
{
B AR use t
U Z
restore clone from Iservice t o'boston' standby controlfile;
R ns e
}
T H i c e
E
executing Memory l
Script
I Z AB rable
E L restore
Starting s fe at 13-JUN-13
I A n
R IC n-tra
T o
nchannel
PA
stby1: starting datafile backup set restore
channel stby1: using network backup set from service boston
channel stby1: restoring control file
channel stby1: restore complete, elapsed time: 00:00:07
output file name=/u01/app/oracle/oradata/london/control01.ctl
output file
name=/u01/app/oracle/fast_recovery_area/london/control02.ctl
Finished restore at 13-JUN-13

contents of Memory Script:


{
sql clone 'alter database mount standby database';
}
executing Memory Script
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 4: Creating a Physical Standby Database by Using SQL and RMAN Commands
Chapter 4 - Page 10
Edutronic Global Services EฺIฺRฺL

sql statement: alter database mount standby database

contents of Memory Script:


{
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

set newname for tempfile 1 to


"/u01/app/oracle/oradata/london/temp01.dbf";
set newname for tempfile 2 to
"/u01/app/oracle/oradata/london/pdbseed/pdbseed_temp01.dbf";
set newname for tempfile 3 to
"/u01/app/oracle/oradata/london/dev1/dev1_temp01.dbf";
switch clone tempfile all;
set newname for datafile 1 to
"/u01/app/oracle/oradata/london/system01.dbf";
s a
set newname for datafile 3 to
) ha
"/u01/app/oracle/oradata/london/sysaux01.dbf";
l ฺ c om
set newname for datafile 4 to
m ai ฺ
9 @ g
u ide
"/u01/app/oracle/oradata/london/undotbs01.dbf";
set newname for datafile 5 to
i z 9 nt G
u
pr tude
"/u01/app/oracle/oradata/london/pdbseed/system01.dbf";
(
ON his S
set newname for datafile 6 to
R
AR use t
"/u01/app/oracle/oradata/london/users01.dbf";
B
set newname for datafile 7 to
IZ e to
U
"/u01/app/oracle/oradata/london/pdbseed/sysaux01.dbf";

T H R icens
set newname for datafile 8 to

A BE ble l
"/u01/app/oracle/oradata/london/dev1/system01.dbf";

E LIZ sfera
set newname for datafile 9 to

I C IA -tran"/u01/app/oracle/oradata/london/dev1/sysaux01.dbf";

TR non set newname for datafile 10 to


PA "/u01/app/oracle/oradata/london/dev1/SAMPLE_SCHEMA_users01.dbf";
set newname for datafile 11 to
"/u01/app/oracle/oradata/london/dev1/example01.dbf";
restore
from service 'boston' clone database
;
sql 'alter system archive log current';
}
executing Memory Script

executing command: SET NEWNAME

executing command: SET NEWNAME


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

Practices for Lesson 4: Creating a Physical Standby Database by Using SQL and RMAN Commands
Chapter 4 - Page 11
Edutronic Global Services EฺIฺRฺL

executing command: SET NEWNAME

renamed tempfile 1 to /u01/app/oracle/oradata/london/temp01.dbf


in control file
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

renamed tempfile 2 to
/u01/app/oracle/oradata/london/pdbseed/pdbseed_temp01.dbf in
control file
renamed tempfile 3 to
/u01/app/oracle/oradata/london/dev1/dev1_temp01.dbf in control
file

executing command: SET NEWNAME

executing command: SET NEWNAME


s a
) ha
executing command: SET NEWNAME
l ฺ c om
m ai ฺ
executing command: SET NEWNAME
9 @ g
u ide
i z 9 nt G
executing command: SET NEWNAME u
pr tude
(
executing command: SET NEWNAME R
ON his S
B AR use t
U
executing command: SETIZNEWNAME
e to
R
H icen s
executing B
T
E leSET l NEWNAME
A command:
IZ ferab
L
E nscommand: SET NEWNAME
I A
IC n-tra
executing

T R no
PA executing command: SET NEWNAME

Starting restore at 13-JUN-13

channel stby1: starting datafile backup set restore


channel stby1: using network backup set from service boston
channel stby1: specifying datafile(s) to restore from backup set
channel stby1: restoring datafile 00001 to
/u01/app/oracle/oradata/london/system01.dbf
channel stby1: restore complete, elapsed time: 00:01:05
channel stby1: starting datafile backup set restore
channel stby1: using network backup set from service boston
channel stby1: specifying datafile(s) to restore from backup set

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

Practices for Lesson 4: Creating a Physical Standby Database by Using SQL and RMAN Commands
Chapter 4 - Page 12
Edutronic Global Services EฺIฺRฺL

channel stby1: restoring datafile 00003 to


/u01/app/oracle/oradata/london/sysaux01.dbf
channel stby1: restore complete, elapsed time: 00:01:25
channel stby1: starting datafile backup set restore
channel stby1: using network backup set from service boston
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

channel stby1: specifying datafile(s) to restore from backup set


channel stby1: restoring datafile 00004 to
/u01/app/oracle/oradata/london/undotbs01.dbf
channel stby1: restore complete, elapsed time: 00:00:25
channel stby1: starting datafile backup set restore
channel stby1: using network backup set from service boston
channel stby1: specifying datafile(s) to restore from backup set
channel stby1: restoring datafile 00005 to
/u01/app/oracle/oradata/london/pdbseed/system01.dbf
channel stby1: restore complete, elapsed time: 00:00:25 s a
channel stby1: starting datafile backup set restore ) ha
ฺ c om
channel stby1: using network backup set from service boston
l
m ai ฺ
channel stby1: specifying datafile(s) to restore from backup set
@ g
channel stby1: restoring datafile 00006 to
9 u ide
i z 9 nt G
/u01/app/oracle/oradata/london/users01.dbf
u
pr tude
(
channel stby1: restore complete, elapsed time: 00:00:01
ON his S
channel stby1: starting datafile backup set restore
R
AR use t
channel stby1: using network backup set from service boston
B
IZ e to
channel stby1: specifying datafile(s) to restore from backup set
U
H R icens
channel stby1: restoring datafile 00007 to
T
/u01/app/oracle/oradata/london/pdbseed/sysaux01.dbf

A BE ble l
channel stby1: restore complete, elapsed time: 00:01:25

E LIZ sfera
channel stby1: starting datafile backup set restore

I C IA -tran
channel stby1: using network backup set from service boston

TR non channel stby1: specifying datafile(s) to restore from backup set


PA channel stby1: restoring datafile 00008 to
/u01/app/oracle/oradata/london/dev1/system01.dbf
channel stby1: restore complete, elapsed time: 00:00:35
channel stby1: starting datafile backup set restore
channel stby1: using network backup set from service boston
channel stby1: specifying datafile(s) to restore from backup set
channel stby1: restoring datafile 00009 to
/u01/app/oracle/oradata/london/dev1/sysaux01.dbf
channel stby1: restore complete, elapsed time: 00:01:15
channel stby1: starting datafile backup set restore
channel stby1: using network backup set from service boston
channel stby1: specifying datafile(s) to restore from backup set
channel stby1: restoring datafile 00010 to
/u01/app/oracle/oradata/london/dev1/SAMPLE_SCHEMA_users01.dbf
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 4: Creating a Physical Standby Database by Using SQL and RMAN Commands
Chapter 4 - Page 13
Edutronic Global Services EฺIฺRฺL

channel stby1: restore complete, elapsed time: 00:00:03


channel stby1: starting datafile backup set restore
channel stby1: using network backup set from service boston
channel stby1: specifying datafile(s) to restore from backup set
channel stby1: restoring datafile 00011 to
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

/u01/app/oracle/oradata/london/dev1/example01.dbf
channel stby1: restore complete, elapsed time: 00:00:35
Finished restore at 13-JUN-13

sql statement: alter system archive log current

contents of Memory Script:


{
switch clone datafile all;
s a
) ha
}
executing Memory Script
l ฺ c om
m ai ฺ
g ide
datafile 1 switched to datafile copy
input datafile copy RECID=7 STAMP=818005339 file 9 @
9 nt G u
u i
name=/u01/app/oracle/oradata/london/system01.dbf
r udez
datafile 3 switched to datafile copy (p t
O N is Sfile
RR se th
input datafile copy RECID=8 STAMP=818005339
A
name=/u01/app/oracle/oradata/london/sysaux01.dbf
B o copy
u
datafile 4 switched toIZ datafile
U t
input datafile copy
H R RECID=9
e n seSTAMP=818005339 file
ET le ltoic datafile copy
name=/u01/app/oracle/oradata/london/undotbs01.dbf
datafileA5Bswitched
Z eracopy
Idatafile b RECID=10 STAMP=818005339 file
L
E nsf
input
I A tra 6 switched to datafile copy
name=/u01/app/oracle/oradata/london/pdbseed/system01.dbf
R IC datafile
n -
PA
T no input datafile copy RECID=11 STAMP=818005339 file
name=/u01/app/oracle/oradata/london/users01.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=12 STAMP=818005340 file
name=/u01/app/oracle/oradata/london/pdbseed/sysaux01.dbf
datafile 8 switched to datafile copy
input datafile copy RECID=13 STAMP=818005340 file
name=/u01/app/oracle/oradata/london/dev1/system01.dbf
datafile 9 switched to datafile copy
input datafile copy RECID=14 STAMP=818005340 file
name=/u01/app/oracle/oradata/london/dev1/sysaux01.dbf
datafile 10 switched to datafile copy

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

Practices for Lesson 4: Creating a Physical Standby Database by Using SQL and RMAN Commands
Chapter 4 - Page 14
Edutronic Global Services EฺIฺRฺL

input datafile copy RECID=15 STAMP=818005340 file


name=/u01/app/oracle/oradata/london/dev1/SAMPLE_SCHEMA_users01.d
bf
datafile 11 switched to datafile copy
input datafile copy RECID=16 STAMP=818005340 file
name=/u01/app/oracle/oradata/london/dev1/example01.dbf
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Finished Duplicate Db at 13-JUN-13

allocated channel: stby


channel stby: SID=19 device type=DISK

sql statement: alter database recover managed standby database


disconnect
released channel: prmy1
released channel: stby1
s a
released channel: stby
) ha
RMAN> exit
l ฺ c om
Recovery Manager complete.
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 4: Creating a Physical Standby Database by Using SQL and RMAN Commands
Chapter 4 - Page 15
Edutronic Global Services EฺIฺRฺL

Practice 4-3: Start Redo Transport and Verify Operation


Overview
In this practice, you will start the redo transport from host01 to host03 and verify operation.

Tasks
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

1. Use a terminal window for host01 logged in as oracle with the environment variables set
to boston and start redo transport by defining log_archive_dest_2 pointing to the
physical standby database.
[oracle@host01]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Tue Jun 11 06:28:00
2013

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


s a
) ha
Connected to:
l ฺ c om
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -
m ai ฺ
64bit Production
9 @ g
u ide
z
With the Partitioning, OLAP, Advanced Analytics and Real
i 9 nt G
Application Testing options u
pr tude
(
R ON his S
A R se t
SQL> alter system set log_archive_dest_2='SERVICE=london ASYNC
B ou
REOPEN=15 valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE)
db_unique_name=london'IZ
R U se t
scope=both;
System altered.
T H icen
E lenumber
2. Determine the last sequence
B l archived on the primary database (host01). You
number may Z A
I be different
r a blab.
in
L
E SELECT e
sf MAX(SEQUENCE#), THREAD# FROM V$ARCHIVED_LOG GROUP BY
I A
SQL>
a n
IC n-tr
THREAD#;
TR nMAX(SEQUENCE#)
o
PA
THREAD#
-------------- ----------
69 1

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

Practices for Lesson 4: Creating a Physical Standby Database by Using SQL and RMAN Commands
Chapter 4 - Page 16
Edutronic Global Services EฺIฺRฺL

3. Use a terminal window on host03 connected as oracle with the environment variables
set to london. Start SQL*Plus and determine the last sequence number of the physical
standby instance.
[oracle@host03]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Tue Jun 11 06:58:53
2013
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

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

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -
64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real
Application Testing options
s a
) ha
SQL> SELECT MAX(SEQUENCE#), THREAD# FROM V$ARCHIVED_LOG GROUP BY
l ฺ c om
THREAD#;
m ai ฺ
MAX(SEQUENCE#) THREAD#
9 @ g
u ide
-------------- ----------
i z 9 nt G
69 1 u
pr tude
4. Return to the terminal window of host01, and forceN
(
log sequence number. Verify the sequence R number h is S to advance the online redo
a log switch
RO hastincreased.
B Aswitchus
e
(host01) SQL> alter system
(host01) SQL> SELECTU
Z
I e to logfile;
R MAX(SEQUENCE#),
n s THREAD# FROM V$ARCHIVED_LOG
GROUP BY THREAD#;
E TH THREAD#
l i c e
AB ra----------
MAX(SEQUENCE#)
I Z ble
L sfe
--------------
E
C I A tran 70 1
I to -the terminal window of host03, and verify that the physical standby instance is
T5.R Return
non
PA receiving redo from the primary database instance
(host03) SQL> SELECT MAX(SEQUENCE#), THREAD# FROM V$ARCHIVED_LOG
GROUP BY THREAD#;
MAX(SEQUENCE#) THREAD#
-------------- ----------
70 1

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

Practices for Lesson 4: Creating a Physical Standby Database by Using SQL and RMAN Commands
Chapter 4 - Page 17
Edutronic Global Services EฺIฺRฺL

6. Exit SQL*Plus on both host01 and host03.


SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release
12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Application Testing options


[oracle@host01] $

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release
12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real
Application Testing options
[oracle@host03] $
s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 4: Creating a Physical Standby Database by Using SQL and RMAN Commands
Chapter 4 - Page 18
Edutronic Global Services EฺIฺRฺL
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
Practices for Lesson g 5: Using
ide
9
Oracle ActiveizData
@
9 nGuardG u
u t
Chapter 5 ( pr tude
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 5: Using Oracle Active Data Guard


Chapter 5 - Page 1
Edutronic Global Services EฺIฺRฺL

Practices for Lesson 5: Overview


Practices Overview
In these practices, you will enable Active Data Guard real-time query and verify its operation.
You will also enable change tracking on the physical standby database and implement Far Sync
into the current environment.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 5: Using Oracle Active Data Guard


Chapter 5 - Page 2
Edutronic Global Services EฺIฺRฺL

Practice 5-1: Enable Active Data Guard Real-Time Query


Overview

In this practice, you enable the Active Data Guard real-time query feature and verify its
operation.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Tasks
1. Use a terminal window logged in as oracle to host03 with the environment variables set
for 'london' appropriately. Attempt to enable Active Data Guard real-time query by opening
the physical standby database in read only mode.
[oracle@host03]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Wed Aug 21 18:08:44
2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
s a
) ha
Connected to:

om
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -
64bit Production
l ฺ c
With the Partitioning, OLAP, Advanced Analytics and Real m ai ฺ
Application Testing options
9 @ g
u ide
i z 9 nt G
u
pr tude
SQL> alter database open read only;
(
alter database open read only
R ON his S
*
A R se t
ERROR at line 1:
I Z B o u
U t
ORA-10456: cannot R
H e n se database; media recovery session
open standby

ET lequery liccannot be enabled while Redo Apply is active. Stop redo


may be in progress
2. Active Data GuardA Breal-time
b database and attempt to enable it again.
L
apply on the Z estandby
Iphysical r a
I A E nSQL>
a sf alter database recover managed standby database
tr
(host03)
IC cancel;
TR non-
PA Database altered.

(host03) SQL> alter database open read only;


Database altered.
3. Restart the Redo Apply process on the physical standby database.
(host03) SQL> alter database recover managed standby database
disconnect;
Database altered.
4. This database is using the Oracle Multitenant option. The default operating system
authentication method for the multitenant container database (CDB) is to the container root
(CDB$ROOT). Data Guard environment operations are performed at the CDB level. Schema
objects like the sample schemas exist in customer created pluggable databases (PDBs).
Verify that the SQL*Plus session is currently connected to the CDB$ROOT and that sample
schemas do not exist in the root container. Two ways are illustrated to determine the
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 5: Using Oracle Active Data Guard


Chapter 5 - Page 3
Edutronic Global Services EฺIฺRฺL

current container name. The first technique uses the SQL*Plus show commands. The
second technique uses all SQL syntax. The HR.REGIONS table is part of the sample
schemas, but should not exist in the root container.
(host03) SQL> show con_id
CON_ID
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

------------------------------
1

(host03) SQL> show con_name


CON_NAME
------------------------------
CDB$ROOT

(host03) SQL> SELECT sys_context ('USERENV', 'CON_NAME') FROM


s a
) ha
dual;
SYS_CONTEXT('USERENV','CON_NAME')
-----------------------------------------------------
l ฺ c om
CDB$ROOT m ai ฺ
9 @ g
u ide
i z 9 nt G
(host03) SQL> select * from hr.regions;
u
pr tude
select * from hr.regions (
*
R ON his S
ERROR at line 1:
B AR use t
ORA-00942: table or view
U IZ does e t onot exist
5. Determine the pluggable database
H R name n s (PDB) that was used when creating the
T
multitenant databaseEin previouslic e
labs. Two different queries are shown that can provide this
answer. There areA Bmore views
b l e available that also provide this information.
L I Z r a
E nSQL>
(host03)
A s fe select con_id, name, open_mode from v$containers;
I
IC ----------tra NAME
CON_ID
- OPEN_MODE
T R no n ------------------------------ ----------
PA 1 CDB$ROOT READ ONLY
2 PDB$SEED READ ONLY
3 DEV1 MOUNTED

(host03) SQL> col pdb_name format a15


(host03) SQL> select pdb_id, pdb_name, status from DBA_PDBS;
PDB_ID PDB_NAME STATUS
---------- --------------- -------------
3 DEV1 NORMAL
2 PDB$SEED NORMAL

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

Practices for Lesson 5: Using Oracle Active Data Guard


Chapter 5 - Page 4
Edutronic Global Services EฺIฺRฺL

6. Switch the SQL*Plus session to the DEV1 pluggable database (PDB) and attempt to query
the HR.REGIONS table again.
(host03) (CDB$ROOT) SQL> ALTER SESSION SET CONTAINER = DEV1;
Session altered.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

(host03) (DEV1) SQL> select * from hr.regions;


select * from hr.regions
*
ERROR at line 1:
ORA-01219: database or pluggable database not open: queries
allowed on fixed tables or views only
Note: Even thought the 'london' physical standby database was opened read-only to
enable Active Data Guard in step 2, this command was performed at the CDB level. It did
not open each individual PDB. The output of step 5 shows that the PDB is currently
mounted. Therefore, queries against fixed tables are not allowed and return errors. s a
7. Open the DEV1 PDB with the 'ALTER DATABASE OPEN' command and attempt to query ) ha
the HR.REGIONS table again. l ฺ c om
m ai ฺ
g ide
(host03) (DEV1) SQL> alter database open;
Database altered. 9 @
9 nt G u
u i z
( pr tuorder
(host03) (DEV1) SQL> select * from hr.regions de by
region_id;
R ON his S
B AR use t
REGION_ID REGION_NAMEIZ
R U se to
H icen
---------- -------------------------
T
E le l
1 Europe
BAmericas
A
IZ 3 fAsia
2
r ab
L
E ns e
I A
R IC n-tra 4 Middle East and Africa
o DATABASE OPEN' command is normally used to open a database to the read-
T8. Then'ALTER
PA write mode. Use the query in step 5 to determine the open mode of the DEV1 PDB.
(host03) (DEV1) SQL> select con_id, name, open_mode from
v$containers;

CON_ID NAME OPEN_MODE


---------- ------------------------------ ----------
3 DEV1 READ ONLY
Note: Since the current container is DEV1 and not CDB$ROOT, the output is restricted to
that of only the DEV1 PDB. Because the entire PDB is a physical standby database, the
SQL statement to open the database is only allowed to open to the read only mode even
though a normal read write mode was requested.

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

Practices for Lesson 5: Using Oracle Active Data Guard


Chapter 5 - Page 5
Edutronic Global Services EฺIฺRฺL

9. Leave the above window open. Open a terminal window (if not already open) logged in as
oracle to host01 with the environment variables set for 'boston' appropriately. Launch
SQL*Plus and switch session to the DEV1 PDB of the primary database. Query the
HR.REGIONS table.
[oracle@host01] sqlplus / as sysdba
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

SQL*Plus: Release 12.1.0.1.0 Production on Wed Aug 21 19:27:19


2013

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

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -
64bit Production
s a
With the Partitioning, OLAP, Advanced Analytics and Real
) ha
Application Testing options
l ฺ c om
i
aDEV1;
(host01) (CDB$ROOT) SQL> alter session set container
@ g m=
i d eฺ
Session altered.
i z 99 nt Gu
( p ru ude
(host01) (DEV1) SQL> select * from N
O
hr.regions
i s St order by
RR se th
region_id;
REGION_ID REGION_NAME A
B ou
U I Z t
---------- -------------------------
R s e
1 Europe
T H icen
B E le l
2 Americas
A
IZ 3 fAsiar ab
L e
E n4s Middle East and Africa
I A
C annew a into the HR.REGIONS table and commit the SQL statement.
trrow
10.
R IInsert -
PA
T no (host01) (DEV1) SQL> insert into hr.regions values
(5,'Australia');
1 row created.

SQL> commit;
Commit complete.

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

Practices for Lesson 5: Using Oracle Active Data Guard


Chapter 5 - Page 6
Edutronic Global Services EฺIฺRฺL

11. Return to the SQL*Plus session to the DEV1 PDB that is still open for the physical standby
database on host03 and query the HR.REGIONS value. The new row is immediately
available on the physical standby database for reporting applications after it was inserted
on the primary database. This illustrates the real-time query capability of Active Data
Guard.
(host03) (DEV1) SQL> select * from hr.regions order by
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

region_id;
REGION_ID REGION_NAME
---------- -------------------------
1 Europe
2 Americas
3 Asia
4 Middle East and Africa
5 Australia
12. Exit SQL*Plus on host03 of the physical standby database. It is recommended to keep the s a
terminal session open with the environment variables set appropriately. ) ha
l ฺ c om
13. Returning to the SQL*Plus session on host01, attempt to perform a log switch on the
ai ฺ
primary database and observe the error message. This occurs because the session is
m
9 @ g
u ide
connected to the DEV1 PDB and not the root container. This presents a challenge when
using terminal session for a command line Data Guard environment due to hosts involved
i z 9 nt G
u
(host01,host02,host03,host04), operating system accounts (vncuser, root,
pr tude
(
oracle), environment variable settings (boston, bostonFS, london, londonFS), and
ON his S
now CDB vs. PDB connected sessions (CDB$ROOT, DEV1). Fictitious prompts have been
R
B AR use t
added to these lab exercises to help the student know how they should be connected.
These prompts do not appear in the actual labs.
U IZ esystem
to switch logfile;
R
(host01) (DEV1) SQL> alter
H logfile n s
T
alter system switch
l i c e
* A BE ble
Z lineera1:
LIat
I A E
ERROR
a n sfoperation not allowed from within a pluggable
IC n-tr
ORA-65040:
TR ndatabase
o
PA Note: Remember that all Data Guard operations must be performed at the container root
level (CDB$ROOT).
14. Exit SQL*Plus on host01, leaving the window open for future practices.

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

Practices for Lesson 5: Using Oracle Active Data Guard


Chapter 5 - Page 7
Edutronic Global Services EฺIฺRฺL

Practice 5-2: Enable Change Tracking on the Physical Standby


Database
Overview
In this practice, you will enable the change tracking feature on host03 for the physical standby
database and verify its usage.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Tasks
1. Use a terminal window logged in as oracle to host03 with the environment variables set
for 'london' appropriately. SQL*Plus using operating system authentication connect by
default in the lab environment to the root container. Enable change tracking using the file
/u01/app/oracle/oradata/london/rman_change_track.file.
[oracle@host03]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Wed Aug 21 20:06:05
2013
s a
Copyright (c) 1982, 2013, Oracle. All rights reserved.
) ha
Connected to:
l ฺ c om
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -
m ai ฺ
64bit Production
9 @ g
u ide
With the Partitioning, OLAP, Advanced Analytics and Real
i z 9 nt G
Application Testing options u
pr tude
(
(host03) SQL> alter database enable R ONblock
h i s S
change tracking using
AR use t
file '/u01/app/oracle/oradata/london/rman_change_track.file';
B
Database altered.
U IZ e to
Hfile.R iciseenabled,
2. Verify that block change tracking
T ns displaying the file name used and file size of
E le l
the block change tracking
B
(host03) A
IZ SQL> r a b filename, status, bytes from
select
L
E nsf e
v$block_change_tracking;
I A tra
R IC FILENAME
n -
PA
T no ----------------------------------------------------
STATUS BYTES
---------- ----------
/u01/app/oracle/oradata/london/rman_change_track.file
ENABLED 11599872
3. Exit SQL*Plus on host03 of the physical standby database. It is recommended to keep the
terminal session open with the environment variables set appropriately.

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

Practices for Lesson 5: Using Oracle Active Data Guard


Chapter 5 - Page 8
Edutronic Global Services EฺIฺRฺL

Practice 5-3: Add Far Sync to the Data Guard Environment


Overview
In this practice, you will create a Far Sync instance (bostonFS) on host02 that is in close
proximity to the primary database.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Tasks
1. Use a terminal window for host01 logged in as oracle with the environment variables set
to 'boston'. Use SQL*Plus to create a text-based initialization parameter file named
'/tmp/initbostonFS.ora' that contains a copy of all the current parameters for the
primary database.
[oracle@host01]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Wed Aug 21 21:27:25
2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
s a
Connected to:
) ha
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -
l ฺ c om
64bit Production
m ai ฺ
g ide
With the Partitioning, OLAP, Advanced Analytics and Real
Application Testing options 9 @
9 nt G u
u i z
(
(host01) SQL> create pfile='/tmp/initbostonFS.ora' pr tude from spfile;
File created. R ON his S
B AR use t on the primary database and
2. Create a Far Sync control file named '/tmp/bostonFS.ctl'
exit SQL*Plus when done.
U IZ e to
H R database
n s create far sync instance
(host01) SQL> alter
controlfile E T lic e
as '/tmp/bostonFS.ctl';
A B b l e
L IZ altered.
Database
e r a
A E nsf
I
IC n-tra SQL> exit
(host01)
R
T3. Copynothe primary password file to the /tmp directory.
PA [oracle@host01]$ cp $ORACLE_HOME/dbs/orapwboston /tmp
4. Transfer the three files staged in the /tmp directory from host01 to host02 and place
them into the /tmp directory on host02.
[oracle@host01]$ scp /tmp/initbostonFS.ora oracle@host02:/tmp
initbostonFS.ora 100% 1416 1.4KB/s 00:00
[oracle@host01]$ scp /tmp/bostonFS.ctl oracle@host02:/tmp
bostonFS.ctl 100% 18MB 17.7MB/s 00:00
[oracle@host01]$ scp /tmp/orapwboston oracle@host02:/tmp
orapwboston 100% 7680 7.5KB/s 00:00

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

Practices for Lesson 5: Using Oracle Active Data Guard


Chapter 5 - Page 9
Edutronic Global Services EฺIฺRฺL

5. Use a terminal window for host02 logged in as oracle with the environment variables set
to 'bostonFS'. Create the initial directories needed on the Far Sync server. These are the
same directories that were created on the physical standby server host03 in practice 4-2.
[oracle@host02]$ mkdir -p /u01/app/oracle/admin/bostonFS/adump
[oracle@host02]$ mkdir -p /u01/app/oracle/oradata/bostonFS
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

[oracle@host02]$ mkdir -p
/u01/app/oracle/oradata/bostonFS/pdbseed
[oracle@host02]$ mkdir -p /u01/app/oracle/oradata/bostonFS/dev1
[oracle@host02]$ mkdir -p
/u01/app/oracle/fast_recovery_area/bostonFS
Note: Linux directory and file names are case sensitive. Throughout these labs, the names
for Far Sync use the format bostonFS and londonFS for readability. The last 2 letters are in
upper-case.
6. On host02, use the VI utility to edit the /tmp/initbostonFS.ora file. You will need to
make changes to the initialization parameters to reflect the name change from 'boston' to
s a
'bostonFS'. You will also need to make adjustments for control file name changes and
) ha
directory name changes.
l ฺ c om
[oracle@host02]$ vi /tmp/initbostonFS.ora
m ai ฺ
a. Globally search and replace all occurrences of 'boston' with 'bostonFS'
9 @ g
u ide
:%s/boston/bostonFS/g
i z 9 nt G
u
pr tude
18 substitutions on 16 lines
N ( Sare incorrect and need to
b. Two of the substitutions from the global search
R O s
and replace
h i
be reverted back to their original value.R t the file to locate and correct
Continue editing
A entries. e
db_name and log_archive_config
Z B s
u use the
Ask your instructor for assistance if you
I
U se
need help with VI syntax. Remember to t o
always <ESC> key before starting a
new VI command option.R
T H icen
B E le l
*.db_name='boston'
I A
Z erab
*.log_archive_config='dg_config=(boston,bostonFS,london,londonFS
L
E nsf
,london2)'
I A trafor log_archive_dest_2 uses the valid_for option assuming it has the
R Ic.C Thenentry
-
T o of primary database. On the Far Sync, this needs to use the role of a standby
nrole
PA database. Also the Far Sync should use SYNC communication to the physical standby
environment. Correct the log_archive_dest_2 parameter to the following value
(Changes to make in bold):
*.log_archive_dest_2='SERVICE=london SYNC REOPEN=15
valid_for=(STANDBY_LOGFILES,STANDBY_ROLE) db_unique_name=london'
d. The original control files are named control01.ctl and control02.ctl. We will
rename these to bostonFS01.ctl and bostonFS02.ctl. This is for preference only
since these files are not normal control files. Both changes can be made with the
following global search and replace:
:%s/control0/bostonFS0/g

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

Practices for Lesson 5: Using Oracle Active Data Guard


Chapter 5 - Page 10
Edutronic Global Services EฺIฺRฺL

e. Add the following new entries to the bottom of the file.


*.db_unique_name=bostonFS
*.fal_server=boston
*.log_file_name_convert='boston','bostonFS'
f. Recheck all modifications and case sensitivity issues. If accurate, then save the
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

changes made to the file.


:wq!
g. The complete edited file is listed below for reference. Bold entries indicate changes
that were made.
[oracle@host02]$ cat /tmp/initbostonFS.ora
bostonFS.__data_transfer_cache_size=0
bostonFS.__db_cache_size=46137344
bostonFS.__java_pool_size=12582912
bostonFS.__large_pool_size=12582912
s a
bostonFS.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from
) ha
environment
l ฺ c om
bostonFS.__pga_aggregate_target=209715200
m ai ฺ
bostonFS.__sga_target=310378496
9 @ g
u ide
i z 9 nt G
bostonFS.__shared_io_pool_size=4194304
u
pr tude
bostonFS.__shared_pool_size=226492416
(
ON his S
bostonFS.__streams_pool_size=0
R
AR use t
*.audit_file_dest='/u01/app/oracle/admin/bostonFS/adump'
B
*.audit_trail='db'
IZ e to
U
*.compatible='12.1.0.0.0'

T H R icens
*.control_files='/u01/app/oracle/oradata/bostonFS/bostonFS01.ctl
BE ble l
','/u01/app/oracle/fast_recovery_area/bostonFS/bostonFS02.ctl'
A
E LIZ sfera
*.db_block_size=8192

I C IA -tran
*.db_domain='example.com'
*.db_name='boston'
TR non
PA *.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
*.db_recovery_file_dest_size=10g
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=bostonFSXDB)'
*.enable_pluggable_database=true
*.log_archive_config='dg_config=(boston,bostonFS,london,londonFS
,london2)'
*.log_archive_dest_1='location=USE_DB_RECOVERY_FILE_DEST
valid_for=(ALL_LOGFILES,ALL_ROLES) db_unique_name=bostonFS'
*.log_archive_dest_2='SERVICE=london SYNC REOPEN=15
valid_for=(STANDBY_LOGFILES,STANDBY_ROLE) db_unique_name=london'
*.log_archive_dest_state_1='enable'
*.log_archive_format='arch_%t_%s_%r.log'
*.log_archive_max_processes=4

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

Practices for Lesson 5: Using Oracle Active Data Guard


Chapter 5 - Page 11
Edutronic Global Services EฺIฺRฺL

*.memory_target=496m
*.open_cursors=300
*.processes=300
*.remote_login_passwordfile='EXCLUSIVE'
*.standby_file_management='auto'
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

*.undo_tablespace='UNDOTBS1'
*.db_unique_name=bostonFS
*.fal_server=boston
*.log_file_name_convert='boston','bostonFS'
7. Copy the /tmp/bostonFS.ctl Far Sync control file to the two destination directories
used in the initialization parameter file. Rename the files to the correct name while copying
them.
[oracle@host02]$ cp /tmp/bostonFS.ctl
/u01/app/oracle/oradata/bostonFS/bostonFS01.ctl
s a
) ha
[oracle@host02]$ cp /tmp/bostonFS.ctl
l ฺ c om
aFari Syncฺ
/u01/app/oracle/fast_recovery_area/bostonFS/bostonFS02.ctl
8. Copy the password file staged into the /tmp directory to the default locationmof
instance. Rename the file appropriately while copying it.
9 @ g
u ide
i z 9 nt G
[oracle@host02]$ cp /tmp/orapwboston u
pr tude
(
/u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwbostonFS
N is S If they are not, then use
9. Verify that the environment variables are defined
R O
for 'bostonFS'.
the oraenv utility to set them if needed. AR e th
[oracle@host02]$ set |IZ
B o us
OLD_ORACLE_BASE= R
U se t
grep ORA

T H icen
B E le l
ORABASE_EXEC=/u01/app/oracle/product/12.1.0/dbhome_1/bin/orabase
A
IZ ferab
ORACLE_BASE=/u01/app/oracle
L
E ns
ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1
I A tra
R IC ORACLE_SID=bostonFS
n -
T o
nORAHOME=/u01/app/oracle/product/12.1.0/dbhome_1
PA ORASID=oracle
10. Use SQL*Plus to create a binary server parameter file from the text parameter file. Create
the server parameter file into the default directory.
[oracle@host02]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Wed Aug 21 22:41:21
2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.

(host02) SQL> create spfile from pfile='/tmp/initbostonFS.ora';


File created.

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

Practices for Lesson 5: Using Oracle Active Data Guard


Chapter 5 - Page 12
Edutronic Global Services EฺIฺRฺL

11. Startup MOUNT the Far Sync instance.


(host02) SQL> startup mount;
ORACLE instance started.

Total System Global Area 517763072 bytes


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Fixed Size 2290216 bytes


Variable Size 440405464 bytes
Database Buffers 71303168 bytes
Redo Buffers 3764224 bytes
Database mounted.

12. Use a terminal window for host01 logged in as oracle with the environment variables set
to 'boston', the primary database. Launch SQL*plus and examine the current value of
log_archive_dest_2.
s a
[oracle@host01]$ sqlplus / as sysdba ) ha
c om
SQL*Plus: Release 12.1.0.1.0 Production on Wed Aug 21 22:58:23
l ฺ
2013
m ai ฺ
9 @ g
Copyright (c) 1982, 2013, Oracle. All rights reserved.
u ide
Connected to:
i z 9 nt G
u
pr tude
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -
(
ON his S
64bit Production
R
AR use t
With the Partitioning, OLAP, Advanced Analytics and Real
B
Application Testing options
IZ e to
(host01) SQL> showR
U s log_archive_dest_2
T H n
parameter
e
NAME
B ic
E le lTYPE VALUE
A
IZ ferab ----------- ------------------------------
-------------------
L
E ns
I A
log_archive_dest_2
tr a
string SERVICE=london SYNC REOPEN=15
IC
TR non-
valid_for=(ONLINE_LOGFILES,

PA PRIMARY_ROLE)
db_unique_name=london
13. The primary is currently forwarding redo to the physical standby database. Alter the primary
database to now forward redo to the Far Sync instance instead of the physical standby
database. Be sure to make the corrections both in memory and written to the server
parameter file.
(host01) SQL> alter system set
log_archive_dest_2='SERVICE=bostonFS SYNC REOPEN=15
valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE)
db_unique_name=bostonFS' scope=both;

System altered.

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

Practices for Lesson 5: Using Oracle Active Data Guard


Chapter 5 - Page 13
Edutronic Global Services EฺIฺRฺL

14. Determine the most recently archived redo log on the primary database. Perform a log
switch, and verify the next sequence number used.
(host01) SQL> SELECT MAX(SEQUENCE#), THREAD# FROM V$ARCHIVED_LOG
GROUP BY THREAD#;
MAX(SEQUENCE#) THREAD#
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

-------------- ----------
165 1

(host01) SQL> alter system switch logfile;


System altered.

(host01) SQL> SELECT MAX(SEQUENCE#), THREAD# FROM V$ARCHIVED_LOG


GROUP BY THREAD#;
MAX(SEQUENCE#) THREAD#
s a
) ha
-------------- ----------

om
166 1
l ฺ c
m ai ฺ
15. Use the previous SQL*Plus session for host02 logged in as oracle with the environment
variables set to 'bostonFS', the Far Sync. Verify that the last sequence number of the
primary was received on the Far Sync.
9 @ g
u ide
i z t G
9FROM nV$ARCHIVED_LOG
(host02) SQL> SELECT MAX(SEQUENCE#), THREAD# u
pr tude
GROUP BY THREAD#; (
MAX(SEQUENCE#) THREAD#
R ON his S
-------------- ---------- AR e t
B s
166
U IZ1 e to u
R logged
16. Use a terminal window for host03
H n s in as oracle with the environment variables set
to 'london'. Launch T
ESQL*Plus e
c verify that the physical standby on host03 is
liand
A Bthe l e
L I Z erab on host02.
receiving redo from Far Sync

A E nsf
[oracle@host03]$ sqlplus / as sysdba
I
IC SQL*Plus:
- tra Release 12.1.0.1.0 Production on Thu Aug 22 01:22:50
T R no n
2013
PA Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -
64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real
Application Testing options

(host03) SQL> SELECT MAX(SEQUENCE#), THREAD# FROM V$ARCHIVED_LOG


GROUP BY THREAD#;
MAX(SEQUENCE#) THREAD#
-------------- ----------
166 1

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

Practices for Lesson 5: Using Oracle Active Data Guard


Chapter 5 - Page 14
Edutronic Global Services EฺIฺRฺL

17. Exit all SQL*Plus sessions from host01, host02, and host03. Leave the terminal
sessions open with the environment variables set for each system.
(host01) SQL> exit;
(host02) SQL> exit;
(host03) SQL> exit;
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

18. Verify on the Far Sync server, host02, that the standby redo logs were automatically
created.
[oracle@host02]$ ls -la /u01/app/oracle/oradata/bostonFS/stdby*
-rw-r----- 1 oracle oinstall 52429312 Aug 22 02:38
/u01/app/oracle/oradata/bostonFS/stdbyredo01.log
-rw-r----- 1 oracle oinstall 52429312 Aug 22 01:22
/u01/app/oracle/oradata/bostonFS/stdbyredo02.log
-rw-r----- 1 oracle oinstall 52429312 Aug 22 01:13
/u01/app/oracle/oradata/bostonFS/stdbyredo03.log
-rw-r----- 1 oracle oinstall 52429312 Aug 22 01:13 s a
/u01/app/oracle/oradata/bostonFS/stdbyredo04.log ) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 5: Using Oracle Active Data Guard


Chapter 5 - Page 15
Edutronic Global Services EฺIฺRฺL

Practice 5-4: Add 2nd Far Sync to the Data Guard Environment
Overview
In this practice, you will create an additional Far Sync instance (londonFS) on host04 that is
in close proximity to the physical standby database. This will be used in future practices that
perform role reversal. With a role reversal, the 'london' instance on host03 will become the
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

primary database. It will need to forward redo to 'londonFS' Far Sync on host04.

Tasks
1. In the practice, we copied a Far Sync control file, initialization parameter file, and password
file to the /tmp directory on host02. We will start with these files and copy them to host04
since they were already edited for a Far Sync environment. Use a terminal window for
host02 logged in as oracle with the environment variables set to 'bostonFS'. Copy the
three files staged in /tmp to host04.
[oracle@host02]$ scp /tmp/bostonFS.ctl oracle@host04:/tmp
s a
) ha
bostonFS.ctl 100% 18MB 17.7MB/s 00:00

l ฺ c om
[oracle@host02]$ scp /tmp/initbostonFS.ora oracle@host04:/tmp
m ai ฺ
g ide
initbostonFS.ora 100% 1586 1.6KB/s 00:00
9 @
9 nt G u
u i z
pr t00:00 de
[oracle@host02]$ scp /tmp/orapwboston oracle@host04:/tmp
( u
ON with S
orapwboston 100% 7680 7.5KB/s
2. Use a terminal window for host04 logged in as R oracleth i s the environment variables set
A Rneededs e
Z B
to 'londonFS'. Create the initial directories
u on the Far Sync server. These are the
same directories that were createdI on the physical
R U se to standby server host03 in practice 4-2.
[oracle@host04]$
T Hmkdirice-pn /u01/app/oracle/admin/londonFS/adump
BE bmkdir
[oracle@host04]$
l e l -p /u01/app/oracle/oradata/londonFS
A
LIZ sfera mkdir -p
[oracle@host04]$
E
an
IA[oracle@host04]$
/u01/app/oracle/oradata/londonFS/pdbseed
I C - t r mkdir -p /u01/app/oracle/oradata/londonFS/dev1
TR n[oracle@host04]$
on
PA
mkdir -p
/u01/app/oracle/fast_recovery_area/londonFS
Note: Linux directory and file names are case sensitive. Throughout these labs, the names
for Far Sync use the format bostonFS and londonFS for readability. The last 2 letters are in
upper-case.
3. Use a terminal window for host04 logged in as oracle with the environment variables set
to 'londonFS'. Rename the /tmp/initbostonFS.ora file to
/tmp/initlondonFS.ora. You will need to make changes to the initialization parameters
to reflect the name change from 'boston' to 'london'. You will also need to make
adjustments for control file name changes and directory name changes.
[oracle@host04]$ mv /tmp/initbostonFS.ora /tmp/initlondonFS.ora

[oracle@host04]$ vi /tmp/initlondonFS.ora

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

Practices for Lesson 5: Using Oracle Active Data Guard


Chapter 5 - Page 16
Edutronic Global Services EฺIฺRฺL

a. Globally search and replace all occurrences of 'boston' with 'london'


:%s/boston/london/g
24 substitutions on 19 lines
b. Three of the substitutions from the global search and replace are incorrect and need to
be reverted back to their original value. Continue editing the file to locate and correct
db_name, log_archive_config, and log_file_name_convert entries. Ask
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

your instructor for assistance if you need help with VI syntax. Remember to always use
the <ESC> key before starting a new VI command option.
*.db_name='boston'
*.log_archive_config='dg_config=(boston,bostonFS,london,londonFS
,london2)'
*.log_file_name_convert='boston','londonFS'
c. The entry for log_archive_dest_2 is defined for a standby database role to ship
redo to the 'london' service. If 'london' becomes the primary database, then the
'londonFS' Far Sync should ship redo to 'boston', which will become the standby s a
database after role reversal. Correct the values for this parameter. Changes shown in
) ha
bold.
l ฺ c om
*.log_archive_dest_2='SERVICE=boston ASYNC REOPEN=15 ai
valid_for=(STANDBY_LOGFILES,STANDBY_ROLE) db_unique_name=boston'
@ gm ideฺ
99 then
d. Recheck all modifications and case sensitivity issues. If accurate, G uthe
save
i z t
en with a modified
( pru we
changes made to the file. Less changes were needed since
u
started
d
file.
O N is St
:wq!
A RR se th
I Z B fororeference.
e. The complete edited file is listed below u Bold entries indicate changes
that were made.
R U se t
[oracle@host04]$
T cat
c n
H i/tmp/initlondonFS.ora
e
BE ble l
londonFS.__data_transfer_cache_size=0
A
IZ fera
L
londonFS.__db_cache_size=46137344
E
C I t r a ns
AlondonFS.__java_pool_size=12582912
I londonFS.__large_pool_size=12582912
TR non-
PA londonFS.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from
environment
londonFS.__pga_aggregate_target=209715200
londonFS.__sga_target=310378496
londonFS.__shared_io_pool_size=4194304
londonFS.__shared_pool_size=226492416
londonFS.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/londonFS/adump'
*.audit_trail='db'
*.compatible='12.1.0.0.0'
*.control_files='/u01/app/oracle/oradata/londonFS/londonFS01.ctl
','/u01/app/oracle/fast_recovery_area/londonFS/londonFS02.ctl'
*.db_block_size=8192
*.db_domain='example.com'
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 5: Using Oracle Active Data Guard


Chapter 5 - Page 17
Edutronic Global Services EฺIฺRฺL

*.db_name='boston'
*.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
*.db_recovery_file_dest_size=10g
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=londonFSXDB)'
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

*.enable_pluggable_database=true
*.log_archive_config='dg_config=(boston,bostonFS,london,londonFS
,london2)'
*.log_archive_dest_1='location=USE_DB_RECOVERY_FILE_DEST
valid_for=(ALL_LOGFILES,ALL_ROLES) db_unique_name=londonFS'
*.log_archive_dest_2='SERVICE=boston ASYNC REOPEN=15
valid_for=(STANDBY_LOGFILES,STANDBY_ROLE) db_unique_name=boston'
*.log_archive_dest_state_1='enable'
*.log_archive_format='arch_%t_%s_%r.log'
*.log_archive_max_processes=4 s a
*.memory_target=496m ) ha
*.open_cursors=300
l ฺ c om
*.processes=300
m ai ฺ
*.remote_login_passwordfile='EXCLUSIVE'
9 @ g
u ide
*.standby_file_management='auto' i z 9 nt G
u
pr tude
*.undo_tablespace='UNDOTBS1' (
*.db_unique_name=londonFS
R ON his S
*.fal_server=london
B AR use t
IZ e to
*.log_file_name_convert='boston','londonFS'
U
4. Copy the /tmp/bostonFS.ctl
T H R icFarfile.
e s control file to the two destination directories
nSync
used in the initialization
B E e l
parameter Rename the files to the correct name while copying
them.
I Z A rabl
L
E nsfe cp /tmp/bostonFS.ctl
[oracle@host04]$
I A
IC n-tra
/u01/app/oracle/oradata/londonFS/londonFS01.ctl

T R no
PA [oracle@host04]$ cp /tmp/bostonFS.ctl
/u01/app/oracle/fast_recovery_area/londonFS/londonFS02.ctl
5. Copy the password file staged into the /tmp directory to the default location of Far Sync
instance. Rename the file appropriately while copying it.
[oracle@host04]$ cp /tmp/orapwboston
/u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwlondonFS
6. Verify that the environment variables are defined for 'bostonFS'. If they are not, then use
the oraenv utility to set them if needed.
[oracle@host04]$ set | grep ORA
OLD_ORACLE_BASE=
ORABASE_EXEC=/u01/app/oracle/product/12.1.0/dbhome_1/bin/orabase
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1

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

Practices for Lesson 5: Using Oracle Active Data Guard


Chapter 5 - Page 18
Edutronic Global Services EฺIฺRฺL

ORACLE_SID=londonFS
ORAHOME=/u01/app/oracle/product/12.1.0/dbhome_1
ORASID=oracle
7. Use SQL*Plus to create a binary server parameter file from the text parameter file. Create
the server parameter file into the default directory.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

[oracle@host04]$ sqlplus / as sysdba


SQL*Plus: Release 12.1.0.1.0 Production on Wed Aug 21 22:41:21
2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.

(host04) SQL> create spfile from pfile='/tmp/initlondonFS.ora';


File created.
8. Startup MOUNT the Far Sync instance. Leave SQL*Plus session open when done.
s a
(host04) SQL> startup mount;
) ha
ORACLE instance started.
l ฺ c om
m ai ฺ
Total System Global Area 517763072 bytes
9 @ g
u ide
Fixed Size 2290216 bytes
i z 9 nt G
u
pr tude
Variable Size
(
440405464 bytes
71303168Nbytes S
RO bytes
Database Buffers
Redo Buffers R
3764224 t h is
B A use
Database mounted.
Z
UI se to
(host04) SQL> T exit;
R
H icen
l e l logged in as oracle with the environment variables set
BE forbhost03
A
9. Use a terminal window
LIZthesphysical
to 'london',
E f era standby database. Launch SQL*plus and examine the current
I
value
C - t r an
IAof log_archive_dest_2.
TR n[oracle@host03]$
on sqlplus / as sysdba
PA SQL*Plus: Release 12.1.0.1.0 Production on Wed Aug 21 22:58:23
2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -
64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real
Application Testing options

(host03) SQL> show parameter log_archive_dest_2


NAME TYPE VALUE
------------------- ----------- ------------------------------
log_archive_dest_2 string

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

Practices for Lesson 5: Using Oracle Active Data Guard


Chapter 5 - Page 19
Edutronic Global Services EฺIฺRฺL

10. The log_archive_dest_2 parameter of the 'london' physical standby instance is not
currently defined because it is a terminal destination. After role reversals, it would become
the primary database. At that time, it should forward redo to the 'londonFS' Far Sync.
Modify the log_archive_dest_2 parameter so that it forwards redo accordingly.
(host03) SQL> alter system set
log_archive_dest_2='SERVICE=londonFS SYNC REOPEN=15
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE)
db_unique_name=londonFS' scope=both;
System altered.
Note: At this point in the labs, the 'londonFS' Far Sync has been started, but it is not
currently used. It will be tested after switchover exercises are performed in future labs.
11. Exit all SQL*Plus sessions from host01, host02, host03, and host04 if they are still
open. Leave the terminal sessions open with the environment variables set for each
system.
(host01) SQL> exit;
s a
) ha
(host02) SQL> exit;
(host03) SQL> exit;
l ฺ c om
(host04) SQL> exit;
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 5: Using Oracle Active Data Guard


Chapter 5 - Page 20
Edutronic Global Services EฺIฺRฺL
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
Practices for Lesson g 6: ide
9 @
9 nt Gua
Creating andizManaging
Snapshot ( ru ude Database
pStandby
O N is St
A RR s6 e th
Chapter

I Z B ou
R U se t
T H icen
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 6: Creating and Managing a Snapshot Standby Database


Chapter 6 - Page 1
Edutronic Global Services EฺIฺRฺL

Practices for Lesson 6: Overview


Practices Overview
In these practices, you will convert the physical standby database to a snapshot database and
open it for read-write operations. You will create new schema objects in the database to verify
the success of creating the snapshot. Finally, you will convert it back into a physical standby
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

database, discarding the schema objects that were created.

s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 6: Creating and Managing a Snapshot Standby Database


Chapter 6 - Page 2
Edutronic Global Services EฺIฺRฺL

Practice 6-1: Convert Physical Standby to a Snapshot Standby


Overview

In this practice, you will convert the 'london' physical standby database to a snapshot standby
database.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Tasks
1. Use a terminal window logged in as oracle to host03 with the environment variables set
for 'london' appropriately. Launch SQL*Plus and verify that the current database role is
physical standby.
[oracle@host03]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Thu Aug 22 03:45:30
2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
s a
) ha
Connected to:

om
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -
64bit Production
l ฺ c
With the Partitioning, OLAP, Advanced Analytics and Real m ai ฺ
Application Testing options
9 @ g
u ide
i z 9 nt G
(host03) SQL> select database_role frompv$database; u
r ude
(
N is St
DATABASE_ROLE O
----------------
A RR se th
PHYSICAL STANDBY
I Z B ou
2. Verify that flashback databaseR Uturnedsoff,
is e t
and show the default value for the flashback
retention target. T H icen
(host03)ASQL>BE selectl e l flashback_on from v$database;
L IZ ferab
E ns
FLASHBACK_ON
A
I
IC NO n-tra
------------------
T R no
PA
(host03) SQL> show parameter DB_FLASHBACK_RETENTION_TARGET
NAME TYPE VALUE
------------------------------------ ----------- -------------
db_flashback_retention_target integer 1440
3. Display the values for the two initialization parameters that define the Fast Recovery Area.
(host03) SQL> show parameter DB_RECOVERY_FILE_DEST
NAME TYPE VALUE
--------------------------- ----------- ------
db_recovery_file_dest string
/u01/app/oracle/fast_recovery_area
db_recovery_file_dest_size big integer 10G

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

Practices for Lesson 6: Creating and Managing a Snapshot Standby Database


Chapter 6 - Page 3
Edutronic Global Services EฺIฺRฺL

4. Display the current file types, number of files for each type, and percent of space utilization
per file type for the Fast Recovery Area.
(host03) SQL> select
file_type,number_of_files,percent_space_used from
v$recovery_area_usage;
FILE_TYPE NUMBER_OF_FILES PERCENT_SPACE_USED
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

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


CONTROL FILE 0 0
REDO LOG 0 0
ARCHIVED LOG 4 .15
BACKUP PIECE 1 .17
IMAGE COPY 0 0
FLASHBACK LOG 0 0
FOREIGN ARCHIVED LOG 0 0
AUXILIARY DATAFILE COPY 0 0 s a
) ha
8 rows selected.
l ฺ c om
m ai ฺ
5. Attempt to convert the physical standby database to a snapshot standby database.
(host03) SQL> alter database convert to snapshot 9 @ g
standby;u ide
i z 9 nt G
alter database convert to snapshot standby u
pr tude
* (
ERROR at line 1: R ON his S
ORA-38784: Cannot create restore
B AR upoint
s et
IZ e to
'SNAPSHOT_STANDBY_REQUIRED_08/22/2013
U
03:57:13'.
T H R icensmedia recovery is active
ORA-01153: an
B E le l
incompatible
A abphysicalstandby
LIZ stofearsnapshot
6. Cancel redo apply on the standby database and reattempt to convert the physical
standbyEdatabase database.
I A n
tra SQL> alter database recover managed standby database
R IC (host03)
n -
PA
T nocancel;
Database altered.

(host03) SQL> alter database convert to snapshot standby;


Database altered.
7. Display the current database role.
(host03) SQL> select database_role from v$database;
DATABASE_ROLE
----------------
SNAPSHOT STANDBY

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

Practices for Lesson 6: Creating and Managing a Snapshot Standby Database


Chapter 6 - Page 4
Edutronic Global Services EฺIฺRฺL

8. Verify that flashback database was automatically enabled when the physical standby was
converted to a snapshot standby.
(host03) SQL> select flashback_on from v$database;
FLASHBACK_ON
------------------
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

RESTORE POINT ONLY


9. Display the name of the guaranteed restore point that was created and its current storage
size.
(host03) SQL> select name, storage_size from v$restore_point;
NAME STORAGE_SIZE
-------------------------------------------- ------------
SNAPSHOT_STANDBY_REQUIRED_08/22/2013 03:59:36 52428800
10. Display the current open mode for the snapshot standby.
(host03) SQL> select open_mode from v$database; s a
OPEN_MODE ) ha
--------------------
l ฺ c om
MOUNTED
m ai ฺ
11. Verify that a flashback log was automatically created in the Recovery@
9
g
Area. u ide
i z 9 nt G
(host03) SQL> select file_type, number_of_files, u
pr tude
percent_space_used from v$recovery_area_usage; (
N is S
R O
FILE_TYPE R se th PERCENT_SPACE_USED
NUMBER_OF_FILES
A
Z B ou
----------------------- ---------------
I ------------------
CONTROL FILE
R U se t 0 0
REDO LOG TH lice n 0 0
ARCHIVEDALOG
E
B ble 4 .15
I Z
L PIECE er a
BACKUP
E s f 1 .17

I C an
IAIMAGE-trCOPY 0 0

TR nFLASHBACK
on LOG 2 .98
PA FOREIGN ARCHIVED LOG 0 0
AUXILIARY DATAFILE COPY 0 0

8 rows selected.
12. Attempt to convert the snapshot standby back to a physical standby.
(host03) SQL> alter database convert to physical standby;
alter database convert to physical standby
*
ERROR at line 1:
ORA-16433: The database or pluggable database must be opened in
read/write
mode.

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

Practices for Lesson 6: Creating and Managing a Snapshot Standby Database


Chapter 6 - Page 5
Edutronic Global Services EฺIฺRฺL

Note: Even though the command in step 6 succeeded in converting the physical standby
into a snapshot standby, it must be opened into read-write mode at least one time before
you can reverse the operation back to a physical standby. The purpose of this example is to
show what happens if you changed your mind and wanted to convert back to a physical
standby without proceeding.
13. Open the snapshot database and verify that it has been opened in the read-write mode.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

(host03) SQL> alter database open;


Database altered.

(host03) SQL> select open_mode from v$database;


OPEN_MODE
--------------------
READ WRITE
14. Switch the container to the DEV1 PDB for the session. Even though the container is open,
the DEV1 PDB is mounted. Open the DEV1 PDB, and create a miscellaneous table. Insert 1 s a
row into the table and commit the result. Return to the root container when done.
) ha
(host03) SQL> alter session set container = DEV1;
l ฺ c om
Session altered.
m ai ฺ
9 @ g
u ide
(host03) SQL> alter database open; i z 9 nt G
u
pr tude
Database altered. (
R ON his S
A
(host03) SQL> create table misc1 t
R (xsevarchar2(50) );
Table created. B
IZ e to u
U
(host03) SQL> T H R iinto e n s
c misc1 values ('Test Row');
B E insert
l e l
IZA ferab
1 row created.
L
E nSQL> s commit;
C I A t r
(host03) a
I
on- complete.
TR nCommit
PA
(host03) SQL> alter session set container = CDB$ROOT;
Session altered.

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

Practices for Lesson 6: Creating and Managing a Snapshot Standby Database


Chapter 6 - Page 6
Edutronic Global Services EฺIฺRฺL

15. In step 6, managed recovery was stopped for the snapshot database. Use a terminal
window logged in as oracle to host01 to with the environment variables set for 'boston'
appropriately. Determine the last archived redo log for the primary database and perform a
log switch. Exit SQL*Plus when done.
[oracle@host01]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Thu Aug 22 04:27:34
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -
64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real
Application Testing options

(host01) SQL> SELECT MAX(SEQUENCE#), THREAD# FROM V$ARCHIVED_LOG


s a
) ha
GROUP BY THREAD#;
MAX(SEQUENCE#) THREAD#
l ฺ c om
-------------- ----------
m ai ฺ
g ide
175 1
9 @
9 nt G u
u i z
pr tude
(host01) SQL> alter system switch logfile;
(
ON his S
System altered.
R
(host01) SQL> exit;
B AR use t
16. Return to the SQL*Plus sessionU onIZ o verify that the snapshot standby is still
host03 tand
R s e
n forwarded to the Far Sync, and then to the
T H database,
receiving redo from the primary
i c e
BE database
snapshot standby. The sequence
l e l number should be the next one after the number
displayed on the
I A
Z erab
primary in the previous step.
L
E nSQL>
(host03) s f SELECT MAX(SEQUENCE#), THREAD# FROM V$ARCHIVED_LOG
I A ta
GROUP rBY
R IC MAX(SEQUENCE#)
n -
THREAD#;

PA
T no THREAD#
-------------- ----------
176 1

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

Practices for Lesson 6: Creating and Managing a Snapshot Standby Database


Chapter 6 - Page 7
Edutronic Global Services EฺIฺRฺL

Practice 6-2: Convert Snapshot Standby Back to Physical Standby


Overview
In this practice, you convert the snapshot standby back into a physical standby database.

Tasks
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

1. Attempt to convert the snapshot standby back into a physical standby.


(host03) SQL> alter database convert to physical standby;
alter database convert to physical standby
*
ERROR at line 1:
ORA-01126: database must be mounted in this instance and not
open in any
Instance
s a
) ha
2. Shutdown the snapshot standby and start it back up in the MOUNT mode.
(host03) SQL> shutdown immediate;
l ฺ c om
Database closed.
m ai ฺ
Database dismounted.
9 @ g
u ide
ORACLE instance shut down.
i z 9 nt G
u
pr tude
(
ON his S
SQL> startup mount;
R t
AR usebytes
ORACLE instance started.
Total System Global Area B 517763072
Fixed Size U IZ e2290216
to bytes
Variable Size H
R s
n 440405464 bytes
T l i c e
A BE ble
Database Buffers 71303168 bytes
IZ fera
RedoLBuffers 3764224 bytes
E
ADatabase s
nmounted.
I C I t r a
- to convert the snapshot standby back into a physical standby.
T3.R Reattempt
non
PA (host03) SQL> alter database convert to physical standby;
Database altered.
4. Verify that flashback has been turned off, and the flashback log was deleted freeing up
space in the flash recovery area.
(host03) SQL> select flashback_on from v$database;
FLASHBACK_ON
------------------
NO

(host03) SQL> select


file_type,number_of_files,percent_space_used from
v$recovery_area_usage;
FILE_TYPE NUMBER_OF_FILES PERCENT_SPACE_USED

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

Practices for Lesson 6: Creating and Managing a Snapshot Standby Database


Chapter 6 - Page 8
Edutronic Global Services EฺIฺRฺL

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


CONTROL FILE 0 0
REDO LOG 0 0
ARCHIVED LOG 5 .19
BACKUP PIECE 1 .17
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

IMAGE COPY 0 0
FLASHBACK LOG 0 0
FOREIGN ARCHIVED LOG 0 0
AUXILIARY DATAFILE COPY 0 0
5. Open the container database to enable Active Data Guard, and then switch the session to
the DEV1 pluggable database. Open the DEV1 PDB.
(host03) SQL> alter database open;
Database altered.

s a
(host03) SQL> alter session set container = DEV1;
) ha
Session altered.
l ฺ c om
m ai ฺ
(host03) (DEV1) SQL> alter database open;
9 @ g
u ide
Database altered.
i z 9 nt G
u de14, and verify that
pr 6-1tustep
6. Attempt to query the MISC1 table that was created in Practice
(
standby database. R ON standby
the table no longer exists after converting the snapshot
h i s Sback into a physical
A*Rfrom e t
(host03) (DEV1) SQL> select
Z B u smisc1;
select * from misc1 UI t o
*H
R nse
E T l i c e
I Z ABtable
ERROR at line
r
1: le
a bor view does not exist
L
ORA-00942:
E nsf e
I A
R IC n-tra
PA
T no (host03) (DEV1) SQL> select table_name from dba_tables where
table_name like 'MISC%';
no rows selected

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

Practices for Lesson 6: Creating and Managing a Snapshot Standby Database


Chapter 6 - Page 9
Edutronic Global Services EฺIฺRฺL

7. Return the session back to the container root. Shut down the physical standby to disable
Active Data Guard. Start in back up in the MOUNT state and restart Redo Apply.
(host03) SQL> alter session set container = CDB$ROOT;
Session altered.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

(host03) SQL> shutdown immediate;


Database closed.
Database dismounted.
ORACLE instance shut down.

(host03) SQL> startup mount;


ORACLE instance started.
Total System Global Area 517763072 bytes
Fixed Size 2290216 bytes
s a
) ha
Variable Size 440405464 bytes
Database Buffers 71303168 bytes
l ฺ c om
Redo Buffers 3764224
m ai ฺ
bytes
g ide
Database mounted.
9 @
9standby G u
(host03) SQL> alter database recover managed r u i z e n t database
disconnect; p
( Stu d
O N is
Database altered.
R R t h
8. Exit SQL*Plus on any host machine in B
Z
which se Do not close down the terminal
A it isuopen.
sessions.
R UI se to
H icen
(host03) SQL> exit;
T
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 6: Creating and Managing a Snapshot Standby Database


Chapter 6 - Page 10
Edutronic Global Services EฺIฺRฺL
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
Practices for Lesson g 7: ide
Creating a Logical 9 @
9 Standby
G u
i z n t
Database(pru tude
R O7N his S
AR use t
Chapter
B
IZ e to
U
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 7: Creating a Logical Standby Database


Chapter 7 - Page 1
Edutronic Global Services EฺIฺRฺL

Practices for Lesson 7: Overview


Practices Overview
In these practices, you will prepare host03 to create a logical standby database. You will use
the RMAN utility to create the physical standby database and then verify its operation.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 7: Creating a Logical Standby Database


Chapter 7 - Page 2
Edutronic Global Services EฺIฺRฺL

Practice 7-1: Identify Unsupported Objects for Logical Standbys


Overview
In this practice, you will examine the primary database to determine which objects will not be
supported in a logical standby.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Tasks
1. Use a terminal window on host01 connected as oracle with the environment variables
set to boston. Start SQL*Plus and verify that all pluggable databases are open for queries.
If any pluggable database is mounted or shutdown, the queries that follow this step will not
return complete results.
[oracle@host01]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Tue Jun 11 03:51:01
2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
s a
) ha
Connected to an idle instance.

l ฺ c om
(host01) SQL> select con_id, name, open_mode from v$containers;
m ai ฺ
CON_ID NAME OPEN_MODE
9 @ g
u ide
---------- ------------------------------ ----------
i z 9 nt G
1 CDB$ROOT READ WRITE u
pr tude
(
ON his S
2 PDB$SEED READ ONLY
R
AR use t
3 DEV1 READ WRITE
B
IZ unique
U
2. Find all tables across all PDBs without
R e tological identifiers in the primary database.
This query will take a fewHminutes to e n s
run.
T l i c
(host01) SQL>
A BE SELECT
b l e CON_ID, OWNER, TABLE_NAME FROM
I Z era
CDB_LOGSTDBY_NOT_UNIQUE
L WHERE (CON_ID, OWNER, TABLE_NAME) NOT IN

I A E nDISTINCT
(SELECT
a sf CON_ID, OWNER, TABLE_NAME FROM

R IC n-tr
CDB_LOGSTDBY_UNSUPPORTED) AND BAD_COLUMN = 'Y';

PA
T no CON_ID OWNER TABLE_NAME
---------- ------------ ------------------------------
1 APEX_040200 WWV_FLOW_BANNER
1 APEX_040200 APEX$_WS_WEBPG_SECTION_HISTORY
2 APEX_040200 WWV_FLOW_BANNER
2 APEX_040200 APEX$_WS_WEBPG_SECTION_HISTORY
3 APEX_040200 WWV_FLOW_BANNER
3 APEX_040200 APEX$_WS_WEBPG_SECTION_HISTORY

6 rows selected.
Note: This query differs from the one listed in the product documentation. It has been
modified to examine schema objects across all PDBs. We can ignore the APEX user, since
we will not be using that product in class. The normal response to rows found by the above

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

Practices for Lesson 7: Creating a Logical Standby Database


Chapter 7 - Page 3
Edutronic Global Services EฺIฺRฺL

query would be to create disabled 'rely' primary constraints, or to have SQL Apply skip
changes made to the tables identified.
3. Identify the internal schemas that ship with the Oracle Database. Any user-defined table
created into these schemas will not be replicated on the logical standby database. Also,
those user-defined tables will not show up in the DBA_LOGSTDBY_UNSUPPORTED or
CDB_LOGSTDBY_UNSUPPORTED views of step 4, even though they are unsupported.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

(host01) SQL> SELECT CON_ID, OWNER FROM CDB_LOGSTDBY_SKIP WHERE


STATEMENT_OPT = 'INTERNAL SCHEMA' ORDER BY CON_ID, OWNER;

3 OLAPSYS
3 ORACLE_OCM
3 ORDDATA
3 ORDPLUGINS

CON_ID OWNER
s a
---------- --------------------
) ha
3 ORDSYS
l ฺ c om
3 OUTLN
m ai ฺ
3 SI_INFORMTN_SCHEMA
9 @ g
u ide
3 SYS
i z 9 nt G
u
pr tude
3 SYSBACKUP
(
3 SYSDG
R ON his S
3 SYSKM
B AR use t
3 SYSTEM
U IZ e to
H R icens
3 WMSYS
T
3 XDB
A BE ble l
3 XS$NULL

E LIZ sfera
88 rows selected.

INote:
C an differs from the one listed in the product documentation. It has been
IAThis-tquery
r
TR modified
nonto examine schema objects across all PDBs. The PDB DEV1 contains one
PA additional internal schema not found in the CDB$ROOT or PDB$SEED containers. It is the BI
schema.
4. Identify tables that do not belong to internal schemas and that will not be maintained by
SQL Apply because of unsupported data types.
(host01) SQL> SELECT DISTINCT CON_ID,OWNER,TABLE_NAME FROM
CDB_LOGSTDBY_UNSUPPORTED ORDER BY OWNER,TABLE_NAME;

CON_ID OWNER TABLE_NAME


---------- -------------------- ------------------------------
3 IX AQ$_ORDERS_QUEUETABLE_G
3 IX AQ$_ORDERS_QUEUETABLE_H
3 IX AQ$_ORDERS_QUEUETABLE_I
3 IX AQ$_ORDERS_QUEUETABLE_L
3 IX AQ$_ORDERS_QUEUETABLE_S
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Creating a Logical Standby Database


Chapter 7 - Page 4
Edutronic Global Services EฺIฺRฺL

3 IX AQ$_ORDERS_QUEUETABLE_T
3 IX AQ$_STREAMS_QUEUE_TABLE_C
3 IX AQ$_STREAMS_QUEUE_TABLE_G
3 IX AQ$_STREAMS_QUEUE_TABLE_H
3 IX AQ$_STREAMS_QUEUE_TABLE_I
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

3 IX AQ$_STREAMS_QUEUE_TABLE_L

CON_ID OWNER TABLE_NAME


---------- -------------------- ------------------------------
3 IX AQ$_STREAMS_QUEUE_TABLE_S
3 IX AQ$_STREAMS_QUEUE_TABLE_T
3 IX ORDERS_QUEUETABLE
3 IX STREAMS_QUEUE_TABLE
3 OE CATEGORIES_TAB
s a
3 OE CUSTOMERS
) ha
3 OE PURCHASEORDER
l ฺ c om
3 PM ai ฺ
PRINT_MEDIA
m
3 SH
9 @ g ide
DIMENSION_EXCEPTIONS
u
i z 9 nt G
20 rows selected. u
pr tude
5. View the column names and data types that conflict N
( S for only
with SQL Apply
R O h i s
OE.CUSTOMERS table identified in the previous
AR uwhen e tdone.
step. The command is this step could be
repeated for each table if needed. Exit B
SQL*Plus s
(host01) SQL> SELECTU IZ e COLUMN_NAME,DATA_TYPE
CON_ID, t o FROM
R
H icen
CDB_LOGSTDBY_UNSUPPORTED s
WHERE OWNER='OE' AND TABLE_NAME =
'CUSTOMERS';ET
CON_IDZA
B ble l
L I fe r a
COLUMN_NAME DATA_TYPE
E n------------------------------
-------
A s -------------
I
IC n-tr3a PHONE_NUMBERS VARRAY
T R no
PA (host01) SQL> exit;

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

Practices for Lesson 7: Creating a Logical Standby Database


Chapter 7 - Page 5
Edutronic Global Services EฺIฺRฺL

Practice 7-2: Create a Logical Standby (Temporarily a Physical)


Overview
In this practice, you will prepare host03 to receive the logical standby database and create the
logical standby database using RMAN and SQL.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Tasks
1. Use a terminal window logged in as oracle to host03 to create the initial directories
needed for a logical standby database. You may want to consider having a separate
terminal windows open for the host03/london and host03/london2 combinations. For this lab
section you will be working with the host03/london2 combination. Since the primary
database is using multi-tenant architecture, additional directories are needed.
[oracle@host03]$ mkdir -p /u01/app/oracle/admin/london2/adump
[oracle@host03]$ mkdir -p /u01/app/oracle/oradata/london2
[oracle@host03]$ mkdir -p
s a
) ha
/u01/app/oracle/oradata/london2/pdbseed

om
[oracle@host03]$ mkdir -p /u01/app/oracle/oradata/london2/dev1
l ฺ c
[oracle@host03]$ mkdir -p
/u01/app/oracle/fast_recovery_area/london2 m ai ฺ
9 @ g
u ide
i z 9 standby
2. Create a starter initialization file on host03 for the london2ulogical n t Ginstance. The
only two parameters required are DB_NAME and DB_DOMAIN. ( pr tude
[oracle@host03]$ echo 'DB_NAME=london2' R ON hi>s S
AR use t
/u01/app/oracle/product/12.1.0/dbhome_1/dbs/initlondon2.ora
B
U Z
[oracle@host03]$ echo I'DB_DOMAIN=example.com'
t o >>
R ns e
/u01/app/oracle/product/12.1.0/dbhome_1/dbs/initlondon2.ora
T H c e database to the new logical standby database.
from theliprimary
3. Copy the password fileE
AB exists
Since a copy already
I Z a b e host03, we use the same file renaming it accordingly.
lon
E L sfer cp
[oracle@host03]$

I C - t an
IA/u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwlondon
r
TR non /u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwlondon2
PA 4. Startup nomount the london2 standby instance on host03. You will need to set or change
the environment variables to the london2 standby instance. Up to this point in labs, we
have been using london when on host03.
[oracle@host03]$ . oraenv
ORACLE_SID = [oracle] ? london2
The Oracle base has been set to /u01/app/oracle

[oracle@host03]$ sqlplus / as sysdba


SQL*Plus: Release 12.1.0.1.0 Production on Tue Jun 11 03:51:01
2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.

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

Practices for Lesson 7: Creating a Logical Standby Database


Chapter 7 - Page 6
Edutronic Global Services EฺIฺRฺL

(host03) SQL> startup nomount


ORACLE instance started.

Total System Global Area 217157632 bytes


Fixed Size 2286656 bytes
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Variable Size 159386560 bytes


Database Buffers 50331648 bytes
Redo Buffers 5152768 bytes

(host03) SQL> exit


Disconnected from Oracle Database 12c Enterprise Edition Release
12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real
Application Testing options
s a
) ha
5. Create a physical standby on host03 using the RMAN utility. The physical standby will be
converted to a logical standby later in the practice. Exit RMAN when done.
l ฺ c om
sys/oracle_4U@london2 m ai ฺ
[oracle@host03]$ rman target sys/oracle_4U@boston auxiliary

9 @ g
u ide
Recovery Manager: Release 12.1.0.1.0 - Production on Fri Aug 23
02:39:07 2013 i z 9 nt G
u
pr tude
(
N iits Saffiliates. All
Copyright (c) 1982, 2013, Oracle O and/or s
R h
rights reserved.
B AR use t
connected to target U
IZ e toBOSTON (DBID=2511874565)
H R icedatabase:
ns
database:

E T
connected to auxiliary
l LONDON2 (not mounted)
A B ble
RMAN> I Z
L run s{fera
E
I C IA allocate
- t r an channel prmy1 type disk;
TR nonallocate auxiliary channel stby1 type disk;
PA duplicate target database for standby from active database
spfile
parameter_value_convert 'boston','london2'
set db_unique_name='london2'
set db_file_name_convert='boston','london2'
set log_file_name_convert='boston','london2'
set fal_server='boston'
nofilenamecheck;
allocate auxiliary channel stby type disk;
sql channel stby "alter database recover managed standby
database disconnect"; }

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

Practices for Lesson 7: Creating a Logical Standby Database


Chapter 7 - Page 7
Edutronic Global Services EฺIฺRฺL

<<<<<Output truncated. Output is almost identical to the


complete output shown in Practice 4, except that the destination
name is 'london2' instead of 'london'>>>>>


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

RMAN> exit;
Recovery Manager complete.

s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 7: Creating a Logical Standby Database


Chapter 7 - Page 8
Edutronic Global Services EฺIฺRฺL

Practice 7-3: Start Redo Transport and Verify Operation


Overview
In this practice, you will start the redo transport from host01 to host03 for the new physical
standby and verify operation.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Tasks
1. Use a terminal window for host01 logged in as oracle with the environment variables set
to boston and start redo transport by defining log_archive_dest_3 pointing to the
logical standby database.
[oracle@host01]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Tue Jun 11 06:28:00
2013

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


s a
) ha
l ฺ c om
Connected to:
m ai ฺ
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0
9 @ g
u id-e
64bit Production
i z 9 nt G
With the Partitioning, OLAP, Advanced Analytics u
pr tudand e Real
(
ON his S
Application Testing options
R
R se t
(host01) SQL> alter system A
I Z B set
o u SYNC REOPEN=15
log_archive_dest_3='SERVICE=london2
U
R nse
valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE)
t db_unique_name=london2'
scope=both; TH e
A
System altered. BE ble lic
Note: For
E LthisIZstep,
s f a
wer are configuring redo transportation from the primary database to the
e
I A standby
logical
C t r a ndatabase. Even though there is a far sync configured, we are not using the
I -
TR primary
far
nondatabase transports redo directly to the standby site, and provide a little variation in
sync at this moment. This is designed to illustrate a typical configuration where the
PA the architecture. Again, this is for illustration only. At a later time, we will change this to use
the far sync instance.
2. Determine the last sequence number archived on the primary database.
(host01) SQL> SELECT MAX(SEQUENCE#), THREAD# FROM V$ARCHIVED_LOG
GROUP BY THREAD#;
MAX(SEQUENCE#) THREAD#
-------------- ----------
182 1

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

Practices for Lesson 7: Creating a Logical Standby Database


Chapter 7 - Page 9
Edutronic Global Services EฺIฺRฺL

3. Use a terminal window on host03 connected as oracle with the environment variables
set to london2. Start SQL*Plus and determine the last sequence number of the physical
standby instance.
[oracle@host03]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Tue Jun 11 06:58:53
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -
64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real
Application Testing options

(host03) SQL> SELECT MAX(SEQUENCE#), THREAD# FROM V$ARCHIVED_LOG


GROUP BY THREAD#;
s a
MAX(SEQUENCE#) THREAD#
) ha
-------------- ----------
l ฺ c om
182 1
m ai ฺ
@
4. Return to the terminal window of host01, and force a log switch to advance
9 u ide redo
g the online
log sequence number. Verify the sequence number has increased.
i z 9 nt G
u
pr tude
(host01) SQL> alter system switch logfile; (
System altered.
R ON his S
A R se t
B
IZ e to u THREAD# FROM V$ARCHIVED_LOG
(host01) SQL> SELECT MAX(SEQUENCE#),
GROUP BY THREAD#; U
R ns
MAX(SEQUENCE#)TH THREAD# e
E l i c
AB183ra----------
--------------
I Z ble
E L sfe 1
IA to -the
5. Return
C t r n window of host03, and verify that the physical standby instance is
aterminal
I
TR receiving
non
redo from the primary database instance
PA (host03) SQL> SELECT MAX(SEQUENCE#), THREAD# FROM V$ARCHIVED_LOG
GROUP BY THREAD#;
MAX(SEQUENCE#) THREAD#
-------------- ----------
183 1

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

Practices for Lesson 7: Creating a Logical Standby Database


Chapter 7 - Page 10
Edutronic Global Services EฺIฺRฺL

Practice 7-4: Convert Physical Standby to Logical Standby


Overview
In this practice, you will convert the newly created physical standby 'london2' to a logical
standby database.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Tasks
1. Use a terminal window on host03 connected as oracle with the environment variables
set to london2. Stop redo apply on the 'london2' physical standby.
(host03) SQL> alter database recover managed standby database
cancel;
Database altered.
2. Use a terminal window on host01 connected as oracle with the environment variables
set to boston. Build the LogMiner dictionary into the redo. Wait for this procedure to finish
before continuing with labs.
s a
(host01) SQL> execute dbms_logstdby.build; ) ha
PL/SQL procedure successfully completed.
l ฺ c om
i
avariables
3. Use a terminal window on host03 connected as oracle with the environment m
untilgit is ready
set to london2. Continue applying redo data to the physical standby@ i d etoฺ
convert to a logical standby database. i z 99 nt Gu
(host03) SQL> alter database recover to ( ru udstandby
plogical e london2;
N S t
Database altered.
R O his
R
A standby
4. Increase the SGA size allocated to the logical e t
database.
B u s
(host03) SQL> alter system
U IZ esettomemory_max_target=640M
scope=spfile;
T H R icens
BE ble l
System altered.
A
E LIZ SQL> f e raalter system set memory_target=640M scope=spfile;
C I
(host03)
ns
ASystemtraaltered.
I -
T5.R Shutdown
non the logical standby database on host03, and restart it in the MOUNT mode.
PA
(host03) SQL> shutdown;
ORA-01507: database not mounted
ORACLE instance shut down.

(host03) SQL> startup mount;


ORACLE instance started.
Total System Global Area 668082176 bytes
Fixed Size 2291952 bytes
Variable Size 591398672 bytes
Database Buffers 71303168 bytes
Redo Buffers 3088384 bytes
Database mounted.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Creating a Logical Standby Database


Chapter 7 - Page 11
Edutronic Global Services EฺIฺRฺL

6. Display the LOG_ARCHIVE_DEST parameters on host03 that were copied from the
primary database. Only entries that have values are displayed below.
(host03) SQL> show parameter log_archive_dest
NAME TYPE VALUE
------------------ --------- ------------------------------
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

log_archive_dest_1 string location=USE_DB_RECOVERY_FILE_


DEST valid_for = (ALL_LOGFILES,
ALL_ROLES) db_unique_name =
london2
log_archive_dest_2 string SERVICE=london2FS SYNC REOPEN=
15 valid_for=(ONLINE_LOGFILES,
PRIMARY_ROLE) db_unique_name=
bostonFS
7. Remove the LOG_ARCHIVE_DEST_2 entry on host03 since this logical database will not
s a
) ha
be a target for role reversal in this course.
(host03) SQL> alter system set log_archive_dest_2='' scope=both;
l ฺ c om
System altered.
m ai ฺ
8. Open the logical standby database.
9 @ g
u ide
(host03) SQL> alter database open resetlogs;
i z 9 nt G
u
pr tude
Database altered. (
N isfrom S the primary database.
9. Start SQL Apply to begin applying redo data that O
is received
R R t h
(host03) SQL> alter database
B A s e
start logical
u
standby apply
immediate;
Database altered. RU
IZ e to
H e n s
T
10. Open the DEV1 PDBEand verifyltheic mode that is was opened with.
A B l e
b pluggable database dev1 open;
L IZ SQL>
(host03)
f e r a
alter

A E nsdatabase
Pluggable altered.
I a
IC n-tr SQL> select con_id, name, open_mode from v$containers;
TR n(host03)
o
PA CON_ID NAME OPEN_MODE
---------- ------------------------------ ----------
1 CDB$ROOT READ WRITE
2 PDB$SEED READ ONLY
3 DEV1 READ WRITE
11. Exit SQL*Plus sessions on all host mahines. Leave the terminal session windows open with
the environment variables set.
(host01) SQL> exit;
(host03) SQL> exit;

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

Practices for Lesson 7: Creating a Logical Standby Database


Chapter 7 - Page 12
Edutronic Global Services EฺIฺRฺL
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
Practices for Lesson g 8: ide
Oracle Data Guard 9 @ Gu
9 nBroker:
i z t
Overview(pru tude
R O8N his S
AR use t
Chapter
B
IZ e to
U
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 8: Oracle Data Guard Broker: Overview


Chapter 8 - Page 1
Edutronic Global Services EฺIฺRฺL

Practices for Lesson 8: Overview


Practices Overview
There are no practices for lesson 8.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 8: Oracle Data Guard Broker: Overview


Chapter 8 - Page 2
Edutronic Global Services EฺIฺRฺL
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
Practices for Lesson g 9: ide
Creating a Data 9 @
9 Guard G u
Broker
i z t
pru tuden
Configuration
(
R O9N his S
AR use t
Chapter
B
IZ e to
U
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 9: Creating a Data Guard Broker Configuration


Chapter 9 - Page 1
Edutronic Global Services EฺIฺRฺL

Practices for Lesson 9: Overview


Practices Overview
In these practices, you will examine the differences between local and remote connections to
the Oracle Database instance using the DGMRL utility. You will also create and enable a Data
Guard broker configuration.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 9: Creating a Data Guard Broker Configuration


Chapter 9 - Page 2
Edutronic Global Services EฺIฺRฺL

Practice 9-1: Establishing Local and Remote Connections with


DGMGRL
Overview
In this practice, you will use DGMGRL and connect with both local and remote connections. The
password file will be updated on the primary database and copied to every other destination in
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

the Data Guard configuration.

Tasks
1. Use a terminal window on host01 connected as oracle with the environment variables
set to boston. Issue the "ID" command and verify that the dgdba operating system group
is assigned to the oracle account.
[oracle@host01]$ id
uid=54321(oracle) gid=54321(oinstall)
groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),5
s a
) ha
4325(dgdba),54326(kmdba)

l ฺ c om
Note: The oracle user is a member of the dgdba group. This group was specified during
i
the database software installation to be associated with the SYSDG privilege for Data Guard.
ma user
2. Launch the DGMGRL utility and verify that you are able to connect as thegsysdg
d eฺwith
@ u i
i z 99 group).
operating system authentication (The oracle OS user is in the dgdba
t G
[oracle@host01]$ dgmgrl
( p ru uden
DGMGRL for Linux: Version 12.1.0.1.0
O N - 64bit
i s StProduction
Copyright (c) 2000, 2012, Oracle.
R R All trights
h reserved.
Welcome to DGMGRL, type "help" A
B ofor e
usinformation.
I Z t
DGMGRL> connect H
RU
sysdg ens
e
Password: B ET password
<<Any l e lic will work>>
A ab
IZ asfeSYSDG.
r
L
Connected
E ns System authentication, any password will work for local connections.
I A
Note:
tra switchover and failover operation to the remote site, you must use the
With Operating
C n-during
R IHowever,
PA nopassword.
T correct
3. Attempt to make a remote connection to the physical standby database 'london' as the
sysdg user. You must use the password that is in the password file. Exit DGMGRL.
(host01) DGMGRL> connect sysdg@london
Password: oracle_4U
ORA-01017: invalid username/password; logon denied

(host01) DGMGRL> exit


Note: During the creation of the database, the option to use the same password for all
administrative accounts was chosen. However, this only applied to the SYS and SYSTEM
database accounts.

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

Practices for Lesson 9: Creating a Data Guard Broker Configuration


Chapter 9 - Page 3
Edutronic Global Services EฺIฺRฺL

4. Use SQL*Plus on host01 connected as SYSDBA to reset the SYSDG password and
unlock the account. Exit SQL*Plus.
[oracle@host01]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Wed Sep 11 06:17:09
2013
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -
64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real
Application Testing options

(host01) SQL> alter user sysdg identified by oracle_4U;


User altered.
s a
(host01) SQL> alter user sysdg account unlock; ) ha
User altered.
l ฺ c om
m ai ฺ
(host01) SQL> exit;
9 @ g
u ide
5. Copy the modified password file to all other machines overwriting i z n G files that
9the password
t
are already there. On host03, a password file is needed
u e
pforr bothtuthedphysical standby
(
ON hifiles
database and the logical standby database. The password
R s Sshould be renamed during
AR use t
the copy to the appropriate names for each destination.
B
[oracle@host01]$ scp $ORACLE_HOME/dbs/orapwboston
IZ e to
U
host02:/u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwbostonFS
orapwboston
T H R icens 100% 7680 7.5KB/s 00:00
BE ble l
A
E LIZ sfera scp $ORACLE_HOME/dbs/orapwboston
[oracle@host01]$
host03:/u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwlondon
I C IAorapwboston
- t r an 100% 7680 7.5KB/s 00:00
TR non
PA [oracle@host01]$ scp $ORACLE_HOME/dbs/orapwboston
host03:/u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwlondon2
orapwboston 100% 7680 7.5KB/s 00:00

[oracle@host01]$ scp $ORACLE_HOME/dbs/orapwboston


host04:/u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwlondonFS
orapwboston 100% 7680 7.5KB/s 00:00

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

Practices for Lesson 9: Creating a Data Guard Broker Configuration


Chapter 9 - Page 4
Edutronic Global Services EฺIฺRฺL

6. Launch the DGMGRL utility on host01 and verify that you are now able to establish a
remote connection as sysdg to the physical standby database. Exit DGMGRL when done.
[oracle@host01]$ dgmgrl
DGMGRL for Linux: Version 12.1.0.1.0 - 64bit Production
Copyright (c) 2000, 2012, Oracle. All rights reserved.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Welcome to DGMGRL, type "help" for information.

(host01) DGMGRL> connect sysdg/oracle_4U@london


Connected as SYSDG.

(host01) DGMGRL> exit

s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 9: Creating a Data Guard Broker Configuration


Chapter 9 - Page 5
Edutronic Global Services EฺIฺRฺL

Practice 9-2: Create and Enable a Data Guard Broker Configuration


Overview
In this practice, you will create and name the Data Guard configuration. The physical standby
database, far sync instances, and logical standby database will be added to the configuration.
You will enable the configuration and define redo routing rules.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Tasks
1. Use a terminal window on host01 connected as oracle with the environment variables
set to 'boston'. Connect to the primary database using SQL*Plus and reset the
LOG_ARCHIVE_DEST_2 and LOG_ARCHIVE_DEST_3 parameters since they are defined as
network locations. Start the Data Guard Broker process. Make sure the changes are
persistent. Exit SQL*Plus.
[oracle@host01]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Wed Sep 11 06:17:09
s a
) ha
2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
l ฺ c om
Connected to:
m ai ฺ
g ide
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -
64bit Production 9 @
9 nt G u
u i z
With the Partitioning, OLAP, Advanced Analytics and Real
Application Testing options ( pr tude
O N is S
R th
R log_archive_dest_2=''
(host01) SQL> alter system set
B A s e scope=both;
System altered.
U IZ e to u
(host01) SQL> T H R system
e n sset log_archive_dest_3='' scope=both;
BE ble lic
alter
A
System altered.

E LIZ sfera
C I A(host01)
t r a nSQL> alter system set dg_broker_start=true scope=both;
I
TR nSystemon- altered.
PA (host01) SQL> exit
2. Use a terminal window on host02 connected as oracle with the environment variables
set to 'bostonFS'. Connect to the Far Sync using SQL*Plus and reset the
LOG_ARCHIVE_DEST_2 parameter since it is defined as network location. Start the Data
Guard broker process for the Far Sync. Exit SQL*Plus.
[oracle@host02]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Wed Sep 11 06:17:09
2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -
64bit Production

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

Practices for Lesson 9: Creating a Data Guard Broker Configuration


Chapter 9 - Page 6
Edutronic Global Services EฺIฺRฺL

With the Partitioning, OLAP, Advanced Analytics and Real


Application Testing options

(host02) SQL> alter system set log_archive_dest_2='' scope=both;


System altered.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

(host02) SQL> alter system set dg_broker_start=true scope=both;


System altered

(host02) SQL> exit


3. Use a terminal window on host03 connected as oracle with the environment variables
set to 'london'. Connect to the physical standby using SQL*Plus and stop managed
recovery. Reset the LOG_ARCHIVE_DEST_2 parameter since it is defined as network
location. Start the Data Guard broker process for the physical standby database.
[oracle@host03]$ sqlplus / as sysdba
s a
SQL*Plus: Release 12.1.0.1.0 Production on Wed Sep 11 06:17:09 ) ha
2013
l ฺ c om
Copyright (c) 1982, 2013, Oracle. All rights reserved.
m ai ฺ
Connected to:
9 @ g
u ide
z 9 nt G
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -
i
64bit Production u
pr tude
(
ON his S
With the Partitioning, OLAP, Advanced Analytics and Real
Application Testing options R
B AR use t
IZ e recover
(host03) SQL> alter database
U t o managed standby database

H R icens
cancel;
T
BE ble l
Database altered.
A
E LIZ SQL>
(host03)
f e raalter system set log_archive_dest_2='' scope=both;
C I ns
ASystemtraaltered
I
TR non-
PA (host03) SQL> alter system set dg_broker_start=true scope=both;
System altered
4. If you are using a separate window for the host03/london2 combination, then you can skip
the part about resetting the environment variables. Otherwise, while still using the terminal
window for host03, exit SQL*Plus. Change the environment variables to the 'london2'
logical standby database. The logical standby does not have any network locations defined
for redo transportation. Start the Data Guard broker process. Exit SQL*Plus.
(host03) SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release
12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real
Application Testing options

[oracle@host03]$ . oranev

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

Practices for Lesson 9: Creating a Data Guard Broker Configuration


Chapter 9 - Page 7
Edutronic Global Services EฺIฺRฺL

ORACLE_SID = [oracle] ? london2


The Oracle base has been set to /u01/app/oracle

[oracle@host03]$ sqlplus / as sysdba


SQL*Plus: Release 12.1.0.1.0 Production on Tue Jun 11 03:51:01
2013
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -
64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real
Application Testing options

(host03) SQL> alter database stop logical standby apply;


Database altered.
s a
) ha
(host03) (london2) SQL> alter system set dg_broker_start=true
l ฺ c om
scope=both;
m ai ฺ
System altered.
9 @ g
u ide
i z 9 nt G
(host03) SQL> exit u
r ude
pwith
5. Use a terminal window on host04 connected as oracle
(
N is Sthet environment variables
O
R SQL*Plus
set to 'londonFS'. Connect to the Far Sync using
A R e thnetwork
and reset the
LOG_ARCHIVE_DEST_2 parameter since
Z B it is s
defined
u as location. Start the Data
I Exit
Guard broker process for the Far Sync.
U e o
tSQL*Plus.
R
Hsqlplus s
n/ as sysdba
[oracle@host04]$
T l i c e
BE ble12.1.0.1.0 Production on Wed Sep 11 06:17:09
SQL*Plus: Release
2013 ZA
E LI s(c)
Copyright f era1982, 2013, Oracle. All rights reserved.
I C IAConnected
- t r an to:
TR nOracle on Database 12c Enterprise Edition Release 12.1.0.1.0 -
PA 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real
Application Testing options

(host04) SQL> alter system set log_archive_dest_2='' scope=both;


System altered

(host04) SQL> alter system set dg_broker_start=true scope=both;


System altered

(host04) SQL> exit

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

Practices for Lesson 9: Creating a Data Guard Broker Configuration


Chapter 9 - Page 8
Edutronic Global Services EฺIฺRฺL

6. Use a terminal window on host01 connected as oracle with the environment variables
set to 'boston'. Launch DGMGRL and attempt to show the configuration.
[oracle@host01]$ dgmgrl
DGMGRL for Linux: Version 12.1.0.1.0 - 64bit Production
Copyright (c) 2000, 2012, Oracle. All rights reserved.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Welcome to DGMGRL, type "help" for information.

(host01) DGMGRL> connect sysdg/oracle_4U@boston


Connected as SYSDG.

(host01) DGMGRL> show configuration


ORA-16532: Data Guard broker configuration does not exist
Configuration details cannot be determined by DGMGRL
7. Create the Data Guard broker configuration and then show the configuration. s a
(host01) DGMGRL> create configuration 'DRSolution' as primary ) ha
database is 'boston' connect identifier is boston;
l ฺ c om
ai ฺ
Configuration "DRSolution" created with primary database
m
"boston"
9 @ g
u ide
i z 9 nt G
(host01) DGMGRL> show configuration u
pr tude
(
Configuration - DRSolution
R ON his S
B AR use t
Protection Mode: MaxPerformance
Databases: U IZ e to
T H Rdatabase
e n s
BE ble lic
boston - Primary

A
LIZ sfFailover:
Fast-Start
E era DISABLED

I C IA -tran
TR nConfiguration
on Status:
PA DISABLED
Note: Since the Data Guard broker is a distributed framework, the DGMGRL utility can be
launched from any host machine that participates in the Data Guard configuration. The labs
will continue to display the machine name (host01), and therefore the terminal session
window being used, for which the DGMGRL utility was launched. It would be acceptable
though to launch it from another terminal session connected to another virtual host
machine.
8. Add the Far Sync 'bostonFS' to the configuration and show the results.
(host01) DGMGRL> add far_sync 'bostonFS' as connect identifier
is bostonFS;
far sync instance "bostonFS" added

(host01) DGMGRL> show configuration


Configuration - DRSolution
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 9: Creating a Data Guard Broker Configuration


Chapter 9 - Page 9
Edutronic Global Services EฺIฺRฺL

Protection Mode: MaxPerformance


Databases:
boston - Primary database
bostonFS - Far Sync (inactive)
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Fast-Start Failover: DISABLED

Configuration Status:
DISABLED
9. Add the physical standby database 'london' to the configuration and show the results.
(host01) DGMGRL> add database 'london' as connect identifier is
london;
Database "london" added
s a
) ha
(host01) DGMGRL> show configuration
l ฺ c om
Configuration - DRSolution
m ai ฺ
9 @ g
u i de
Protection Mode: MaxPerformance
i z 9 nt G
Databases: u
pr tude
(
boston - Primary database
R ON his S
AR database
bostonFS - Far Sync (inactive)
e t
B s
london
IZ e to u
- Physical standby
U
T H R iDISABLED
e n s
BE ble l c
Fast-Start Failover:
A
LIZ sferaStatus:
Configuration
E
I C IADISABLED
- t r an
R Addnthe
T10. onlogical standby database 'london2' to the configuration and show the results.
PA (host01) DGMGRL> add database 'london2' as connect identifier is
london2;
Database "london2" added

(host01) DGMGRL> show configuration


Configuration - DRSolution

Protection Mode: MaxPerformance


Databases:
boston - Primary database
bostonFS - Far Sync (inactive)
london - Physical standby database
london2 - Logical standby database
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 9: Creating a Data Guard Broker Configuration


Chapter 9 - Page 10
Edutronic Global Services EฺIฺRฺL

Fast-Start Failover: DISABLED

Configuration Status:
DISABLED
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

11. Add the Far Sync 'londonFS' to the configuration and show the results.
(host01) DGMGRL> add far_sync 'londonFS' as connect identifier
is londonFS;
far sync instance "londonFS" added

(host01) DGMGRL> show configuration


Configuration - DRSolution

Protection Mode: MaxPerformance


s a
Databases:
) ha
boston - Primary database
l ฺ c om
bostonFS - Far Sync (inactive)
m ai ฺ
london - Physical standby database
9 @ g
u ide
london2 - Logical standby database
i z 9 nt G
londonFS - Far Sync (inactive) u
pr tude
(
Fast-Start Failover: DISABLEDRR
ON his S
B A use t
U IZ e to
H R icens
Configuration Status:
DISABLED T l
BE broker
12. Enable the DataAGuard b l e configuration and show the results.
L I Z r a
E nDGMGRL>
(host01)
A s fe enable configuration
I
IC Enabled.
- tra
T R no n
PA (host01) DGMGRL> show configuration
Configuration - DRSolution

Protection Mode: MaxPerformance


Databases:
boston - Primary database
bostonFS - Far Sync (inactive)
london - Physical standby database
london2 - Logical standby database
londonFS - Far Sync (inactive)

Fast-Start Failover: DISABLED

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

Practices for Lesson 9: Creating a Data Guard Broker Configuration


Chapter 9 - Page 11
Edutronic Global Services EฺIฺRฺL

Configuration Status:
SUCCESS
13. Define redo routing rules for the configuration and show the results. The current primary
database 'boston' should forward redo to the Far Sync 'bostonFS' synchronously. The
Far Sync 'bostonFS' should forward redo to both the physical standby 'london' and to the
logical standby 'london2' asynchronously. Additional redo routing rules should be created
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

for role reversal. After role reversal, the primary database will be 'london' and should
forward redo to the Far Sync 'londonFS' synchronously. The Far Sync 'londonFS' should
then forward redo to the physical standby 'boston' and the logical standby 'london2'.
(host01) DGMGRL> EDIT DATABASE 'boston' SET PROPERTY
'RedoRoutes' = '(boston:bostonFS SYNC)';
Property "RedoRoutes" updated

(host01) DGMGRL> EDIT FAR_SYNC 'bostonFS' SET PROPERTY


'RedoRoutes' = '(boston:london,london2 ASYNC)';
s a
Property "RedoRoutes" updated
) ha
l ฺ c om
(host01) DGMGRL> EDIT DATABASE 'london' SET PROPERTY ai
'RedoRoutes' = '(london:londonFS SYNC)';
@ gm ideฺ
Property "RedoRoutes" updated
i z 99 nt Gu
( p ru ude
O i s St PROPERTY
N ASYNC)';
(host01) DGMGRL> EDIT FAR_SYNC 'londonFS' SET

RR se th
'RedoRoutes' = '(london:boston,london2
A
Property "RedoRoutes" updated
I Z B ou
R U e t
(host01) DGMGRL> n s
Hshowicconfiguration;
e
T l
BE - bDRSolution
Configuration
A le
I Z
L sfeMode: r a
A E n
Protection MaxPerformance
I a
n-tr
IC Databases:
TR noboston
PA - Primary database
bostonFS - Far Sync
london - Physical standby database
london2 - Logical standby database
londonFS - Far Sync (inactive)

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

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

Practices for Lesson 9: Creating a Data Guard Broker Configuration


Chapter 9 - Page 12
Edutronic Global Services EฺIฺRฺL

Note: If you output does not match the above. Do not proceed with labs until all issues
have been resolved. You may need to reissue the SHOW CONFIGURATION command
several times to give the Virtual Machines time to catch up with all the background
operations that need to be performed. For example in one test case, it was noted that the
london2 logical standby database was receiving "ORA-16810: multiple errors or
warnings detected for this database." To further diagnose the problem issue the
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

command "show database london2". SQL Apply had stopped with an "ORA-16768:
SQL Apply is stopped" message, followed by "ORA-01304: subordinate
process error. Check alert and trace logs." An examination of the alert log
indicated that SQL Apply had stopped due to an "ORA-4031: unable to allocate
XXX bytes of shared memory." SQL Apply was restarted with the command "edit
database london set state='APPLY-ON'", at which time the configuration reported
everything acceptable. Please consult with your instructor if you need to troubleshoot any
issues.

s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 9: Creating a Data Guard Broker Configuration


Chapter 9 - Page 13
Edutronic Global Services EฺIฺRฺL
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 9: Creating a Data Guard Broker Configuration


Chapter 9 - Page 14
Edutronic Global Services EฺIฺRฺL
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
Practices for Lesson g 10: ide
Monitoring a iData 9 @
9 Guard G u
z t
pru tuden
Broker Configuration
(
R O10N his S
AR use t
Chapter
B
IZ e to
U
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 10: Monitoring a Data Guard Broker Configuration


Chapter 10 - Page 1
Edutronic Global Services EฺIฺRฺL

Practices for Lesson 10: Overview


Practices Overview
In these practices, you will use the DGMGRL utility to monitor your physical standby database.
You will also examine the use of trace files to monitor the Data Guard environment.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 10: Monitoring a Data Guard Broker Configuration


Chapter 10 - Page 2
Edutronic Global Services EฺIฺRฺL

Practice 10-1: Monitoring the Physical Standby Database


Overview
In this practice, you will use DGMGRL and connect with both local and remote connections. The
password file will be updated on the primary database and copied to every other destination in
the Data Guard configuration.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Tasks
1. Use a terminal window on host01 connected as oracle with the environment variables set to
'boston'. Launch DGMGRL connecting as the sysdg user with operating system
authentication.
[oracle@host01]$ dgmgrl
DGMGRL for Linux: Version 12.1.0.1.0 - 64bit Production
Copyright (c) 2000, 2012, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
s a
) ha
DGMGRL> connect sysdg/oracle_4U@boston
l ฺ c om
Connected as SYSDG.
m ai ฺ
2. Use the SHOW CONFIGURATION VERBOSE command to display the current
@ g valuesi e the
dfor
CommunicationTimeout property and the OperationTimeout 9
9 property.G u
u i z n t
(host01) DGMGRL> show configuration verbose
( pr tude
Configuration - DRSolution
R ON his S
A R se t
Z
Protection Mode: MaxPerformance
I B o u
Databases: U
R nse t
boston T H
- Primary
i c e
database
E l
AB -raFar
bostonFS
I Z b leSync
E L london
s f e - Physical standby database
I C an
IA -trlondon2 - Logical standby database
TR non londonFS - Far Sync (inactive)
PA
Properties:
FastStartFailoverThreshold = '30'
OperationTimeout = '30'
TraceLevel = 'USER'
FastStartFailoverLagLimit = '30'
CommunicationTimeout = '180'
ObserverReconnect = '0'
FastStartFailoverAutoReinstate = 'TRUE'
FastStartFailoverPmyShutdown = 'TRUE'
BystandersFollowRoleChange = 'ALL'
ObserverOverride = 'FALSE'

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

Practices for Lesson 10: Monitoring a Data Guard Broker Configuration


Chapter 10 - Page 3
Edutronic Global Services EฺIฺRฺL

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS
3. Modify the CommunicationTimeout property and set it to a value of 300. Verify the
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

result.
(host01) DGMGRL> edit configuration set property
'CommunicationTimeout' = 300;
Property "CommunicationTimeout" updated

(host01) DGMGRL> show configuration verbose



Properties:
FastStartFailoverThreshold = '30'
s a
) ha
OperationTimeout = '30'
TraceLevel =
l ฺ om
'USER'
c
FastStartFailoverLagLimit
m ai ฺ
= '30'
CommunicationTimeout
9 @ g =
u ide'300'
ObserverReconnect
i z 9 nt G = '0'
FastStartFailoverAutoReinstate u
pr tude = 'TRUE'
… (
N is S
R Olabs h in the Virtual Machine
A R
Note: This is not normally needed but it helps with
e trunning
architecture.
I Z B o us
4. Modify the OperationTimeout
R Uproperty e t set it to the maximum value of 300. Verify
and
the result. H icen s
T
E edit l configuration set property
B
(host01) DGMGRL>
A l e
IZ ferab = 300;
'OperationTimeout'
L
A E n"CommunicationTimeout"
Property s updated
I
IC n-tr a
TR n(host01)
o
PA …
DGMGRL> show configuration verbose

Properties:
FastStartFailoverThreshold = '30'
OperationTimeout = '300'
TraceLevel = 'USER'
FastStartFailoverLagLimit = '30'
CommunicationTimeout = '300'
ObserverReconnect = '0'
FastStartFailoverAutoReinstate = 'TRUE'

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

Practices for Lesson 10: Monitoring a Data Guard Broker Configuration


Chapter 10 - Page 4
Edutronic Global Services EฺIฺRฺL

5. Use the SHOW DATABASE command for the physical standby database and determine the
current transport lag, apply lag, and apply rate.
(host01) DGMGRL> show database london
Database - london
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Role: PHYSICAL STANDBY


Intended State: APPLY-ON
Transport Lag: 0 seconds (computed 0 seconds ago)
Apply Lag: 0 seconds (computed 0 seconds ago)
Apply Rate: 0 Byte/s
Real Time Query: OFF
Instance(s):
london

s a
) ha
Database Status:
SUCCESS
l ฺ c om
6. Stop redo apply on the physical standby database to force an apply rate lag toa i
occur.
(host01) DGMGRL> edit database london set state = 'APPLY-OFF';
@ g m
i d eฺ
Succeeded.
i z 99 nt Gu
u de
prdatabase.
(
7. Without exiting DGMGRL, force a log switch on the primary
N is Stu
Note: You are currently connected to the primaryO
database.
(host01) DGMGRL> SQL "alterAsystem RR sswitch
e th logfile";
I Z B ou
Succeeded.
R U forsthe
e t
H icen physical standby database and display the
8. Use the SHOW DATABASE command
T
E le l
current apply lag rate.
B
I
(host01) A
Z DGMGRL> r a bshow database london
L
E n-sflondon
Database e
I A
R IC n-tra
PA
T noRole: PHYSICAL STANDBY
Intended State: APPLY-OFF
Transport Lag: 0 seconds (computed 0 seconds ago)
Apply Lag: 33 seconds (computed 0 seconds ago)
Apply Rate: (unknown)
Real Time Query: OFF
Instance(s):
london

Database Status:
SUCCESS

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

Practices for Lesson 10: Monitoring a Data Guard Broker Configuration


Chapter 10 - Page 5
Edutronic Global Services EฺIฺRฺL

9. Display the standby receive queue for the physical standby database.
(host01) DGMGRL> show database london 'RecvQEntries';
STANDBY_RECEIVE_QUEUE
STATUS RESETLOGS_ID THREAD
LOG_SEQ TIME_GENERATED TIME_COMPLETED
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

FIRST_CHANGE# NEXT_CHANGE# SIZE (KBs)


PARTIALLY_APPLIED 837070180 1
41 01/17/2014 13:26:46 01/17/2014 14:22:47 2084714
2096633 8084
10. Restart redo apply on the physical standby database. Verify that the apply lag has been
cleared. Exit DGMGRL when done.
Note: You may have to wait a minute after restarting redo apply to verify the results.
(host01) DGMGRL> edit database london set state = 'APPLY-ON';
Succeeded.
s a
(host01) DGMGRL> show database london ) ha
Database - london
l ฺ c om
m ai ฺ
Role: PHYSICAL STANDBY
9 @ g
u ide
i z 9 nt G
Intended State: APPLY-ON
u
pr0 secondsde ago)
Transport Lag: (
0 seconds (computed
t u
Apply Lag:
R ON his0 Sseconds ago)
0 seconds (computed
Apply Rate: AR use t
0 Byte/s
B
Real Time Query:
U IZ e to
OFF
Instance(s):
H R ns
london E T l i c e
I Z AB rable
E L Status:
Database s fe
I A tra n
R IC SUCCESS
n -
PA
T no (host01) DGMGRL> exit;

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

Practices for Lesson 10: Monitoring a Data Guard Broker Configuration


Chapter 10 - Page 6
Edutronic Global Services EฺIฺRฺL

Practice 10-2: Examining Data Guard Log and Trace Files


Overview
In this practice, you will locate and examine the Data Guard log and trace files.

Tasks
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

1. Use a terminal window on host01 connected as oracle with the environment variables
set to 'boston'. Connect to the primary database using SQL*Plus and determine the root
directory for the Automatic Diagnostic Repository (ADR). Exit SQL*Plus when done.
[oracle@host01]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Tue Oct 15 21:07:58
2013

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


s a
Connected to: ) ha
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -
l ฺ c om
64bit Production
m ai ฺ
With the Partitioning, OLAP, Advanced Analytics and Real
9 @ g
u ide
Application Testing options
i z 9 nt G
u
(host01) SQL> show parameter diag N
(pr Stude
R RO this
NAME TYPE BA VALUE
Z u se
R UI se to------------------------------
------------------ -----------
diagnostic_dest T H string c e n /u01/app/oracle
E
B ble l i
I Z A raexit;
L SQL>
(host01)
E f e
I
2. Change
C A directory
t r a nsto the "trace" subdirectory located underneath the Automatic Diagnostic
I - home location. The ADR home is located at
TR Repository
n o n
PA <diagnostic_dest>/diag/rdbms/<dbname>/<instance_name>.
[oracle@host01]$ cd
/u01/app/oracle/diag/rdbms/boston/boston/trace
3. Verify that the previous commands that changed the state of redo apply and connection
timeout where recorded in the Data Guard broker log file. The broker log file is named
drc<db_unique_name>.log.
[oracle@host01]$ grep CommunicationTimeout drcboston.log
EDIT CONFIGURATION SET PROPERTY CommunicationTimeout = 300

[oracle@host01]$ grep APPLY drcboston.log


EDIT DATABASE london SET STATE = APPLY-OFF
EDIT DATABASE london SET STATE = APPLY-ON

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

Practices for Lesson 10: Monitoring a Data Guard Broker Configuration


Chapter 10 - Page 7
Edutronic Global Services EฺIฺRฺL

4. Use the "ls -alt | more" command to list the directory contents of the trace directory
sorted by modification time descending. The most recent modified file will be displayed first.
[oracle@host01]$ ls -alt | more
total 12084
-rw-r----- 1 oracle oinstall 4266449 Oct 15 21:20 drcboston.log
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

-rw-r----- 1 oracle oinstall 8602 Oct 15 21:18


boston_mmon_10187.trc
-rw-r----- 1 oracle oinstall 868 Oct 15 21:18
boston_mmon_10187.trm
drwxr-x--- 2 oracle oinstall 36864 Oct 15 20:58 .
-rw-r----- 1 oracle oinstall 2256 Oct 15 20:51
boston_nsv1_7354.trc
-rw-r----- 1 oracle oinstall 217 Oct 15 20:51
boston_nsv1_7354.trm

s a
5. Use a terminal window on host01 connected as oracle with the environment variables ) ha
set to 'boston'. Connect to the primary database using SQL*Plus and set the level to
l ฺ c om
16 to
i
track detailed archived redo log destination activity. Force a log switch and exitaSQL*Plus
when done.
@ gm ideฺ
[oracle@host01]$ sqlplus / as sysdba
i z 99 nt Gu
SQL*Plus: Release 12.1.0.1.0 Production on
( pru Tue u d e 15 21:21:32
Oct
2013
O N i s St reserved.
Copyright (c) 1982, 2013, Oracle.
A RR se th All rights
Connected to:
I Z B ou
U se t Edition Release 12.1.0.1.0 -
Oracle Database 12c Enterprise
64bit Production R
T H iceOLAP, n Advanced Analytics and Real
BETesting
With the Partitioning, l
le options
Z
Application
I A a b
E L sfer
I C r an system set log_archive_trace=16;
IASQL>-talter
TR nSystem on altered.
PA
SQL> alter system switch logfile;
System altered.

(host01) SQL> exit;


6. Use the "ls -alt | more" command to list the directory contents of the trace directory
sorted by modification time descending. Identify the newly created files in the directory that
were not present for the previous step 4.
[oracle@host01]$ ls -alt | more
total 12104
-rw-r----- 1 oracle oinstall 16177 Oct 15 21:22
boston_lgwr_10177.trc

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

Practices for Lesson 10: Monitoring a Data Guard Broker Configuration


Chapter 10 - Page 8
Edutronic Global Services EฺIฺRฺL

-rw-r----- 1 oracle oinstall 1202 Oct 15 21:22


boston_lgwr_10177.trm
-rw-r----- 1 oracle oinstall 8490 Oct 15 21:22
boston_nss2_10213.trc
-rw-r----- 1 oracle oinstall 540 Oct 15 21:22
boston_nss2_10213.trm
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

-rw-r----- 1 oracle oinstall 274595 Oct 15 21:22


alert_boston.log
-rw-r----- 1 oracle oinstall 2179 Oct 15 21:22
boston_arc0_10217.trc
-rw-r----- 1 oracle oinstall 181 Oct 15 21:22
boston_arc0_10217.trm

7. The resulting log writer process (LGWR) and network server sync process (NSS) trace files
can be very large in size. Since the primary database is configured for SYNC redo transport
s a
) ha
to the 'bostonFS' far sync destination, verify that communication occurred to this
destination in the trace file using the "grep destination <NSS2 trace file name>"
command. The trace file name must be determined from the previous step. You may
l ฺ c om
explore the contents of the trace files if desired.
m ai ฺ
[oracle@host01]$ grep destination boston_nss2_10213.trc
9 @ g
u ide
NSS2: connecting to remote destination bostonfs i z 9 nt G
NSS2: connecting to remote destination(p
u
r ude
bostonfs
NSS2: connecting to remote destination O N bostonfs
i s St
8. Use a terminal window on host01 connected A RR e
as oraclethwith the environment variables
s SQL*Plus and set the
I Z
set to 'boston'. Connect to the primary Bdatabase
o uusing
to U
t
log_archive_trace level R
H e n se tracing. Exit SQL*Plus when done.
0 to disable

ET sqlplus
[oracle@host01]$
B e l ic / as sysdba
SQL*Plus:
2013LI
ZA Release
r a bl 12.1.0.1.0 Production on Tue Oct 15 21:21:32
A E ns(c) fe
I C I Copyright
- t r a 1982, 2013, Oracle. All rights reserved.
TR nConnected
on to:
PA Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -
64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real
Application Testing options

(host01) SQL> alter system set log_archive_trace=0;


System altered.

(host01) SQL> exit;

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

Practices for Lesson 10: Monitoring a Data Guard Broker Configuration


Chapter 10 - Page 9
Edutronic Global Services EฺIฺRฺL
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 10: Monitoring a Data Guard Broker Configuration


Chapter 10 - Page 10
Edutronic Global Services EฺIฺRฺL
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
Practices for Lesson g 11: ide
Configuring Data 9 @ u
9 Protection
G
i z n t
Modes (pru tude
R O11N his S
AR use t
Chapter
B
IZ e to
U
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 11: Configuring Data Protection Modes


Chapter 11 - Page 1
Edutronic Global Services EฺIฺRฺL

Practices for Lesson 11: Overview


Practices Overview
In these practices, you will examine the various protection modes and the impact that they may
have on the primary database.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 11: Configuring Data Protection Modes


Chapter 11 - Page 2
Edutronic Global Services EฺIฺRฺL

Practice 11-1: Examining the Maximum Availability Protection Mode


Overview
In this practice, you will use DGMGRL to view the current protection mode and modify it to
maximum availability. You will simulate a problem on the standby database and observe the
impact if any to the primary database.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Tasks
1. Use a terminal window on host01 connected as oracle with the environment variables
set to boston. Launch the DGMGRL utility and connect as the sysdg user with operating
system authentication.
[oracle@host01]$ dgmgrl
DGMGRL for Linux: Version 12.1.0.1.0 - 64bit Production
Copyright (c) 2000, 2012, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
s a
) ha
(host01) DGMGRL> connect sysdg/oracle_4U@boston
l ฺ c om
Connected as SYSDG.
m ai ฺ
g modeidfore the
2. Use the SHOW CONFIGURATION command to display the current protection
@
Data Guard configuration.
i z 9 nt Gu
9
(host01) DGMGRL> show configuration
( p ru ude
Configuration - DRSolution
O N is St
A RR se th
Protection Mode: MaxPerformance
I Z B ou
Databases:
R U se t
boston H idatabase
- Primary
T c e n
bostonFS BE- Far l e l
Sync
A b
Z era- Physical standby database
E LIlondonsf - Logical standby database
I A tr a n
london2
IC
TR non-
londonFS - Far Sync (inactive)

PA Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS
3. Using DGMGRL, determine the current LogXptMode for the far sync instance and the
physical standby database.
(host01) DGMGRL> show far_sync 'bostonFS' 'LogXptMode';
LogXptMode = 'ASYNC';

(host01) DGMGRL> show database london 'LogXptMode';


LogXptMode = 'ASYNC';

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

Practices for Lesson 11: Configuring Data Protection Modes


Chapter 11 - Page 3
Edutronic Global Services EฺIฺRฺL

4. Optional: If the current LogXptMode is not reported as 'ASYNC' for both the far sync
instance and the physical standby database, then explicitly set it to 'ASYNC'. Exit DGMGRL
when done.
(host01) DGMGRL> edit far_sync 'bostonFS' set property
'LogXptMode' = 'ASYNC';
Property "LogXptMode" updated
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

(host01) DGMGRL> edit database london set property LogXptMode =


ASYNC;
Property "logxptmode" updated

(host01) DGMGRL> exit;


Note: Database names, far sync instance names, property names and property values do
not need to be enclosed with single quote marks unless they are case sensitive. The
documentation examples generally use a single quote for both property names and
s a
property values and that convention has been followed in these labs. For the above
) ha
l ฺ om
example, only the far sync name 'bostonFS' would require it to be enclosed by single
c
quotes. The second edit command does not use any single quotes for illustration.
5. m ai ฺ
Use a terminal window on host01 connected as oracle with the environment variables set to
@ g ide
'boston'. Connect to the primary database using SQL*Plus and determine the current
9 u
i z 9 nt G
value for the LOG_ARCHIVE_DEST_2 parameter. What is the current LogXptMode? Exit
SQL*Plus. u
pr tude
(
N sS
RO thion
[oracle@host01]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 R Production Wed Oct 16 19:22:29
2013 A
BOracle. e
usAll rights reserved.
U se
Copyright (c) 1982, 2013, I Z t o
Connected to: R n
H12c Enterprise
T
E le
Oracle Database
l i c e Edition Release 12.1.0.1.0 -
B
IZAPartitioning,
b
64bit Production
WithLthe
f e r a OLAP, Advanced Analytics and Real
E s
I C IA -tran
Application Testing options

TR n(host01)
on
PA
SQL> show parameter LOG_ARCHIVE_DEST_2

NAME TYPE VALUE


------------------- ----------- ----------------------------
log_archive_dest_2 string service="bostonfs", SYNC
AFFIRM delay=0 optional
compression=disable
max_failure=0
max_connections=1 reopen=300
db_unique_name="bostonFS"
net_timeout=30, valid_for=
(online_logfile, all_roles)

(host01) SQL> exit;

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

Practices for Lesson 11: Configuring Data Protection Modes


Chapter 11 - Page 4
Edutronic Global Services EฺIฺRฺL

6. Use a terminal window on host01 connected as oracle with the environment variables
set to boston. Launch the DGMGRL utility and connect as the sysdg user with operating
system authentication.
[oracle@host01]$ dgmgrl
DGMGRL for Linux: Version 12.1.0.1.0 - 64bit Production
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

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


Welcome to DGMGRL, type "help" for information.

(host01) DGMGRL> connect sysdg/oracle_4U@boston


Connected as SYSDG.
7. Display the value for the 'RedoRoutes' property of the primary database.
(host01) DGMGRL> show database 'boston' 'RedoRoutes';
RedoRoutes = '(boston:bostonFS SYNC)'
Note: When the property 'RedoRoutes' has been defined, it takes precedence over the
s a
value of the property 'LogXptMode'. The property 'LogXptMode' will continue to report
) ha
'ASYNC' even though the actual transport mode is currently 'SYNC'.
l ฺ c om
8. Modify the 'RedoRoutes' property for the 'boston' primary database and set it a toithe
'ASYNC' redo transport mode.
@ g m
i d eฺ
(host01) DGMGRL> edit database boston set property
i z Gu
99 n'RedoRoutes'
t
= '(boston:bostonFS ASYNC)';
( p ru ude
Property "RedoRoutes" updated
O N is St
R
9. Attempt to change the configuration mode toRmaximum h
tavailability and notice the results.
A e
B o us set protection mode as
maxavailability; I
U se t Z
(host01) DGMGRL> edit configuration
R
H operation n disallowed since no standby
Error: ORA-16627:
databases B
T
E remain l i c e
A
would
b l e to support protection mode

L IZ fera
E
AFailed. ns
C I t r a
RIModify
T10. non
the- 'RedoRoutes' property for the 'boston' primary database and set it to the new
PA 'FASTSYNC' redo transport mode.
(host01) DGMGRL> edit database boston set property 'RedoRoutes'
= '(boston:bostonFS FASTSYNC)';
Property "RedoRoutes" updated
11. Change the configuration mode to maximum availability and verify the results.
(host01) DGMGRL> edit configuration set protection mode as
maxavailability;
Succeeded.

(host01) DGMGRL> show configuration;

Configuration - DRSolution

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

Practices for Lesson 11: Configuring Data Protection Modes


Chapter 11 - Page 5
Edutronic Global Services EฺIฺRฺL

Protection Mode: MaxAvailability


Databases:
boston - Primary database
bostonFS - Far Sync
london - Physical standby database
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

london2 - Logical standby database


londonFS - Far Sync (inactive)

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS
12. Use a terminal window on host03 connected as oracle with the environment variables set to
'london'. Connect to the physical standby database using SQL*Plus and perform a
s a
) ha
shutdown abort.
[oracle@host03]$ . oraenv
l ฺ c om
ORACLE_SID = [london2] ? london
m ai ฺ
9 @ g
u ide
The Oracle base remains unchanged with value /u01/app/oracle

i z 9 nt G
[oracle@host03]$ sqlplus / as sysdba u
r ude
pon
SQL*Plus: Release 12.1.0.1.0 Production (
N is SThu t Dec 12 17:16:46
R O
e thrights reserved.
2013
Copyright (c) 1982, 2013, B AR usAll
Oracle.
Connected to:
U IZ e to
Oracle Database H R Enterprise
n s Edition Release 12.1.0.1.0 -
T
12c
E le lic
64bit Production e
A B b
L IZ Partitioning,
With the
e r a OLAP, Advanced Analytics and Real

A E nsf
Application Testing options
I tra SQL> shutdown abort;
IC (host03)
-
T R no n
PA ORACLE instance shut down.
13. Return to the DGMGRL session running on host01 and display the configuration.
(host01) DGMGRL> show configuration

Configuration - DRSolution

Protection Mode: MaxAvailability


Databases:
boston - Primary database
bostonFS - Far Sync
Error: ORA-16778: redo transport error for one or more
databases

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

Practices for Lesson 11: Configuring Data Protection Modes


Chapter 11 - Page 6
Edutronic Global Services EฺIฺRฺL

london - Physical standby database


Error: ORA-01034: ORACLE not available

london2 - Logical standby database


londonFS - Far Sync (inactive)
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Fast-Start Failover: DISABLED

Configuration Status:
ERROR
14. Use a terminal window on host03 connected as oracle with the environment variables set to
'london'. Use SQL*Plus to restart and mount the physical standby database. Verify that
the 'DEV1' pluggable database is also mounted.
(host03) SQL> startup mount
s a
ORACLE instance started.
) ha
l ฺ c om
Total System Global Area 517763072 bytes
m ai ฺ
Fixed Size 2290216 bytes
9 @ g
u ide
Variable Size 440405464 bytes
i z 9 nt G
u de
Database Buffers
Redo Buffers
(pr
71303168 bytes
3764224Nbytes Stu
Database mounted.
R RO this
B A use
Z
UI se to
(host3) SQL> show pdbs
R
H icen
T
E le l
CON_IDBCON_NAME
I Z A a b OPEN MODE RESTRICTED

E L sfer
---------- ------------------------ ---------- ----------

C I A tran2 PDB$SEED MOUNTED


I
TR non- 3 DEV1 MOUNTED
PA 15. Return to the DGMGRL session running on host01 and display the configuration.
(host01) DGMGRL> show configuration

Configuration - DRSolution

Protection Mode: MaxAvailability


Databases:
boston - Primary database
bostonFS - Far Sync
london - Physical standby database
Error: ORA-16766: Redo Apply is stopped

london2 - Logical standby database


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

Practices for Lesson 11: Configuring Data Protection Modes


Chapter 11 - Page 7
Edutronic Global Services EฺIฺRฺL

londonFS - Far Sync (inactive)

Fast-Start Failover: DISABLED

Configuration Status:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

ERROR
Note: the broker may have restarted redo apply before you are able to see the above error.
In addition, you may also receive a warning ORA-16857 standby disconnected from redo
source for longer than specified threshold. This is acceptable.
16. Restart redo apply for the physical standby database. Perform a log switch on the primary
database and verify the configuration.
(host01) DGMGRL> edit database london set state = 'APPLY-ON';
Succeeded.

s a
) ha
(host01) DGMGRL> SQL "alter system switch logfile";
Succeeded.
l ฺ c om
m ai ฺ
g ide
(host01) DGMGRL> show configuration
9 @
9 nt G u
u i z
pr tude
Configuration - DRSolution
(
Protection Mode: MaxAvailability R ON his S
Databases:
B AR use t
boston
U IZ e to
- Primary database
bostonFS - FarR Sync ns
T H i c e standby database
l
londonE - Physical
I Z AB ra-bLogical
london2
le standby database
L
ElondonFS e
sf - Far Sync (inactive)
I A a n
IC n-tr
TR nFast-Start
o
PA Failover: DISABLED

Configuration Status:
SUCCESS

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

Practices for Lesson 11: Configuring Data Protection Modes


Chapter 11 - Page 8
Edutronic Global Services EฺIฺRฺL

17. Before proceeding with additional lab steps, give the transport lag and apply lag an
opportunity to catch up. In this training environment, all five VMs and domain 0 typically
share a single physical desktop class disk drive. Use the 'show configuration' and
'show database verbose london' commands until the lag clears. Repeat these
commands as needed.
DGMGRL> show database verbose london
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Database - london
Role: PHYSICAL STANDBY
Intended State: APPLY-ON
Transport Lag: 0 seconds (computed 1 second ago)
Apply Lag: 0 seconds (computed 1 second ago)
Apply Rate: 0 Byte/s
Real Time Query: OFF
Instance(s):
s a
) ha
london

l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 11: Configuring Data Protection Modes


Chapter 11 - Page 9
Edutronic Global Services EฺIฺRฺL

Practice 11-2: Examining the Maximum Protection Mode


Overview
In this practice, you will use DGMGRL to modify the current protection mode to maximum
protection. You will simulate a problem on the standby database and observe the impact to the
primary database.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Tasks
1. Modify the 'RedoRoutes' property for the 'boston' primary database and set it to the 'SYNC'
redo transport mode. Enable the maximum protection mode for the Data Guard
configuration.
(host01) DGMGRL> edit database boston set property 'RedoRoutes'
= '(boston:bostonFS SYNC)';
Property "RedoRoutes" updated

s a
(host01) DGMGRL> edit configuration set protection mode as
) ha
maxprotection;
l ฺ c om
Error: ORA-16627: operation disallowed since no standby
m ai ฺ
g ide
databases would remain to support protection mode
9 @
9 nt G u
u i z
pfarr sync.tude
Failed.
Note: The maximum protection mode is not supported (
by
R
2. Modify the redo transport routes so that the primaryON h
databasei s S
ships redo to both the
AR standby
'bostonFS' far sync and the 'london' physical e tdatabase directly using the SYNC
B s
property. Modify the 'bostonFS' far
U o uit only ships redo to the 'london2' logical
IZsynceso tthat
R property.
standby database using the ASYNC
H n s We are temporarily bypassing the far sync
T and
between the primary database
Estandby l e
ic the physical standby database, but leaving the far sync
B
A rabl
in place for the logical e database. This is for lab illustration only and would not be
I Z
practical otherwise.
L sfe
E nDGMGRL> edit database boston set property 'RedoRoutes'
A= '(boston:bostonFS,london
I C I (host01)
t r a
TR nPropertyon- "RedoRoutes" updated
SYNC)';

PA
(host01) DGMGRL> edit far_sync 'bostonFS' set property
'RedoRoutes' = '(boston:london2 ASYNC)';
Property "RedoRoutes" updated
3. Enable the maximum protection mode for the Data Guard configuration and display the
resulting configuration. Exit DGMGRL.
(host01) DGMGRL> edit configuration set protection mode as
maxprotection;
Succeeded.

(host01) DGMGRL> show configuration

Configuration - DRSolution
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 11: Configuring Data Protection Modes


Chapter 11 - Page 10
Edutronic Global Services EฺIฺRฺL

Protection Mode: MaxProtection


Databases:
boston - Primary database
bostonFS - Far Sync
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

london2 - Logical standby database


london - Physical standby database
londonFS - Far Sync (inactive)

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

s a
(host01) DGMGRL> exit
) ha
4.
l ฺ c om
Use a terminal window on host01 connected as oracle with the environment variables set to
ai ฺ
'boston'. Connect to the primary database using SQL*Plus and switch the session to the
m
DEV1 pluggable database. Leave this window open.
9 @ g
u ide
[oracle@host01]$ sqlplus / as sysdba
i z 9 nt G
SQL*Plus: Release 12.1.0.1.0 Production on u
pr tudOct
Wed e 16 23:19:29
(
ON
2013
i s S reserved.
Copyright (c) 1982, 2013, Oracle. R All hrights
Connected to: B AR use t
U IZ e toEdition Release 12.1.0.1.0 -
Oracle Database 12c Enterprise
64bit Production R s
T H e n
BETesting
With the Partitioning,
e ic OLAP, Advanced Analytics and Real
loptions
A l
IZ ferab
Application
L
A E ns
I
IC Sessiontra altered.
(host01)
- SQL> alter session set container=DEV1;
T R no n
PA 5. Use a terminal window on host03 connected as oracle with the environment variables set to
'london'. Connect to the physical standby database using SQL*Plus and perform a
shutdown abort.
[oracle@host03]$ . oraenv
ORACLE_SID = [london2] ? london
The Oracle base remains unchanged with value /u01/app/oracle

[oracle@host03]$ sqlplus / as sysdba


SQL*Plus: Release 12.1.0.1.0 Production on Thu Dec 12 17:16:46
2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:

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

Practices for Lesson 11: Configuring Data Protection Modes


Chapter 11 - Page 11
Edutronic Global Services EฺIฺRฺL

Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -


64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real
Application Testing options

(host03) SQL> shutdown abort;


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

ORACLE instance shut down.


6. Return to the SQL*Plus session on host01 with the session set to the DEV1 pluggable
database. Display the current data for the HR.REGIONS table and then insert a new row
into the table. Exit the terminated session.
(host01) SQL> select * from hr.regions order by region_id;

REGION_ID REGION_NAME
---------- -------------------------
s a
) ha
1 Europe
2 Americas
3 Asia
l ฺ c om
4 Middle East and Africa m ai ฺ
5 Australia
9 @ g
u ide
i z 9 nt G
u de
pr (6,'MyRegion');
(
(host01) SQL> insert into hr.regions values
t u
R ON his S
insert into hr.regions values (6,'MyRegion')
*
B AR use t
ERROR at line 1:
U IZ e to
ORA-03135: connection
H R lost n scontact
T e
Process ID: E
SessionZA
B 19624ble licnumber: 3265
LI sfera
ID: 20 Serial
E
I C anthe row inserts successfully, then attempt to commit
IANote:-trIf
TR nthe on change.
PA 1 row created.
(host01) SQL> commit;
ERROR at line 1:
ORA-03113: end-of-file on communication channel
Process ID: 15203
Session ID: 65 Serial number: 2297

(host01) SQL> exit


Note: The primary database has been brought down due to the maximum protection mode
and not having the standby database available to accept redo. Depending on timings and
blocks cached in memory, the insert may be successful, but the commit will always fail. You
may have to wait for the timeout period to elapse before seeing the error message.

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

Practices for Lesson 11: Configuring Data Protection Modes


Chapter 11 - Page 12
Edutronic Global Services EฺIฺRฺL

7. Use a terminal window on host01 connected as oracle with the environment variables set to
'boston'. Connect to the primary database using SQL*Plus and restart the instance. If the
instance is already running then open the database. Exit the terminated session.
[oracle@host01]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Wed Oct 16 23:34:43
2013
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

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


Connected to an idle instance.

(host01) SQL> startup


ORACLE instance started.

Total System Global Area 517763072 bytes


Fixed Size 2290216 bytes
s a
) ha
Variable Size 440405464 bytes
Database Buffers 71303168 bytes
Redo Buffers 3764224 bytes
l ฺ c om
Database mounted. m ai ฺ
ORA-03113: end-of-file on communication channel
9 @ g
u ide
i z 9 nt G
Process ID: 19973
u
pr tude
Session ID: 1 Serial number: 5 (
R ON his S
(host01) SQL> exit
B AR use t
Note: The primary cannot be started
U IZwithethetophysical standby down with the maximum
protection mode and no otherR s
standby databases available that support this mode.
T H e n
8. Use a terminal window
l e licconnected
BE ontobhost03 as oracle with the environment variables set to
A
'london'. Use SQL*Plus
IZ fedatabase startup and mount the physical standby database. Verify that
ra is mounted. Exit SQL*Plus.
the DEV1 L pluggable
E ns
A[oracle@host03]$
I C I - t r a sqlplus / as sysdba
TR nSQL*Plus:
on Release 12.1.0.1.0 Production on Wed Oct 16 23:56:47
PA 2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.

(host03) SQL> startup mount


ORACLE instance started.
Total System Global Area 517763072 bytes
Fixed Size 2290216 bytes
Variable Size 440405464 bytes
Database Buffers 71303168 bytes
Redo Buffers 3764224 bytes
Database mounted.

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

Practices for Lesson 11: Configuring Data Protection Modes


Chapter 11 - Page 13
Edutronic Global Services EฺIฺRฺL

(host03) SQL> show pdbs


CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ----------------------- ---------- ----------
2 PDB$SEED MOUNTED
3 DEV1 MOUNTED
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

(host03) SQL> exit


9. Use a terminal window on host01 connected as oracle with the environment variables set to
'boston'. Use SQL*Plus to open the primary database. Verify that the pluggable database
is open. If not, then open it. Exit SQL*Plus.
[oracle@host01]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Wed Oct 16 23:56:47
2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
s a
) ha
Connected to an idle instance.

l ฺ c om
(host01) SQL> startup
m ai ฺ
g ide
ORACLE instance started.
Total System Global Area
517763072 bytes 9 @
9 nt G u
2290216 bytesuiz
pr tude
Fixed Size
(
ONbytes
Variable Size 440405464 bytes
i s S
Database Buffers R
71303168
t
R sebytes h
Redo Buffers B A3764224
U
Database mounted. IZ e to u
H R icens
Database opened.
T
B E le l
A ab pdbs
IZSQL>feshow
(host1)
r
L
E ns
I A tra CON_NAME
R IC n-CON_ID OPEN MODE RESTRICTED
T o
n---------- ------------------------ ---------- ----------
PA 2 PDB$SEED READ ONLY NO
3 DEV1 MOUNTED
(host01) SQL> alter pluggable database DEV1 open;
Pluggable database altered.

(host01) SQL> exit

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

Practices for Lesson 11: Configuring Data Protection Modes


Chapter 11 - Page 14
Edutronic Global Services EฺIฺRฺL

10. Use a terminal window on host01 connected as oracle with the environment variables
set to boston. Launch the DGMGRL utility and connect as the sysdg user with operating
system authentication. Display the Data Guard configuration.
[oracle@host01]$ dgmgrl
DGMGRL for Linux: Version 12.1.0.1.0 - 64bit Production
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

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


Welcome to DGMGRL, type "help" for information.

(host01) DGMGRL> connect sysdg/oracle_4U@boston


Connected as SYSDG.

DGMGRL> show configuration


Configuration - DRSolution

s a
) ha
Protection Mode: MaxProtection
Databases:
l ฺ c om
boston - Primary database
m ai ฺ
bostonFS - Far Sync
9 @ g
u ide
london2 - Logical standby database
i z 9 nt G
london - Physical standby database u
pr tude
(
londonFS - Far Sync (inactive)
R ON his S
Fast-Start Failover: DISABLED B AR use t
U IZ e to
T
Configuration Status: H R icens
SUCCESS
A BE ble l
IZ Guard
11. Return theLData
f e raprotection mode to maximum performance.
E
A(host01) s
nDGMGRL>
I C I - t r a edit configuration set protection mode as
TR non maxperformance;
PA Succeeded.
12. Correct the redo routing rules such that the 'boston' primary database forwards redo to only
the far sync using the FASTSYNC attribute. Adjust the far sync to forward redo to both the
'london' physical standby database and the 'london2' logical standby database using the
ASYNC attribute.
(host01) DGMGRL> edit database boston set property 'RedoRoutes'
= '(boston:bostonFS SYNC)';
Property "RedoRoutes" updated

(host01) DGMGRL> edit far_sync 'bostonFS' set property


'RedoRoutes' = '(boston:london,london2 ASYNC)';
Property "RedoRoutes" updated

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

Practices for Lesson 11: Configuring Data Protection Modes


Chapter 11 - Page 15
Edutronic Global Services EฺIฺRฺL

13. Restart Redo Apply on the physical standby database and perform a log switch on the
primary database.
(host01) DGMGRL> edit database london set state = 'APPLY-ON';
Succeeded.
(host01) DGMGRL> SQL "alter system switch logfile";
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Succeeded.
14. Display the resulting configuration.
(host01) DGMGRL> show configuration

Configuration - DRSolution

Protection Mode: MaxPerformance


Databases:
boston - Primary database
s a
bostonFS - Far Sync
) ha
london - Physical standby database
l ฺ c om
london2 - Logical standby database
m ai ฺ
londonFS - Far Sync (inactive)
9 @ g
u ide
i z 9 nt G
Fast-Start Failover: DISABLED u
pr tude
(
R ON his S
AR use t
Configuration Status:
SUCCESS B
IZ e tbroker
o to resynchronize all the changes in this
forU
Note: It may take some time R Data Guard
s
n constraints. The following actions can be used if
H the ihardware
lab environment considering e
T l c
needed:
A BE ble
• L IZ andfrestart
Stop
e ra managed recovery on the physical standby database:
E
A DGMGRL> ns edit database london set state = 'APPY-OFF';
I C I t r a
TR non-DGMGRL> edit database london set state = 'APPY-ON';
PA • Stop and restart redo transport from the primary database:
DGMGRL> edit database boston set state = 'TRANSPORT-OFF';
DGMGRL> edit database boston set state = 'TRANSPORT-ON';
• Perform a log switch at the primary database:
DGMGRL> SQL "alter system switch logfile";

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

Practices for Lesson 11: Configuring Data Protection Modes


Chapter 11 - Page 16
Edutronic Global Services EฺIฺRฺL

15. Before proceeding with additional lab steps, give the transport lag and apply lag an
opportunity to catch up. In this training environment, all five VMs and domain 0 typically
share a single physical desktop class disk drive. Use the 'show configuration' and
'show database verbose london' commands until the lag clears. Repeat these
commands as needed.
DGMGRL> show database london
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Database - london

Role: PHYSICAL STANDBY


Intended State: APPLY-ON
Transport Lag: 0 seconds (computed 0 seconds ago)
Apply Lag: 0 seconds (computed 0 seconds ago)
Apply Rate: 0 Byte/s
Real Time Query: OFF
Instance(s): s a
london ) ha
l ฺ c om
Database Status:
m ai ฺ
SUCCESS
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 11: Configuring Data Protection Modes


Chapter 11 - Page 17
Edutronic Global Services EฺIฺRฺL
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 11: Configuring Data Protection Modes


Chapter 11 - Page 18
Edutronic Global Services EฺIฺRฺL
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
Practices for Lesson g 12: ide
Performing Role 9 @ u
9 Transitions
G
i z
ru uden t
Chapter 12 (p
O N is St
A RR se th
I Z B ou
R U se t
T H icen
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 12: Performing Role Transitions


Chapter 12 - Page 1
Edutronic Global Services EฺIฺRฺL

Practices for Lesson 12: Overview


Practices Overview
In these practices, you will perform a switchover, and then switch back to the original
configuration.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 12: Performing Role Transitions


Chapter 12 - Page 2
Edutronic Global Services EฺIฺRฺL

Practice 12-1: Performing Switchover


Overview
In this practice, you will use DGMGRL view the configuration status, validate that the databases
are ready for a role reversal, and then perform a switchover.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Tasks
1. Use a terminal window on host01 connected as oracle with the environment variables
set to boston. Launch the DGMGRL utility and connect as the sysdg user with operating
system authentication.
[oracle@host01]$ dgmgrl
DGMGRL for Linux: Version 12.1.0.1.0 - 64bit Production
Copyright (c) 2000, 2012, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
s a
(host01) DGMGRL> connect sysdg/oracle_4U@boston ) ha
Connected as SYSDG.
l ฺ c om
2. Use the SHOW CONFIGURATION command to display the configuration status
m afori the ฺData
Guard configuration.
9 @ g
u ide
(host01) DGMGRL> show configuration i z 9 nt G
u
pr tude
Configuration - DRSolution (
R ON his S
Protection Mode: MaxPerformance
B AR use t
Databases:
U IZ e to
H RSync s
boston - Primary database
bostonFSE-TFar e n
B -bPhysical
l e lic
A
Z era- Logical standby
london
Ilondon2 standby database
L
E nsf database
I A tra
R IC n-londonFS - Far Sync (inactive)

PA
T no Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS
3. Validate that the primary database is ready for role reversal using the VERBOSE option. The
VERBOSE option will show all checks being performed during validation.
(host01) DGMGRL> validate database verbose boston

Database Role: Primary database

Ready for Switchover: Yes

Capacity Information:
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 12: Performing Role Transitions


Chapter 12 - Page 3
Edutronic Global Services EฺIฺRฺL

Database Instances Threads


boston 1 1

Temporary Tablespace File Information:


boston TEMP Files: 1
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Flashback Database Status:


boston: Off

Data file Online Move in Progress:


boston: No

Transport-Related Information:
Transport On: Yes
s a
m ) ha
Log Files Cleared:
l ฺ c o
boston Standby Redo Log Files: Cleared
m ai ฺ
9 @ g
u ide
Automatic Diagnostic Repository Errors:
boston rui
z9 ent G
Error
No logging operation NO N
(p Stud
Control file corruptions
R RNOO this
System data file missing
Z B A NOu se
System data fileU I e to NO
corrupted
System data H
R n s
E T l i c e
file offline NO
User data
A B ble file missing NO

E LIZ data
User
f e rafile corrupted NO
s file offline
C I A User
t r a ndata NO
I
TR non-Block Corruptions found NO
PA 4. Validate that the physical standby database is ready for role reversal using the VERBOSE
option.
(host01) DGMGRL> validate database verbose london

Database Role: Physical standby database


Primary Database: boston

Ready for Switchover: Yes


Ready for Failover: Yes (Primary Running)

Capacity Information:
Database Instances Threads
boston 1 1
london 1 1
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 12: Performing Role Transitions


Chapter 12 - Page 4
Edutronic Global Services EฺIฺRฺL

Temporary Tablespace File Information:


boston TEMP Files: 3
london TEMP Files: 3
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Flashback Database Status:


boston: Off
london: Off

Data file Online Move in Progress:


boston: No
london: No

Standby Apply-Related Information:


Apply State: Running s a
Apply Lag: 0 seconds ) ha
Apply Delay: 0 minutes
l ฺ c om
m ai ฺ
Transport-Related Information:
9 @ g
u ide
Transport On: Yes
i z 9 nt G
u
pr tude
Gap Status: No Gap
0 seconds ON
( S
Transport Lag:
R h i s
Transport Status: Success
B AR use t
Log Files Cleared:U
IZ e to
T H RRedo e n s Files: Cleared
boston Standby
E leRedo
londonBOnline
lic Log Files: Cleared
Log
A
IZ ferab
L
E nsLog File Groups Configuration:
I A Current
tra # Online Redo Log Groups Standby Redo Log Groups
R IC n-Thread
PA
T no (boston) (london)
1 3 2

Future Log File Groups Configuration:


Thread # Online Redo Log Groups Standby Redo Log Groups
(london) (boston)
1 3 2

Current Configuration Log File Sizes:


Thread # Smallest Online Redo Smallest Standby Redo
Log File Size Log File Size
(boston) (london)
1 50 MBytes 50 MBytes

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

Practices for Lesson 12: Performing Role Transitions


Chapter 12 - Page 5
Edutronic Global Services EฺIฺRฺL

Future Configuration Log File Sizes:


Thread # Smallest Online Redo Smallest Standby Redo
Log File Size Log File Size
(london) (boston)
1 50 MBytes 50 MBytes
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Apply-Related Property Settings:


Property boston Value london Value
DelayMins 0 0
ApplyParallel AUTO AUTO

Transport-Related Property Settings:


Property boston Value london Value
LogXptMode ASYNC async
s a
) ha
Dependency <empty> <empty>

om
DelayMins 0 0
l ฺ c
Binding optional
m ai ฺ optional
g ide
MaxFailure 0 0
MaxConnections 1 9 @
9 nt G u 1
u i z
pr tude
ReopenSecs 300 300
(
ON his S
NetTimeout 30 30
RedoCompression R DISABLE DISABLE
LogShipping
B AR use t
ON ON

U IZ e to
R Repository
Automatic Diagnostic
H n s Errors:
Error T
E le lic e boston london
No Z A B b
L I logging
e r aoperation NO NO

A E nsf
Control file corruptions NO NO
I
IC n-SRL tra Group Unavailable NO NO
T R no System data file missing NO
PA
NO
System data file corrupted NO NO
System data file offline NO NO
User data file missing NO NO
User data file corrupted NO NO
User data file offline NO NO
Block Corruptions found NO NO
Note: Your output will contain information regarding thread 3 of redo. There is no thread 3
on this database. This will be fixed with an upcoming patch for the existing issue in Oracle
Database 12.1.0.1.0. It has been removed from the above output.
5. Switchover to the 'london' physical standby database.
(host01) DGMGRL> switchover to london
Performing switchover NOW, please wait...

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

Practices for Lesson 12: Performing Role Transitions


Chapter 12 - Page 6
Edutronic Global Services EฺIฺRฺL

Operation requires a connection to instance "london" on database


"london"
Connecting to instance "london"...
Connected as SYSDG.
New primary database "london" is opening...
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Operation requires startup of instance "boston" on database


"boston"
Starting instance "boston"...
ORACLE instance started.
Database mounted.
Switchover succeeded, new primary is "london"
6. Display the new configuration.
(host01) DGMGRL> show configuration

s a
) ha
Configuration - DRSolution

l ฺ c om
Protection Mode: MaxPerformance
m ai ฺ
Databases:
9 @ g
u ide
london - Primary database
i z 9 nt G
londonFS - Far Sync u
pr tude
(
ON his S
boston - Physical standby database
R
AR use t
london2 - Logical standby database
B
bostonFS - Far Sync (inactive)
IZ e to
U
H R iDISABLED
Fast-Start Failover:
T e n s
A BE ble l c
L IZ feraStatus:
Configuration
E
ASUCCESS ns
I C I t r a
TR non-
(host01) DGMGRL> exit;

PA Note: Remember that the indentation used in the output of the SHOW CONFIGURATION
command indicates the hierarchy of how redo is being forwarded.
7. Use a terminal window on host03 connected as oracle with the environment variables
set to london. Launch the DGMGRL utility and connect as the sysdg user with operating
system authentication.
[oracle@host03]$ dgmgrl
DGMGRL for Linux: Version 12.1.0.1.0 - 64bit Production
Copyright (c) 2000, 2012, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.

(host03) DGMGRL> connect sysdg/oracle_4U@london


Connected as SYSDG.

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

Practices for Lesson 12: Performing Role Transitions


Chapter 12 - Page 7
Edutronic Global Services EฺIฺRฺL

8. Perform a log switch on the new primary database 'london' from within DGMGRL.
(host03) DGMGRL> SQL "alter system switch logfile";
Succeeded.
9. Verify that the new standby database 'boston' has zero transport lag and zero apply lag.
You may need to wait a minute for this to clear.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

(host03) DGMGRL> show database boston

Database - boston

Role: PHYSICAL STANDBY


Intended State: APPLY-ON
Transport Lag: 0 seconds (computed 0 seconds ago)
Apply Lag: 0 seconds (computed 0 seconds ago)
Apply Rate: 0 Byte/s
s a
Real Time Query: OFF
) ha
Instance(s):
l ฺ c om
Boston
m ai ฺ
9 @ g
u ide
Database Status:
i z 9 nt G
u
pr tude
SUCCESS
(
N toisswitch
S back a second time. Do
10. Validate that the new 'london' primary database isOready
R t h
steps. B AR uthe
not use the VERBOSE option so you can compare
s edifference in output from the previous

U IZ database
e to london
R
(host03) DGMGRL> validate
H icen s
T
E le lPrimary database
DatabaseBRole:
A
IZ ferab
L
E for s Switchover: Yes
I A Ready n
I C t r a
TR non-
PA Flashback Database Status:
london: Off
11. Validate that the new 'boston' physical standby database is ready to switch back a second
time. Do not use the VERBOSE option so you can compare the difference in output from the
previous steps.
(host03) DGMGRL> validate database boston

Database Role: Physical standby database


Primary Database: london

Ready for Switchover: Yes


Ready for Failover: Yes (Primary Running)

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

Practices for Lesson 12: Performing Role Transitions


Chapter 12 - Page 8
Edutronic Global Services EฺIฺRฺL

Flashback Database Status:


london: Off
boston: Off

Current Log File Groups Configuration:


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Thread # Online Redo Log Groups Standby Redo Log Groups


(london) (boston)
1 3 2

Future Log File Groups Configuration:


Thread # Online Redo Log Groups Standby Redo Log Groups
(boston) (london)
1 3 2
12. Switchover to the 'boston' physical standby database.
s a
(host03) DGMGRL> switchover to boston ) ha
Performing switchover NOW, please wait...
l ฺ c om
m ai ฺ
Operation requires a connection to instance "boston" on database
"boston"
9 @ g
u ide
z 9 nt G
Connecting to instance "boston"...
i
Connected as SYSDG. u
pr tude
(
ON his S
New primary database "boston" is opening...
R
"london" B AR use t
Operation requires startup of instance "london" on database

U IZ e to
Starting instance "london"...

T H R icens
ORACLE instance started.
BE ble l
Database mounted.
A
E LIZ sfera
Switchover succeeded, new primary is "boston"

I C IA -tran
TR non
PA

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

Practices for Lesson 12: Performing Role Transitions


Chapter 12 - Page 9
Edutronic Global Services EฺIฺRฺL

13. Display the resulting configuration. Exit DGMGRL when done.


(host03) DGMGRL> show configuration

Configuration - DRSolution
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Protection Mode: MaxPerformance


Databases:
boston - Primary database
bostonFS - Far Sync
london - Physical standby database
london2 - Logical standby database
londonFS - Far Sync (inactive)

Fast-Start Failover: DISABLED


s a
) ha
Configuration Status:
l ฺ c om
SUCCESS
m ai ฺ
9 @ g
u ide
(host03) DGMGRL> exit
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 12: Performing Role Transitions


Chapter 12 - Page 10
Edutronic Global Services EฺIฺRฺL
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
Practices for Lesson g 13: ide
Using Flashback 9 @
9 Database
G u in
i z en t
( pru Configuration
a Data Guard u d
O N is St
A RR s13e th
Chapter

I Z B ou
R U se t
T H icen
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 13: Using Flashback Database in a Data Guard Configuration
Chapter 13 - Page 1
Edutronic Global Services EฺIฺRฺL

Practices for Lesson 13: Overview


Practices Overview
In these practices, you will enable flashback database on both the primary database and the
physical standby database.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 13: Using Flashback Database in a Data Guard Configuration
Chapter 13 - Page 2
Edutronic Global Services EฺIฺRฺL

Practice 13-1: Configuring Flashback Database on the Primary


Database
Overview
In this practice, you will configure flashback database on the primary database and verify that it
has been enabled.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Tasks
1. Use a terminal window on host01 connected as oracle with the environment variables
set to boston. Launch SQL*Plus and determine the current state of flashback database.
[oracle@host01]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Tue Dec 17 14:12:34
2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
s a
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - ) ha
64bit Production
l ฺ c om
With the Partitioning, OLAP, Advanced Analytics and Real
m ai ฺ
Application Testing options
9 @ g
u ide
i z 9 nt G
(host01) SQL> select flashback_on from v$database; u
pr tude
(
ON his S
FLASHBACK_ON
R
AR use t
------------------
NO
Z B
2. Verify that the primary databaseUisIin archive
e tolog mode, a pre-requisite to flashback
database.
R
H icen s
T l log list
(host01) SQL>
A BE archive
l e
L
Database ab
IZ logfemode
r Archive Mode
E
AAutomatic nsarchival
I C I t r a Enabled

TR nArchive on- destination USE_DB_RECOVERY_FILE_DEST


PA Oldest online log sequence 95
Next log sequence to archive 97
Current log sequence 97
3. Verify that the fast recovery area has been configured for the primary database, a pre-
requisite to flashback database.
(host01) SQL> show parameter db_recovery
NAME TYPE VALUE
--------------------------- -------- ------------------------
db_recovery_file_dest string /u01/app/oracle
/fast_recovery_area
db_recovery_file_dest_size big integer 10G

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

Practices for Lesson 13: Using Flashback Database in a Data Guard Configuration
Chapter 13 - Page 3
Edutronic Global Services EฺIฺRฺL

4. Determine the current amount of time in minutes for the flashback window.
(host01) SQL> show parameter flashback
NAME TYPE VALUE
------------------------------- ----------- ---------------
db_flashback_retention_target integer 1440
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

5. Adjust the flashback window to be 3 days (1440 minutes/day x 3 days = 4320 minutes).
(host01) SQL> alter system set db_flashback_retention_target =
4320;
System altered.
6. Enable flashback database for the whole database.
(host01) SQL> alter database flashback on;
Database altered
7. Verify that flashback database has been enabled.
s a
) ha
(host01) SQL> select flashback_on from v$database;

om
FLASHBACK_ON
l ฺ c
ai ฺ
------------------
m
g ide
YES
8. Determine the current size (in bytes) of the flashback data. 9 @
9 nt G u
(host01) SQL> select flashback_size fromruiz
( p tude
ON his S
v$flashback_database_log;
FLASHBACK_SIZE R
--------------
B AR use t
104857600
U IZ e to
H
9. Determine the name, quantity Rand sizes
n sof the flashback log files that were created when
T
E enabled.
flashback database was
e
licYour file names will be different. Exit SQL*Plus.
A B l e
b name,bytes from
I
(host01)
L Z SQL>eraselect
E nsf
v$flashback_database_logfile;
A
I
IC n-tra
NAME
T R o
n----------------------------------------------------------------
PA ---------
BYTES
----------
/u01/app/oracle/fast_recovery_area/BOSTON/flashback/o1_mf_9c0r52
hg_.flb
52428800

/u01/app/oracle/fast_recovery_area/BOSTON/flashback/o1_mf_9c0r54
t7_.flb
52428800

(host01) SQL> exit;

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

Practices for Lesson 13: Using Flashback Database in a Data Guard Configuration
Chapter 13 - Page 4
Edutronic Global Services EฺIฺRฺL

Practice 13-2: Configuring Flashback Database on the Physical


Standby Database
Overview
In this practice, you will enable flashback database on the physical standby database.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Tasks
1. Use a terminal window on host03 connected as oracle with the environment variables
set to london. Launch SQL*Plus and determine the current state of flashback database.
[oracle@host03]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Tue Dec 17 14:12:34
2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
s a
) ha
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -
64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real
l ฺ c om
Application Testing options
m ai ฺ
9 @ g
u ide
(host03) SQL> select flashback_on from v$database;
i z 9 nt G
u
pr tude
FLASHBACK_ON (
------------------
R ON his S
NO
B AR use t
IZ eis tinoarchive log mode, a pre-requisite to
2. Verify that the physical standby database
U
H R iclog
flashback database.
(host03) SQL> T e nslist
BEmodeble l
archive
DatabaseAlog
L I Z r a Archive Mode
E nsarchival
Automatic
A fe Enabled
I
IC Archive - t ra destination USE_DB_RECOVERY_FILE_DEST
T R o n
nOldest online log sequence 95
PA Next log sequence to archive 0
Current log sequence 97
3. Verify that the fast recovery area has been configured for the physical standby database, a
pre-requisite to flashback database.
(host03) SQL> show parameter db_recovery
NAME TYPE VALUE
--------------------------- -------- ------------------------
db_recovery_file_dest string /u01/app/oracle
/fast_recovery_area
db_recovery_file_dest_size big integer 10G

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

Practices for Lesson 13: Using Flashback Database in a Data Guard Configuration
Chapter 13 - Page 5
Edutronic Global Services EฺIฺRฺL

4. Determine the current amount of time in minutes for the flashback window.
(host03) SQL> show parameter flashback
NAME TYPE VALUE
------------------------------- ----------- ---------------
db_flashback_retention_target integer 1440
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

5. Adjust the flashback window to be 3 days (1440 minutes/day x 3 days = 4320 minutes).
(host03) SQL> alter system set db_flashback_retention_target =
4320;
System altered.
6. Enable flashback database for the whole database. Note the error message that is
returned.
(host03) SQL> alter database flashback on;
alter database flashback on
* s a
ERROR at line 1: ) ha
ORA-01153: an incompatible media recovery is active
l ฺ c om
7. Use a terminal window on host01 connected as oracle with the environmentm ai ฺset to
variables
@
boston. Launch the DGMGRL utility and connect as the sysdg user with g
operating e
idsystem
authentication. 9
9 nt G u
u i z
[oracle@host01]$ dgmgrl
( pr tude
DGMGRL for Linux: Version 12.1.0.1.0
R ON - h64bit
i s S Production
Copyright (c) 2000, 2012, Oracle.
A R sAll e trights reserved.
B
I e to u information.
Welcome to DGMGRL, typeZ"help" for
U
R ns
(host01) DGMGRL> T Hconnect
i c e sysdg/oracle_4U@boston
E l
Connected
I Z AB b le
as SYSDG.
a
er mode for the physical standby database.
L sfrecovery
8. Stop theEmanaged

I C IA(host01)
- t r anDGMGRL> edit database london set state='APPLY-OFF';
TR nSucceeded.
on
PA 9. Return to the SQL*Plus session on host03 connected to the 'london' physical standby
database and enable flashback database a second time.
(host03) SQL> alter database flashback on;
Database altered.
10. Verify that flashback database has been enabled.
(host03) SQL> select flashback_on from v$database;
FLASHBACK_ON
------------------
YES

(host03) SQL> exit;

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

Practices for Lesson 13: Using Flashback Database in a Data Guard Configuration
Chapter 13 - Page 6
Edutronic Global Services EฺIฺRฺL

11. Return to the terminal window on host01 that is running DGMGRL and restart the managed
recovery mode for the 'london' physical standby database. Exit DGMGRL when done.
(host01) DGMGRL> edit database london set state='APPLY-ON';
Succeeded.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

(host01) DGMGRL> exit

s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 13: Using Flashback Database in a Data Guard Configuration
Chapter 13 - Page 7
Edutronic Global Services EฺIฺRฺL

Practice 13-3: Configuring Flashback Database on the Logical


Standby Database
Overview
In this practice, you will enable flashback database on the logical standby database.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Tasks
1. Use a terminal window on host03 connected as oracle with the environment variables
set to london2. Launch SQL*Plus and determine the current state of flashback database.
[oracle@host03]$ . oraenv
ORACLE_SID = [london] ? london2
The Oracle base remains unchanged with value /u01/app/oracle

[oracle@host03]$ sqlplus / as sysdba


s a
) ha
SQL*Plus: Release 12.1.0.1.0 Production on Tue Dec 17 14:12:34
2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
l ฺ c om
Connected to: m ai ฺ
9 @
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -
g
u ide
64bit Production
i z 9 nt G
u
pr tude
(
With the Partitioning, OLAP, Advanced Analytics and Real
Application Testing options
R ON his S
B AR usfrom
(host03) SQL> select flashback_on
e t v$database;
U IZ e to
H R icens
FLASHBACK_ON
------------------ T
NO
A BE ble l
2. Verify thatL IZlogicalfestandby
the ra database is in archive log mode, a pre-requisite to flashback
E
A trans
I C I
database.

on- SQL> archive log list


TR n(host03)
PA Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 86
Next log sequence to archive 88
Current log sequence 88

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

Practices for Lesson 13: Using Flashback Database in a Data Guard Configuration
Chapter 13 - Page 8
Edutronic Global Services EฺIฺRฺL

3. Verify that the fast recovery area has been configured for the physical standby database, a
pre-requisite to flashback database.
(host03) SQL> show parameter db_recovery
NAME TYPE VALUE
--------------------------- -------- ------------------------
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

db_recovery_file_dest string /u01/app/oracle


/fast_recovery_area
db_recovery_file_dest_size big integer 10G
4. Determine the current amount of time in minutes for the flashback window.
(host03) SQL> show parameter flashback
NAME TYPE VALUE
------------------------------- ----------- ---------------
db_flashback_retention_target integer 1440
5. Adjust the flashback window to be 3 days (1440 minutes/day x 3 days = 4320 minutes). a
(host03) SQL> alter system set db_flashback_retention_target = ) h
as
4320;
l ฺ c om
System altered.
m ai ฺ
g that iside
6. Enable flashback database for the whole database. Note the error message
@
returned.
i z 9 nt Gu
9
(host03) SQL> alter database flashback p
( ru ude
on;
Database altered. O N is St
RR se th
7. Verify that flashback database has been enabled.
A
I Z B o u from v$database;
U se t
(host03) SQL> select flashback_on
R
FLASHBACK_ON
T H icen
BE ble l
------------------
A
LIZ sfera
YES
E
I C IA(host03)
- t r anSQL> exit;
TR non
PA

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

Practices for Lesson 13: Using Flashback Database in a Data Guard Configuration
Chapter 13 - Page 9
Edutronic Global Services EฺIฺRฺL
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 13: Using Flashback Database in a Data Guard Configuration
Chapter 13 - Page 10
Edutronic Global Services EฺIฺRฺL
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
Practices for Lesson g 14: ide
Enabling Fast-Start 9 @ Gu
9 nFailover
i z
ru ude t
Chapter 14 (p
O N is St
A RR se th
I Z B ou
R U se t
T H icen
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 14: Enabling Fast-Start Failover


Chapter 14 - Page 1
Edutronic Global Services EฺIฺRฺL

Practices for Lesson 14: Overview


Practices Overview
In these practices, you will setup and configure fast-start failover. You will then simulate a failure
of the primary database and observe the automatic failover to the standby database.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 14: Enabling Fast-Start Failover


Chapter 14 - Page 2
Edutronic Global Services EฺIฺRฺL

Practice 14-1: Enabling Fast-Start Failover


Overview
In this practice, you will enable fast-start failover on host02 where the 'bostonFS' far sync is
currently running. After enabling fast-start failover, you will start the observer process.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Tasks
1. Use a terminal window on host01 connected as oracle with the environment variables set to
boston. Launch SQL*Plus and perform a log switch on the primary database. Exit
SQL*Plus.
[oracle@host01]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Tue Dec 17 14:12:34
2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
s a
) ha
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -
64bit Production
l ฺ c om
With the Partitioning, OLAP, Advanced Analytics and Real
Application Testing options m ai ฺ
9 @ g
u ide
(host01) SQL> alter system switch logfile; iz9 n t G
u
pr tude
System altered. (
R ON his S
(host01) SQL> exit;
B AR use t
2. Use a terminal window on host02IZ toas oracle with the environment variables
set to bostonFS. Launch theR
U connected
s e
T H e n
DGMGRL utility and connect as the sysdg user with
E le lic
operating system authentication.
B
I A
Z erabdgmgrl
[oracle@host02]$
L
E for
DGMGRL sfLinux: Version 12.1.0.1.0 - 64bit Production
I A a n
R IC n-tr (c) 2000, 2012, Oracle. All rights reserved.
Copyright
T o
nWelcome
PA
to DGMGRL, type "help" for information.

(host02) DGMGRL> connect sysdg/oracle_4U@bostonFS


Connected as SYSDG.
3. Verify that there is no Transport Lag or Apply lag at the physical standby database and
logical standby database before proceeding with labs.
(host02) DGMGRL> show database london

Database - london

Role: PHYSICAL STANDBY


Intended State: APPLY-ON
Transport Lag: 0 seconds (computed 0 seconds ago)
Apply Lag: 0 seconds (computed 0 seconds ago)
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 14: Enabling Fast-Start Failover


Chapter 14 - Page 3
Edutronic Global Services EฺIฺRฺL

Apply Rate: 0 Byte/s


Real Time Query: OFF
Instance(s):
london
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Database Status:
SUCCESS
(host02) DGMGRL> show database london2

Database - london2

Role: LOGICAL STANDBY


Intended State: APPLY-ON
Transport Lag: 0 seconds (computed 0 seconds ago)
s a
Apply Lag: 0 seconds (computed 0 seconds ago)
) ha
Apply Rate: 48.04 MByte/s
l ฺ c om
Instance(s):
m ai ฺ
london2
9 @ g
u ide
i z 9 nt G
Database Status: u
pr tude
(
SUCCESS
R ON his S
R se t
Athe
I Z B
4. Display the current configuration and note
o u state of fast-start failover.
current
R e t
U configuration
(host02) DGMGRL> show
Configuration T H e n s
B l e lic
E - DRSolution
A
IZ feMode:
r ab MaxPerformance
L
E ns
Protection
I A tra - Primary database
R IC boston
Databases:
n -
PA
T no bostonFS - Far Sync
london - Physical standby database
london2 - Logical standby database
londonFS - Far Sync (inactive)

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

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

Practices for Lesson 14: Enabling Fast-Start Failover


Chapter 14 - Page 4
Edutronic Global Services EฺIฺRฺL

5. Display a detailed status of the current fast-start failover settings.


(host02) DGMGRL> show fast_start failover
Fast-Start Failover: DISABLED

Threshold: 30 seconds
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Target: (none)
Observer: (none)
Lag Limit: 30 seconds
Shutdown Primary: TRUE
Auto-reinstate: TRUE
Observer Reconnect: (none)
Observer Override: FALSE

Configurable Failover Conditions


s a
Health Conditions:
) ha
Corrupted Controlfile
l
YES
ฺ c om
Corrupted Dictionary
m ai ฺYES
Inaccessible Logfile
9 @ g
u ide
NO
Stuck Archiver
i z 9 nt G NO
u
pr tude
Datafile Offline
(
N is S
YES

R O
Oracle Error Conditions:
A R se th
(none)
I Z B ou
R
6. Set up the FastStartFailoverTarget
t
U seconfiguration property on the 'boston' primary
H e n
Tdesiredli'london'
database to indicate the c target standby database.
B E
(host02)ADGMGRL>bedit e
l database boston set property
L IZ fera
FastStartFailoverTarget = london;
E s
I C IAProperty
- t r an"faststartfailovertarget" updated
T7.R Display
nonthe FastStartFailoverTarget configuration property for both the primary
PA database and the physical standby database.
(host02) DGMGRL> show database boston faststartfailovertarget;
FastStartFailoverTarget = 'london'

(host02) DGMGRL> show database london FastStartFailoverTarget;


FastStartFailoverTarget = ''
8. Modify the ObserverReconnect configuration property and set the value to 120 seconds.
(host02) DGMGRL> edit configuration set property
ObserverReconnect=120;
Property " observerreconnect" updated

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

Practices for Lesson 14: Enabling Fast-Start Failover


Chapter 14 - Page 5
Edutronic Global Services EฺIฺRฺL

9. Attempt to enable fast-start failover.


(host02) DGMGRL> enable fast_start failover;
Error: ORA-16693: requirements not met for enabling fast-start
failover
Failed.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

10. Since a far sync is being used, define the reciprocal fast-start failover target for when the
'london' physical standby database becomes the primary database. This would be set
automatically by the broker if far sync was not in the configuration.
(host02) DGMGRL> edit database london set property
FastStartFailoverTarget = boston;
Property "faststartfailovertarget" updated
11. Attempt to enable fast-start failover.
(host02) DGMGRL> enable fast_start failover;
Error: ORA-16693: requirements not met for enabling fast-start
s a
) ha
failover
Failed.
c o m
i l
12. To enable fast-start failover when using a far sync, the configuration must be upgraded
aboth ฺ to
m ฺ
g ide
the maximum availability mode. Display the current RedoRoutes property for the
primary and standby database. 9 @
9 nt G u
u i z
pr tude
(host02) DGMGRL> show database boston redoroutes;
(
ON redoroutes;
RedoRoutes = '(boston:bostonFS SYNC)'
(host02) DGMGRL> show database R i s S
london
AR uSYNC)' et h
RedoRoutes = '(london:londonFS B s
Note: FASTSYNC would also be U IZ e tsettings
acceptable o for the maximum availability.
R s
n availability.
H to imaximum
13. Upgrade the protection mode
T l c e
A BE bedit
(host02) DGMGRL> le configuration set protection mode as
I Z
L sfer
maxavailability; a
E
I C IA -tran
Succeeded.

TR nonfast-start failover.
14. Enable
PA (host02) DGMGRL> enable fast_start failover;
Enabled.

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

Practices for Lesson 14: Enabling Fast-Start Failover


Chapter 14 - Page 6
Edutronic Global Services EฺIฺRฺL

15. Display a detailed status of the current fast-start failover settings.


(host02) DGMGRL> show fast_start failover;

Fast-Start Failover: ENABLED


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Threshold: 30 seconds
Target: london
Observer: (none)
Lag Limit: 30 seconds (not in use)
Shutdown Primary: TRUE
Auto-reinstate: TRUE
Observer Reconnect: 120 seconds
Observer Override: FALSE

s a
Configurable Failover Conditions
m ) ha
Health Conditions:
l ฺ c o
Corrupted Controlfile YES
m ai ฺ
Corrupted Dictionary YES
9 @ g
u ide
Inaccessible Logfile NO
NO rui
z9 ent G
Stuck Archiver
Datafile Offline N
YES
(p Stud
R RO this
Oracle Error Conditions: B A use
(none)
Z
UI se to
H icenR
T
16. Start the observer process.
l observer
BE bstart
(host02)ADGMGRL> l e
E LIZ started
Observer f e ra
C I
Note: r a nswill not return after starting the observer. Keep this terminal window open
AThe tprompt
I -
TR withntheonobserver running in it.
PA

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

Practices for Lesson 14: Enabling Fast-Start Failover


Chapter 14 - Page 7
Edutronic Global Services EฺIฺRฺL

Practice 14-2: Testing Fast-Start Failover


Overview
In this practice, you will simulate a disaster on the primary database and observe the automatic
failover to the standby database.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Tasks
1. Use a terminal window on host01 connected as oracle with the environment variables set to
'boston'. Connect to the primary database using SQL*Plus and simulate a failure by issuing
the shutdown abort command. Exit SQL*Plus.
[oracle@host01]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Tue Dec 17 22:40:27
2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
s a
) ha
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -
64bit Production
l ฺ c om
With the Partitioning, OLAP, Advanced Analytics and Real
Application Testing options m ai ฺ
9 @ g
u ide
i z 9 nt G
(host01) SQL> shutdown abort
u
pr tude
ORACLE instance shut down. (
R ON his S
(host01) SQL> exit;
B AR use t
IZ esession
2. Observe the status output in the terminal
U to connected to host02 running the observer
process from the previous labRstep. It may
s take a minute before the failover is initiated.
T n
Hstarticeobserver
BE ble
(host02) DGMGRL> l
A
E LIZ sfera
Observer started

I C - t an Wednesday, December 18, 2013


IA12:59:51.40
r
TR nInitiating
on
PA
Fast-Start Failover to database "london"...
Performing failover NOW, please wait...
Failover succeeded, new primary is "london"
13:01:19.70 Wednesday, December 18, 2013

13:01:23.64 Wednesday, December 18, 2013


Initiating reinstatement for database "london2"...
Reinstating database "london2", please wait...
Operation requires shutdown of instance "london2" on database
"london2"
Shutting down instance "london2"...
Database closed.
Database dismounted.
ORACLE instance shut down.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 14: Enabling Fast-Start Failover


Chapter 14 - Page 8
Edutronic Global Services EฺIฺRฺL

Operation requires startup of instance "london2" on database


"london2"
Starting instance "london2"...
ORACLE instance started.
Database mounted.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Continuing to reinstate database "london2" ...


Operation requires shutdown of instance "london2" on database
"london2"
Shutting down instance "london2"...
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "london2" on database
"london2" s a
Starting instance "london2"... ) ha
ORACLE instance started.
l ฺ c om
Database mounted.
m ai ฺ
Continuing to reinstate database "london2" ...
9 @ g
u ide
Reinstatement of database "london2" succeeded i z 9 nt G
u
pr tude
13:04:04.71 Wednesday, December 18, 2013 (
N is Sthe environment variables
3. Use a terminal window on host03 connected asO oracle with
R R thas the sysdg user with operating
set to london. Launch the DGMGRL utility A e
and connect
B o us
system authentication.
I
U se t Z
[oracle@host03]$ dgmgrlR
H Version n 12.1.0.1.0 - 64bit Production
T
E le
DGMGRL for Linux: l i c e
A B b 2012, Oracle. All rights reserved.
Copyright
L I Z (c) 2000,
e r a
A E ntosfDGMGRL,
Welcome type "help" for information.
I
IC (host03)- tra DGMGRL> connect sysdg/oracle_4U@london
T R no n
PA Connected as SYSDG.
4. Display the current configuration and note the current state of fast-start failover.
(host03) DGMGRL> show configuration
Configuration - DRSolution

Protection Mode: MaxAvailability


Databases:
london - Primary database
londonFS - Far Sync
boston - (*) Physical standby database (disabled)
ORA-16661: the standby database needs to be reinstated

london2 - Logical standby database


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

Practices for Lesson 14: Enabling Fast-Start Failover


Chapter 14 - Page 9
Edutronic Global Services EฺIฺRฺL

Warning: ORA-16857: standby disconnected from redo


source for longer than specified threshold

bostonFS - Far Sync (inactive)


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Fast-Start Failover: ENABLED

Configuration Status:
WARNING
Note: The ORA-16857 warning message depends on the lag and overall performance of
the virtual machine environment. You may or may not see this warning statement. It is a
matter of timing.
5. Use a terminal window on host01 connected as oracle with the environment variables set to
'boston'. Connect to the former primary database (the new physical standby database)
using SQL*Plus and mount the 'boston' database. Exit SQL*Plus.
s a
[oracle@host01]$ sqlplus / as sysdba ) ha

SQL*Plus: Release 12.1.0.1.0 Production on Tue Dec 17 22:40:27
l c om
2013
m ai ฺ
9 @ g
Copyright (c) 1982, 2013, Oracle. All rights reserved.
u ide
Connected to an idle instance.
i z 9 nt G
u
pr tude
(
N is S
(host01) SQL> startup mount
R O
ORACLE instance started.
A R se th
I Z B ou
Total System Global U
R e t
n s
Area 517763072 bytes
Fixed Size
E TH lice 2290216 bytes
B ble
VariableASize 440405464 bytes
I Z
L Buffers er a
Database
E s f 71303168 bytes

I C an
IARedo-tBuffers
r 3764224 bytes

TR nDatabase
on mounted.
PA
(host01) SQL> exit;
6. Observe the output in the terminal session on host02 running the observer process.
Initiating reinstatement for database "boston"...
Reinstating database "boston", please wait...
Reinstatement of database "boston" succeeded
13:10:41.54 Wednesday, December 18, 2013

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

Practices for Lesson 14: Enabling Fast-Start Failover


Chapter 14 - Page 10
Edutronic Global Services EฺIฺRฺL

7. Return to the DGMGRL session running on host03 and display the configuration.
(host03) DGMGRL> show configuration
Configuration - DRSolution
Protection Mode: MaxAvailability
Databases:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

london - Primary database


londonFS - Far Sync
boston - (*) Physical standby database
Warning: ORA-16857: standby disconnected from redo
source for longer than specified threshold
london2 - Logical standby database
bostonFS - Far Sync (inactive)

Fast-Start Failover: ENABLED


s a
) ha
Configuration Status:
l ฺ c om
WARNING
m ai ฺ
Note: The ORA-16857 warning message depends on the lag and overallg
9 @ u idIt eis aof
performance
the virtual machine environment. You may or may not see this warning
i z 9 nt G
statement.
matter of timing. u de Keep displaying
pr totuclear.
8. It may take a few moments for the lag for the standby (
database
N untilistheSapply lag and transport lag
the status until it has cleared. Do not continue R Olabs
with
have cleared. A R se th
(host03) DGMGRL> show Idatabase Z B oboston u
U t
Database - boston R
H e n se
B ET le lic
Role:ZA
L I fState: e r ab PHYSICAL STANDBY

A E ns
Intended APPLY-ON
I
IC n-tra Lag:
Transport 0 seconds (computed 1 second ago)
T R noApply Lag:
PA
0 seconds (computed 1 second ago)
Apply Rate: 0 Byte/s
Real Time Query: OFF
Instance(s):
boston

Database Status:
SUCCESS

(host03) DGMGRL> show configuration


Configuration - DRSolution

Protection Mode: MaxAvailability


Databases:
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 14: Enabling Fast-Start Failover


Chapter 14 - Page 11
Edutronic Global Services EฺIฺRฺL

london - Primary database


londonFS - Far Sync
boston - (*) Physical standby database
london2 - Logical standby database
bostonFS - Far Sync (inactive)
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Fast-Start Failover: ENABLED

Configuration Status:
SUCCESS

s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 14: Enabling Fast-Start Failover


Chapter 14 - Page 12
Edutronic Global Services EฺIฺRฺL

Practice 14-3: Switchover to Reinstated Database


Overview
In this practice, you will perform a switchover to return the configuration to the state that it was
before the failover.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Tasks
1. Validate that the 'london' primary database is ready for switchover.
(host03) DGMGRL> validate database london
Database Role: Primary database
Ready for Switchover: Yes
2. Validate that the 'boston' standby database is ready for switchover.
(host03) DGMGRL> validate database boston

s a
) ha
Database Role: Physical standby database

om
Primary Database: london
l ฺ c
Ready for Switchover: Yes
m ai ฺ
Ready for Failover: Yes (Primary Running) @g
9 u ide
i z 9 nt G
u
pr tude
Current Log File Groups Configuration:
(
N Standby S Redo Log Groups
Thread # Online Redo Log Groups
R O h i s
(london)
A R se t (boston)
1 3 B
IZ e to u 2
U
Future Log File
T HR Groupse n s
Configuration:
c Log Groups Standby Redo Log Groups
ThreadB#E Online
l e liRedo
A b
IZ fera(boston)
E L (london)

C I A 1trans 3 2
I - to the 'boston' database.
T3.R Switchover
non
PA (host03) DGMGRL> switchover to boston
Performing switchover NOW, please wait...
Operation requires a connection to instance "boston" on database
"boston"
Connecting to instance "boston"...
Connected as SYSDG.
New primary database "boston" is opening...
Operation requires startup of instance "london" on database
"london"
Starting instance "london"...
ORACLE instance started.
Database mounted.
Switchover succeeded, new primary is "boston"

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

Practices for Lesson 14: Enabling Fast-Start Failover


Chapter 14 - Page 13
Edutronic Global Services EฺIฺRฺL

4. Display the resulting configuration.


(host03) DGMGRL> show configuration

Configuration - DRSolution
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Protection Mode: MaxAvailability


Databases:
boston - Primary database
bostonFS - Far Sync
london - (*) Physical standby database
london2 - Logical standby database
londonFS - Far Sync (inactive)

Fast-Start Failover: ENABLED


s a
) ha
Configuration Status:
l ฺ c om
SUCCESS
m ai ฺ
5. Stop the observer process.
9 @ g
u ide
(host03) DGMGRL> stop observer
i z 9 nt G
u
pr tude
Done. (
N window S that was connected to
Note: The prompt should now be returned in the O
terminal s
host02 running the observer process. R
R se t h i
6. Disable fast-start failover. B A u
U I Z t o
(host03) DGMGRL> disable
H e se
R nfast_start failover;
Disabled.
B ET le lic
L I ZA emode
7. Reset the protection
r a bback to maximum performance and exit DGMGRL.
I A E nDGMGRL>
(host03)
a sf edit configuration set protection mode as
IC n-tr
maxperformance;
TR nSucceeded.
o
PA DGMGRL> exit;

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

Practices for Lesson 14: Enabling Fast-Start Failover


Chapter 14 - Page 14
Edutronic Global Services EฺIฺRฺL
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
Practices for Lesson g 15: ide
Backup and Recovery 9 @
9 nt Gu
i z
pru tuin
Considerations
( dean Oracle
Data N isConfiguration
OGuard S
R
R se t h
B AChapter
u 15
I
U seZ t o
R
H icen
T
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 15: Backup and Recovery Considerations in an Oracle Data Guard Configuration
Chapter 15 - Page 1
Edutronic Global Services EฺIฺRฺL

Practices for Lesson 15: Overview


Practices Overview
In these practices, you will setup and configure the recovery manager (RMAN) catalog
repository database and use it to perform backup and recovery in a Data Guard environment.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 15: Backup and Recovery Considerations in an Oracle Data Guard Configuration
Chapter 15 - Page 2
Edutronic Global Services EฺIฺRฺL

Practice 15-1: Creating a Recovery Manager Catalog


Overview
In this practice, you will setup and configure the recovery manager (RMAN) catalog repository
database.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Tasks
1. Open a new terminal window on Domain 0 as was done in the first lab. Switch to the root
user and list the virtual machines that are currently running.
[vncuser@Domain0]$ su -
Password: oracle

[root@Domain0]# xm list
Name ID Mem VCPUs State Time(s)
Domain-0 0 1024 2 r----- 15367.0 s a
host01 7 2048 1 -b---- 767.4 ) ha
host02 8 1536 1
l ฺ c om
-b---- 532.4
host03 9 2048 1
m ai ฺ-b---- 1464.9
host04 10 1536 1
9 @ g
u ide
-b---- 535.4
2. Start the 'em12' virtual machine. i z 9 nt G
u
pr tude
(
[root@Domain0]# xm create /OVS/running_pool/em12/vm.cfg
R ON his S
Using config file "/OVS/running_pool/em12/vm.cfg".
Started domain em12 (id=11)AR e t
B s
IZ equickly,
Note: Even though the prompt is returned
U t o u it will take a minute for the operating
R to start
system for virtual machine 'em12'
H n s networking services and allow connectivity.
T e
prompted for the A B blIne theclab environment,
3. Using the SSH client,Econnect toliem12
password.
as the oracle OS user. Enter oracle when you are
always use the -X option of SSH to
enable X11L Z erback
Iforwarding a to the Domain-0 console window.
E s f
I C - t an ssh -X oracle@em12
IA[root@dom0]#
r
TR noracle@em12's
on password: oracle
PA 4. Since Enterprise Manager Cloud Control 12c is installed on em12, startup scripts were
created to automatically start EM when the operating system starts. Stop the EM agent and
the EM Management Server. Exit the terminal session and close the window when done.
[oracle@em12]$ cd /u01/app/oracle/agent/agent_inst/bin
[oracle@em12]$ ./emctl stop agent
Oracle Enterprise Manager Cloud Control 12c Release 3
Copyright (c) 1996, 2013 Oracle Corporation. All rights
reserved.
Agent is Not Running

[oracle@em12]$ cd /u01/app/oracle/middleware/oms/bin
[oracle@em12]$ ./emctl stop oms -all
Oracle Enterprise Manager Cloud Control 12c Release 3

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

Practices for Lesson 15: Backup and Recovery Considerations in an Oracle Data Guard Configuration
Chapter 15 - Page 3
Edutronic Global Services EฺIฺRฺL

Copyright (c) 1996, 2013 Oracle Corporation. All rights


reserved.
Stopping WebTier...
WebTier Successfully Stopped
Stopping Oracle Management Server...
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Oracle Management Server Successfully Stopped


AdminServer Successfully Stopped
Oracle Management Server is Down

[oracle@em12]$ exit
logout
Connection to em12 closed.

[root@dom0]# exit <<You may leave the terminal window open>>


s a
) ha
[vncuser@Domain0]$ exit
5.
l ฺ c om
On host01, invoke SQL*Plus and connect as the SYS user with the SYSDBA privilege to
the emrep service.
ai ฺ
msysdba
[oracle@host01 admin]$ sqlplus sys/oracle_4U@emrep gas
SQL*Plus: Release 12.1.0.1.0 Production on Wed9Dec @ 18G u ide
i z 9 nt 15:10:17
2013
r u de
Copyright (c) 1982, 2013, Oracle. All(p rightstureserved.
Connected to: R ON his S
AR Editione t Release 11.2.0.3.0 -
B
Oracle Database 11g Enterprise s
64bit Production
U IZ e to u
H R iceOLAP,
With the Partitioning,
T ns Data Mining and Real Application
E le l
Testing options
B
A
Z erab data files are stored at.
6. Determine where
I the current
L
E nSQL>
(host01) s f select file_name from dba_data_files;
I A
R IC n-tra
T o
nFILE_NAME
PA ----------------------------------------------------------
/u01/app/oracle/oradata/emrep/users01.dbf
/u01/app/oracle/oradata/emrep/undotbs01.dbf
/u01/app/oracle/oradata/emrep/sysaux01.dbf
/u01/app/oracle/oradata/emrep/system01.dbf
/u01/app/oracle/oradata/emrep/mgmt_ecm_depot1.dbf
/u01/app/oracle/oradata/emrep/mgmt.dbf
/u01/app/oracle/oradata/emrep/mgmt_deepdive.dbf

7 rows selected.

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

Practices for Lesson 15: Backup and Recovery Considerations in an Oracle Data Guard Configuration
Chapter 15 - Page 4
Edutronic Global Services EฺIฺRฺL

7. Create a new tablespace for the recovery manager repository using the same storage
architecture as the existing files. Name the tablesace 'rcts' and give it an initial size of 30MB
with autoextend turned on.
(host01) SQL> create tablespace rcts datafile
'/u01/app/oracle/oradata/emrep/rcts01.dbf' size 30M autoextend
on;
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Tablespace created.
8. Create a new schema 'rcowner' setting the default tablespace to the tablespace just
created.
(host01) SQL> create user rcowner identified by rcpass default
tablespace rcts quota unlimited on rcts;
User created.
9. Grant the recovery catalog owner role to the user just created. Exit SQL*Plus when done.
(host01) SQL> grant recovery_catalog_owner to rcowner;
Grant succeeded. s a
) ha
(host01) SQL> exit
l ฺ c om
ai account
just created. @ g m
10. On host01, invoke recovery manager and connect to the emrep service using the
i d eฺ
i z 99 nt Gu
ru ude on Wed Dec 18
[oracle@host01]$ rman
Recovery Manager: Release 12.1.0.1.0 -(p
N is St
Production
15:25:35 2013 O
A RR se th
Copyright (c) 1982, 2013,
I Z BOracleo uand/or its affiliates. All
U t
nse rcowner/rcpass@emrep
H R icecatalog
rights reserved.
(host01) RMAN>Tconnect
connected B toErecovery
l e l catalog database
A ab
IZ fecatalog.
r
11. Create theLrecovery
A E ns
I
IC recovery tra RMAN>
(host01)
- create catalog;
T R no n catalog created
PA

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

Practices for Lesson 15: Backup and Recovery Considerations in an Oracle Data Guard Configuration
Chapter 15 - Page 5
Edutronic Global Services EฺIฺRฺL

Practice 15-2: Registering Your Database in the Recovery Catalog


Overview
In this practice, you register the primary database in the recovery catalog.

Tasks
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

1. Connect to the 'boston' primary database with SYSDBA privilege and register the database.
(host01) RMAN> connect target 'sys/oracle_4U@boston as sysdba'
connected to target database: BOSTON (DBID=2524687871)

(host01) RMAN> register database;


database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
s a
) ha
Note: Your DBID should be different.
2. List the DB_UNIQUE_NAME for all databases known to the recovery catalog.
c om
(host01) RMAN> list db_unique_name of database; l
ai ฺฺ
m
9 @ g
u ide
List of Databases
i z 9 nt G
DB Key DB Name DB ID Database Role
p u de
r Db_unique_name
( t u
------- ------- ---------- ---------------
R ON his S BOSTON ---------------
1 BOSTON
R se t
2524687871 PRIMARY
Aprimary
I Z B
3. Generate a schema report for the 'boston'
o u database.
U schema t
(host01) RMAN> report
H R
e n se for db_unique_name boston;
B ET leschema lic for database with db_unique_name
Report of A
IZ ferab
database
L
BOSTON
E ns
I A ra Permanent Datafiles
R IC List
n - tof
PA
T no ===========================
File Size(MB) Tablespace RB segs
---- -------- -------------------- -------
Datafile Name
-------------------------------------------------------------
1 800 SYSTEM YES
/u01/app/oracle/oradata/boston/system01.dbf
3 780 SYSAUX NO
/u01/app/oracle/oradata/boston/sysaux01.dbf
4 345 UNDOTBS1 YES
/u01/app/oracle/oradata/boston/undotbs01.dbf
5 260 PDB$SEED:SYSTEM NO
/u01/app/oracle/oradata/boston/pdbseed/system01.dbf

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

Practices for Lesson 15: Backup and Recovery Considerations in an Oracle Data Guard Configuration
Chapter 15 - Page 6
Edutronic Global Services EฺIฺRฺL

6 5 USERS NO
/u01/app/oracle/oradata/boston/users01.dbf
7 640 PDB$SEED:SYSAUX NO
/u01/app/oracle/oradata/boston/pdbseed/sysaux01.dbf
8 290 DEV1:SYSTEM NO
/u01/app/oracle/oradata/boston/dev1/system01.dbf
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

9 700 DEV1:SYSAUX NO
/u01/app/oracle/oradata/boston/dev1/sysaux01.dbf
10 5 DEV1:USERS NO
/u01/app/oracle/oradata/boston/dev1/SAMPLE_SCHEMA_users01.dbf
11 358 DEV1:EXAMPLE NO
/u01/app/oracle/oradata/boston/dev1/example01.dbf

List of Temporary Files


=======================
s a
) ha
File Size(MB) Tablespace Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- -----------------
l ฺ c om
ai ฺ
---
m
g ide
1 88 TEMP 32767
/u01/app/oracle/oradata/boston/temp01.dbf
9 @
9 nt G u
2 87 PDB$SEED:TEMP 32767
u i z
( pr tude
/u01/app/oracle/oradata/boston/pdbseed/pdbseed_temp01.dbf
3 87 DEV1:TEMP 32767
R ON his S
R se t
/u01/app/oracle/oradata/boston/dev1/dev1_temp01.dbf
A
I Z B o u
4. List all the archive logs for the 'boston' primary database.
U t
(host01) RMAN> list
H e n se all for db_unique_name boston;
R archivelog
List of Archived
B ET Log l e l c
iCopies for database with db_unique_name

IZA ferab
BOSTON
L
================================================================
E ns
I A
=====
R IC n-tra
PA
T no Key Thrd Seq S Low Time
------- ---- ------- - ---------

202 1 71 A 18-DEC-13
Name:
/u01/app/oracle/fast_recovery_area/BOSTON/archivelog/2013_12_18/
o1_mf_1_71_9c32odc2_.arc

203 1 72 A 18-DEC-13
Name:
/u01/app/oracle/fast_recovery_area/BOSTON/archivelog/2013_12_18/
o1_mf_1_72_9c32p1r2_.arc

204 1 73 A 18-DEC-13

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

Practices for Lesson 15: Backup and Recovery Considerations in an Oracle Data Guard Configuration
Chapter 15 - Page 7
Edutronic Global Services EฺIฺRฺL

Name:
/u01/app/oracle/fast_recovery_area/BOSTON/archivelog/2013_12_18/
o1_mf_1_73_9c36xrwt_.arc

205 1 74 A 18-DEC-13
Name:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

/u01/app/oracle/fast_recovery_area/BOSTON/archivelog/2013_12_18/
o1_mf_1_74_9c36yy2d_.arc

5. Display all the current configuration parameters for the 'boston' primary database.
(host01) RMAN> show all for db_unique_name boston;

RMAN configuration parameters for database with db_unique_name


BOSTON are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
s a
CONFIGURE BACKUP OPTIMIZATION OFF; # default ) ha
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
l ฺ c om
ai ฺ
CONFIGURE CONTROLFILE AUTOBACKUP ON; # default
m
@ g ide
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO
9 u
'%F'; # default
i z 9 nt G
u
pr tude
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO
(
ON his S
BACKUPSET; # default
R
AR use t
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; #
default
B
IZ e to
U
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; #
H R icens
default
T
BE ble l
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
A
LIZ sfera
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
E CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
I C IA -tran
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT'
TR non OPTIMIZE FOR LOAD TRUE ; # default
PA CONFIGURE RMAN OUTPUT TO KEEP FOR 7 DAYS; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO
'/u01/app/oracle/product/12.1.0/dbhome_1/dbs/snapcf_boston.f'; #
default

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

Practices for Lesson 15: Backup and Recovery Considerations in an Oracle Data Guard Configuration
Chapter 15 - Page 8
Edutronic Global Services EฺIฺRฺL

Practice 15-3: Configuring RMAN Parameters


Overview
In this practice, you will configure RMAN for use in a Data Guard environment.

Tasks
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

1. In your RMAN session (connected to your primary database), configure the backup
retention policy to allow for recovery for seven days.
(host01) RMAN> configure retention policy to recovery window of
7 days;

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
s a
) ha
full resync complete
2.
l ฺ c om
Specify that archived redo log files can be deleted after they are applied to the standby
database.
(host01) RMAN> configure archivelog deletion policygm
ai ฺ
ide
to applied
on all standby; 9 @
9 nt G u
u i
r udez
new RMAN configuration parameters:
( pAPPLIED
CONFIGURE ARCHIVELOG DELETION POLICY
O N is St ON ALL STANDBY;
TO
new RMAN configuration parameters
A RR saree h
tsuccessfully stored
starting full resync of recovery
I Z B o ucatalog
full resync completeU
R e t
3. Configure the connect T H for e s
n primary database.
identifier
BE configure l i c your
(host01)ARMAN>
Z a b le db_unique_name boston connect
L I r
A E nsfe
identifier 'boston';
I tra configuration parameters:
IC newn-RMAN
T R o
nCONFIGURE
PA
DB_UNIQUE_NAME 'boston' CONNECT IDENTIFIER 'boston';
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete
4. Configure the connect identifier for your physical standby database.
(host01) RMAN> configure db_unique_name london connect
identifier 'london';

new RMAN configuration parameters:


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

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

Practices for Lesson 15: Backup and Recovery Considerations in an Oracle Data Guard Configuration
Chapter 15 - Page 9
Edutronic Global Services EฺIฺRฺL

5. Your physical standby database is registered with the recovery catalog. Use the LIST
DB_UNIQUE_NAME command to see the registration information about your primary and
standby databases.
(host01) RMAN> list db_unique_name of database;
List of Databases
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

DB Key DB Name DB ID Database Role Db_unique_name


------- ------- ----------- --------------- ------------------
1 BOSTON 2524687871 PRIMARY BOSTON
1 BOSTON 2524687871 STANDBY LONDON
6. Use the REPORT SCHEMA command to view additional information about your physical
standby database. Exit RMAN when done.
(host01) RMAN> report schema for db_unique_name london;
Report of database schema for database with db_unique_name
LONDON
s a
) ha
List of Permanent Datafiles

om
===========================
l ฺ c
ai ฺ
File Size(MB) Tablespace RB segs Datafile Name
m
g ide
---- -------- -------------------- ------- -----------------
1 800 SYSTEM 9
YES @
9 nt G u
u i z
pr tude
3 770 SYSAUX NO
4 345 UNDOTBS1 ( YES
5 260 R ON his S
PDB$SEED:SYSTEM NO
6 5
B
USERSAR use t NO
7 640
U IZ e to
PDB$SEED:SYSAUX NO
8 290
T H R icens
DEV1:SYSTEM NO
9
A BE ble l
700 DEV1:SYSAUX NO

E LIZ sfera
10
11
5
358
DEV1:USERS
DEV1:EXAMPLE
NO
NO
I C IA -tran
TR n(host01)
on
PA
RMAN> exit;
7. Invoke RMAN again and connect to your physical standby database and the recovery
catalog.
[oracle@host01]$ rman target sys/oracle_4U@london catalog
rcowner/rcpass@emrep
Recovery Manager: Release 12.1.0.1.0 - Production on Wed Dec 18
16:04:49 2013
Copyright (c) 1982, 2013, Oracle and/or its affiliates. All
rights reserved.
connected to target database: BOSTON (DBID=2524687871, not open)
connected to recovery catalog database
Note: Notice that the database name is listed as BOSTON, even though a connection was
made to the 'london' physical standby instance.

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

Practices for Lesson 15: Backup and Recovery Considerations in an Oracle Data Guard Configuration
Chapter 15 - Page 10
Edutronic Global Services EฺIฺRฺL

8. Execute the SHOW ALL command to view the configuration parameters for your physical
standby database.
(host01) RMAN> show all for db_unique_name london;
RMAN configuration parameters for database with db_unique_name
LONDON are:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;


CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO
'%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO
BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; #
default
s a
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; #
) ha
default
l ฺ c om
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
m ai ฺ
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
9 @ g
u ide
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
i z 9 nt G
u
pr tude
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT'
(
ON his S
OPTIMIZE FOR LOAD TRUE ; # default
R
CONFIGURE DB_UNIQUE_NAME 'boston' CONNECT IDENTIFIER 'boston';
B AR use t
CONFIGURE DB_UNIQUE_NAME 'london' CONNECT IDENTIFIER 'london';

U IZ e to
CONFIGURE RMAN OUTPUT TO KEEP FOR 7 DAYS; # default
H R icens
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY;
T
BE ble l
CONFIGURE SNAPSHOT CONTROLFILE NAME TO
A
LIZ sfera
'/u01/app/oracle/product/12.1.0/dbhome_1/dbs/snapcf_london.f'; #
E default
C IA -backup
9. Configure
I t r an optimization. Exit RMAN when done.
TR n(host01)
on
PA
RMAN> configure backup optimization on;
new RMAN configuration parameters:
CONFIGURE BACKUP OPTIMIZATION ON;
new RMAN configuration parameters are successfully stored

(host01) RMAN> exit;

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

Practices for Lesson 15: Backup and Recovery Considerations in an Oracle Data Guard Configuration
Chapter 15 - Page 11
Edutronic Global Services EฺIฺRฺL

Practice 15-4: Recovering a Data File on Your Primary Database


Overview
In this practice, you recover a data file in your primary database by using a data file from your
physical standby database. You will create a new data file in order to simulate a disaster,
without affecting the existing data files on the primary database.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Tasks
1. The logical standby database does not honor the DB_FILE_NAME_CONVERT parameter.
This will cause an error when a tablespace is created on the primary database and force
the Logical Apply process to shutdown because the directory doesn't exit. Use a terminal
window logged in as oracle to host03. Create a symbolic link 'boston' linking to 'london2' so
that file creation can proceed.
[oracle@host03]$ cd /u01/app/oracle/oradata
[oracle@host03]$ ln -s london2 boston
s a
) ha
Note: The Data Guard documentation shows how to create a DDL handler using a
procedure, along with the built-in DBMS_LOGSTDBY.SKIP procedure to skip over the DDL
c om
with the wrong path names and invoke the handler to rename the path in the command.
l ฺ
2. m ai ฺ
Use a terminal window logged in as oracle to host01 to with the environment variables set

9 @ g
u ide
for 'boston' appropriately. Launch SQL*Plus and create a new tablespace SAMPLE in the
DEV1 pluggable database with a data file
i z 9 nt G
u
pr tude
/u01/app/oracle/oradata/boston/dev1/sample01.dbf and a size of 5 MB.
(
N is S
[oracle@host01]$ sqlplus / as sysdba
R O
SQL*Plus: Release 12.1.0.1.0 R
A e th on Wed Dec 18 16:23:20
Production
2013
I Z B o us
Copyright (c) 1982, U
R e
2013, Oracle. t All rights reserved.
Connected to: H e n s
E T l i c
AB rab12c
Oracle Database
Z
64bit IProduction
le Enterprise Edition Release 12.1.0.1.0 -
E Lthe Partitioning,
s fe
C I A
With
t r a n OLAP, Advanced Analytics and Real
I
TR non-
Application Testing options

PA (host01) SQL> alter session set container=DEV1;


Session altered.

(host01) SQL> create tablespace SAMPLE datafile


'/u01/app/oracle/oradata/boston/dev1/sample01.dbf' size 5M;
Tablespace created.

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

Practices for Lesson 15: Backup and Recovery Considerations in an Oracle Data Guard Configuration
Chapter 15 - Page 12
Edutronic Global Services EฺIฺRฺL

3. Connect to your physical standby instance as the SYSDBA user and show the
standby_file_management parameter.
(host01) SQL> connect sys/oracle_4U@london as sysdba
Connected.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

(host01) SQL> show parameter standby_file_management


NAME TYPE VALUE
------------------------------------ ----------- ------------
standby_file_management string AUTO
4. Verify that the data file has successfully been created on the physical standby database.
(host01) SQL> select file#,name from v$datafile;
FILE# NAME
----- ----------------------------------------------------
1 /u01/app/oracle/oradata/london/system01.dbf
s a
3 /u01/app/oracle/oradata/london/sysaux01.dbf
) ha
4 /u01/app/oracle/oradata/london/undotbs01.dbf
l ฺ c om
5 /u01/app/oracle/oradata/london/pdbseed/system01.dbf
m ai ฺ
6 /u01/app/oracle/oradata/london/users01.dbf
9 @ g
u ide
z 9 nt G
7 /u01/app/oracle/oradata/london/pdbseed/sysaux01.dbf
i
u
pr tude
(
8 /u01/app/oracle/oradata/london/dev1/system01.dbf

ON his S
9 /u01/app/oracle/oradata/london/dev1/sysaux01.dbf
R
10
B AR use t
/u01/app/oracle/oradata/london/dev1/SAMPLE_SCHEMA_users01.dbf
U IZ e to
11 /u01/app/oracle/oradata/london/dev1/example01.dbf

T H R icens
12 /u01/app/oracle/oradata/london/dev1/sample01.dbf

A BE ble l
LIZselected.
11 rows
E f e ra
s standby instance as the SYSDBA user.
I A totyour
5. Connect
C r a nlogical
I
on- SQL> connect sys/oracle_4U@london2 as sysdba
TR n(host01)
PA Connected.
6. Verify that the data file has successfully been created on the logical standby database.
(host01) SQL> select file#,name from v$datafile;
FILE# NAME
----- ----------------------------------------------------
1 /u01/app/oracle/oradata/london2/system01.dbf
3 /u01/app/oracle/oradata/london2/sysaux01.dbf
4 /u01/app/oracle/oradata/london2/undotbs01.dbf
5 /u01/app/oracle/oradata/london2/pdbseed/system01.dbf
6 /u01/app/oracle/oradata/london2/users01.dbf
7 /u01/app/oracle/oradata/london2/pdbseed/sysaux01.dbf
8 /u01/app/oracle/oradata/london2/dev1/system01.dbf
9 /u01/app/oracle/oradata/london2/dev1/sysaux01.dbf
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 15: Backup and Recovery Considerations in an Oracle Data Guard Configuration
Chapter 15 - Page 13
Edutronic Global Services EฺIฺRฺL

10
/u01/app/oracle/oradata/london/dev1/SAMPLE_SCHEMA_users01.dbf
11 /u01/app/oracle/oradata/london2/dev1/example01.dbf
12 /u01/app/oracle/oradata/boston/dev1/sample01.dbf
7. Reconnect to your primary database and create the hr.employees2 table as a copy of
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

the hr.employees table into the newly created tablespace. Exit SQL*Plus
(host01) SQL> connect
system/oracle_4U@//host01.example.com/DEV1.example.com
Connected.

(host01) SQL> create table hr.employees2 tablespace sample as


select * from hr.employees;
Table created.
Note: A service name was never created for the DEV1 pluggable database. The connection
s a
) ha
above uses the EZCONNECT method to directly connect to the DEV1 pluggable database
without having an entry in the TNSNAMES.ORA file. It connects without having to connect to
the CDB$ROOT container first and issue the 'alter session set container =
l ฺ c om
ai ฺ
DEV1;' command. Also of interest, the HR account is currently expired and locked.
m
8. @ g ide
Verify that the table was created by counting the number of rows it contains.
9 u
i z 9 nt G
(host01) SQL> select count(*) from hr.employees2;
u
pr tude
COUNT(*) (
----------
R ON his S
107
B AR use t
IZ e to to simulate a failure in the primary
9. Move the sample01.dbf file to sample01.sav
U
database.
H R ns
(host01) SQL> E T!mv l i c e
Z AB rable
/u01/app/oracle/oradata/boston/dev1/sample01.dbf
I
E L sfe
/u01/app/oracle/oradata/boston/dev1/sample01.sav

C IA to-tthe
10. Connect
I r anroot container and shutdown abort the primary database. Exit SQL*Plus.
TR n(host01)
on
PA
SQL> connect sys/oracle_4U@boston as sysdba
Connected.

(host01) SQL> shutdown abort


ORACLE instance shut down.

(host01) SQL> exit


11. Use a terminal window logged in as oracle to host01 with the environment variables set for
'boston' appropriately. Launch SQL*Plus and start the database instance. Exit SQL*Plus.
[oracle@host01]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Fri Jan 17 17:44:40
2014
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 15: Backup and Recovery Considerations in an Oracle Data Guard Configuration
Chapter 15 - Page 14
Edutronic Global Services EฺIฺRฺL

(host01) SQL> startup


ORACLE instance started.

Total System Global Area 517763072 bytes


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Fixed Size 2290216 bytes


Variable Size 440405464 bytes
Database Buffers 71303168 bytes
Redo Buffers 3764224 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 12 - see DBWR trace
file
ORA-01110: data file 12:
'/u01/app/oracle/oradata/boston/dev1/sample01.dbf'
s a
) ha
12. Since the datafile belongs to a non-critical tablespace such as SYSTEM, offline the datafile
and open the database. You will need to change to the DEV1 container where the
c
tablespace was created at in order to offline it. Exit SQL*Plus.
l ฺ om
(host01) SQL> alter session set container=dev1; m ai ฺ
Session altered.
9 @ g
u ide
i z 9 nt G
u e
pr tudoffline;
(host01) SQL> alter tablespace sample (datafile
Tablespace altered.
R ON his S
B AR use t
IZ eset
(host01) SQL> alter session
U t o container=CDB$ROOT;
Session altered. R
T H icens
BE alter
l e l
(host01)ASQL>
L I Z erab database open;
I A a sf
E naltered.
Database
IC n-tr SQL> show pdbs
TR n(host01)
o
PA CON_ID CON_NAME OPEN MODE RESTRICTED
------ ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 DEV1 MOUNTED

(host01) SQL> alter pluggable database dev1 open;


Pluggable database altered.

(host01) SQL> show pdbs


CON_ID CON_NAME OPEN MODE RESTRICTED
------ ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 DEV1 READ WRITE NO
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 15: Backup and Recovery Considerations in an Oracle Data Guard Configuration
Chapter 15 - Page 15
Edutronic Global Services EฺIฺRฺL

(host01) SQL> exit


13. Use RMAN to restore the missing datafile using the physical standby database. You will
need to connect to the physical standby database as the target database, and to the
primary database as the auxiliary database. Exit RMAN.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

[oracle@host01]$ rman
Recovery Manager: Release 12.1.0.1.0 - Production on Fri Dec 20
14:20:37 2013
Copyright (c) 1982, 2013, Oracle and/or its affiliates. All
rights reserved.

(host01) RMAN> connect target sys/oracle_4U@london


connected to target database: BOSTON (DBID=2524687871)

s a
) ha
(host01) RMAN> connect auxiliary sys/oracle_4U@boston
connected to auxiliary database: BOSTON (DBID=2524687871)
l ฺ c om
(host01) RMAN> backup as copy datafile 12 auxiliary m ai ฺ
format
'/u01/app/oracle/oradata/boston/dev1/sample01.bkp';g
9 @ u ide
Starting backup at 20-DEC-13 i z 9 nt G
u de
pr ofturecovery
using target database control file instead( catalog
allocated channel: ORA_DISK_1
R ON his S
A
channel ORA_DISK_1: SID=43 device
e t
R stype=DISK
I Z
channel ORA_DISK_1: starting B o u copy
datafile
U t
input datafile file
H e n se
R number=00012
ET le lic
name=/u01/app/oracle/oradata/london/dev1/sample01.dbf
B
IZA ferab
output file
L
name=/u01/app/oracle/oradata/boston/dev1/sample01.bkp
E ns
I A
tag=TAG20140117T174920
tra ORA_DISK_1: datafile copy complete, elapsed time:
R IC channel
n -
T o
n00:00:01
PA Finished backup at 20-DEC-13

(host01) RMAN> exit


14. Use RMAN with connections to the primary database as the target database and also the
recovery catalog. Catalog the copy of the datafile just made so that RMAN is aware of the
manual backup.
[oracle@host01]$ rman target sys/oracle_4U@boston catalog
rcowner/rcpass@emrep;
Recovery Manager: Release 12.1.0.1.0 - Production on Fri Dec 20
14:27:34 2013
Copyright (c) 1982, 2013, Oracle and/or its affiliates. All
rights reserved.
connected to target database: BOSTON (DBID=2524687871)

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

Practices for Lesson 15: Backup and Recovery Considerations in an Oracle Data Guard Configuration
Chapter 15 - Page 16
Edutronic Global Services EฺIฺRฺL

connected to recovery catalog database

(host01) RMAN> catalog datafilecopy


'/u01/app/oracle/oradata/boston/dev1/sample01.bkp';
starting full resync of recovery catalog
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

full resync complete


cataloged datafile copy
datafile copy file
name=/u01/app/oracle/oradata/boston/dev1/sample01.bkp RECID=11
STAMP=834676134
15. Rename the existing datafile 12 to the new name, switch the control file to use the new file,
and recover the file. Exit RMAN.
RMAN> run {
set newname for datafile 12 to
'/u01/app/oracle/oradata/boston/dev1/sample01.bkp';
s a
switch datafile 12; ) ha
recover datafile 12;
l ฺ c om
}
m ai ฺ
9 @ g
u ide
executing command: SET NEWNAME i z 9 nt G
RMAN-06169: could not read file header(p u
r datafilede 12 error
for
N is S t u
reason 4
R O
datafile 12 switched to datafile
A R se th
copy
input datafile copy RECID=11
I Z B STAMP=834676134
o u file
U se t
name=/u01/app/oracle/oradata/boston/dev1/sample01.bkp
R
T H iof
starting full resync
c e n
recovery catalog
full resync BEcomplete l
le 20-DEC-13
I Z A a b
E L schannel:
Starting
er
recover
f
at

C I A tran
allocated ORA_DISK_1
I channel
on- media recovery
TR nstarting
ORA_DISK_1: SID=81 device type=DISK

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


Finished recover at 20-DEC-13

(host01) RMAN> exit


16. Use a terminal window logged in as oracle to host01 with the environment variables set for
'boston' appropriately. Launch SQL*Plus and switch the container to the pluggable
database. Online the files for the tablespace 'EXAMPLE2.' Verify that the table has been
recovered and the rows exist in the table.
[oracle@host01]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Fri Dec 20 14:34:56
2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 15: Backup and Recovery Considerations in an Oracle Data Guard Configuration
Chapter 15 - Page 17
Edutronic Global Services EฺIฺRฺL

Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -


64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real
Application Testing options

(host01) SQL> alter session set container=DEV1;


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Session altered.

(host01) SQL> alter tablespace sample datafile online;


Tablespace altered.

(host01) SQL> select * from hr.employees2;



EMPLOYEE_ID FIRST_NAME LAST_NAME
s a
) ha
----------- -------------------- -------------------------

om
EMAIL PHONE_NUMBER HIRE_DATE JOB_ID
SALARY
l ฺ c
m ai ฺ
------------------------- -------------------- --------- -------
--- ----------
9 @ g
u ide
COMMISSION_PCT MANAGER_ID DEPARTMENT_ID
i z 9 nt G
u
pr tude
(
-------------- ---------- -------------
205 Shelley
R ON his S
Higgins
SHIGGINS
12008 B AR use t
515.123.8080 07-JUN-02 AC_MGR

U IZ e to
101 110
T H R icens
BEWilliam
l e l
I Z A
206
a b Gietz

E L sfer 8300
WGIETZ 515.123.8181 07-JUN-02

I C IA -tran
AC_ACCOUNT

TR non
205 110

PA EMPLOYEE_ID FIRST_NAME LAST_NAME


----------- -------------------- -------------------------
EMAIL PHONE_NUMBER HIRE_DATE JOB_ID
SALARY
------------------------- -------------------- --------- -------
--- ----------
COMMISSION_PCT MANAGER_ID DEPARTMENT_ID
-------------- ---------- -------------

107 rows selected.

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

Practices for Lesson 15: Backup and Recovery Considerations in an Oracle Data Guard Configuration
Chapter 15 - Page 18
Edutronic Global Services EฺIฺRฺL

17. Use the online datafile move command to rename the newly created datafile back to the old
name.
(host01) SQL> alter database move datafile
'/u01/app/oracle/oradata/boston/dev1/sample01.bkp' TO
'/u01/app/oracle/oradata/boston/dev1/sample01.dbf';
Database altered.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Note: The online move operation does not move (or rename) the datafile on the standby
sites.
18. Drop the tablespace that was created in the lab along with the datafiles. Exit SQL*Plus.
(host01) SQL> drop tablespace sample including contents and
datafiles;
Tablespace dropped;

(host01) SQL> exit


s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 15: Backup and Recovery Considerations in an Oracle Data Guard Configuration
Chapter 15 - Page 19
Edutronic Global Services EฺIฺRฺL
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 15: Backup and Recovery Considerations in an Oracle Data Guard Configuration
Chapter 15 - Page 20
Edutronic Global Services EฺIฺRฺL
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
Practices for Lesson g 16: ide
Enhanced Client 9 @ u
9 Connectivity
G
i z en t
ru uEnvironment
in a Data(p
Guard d
O N is St
A RR s16e th
Chapter

I Z B ou
R U se t
T H icen
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 16: Enhanced Client Connectivity in a Data Guard Environment
Chapter 16 - Page 1
Edutronic Global Services EฺIฺRฺL

Practices for Lesson 16: Overview


Practices Overview
In these practices, you will create a service to connect to the DEV1 pluggable database, and
also create a database startup trigger that will start the service on any host machine that the
primary database is running on.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 16: Enhanced Client Connectivity in a Data Guard Environment
Chapter 16 - Page 2
Edutronic Global Services EฺIฺRฺL

Practice 16-1: Creating and Testing Primary Database Services


Overview
In this practice, you will create and test a service for the DEV1 pluggable database on the
primary database, and follow that service as it migrates from host01 to host03 during switchover
exercises.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Tasks
1. Use a terminal window logged in as oracle to host01 with the environment variables set for
'boston' appropriately. Launch SQL*Plus and set the session container to the DEV1
pluggable database.
[oracle@host01]$ . oraenv
ORACLE_SID = [boston] ?
The Oracle base remains unchanged with value /u01/app/oracle

s a
) ha
[oracle@host01]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Fri Jan 17 18:29:14
l ฺ c om
2014
m ai ฺ
g ide
Copyright (c) 1982, 2013, Oracle. All rights reserved.
9 @
9 nt G u
Connected to: u i z e
r ud12.1.0.1.0
Oracle Database 12c Enterprise Edition(p t
O N is S
Release -
64bit Production
R R h
tAnalytics
With the Partitioning, OLAP,
B A s e
Advanced
u
and Real
Application Testing options
U IZ e to
(host01) SQL> T H R session
ic e n s
B E alter
e l set container=dev1;
Session A
I Zaltered.
r a bl
L fe with the name 'PRMY.EXAMPLE.COM'.
E startnasservice
2. Create and
I A tra SQL> exec
R IC (host01)
n -
T o
nDBMS_SERVICE.CREATE_SERVICE('PRMY.EXAMPLE.COM','PRMY.EXAMPLE.COM
PA ');
PL/SQL procedure successfully completed.

(host01) SQL> exec


DBMS_SERVICE.START_SERVICE('PRMY.EXAMPLE.COM');
PL/SQL procedure successfully completed.
3. From within SQL*Plus, display the status of the Oracle listener running on host01 and verify
that the service was started successfully. Do not exit SQL*Plus.
(host01) SQL> !lsnrctl status
LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 20-DEC-
2013 16:06:01
Copyright (c) 1991, 2013, Oracle. All rights reserved.

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

Practices for Lesson 16: Enhanced Client Connectivity in a Data Guard Environment
Chapter 16 - Page 3
Edutronic Global Services EฺIฺRฺL

Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=host01.example.com)(PO
RT=1521)(SEND_SDU=10485760)(RECV_SDU=10485760)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Version TNSLSNR for Linux: Version 12.1.0.1.0


- Production
Start Date 18-DEC-2013 10:25:42
Uptime 2 days 5 hr. 40 min. 21 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File
/u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.o
s a
ra
) ha
Listener Log File
l ฺ c om
ai ฺ
/u01/app/oracle/diag/tnslsnr/host01/listener/alert/log.xml
m
g ide
Listening Endpoints Summary...
9 @
9 nt G u
u i z
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=host01.example.com)(PO
RT=1521))) ( pr tude
ON his S
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
R
A R se t
B
IZ e to u
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=host01.example.com)(P
U
H R icens
ORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/admin/b
oston/xdb_wallet))(Presentation=HTTP)(Session=RAW))
T
E le l
A B
IZ ferab
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=host01.example.com)(P
L
E ns
ORT=5501))(Security=(my_wallet_directory=/u01/app/oracle/admin/b
A
I tra Summary...
IC Services
oston/xdb_wallet))(Presentation=HTTP)(Session=RAW))
-
T R no n
PA Service "PRMY.EXAMPLE.COM" has 1 instance(s).
Instance "boston", status READY, has 1 handler(s) for this
service...
Service "boston.example.com" has 2 instance(s).
Instance "boston", status UNKNOWN, has 1 handler(s) for this
service...
Instance "boston", status READY, has 1 handler(s) for this
service...
Service "bostonXDB.example.com" has 1 instance(s).
Instance "boston", status READY, has 0 handler(s) for this
service...
Service "boston_DGB.example.com" has 1 instance(s).
Instance "boston", status READY, has 1 handler(s) for this
service...
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 16: Enhanced Client Connectivity in a Data Guard Environment
Chapter 16 - Page 4
Edutronic Global Services EฺIฺRฺL

Service "boston_DGMGRL.example.com" has 1 instance(s).


Instance "boston", status UNKNOWN, has 1 handler(s) for this
service...
Service "dev1.example.com" has 1 instance(s).
Instance "boston", status READY, has 1 handler(s) for this
service...
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

The command completed successfully


4. Use another terminal window logged in as oracle to host02 to with the environment
variables set for 'bostonFS' appropriately. Launch SQL*Plus and connect to the
PRMY.EXAMPLE.COM service.
[oracle@host02]$ . oranev
ORACLE_SID = [bostonFS] ?
The Oracle base remains unchanged with value /u01/app/oracle

s a
) ha
[oracle@host02]$ sqlplus system/oracle_4U@prmy
SQL*Plus: Release 12.1.0.1.0 Production on Fri Dec 20 15:19:40
2013
l ฺ c om
Copyright (c) 1982, 2013, Oracle. All rights reserved.
m ai ฺ
Last Successful login time: Fri Dec 20 2013 14:02:22 +00:00
9 @ g
u ide
Connected to: i z 9 nt G
u
pr tude
(
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -
64bit Production
R ON his S
Application Testing options B AR use t
With the Partitioning, OLAP, Advanced Analytics and Real

Note: The tnsnames.ora network U IZconfiguration


e to file was created in practice 3, with an
R
Hto connect s
nto both host01.example.com and
entry 'PRMY' that attempts
T l i c e
host03.example.com,
A BE bandleaccess a service name of 'PRMY.EXAMPLE.COM'.
5. Verify thatL IZare indeed
you
f e ra connected to the 'boston' instance (the primary database).
E
A(host02) s select instance_name from v$instance;
nSQL>
I C I t r a
on-
TR nINSTANCE_NAME
PA ----------------
boston
6. Verify that your connection has been established with the DEV1 pluggable database and
not the root container. Exit SQL*Plus.
(host02) SQL> select sys_context ('USERENV', 'CON_NAME') as
container FROM dual;
CONTAINER
---------------------------------------------------------
DEV1

(host02) exit

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

Practices for Lesson 16: Enhanced Client Connectivity in a Data Guard Environment
Chapter 16 - Page 5
Edutronic Global Services EฺIฺRฺL

7. Return to the SQL*Plus session running on host01 for the primary database. Create an on
database startup trigger that will open the DEV1 pluggable database if it is not already
open. The trigger should then start the 'PRMY.EXAMPLE.COM' service after it switches the
container to the DEV1 container. The logic should only execute if the database is in the
primary role. Exit SQL*Plus on host01.
(host01) SQL> create or replace trigger primary_services
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

after startup on database


declare
role varchar2(30);
omode varchar2(30);
begin
select database_role into role from v$database;
select open_mode into omode from v$pdbs where name = 'DEV1';
if role = 'PRIMARY' then
s a
) ha
if omode != 'READ WRITE' then
execute immediate 'alter pluggable database dev1 open';
end if;
l ฺ c om
m ai ฺ
9
execute immediate 'alter session set container=dev1'; @ g
u ide
i z 9 nt G
u
dbms_service.start_service('PRMY.EXAMPLE.COM');
pr tude
end if; (
end;
R ON his S
/
B AR use t
U IZ e to
Trigger created. R
T H icens
BE exit l e l
(host01) A
IZ ferab
SQL>
L
E nwindow
8. Use a terminal s logged in as oracle to host01 with the environment variables set for
I A
C n-tr
'boston' a
appropriately. Launch DGMGRL and connect to the sysdg account. Show the
R Iconfiguration.
PA
T no [oracle@host01]$ dgmgrl
DGMGRL for Linux: Version 12.1.0.1.0 - 64bit Production
Copyright (c) 2000, 2012, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.

(host01) DGMGRL> connect sysdg/oracle_4U@boston


Connected as SYSDG.

(host01) DGMGRL> show configuration


Configuration - DRSolution
Protection Mode: MaxPerformance
Databases:
boston - Primary database
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 16: Enhanced Client Connectivity in a Data Guard Environment
Chapter 16 - Page 6
Edutronic Global Services EฺIฺRฺL

bostonFS - Far Sync


london - Physical standby database
london2 - Logical standby database
londonFS - Far Sync (inactive)
Fast-Start Failover: DISABLED
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Configuration Status:
SUCCESS
9. Validate that the primary and physical standby databases are ready for switchover.
(host01) DGMGRL> validate database boston
Database Role: Primary database
Ready for Switchover: Yes

(host01) DGMGRL> validate database london


Database Role: Physical standby database
s a
Primary Database: boston ) ha
l ฺ c om
Ready for Switchover: Yes
m ai ฺ
Ready for Failover: Yes (Primary Running)
9 @ g
u ide
i z 9 nt G
u
pr tude
Current Log File Groups Configuration:
(
Thread # Online Redo Log Groups
R ON hStandby
i s S Redo Log Groups
(boston)
A R se t (london)
1 3 B
IZ e to u 2
U
T HR c e n s
Future Log File
B#E Onlinel e liRedo
Groups Configuration:
Thread
I Z A a b Log Groups Standby Redo Log Groups
E L sfer(london) (boston)

I C IA -1tran 3 2
R Perform
T10. non a switch over to the 'london' physical standby database. Do not exit DGMGRL.
PA (host01) DGMGRL> switchover to london
Performing switchover NOW, please wait...
Operation requires a connection to instance "london" on database
"london"
Connecting to instance "london"...
Connected as SYSDG.
New primary database "london" is opening...
Operation requires startup of instance "boston" on database
"boston"
Starting instance "boston"...
ORACLE instance started.

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

Practices for Lesson 16: Enhanced Client Connectivity in a Data Guard Environment
Chapter 16 - Page 7
Edutronic Global Services EฺIฺRฺL

Database mounted.
Database opened.
Switchover succeeded, new primary is "london"
11. Use another terminal window logged in as oracle to host02 with the environment variables
set for 'bostonFS' appropriately. Launch SQL*Plus and connect to the
PRMY.EXAMPLE.COM service.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

[oracle@host02]$ . oranev
ORACLE_SID = [bostonFS] ?
The Oracle base remains unchanged with value /u01/app/oracle

[oracle@host02]$ sqlplus system/oracle_4U@prmy


SQL*Plus: Release 12.1.0.1.0 Production on Fri Dec 20 15:19:40
2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
s a
) ha
Last Successful login time: Fri Dec 20 2013 14:02:22 +00:00
Connected to:
l ฺ c om
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -
64bit Production m ai ฺ
With the Partitioning, OLAP, Advanced Analytics and Real
9 @ g
u ide
Application Testing options i z 9 nt G
u
r primary
p(the dedatabase).
(
12. Verify that you are now connected to the 'london' instance t u
(host02) SQL> select instance_name
R ON s S
from iv$instance;
h
INSTANCE_NAME
B AR use t
----------------
U IZ e to
london
T H R icens
B E has
13. Verify that your connection
l e lbeen established with the DEV1 pluggable database and
A
Z erExit
not the root Icontainer. a bSQL*Plus.
L
E nSQL> sf select sys_context ('USERENV', 'CON_NAME') as
I A
(host02)
a
R IC n-tr FROM dual;
container
T o
nCONTAINER
PA ---------------------------------------------------------
DEV1

(host02) exit

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

Practices for Lesson 16: Enhanced Client Connectivity in a Data Guard Environment
Chapter 16 - Page 8
Edutronic Global Services EฺIฺRฺL

14. Return to the DGMRL session running on host01 in Step 10. Validate both databases are
ready for switchover, and then perform a switchover to return the configuration to the way it
was at the start of this practice. Exit DGMGRL.
(host01) DGMGRL> validate database london
Database Role: Primary database
Ready for Switchover: Yes
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

(host01) DGMGRL> validate database boston


Database Role: Physical standby database
Primary Database: london
Ready for Switchover: Yes
Ready for Failover: Yes (Primary Running)
Current Log File Groups Configuration:
Thread # Online Redo Log Groups Standby Redo Log Groups
s a
) ha
(london) (boston)

om
1 3 2
l ฺ c
ai ฺ
Future Log File Groups Configuration:
m
g ide
Thread # Online Redo Log Groups Standby Redo Log Groups
(boston) 9
(london) @
9 nt G u
1 3 u
2 i z
( pr tude
R ON his S
(host01) DGMGRL> switchover to boston
Performing switchover NOW, A e t
R swait...
B please
IZ e to to
Operation requires a connection u instance "boston" on database
U
"boston"
T H R ice"boston"...
ns
Connecting to
B E le l
instance
A rab "boston" is opening...
LIZ sfedatabase
Connected as SYSDG.
NewEprimary

I C IAOperation
- t r an requires startup of instance "london" on database
TR n"london"
on
PA Starting instance "london"...
ORACLE instance started.
Database mounted.
Database opened.
Switchover succeeded, new primary is "boston"

(host01) DGMGRL> exit

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

Practices for Lesson 16: Enhanced Client Connectivity in a Data Guard Environment
Chapter 16 - Page 9
Edutronic Global Services EฺIฺRฺL
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 16: Enhanced Client Connectivity in a Data Guard Environment
Chapter 16 - Page 10
Edutronic Global Services EฺIฺRฺL
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
Practices for Lesson g 17: ide
9 @
9 nt Gu
Patching andizUpgrading
Databases u a Data
prin de Guard
( t u
ON his S
Configuration
R
R se t
AChapter
I Z B o u 17
R U se t
T H icen
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 17: Patching and Upgrading Databases in a Data Guard Configuration
Chapter 17 - Page 1
Edutronic Global Services EฺIฺRฺL

Practices for Lesson 17: Overview


Practices Overview
There are no practices for lesson 17.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 17: Patching and Upgrading Databases in a Data Guard Configuration
Chapter 17 - Page 2
Edutronic Global Services EฺIฺRฺL
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
Practices for Lesson g 18: ide
Optimizing a iData 9 @
9 Guard G u
z t
Configuration
( pru tuden
R O18N his S
AR use t
Chapter
B
IZ e to
U
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 18: Optimizing a Data Guard Configuration


Chapter 18 - Page 1
Edutronic Global Services EฺIฺRฺL

Practices for Lesson 18: Overview


Practices Overview
In these practices, you will configure network compression of redo data.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 18: Optimizing a Data Guard Configuration


Chapter 18 - Page 2
Edutronic Global Services EฺIฺRฺL

Practice 18-1: Configuring Network Compression of Redo Data


Overview
In this practice, you will set the RedoCompression property to configure network compression
of redo data.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

Tasks
1. Use a terminal window logged in as oracle to host01 with the environment variables set for
'boston' appropriately. Launch SQL*Plus on your primary database and determine if redo
compression is enabled by querying V$ARCHIVE_DEST.
[oracle@host01]$ . oraenv
ORACLE_SID = [boston] ?
The Oracle base remains unchanged with value /u01/app/oracle

(host01) SQL> sqlplus / as sysdba


s a
SQL*Plus: Release 12.1.0.1.0 Production on Fri Dec 20 15:19:40
) ha
2013
l ฺ c om
Copyright (c) 1982, 2013, Oracle. All rights reserved.
m ai ฺ
9 @ g
Last Successful login time: Fri Dec 20 2013 14:02:22 +00:00
u ide
Connected to:
i z 9 nt G
u
pr tude
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -
(
ON his S
64bit Production
R
AR use t
With the Partitioning, OLAP, Advanced Analytics and Real
B
Application Testing options
IZ e to
(host01) SQL> col R
U s format a30
T H c e n
dest_name
(host01) SQL>
BE select
l e lidest_name, compression from v$archive_dest;
A
IZ ferab
L
E ns
DEST_NAME COMPRES
I A tra
R IC ------------------------------
n - -------
T o
nLOG_ARCHIVE_DEST_1
PA
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_7 DISABLE
LOG_ARCHIVE_DEST_8 DISABLE
LOG_ARCHIVE_DEST_9 DISABLE
LOG_ARCHIVE_DEST_10 DISABLE
LOG_ARCHIVE_DEST_11 DISABLE

DEST_NAME COMPRES
------------------------------ -------
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 18: Optimizing a Data Guard Configuration


Chapter 18 - Page 3
Edutronic Global Services EฺIฺRฺL

LOG_ARCHIVE_DEST_12 DISABLE
LOG_ARCHIVE_DEST_13 DISABLE
LOG_ARCHIVE_DEST_14 DISABLE
LOG_ARCHIVE_DEST_15 DISABLE
LOG_ARCHIVE_DEST_16 DISABLE
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

LOG_ARCHIVE_DEST_17 DISABLE
LOG_ARCHIVE_DEST_18 DISABLE
LOG_ARCHIVE_DEST_19 DISABLE
LOG_ARCHIVE_DEST_20 DISABLE
LOG_ARCHIVE_DEST_21 DISABLE
LOG_ARCHIVE_DEST_22 DISABLE

DEST_NAME COMPRES
------------------------------ -------
s a
) ha
LOG_ARCHIVE_DEST_23 DISABLE
LOG_ARCHIVE_DEST_24 DISABLE
l ฺ c om
LOG_ARCHIVE_DEST_25 DISABLE
m ai ฺ
g ide
LOG_ARCHIVE_DEST_26 DISABLE
LOG_ARCHIVE_DEST_27 9 @
9 nt G
DISABLE u
u i z
LOG_ARCHIVE_DEST_28
( pr tude DISABLE

ON his S
LOG_ARCHIVE_DEST_29 DISABLE
R
AR use t
LOG_ARCHIVE_DEST_30 DISABLE
LOG_ARCHIVE_DEST_31 B
IZ e to
DISABLE

31 rows selected. R
U
T H icens
B
2. Use a terminal windowE logged e inl as oracle to host02 with the environment variables set for
A l
IZ ferabLaunch DGMGRL and connect to the primary database.
'bostonFS' appropriately.
L
A E ns
[oracle@host02]$ dgmgrl
I
IC DGMGRL a
tr for Linux: Version 12.1.0.1.0 - 64bit Production
on-
TR nCopyright
PA (c) 2000, 2012, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.

(host02) DGMGRL> connect sysdg/oracle_4U@boston


Connected as SYSDG.
3. Enable redo compression by setting the RedoCompression property for your far sync. Exit
DGMGRL.
(host02) DGMGRL> edit far_sync 'bostonFS' set property
'RedoCompression'='ENABLE';
Property "RedoCompression" updated

(host02) DGMGRL> exit

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

Practices for Lesson 18: Optimizing a Data Guard Configuration


Chapter 18 - Page 4
Edutronic Global Services EฺIฺRฺL

4. Return to your SQL*Plus session and query V$ARCHIVE_DEST again. Note that
compression is set for LOG_ARCHIVE_DEST_2. Exit SQL*Plus.
(host01) SQL> select dest_name, compression from v$archive_dest;

DEST_NAME COMPRES
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

------------------------------ -------
LOG_ARCHIVE_DEST_1 DISABLE
LOG_ARCHIVE_DEST_2 ENABLE
LOG_ARCHIVE_DEST_3 DISABLE

31 rows selected.

(host01) SQL> show parameter log_archive_dest_2;


s a
) ha
NAME TYPE VALUE

l ฺ c om
------------------- ----------- ----------------------------
log_archive_dest_2 string
ai ฺ
service="bostonfs",
m
9 @ g
SYNC AFFIRM delay=0
u ide
i z 9 nt G
optional compression=enable
u
pr tude
max_failure=0
(
ON his S
max_connections=1 reopen=300
R
AR use t
db_unique_name="bostonFS"
B
IZ e to
net_timeout=30,
U valid_for=(online_logfile

T H R icens ,all_roles)

A BE ble l
LIZ SQL>
(host01)
E f e raexit
C I A trans
I
TR non-
PA

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

Practices for Lesson 18: Optimizing a Data Guard Configuration


Chapter 18 - Page 5
Edutronic Global Services EฺIฺRฺL
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2014, Oracle and/or its affiliatesฺ

s a
) ha
l ฺ c om
m ai ฺ
9 @ g
u ide
i z 9 nt G
u
pr tude
(
R ON his S
B AR use t
U IZ e to
T H R icens
A BE ble l
E LIZ sfera
I C IA -tran
TR non
PA

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

Practices for Lesson 18: Optimizing a Data Guard Configuration


Chapter 18 - Page 6

You might also like