Sunteți pe pagina 1din 272

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

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n ul Ka lic
hs a
A
Oracle Database 12c: RAC
Administration

Activity Guide
D81250GC11
Edition 1.1 | April 2015 | D90918
Learn more from Oracle University at oracle.com/education/
Copyright © 2015, 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© 2016, 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. bl e
fe r a
Trademark Notice
an s
- t r
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective
n
owners.
a no
h a s ฺ
Authors
o m )
u i de
Jim Womack, Dominique Jeunot
a ilฺc ent G
Technical Contributors and Reviewers gm ud
d @ S t
Breederode, Joel Goodman, Sean b i rb Andy
Allan Graves, Gerlinde Frenzen, Branislav
Kim, t isHerbertAlBradbury,
Valny,
h
Fortunak, Flournoy,
Ira Singer, Harald Van
Markus Michalewicz,
h k aRon Soltani
s e
a t
Maria BIllings, Mark Scardina,
t o u
Editors i m
r ( ense
a b c
l
Malavika Jinka, ArijitliGhosh
K
u
an Designer
AhsGraphic
Maheshwari Krishnamurthy

Publishers
Syed Imtiaz Ali, Joseph Fernandez

This book was published using: Oracle Tutor


Table of Contents
Course Practice Environment: Security Credentials ....................................................................................iii
Practices for Lesson 1: Grid Infrastructure Overview ..................................................................................1-1
Practices for Lesson 1: Overview ...................................................................................................................1-2
Practice 1-1: Installing Clusterware ................................................................................................................1-3
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Practices for Lesson 2: RAC Databases Overview & Architecture..............................................................2-1


Practices for Lesson 3: Installing and Configuring Oracle RAC ..................................................................3-1
Practice 3-1: Installing RAC Database ...........................................................................................................3-2
Practice 3-2: Creating a RAC Database.........................................................................................................3-14
Practices for Lesson 4: Oracle RAC Administration.....................................................................................4-1
Practices for Lesson 4: Overview ...................................................................................................................4-2
Practice 4-1: Operating System and Password File Authenticated Connections ...........................................4-3
ble
Practice 4-2: Oracle Database Authenticated Connections ...........................................................................4-6
Practice 4-3: Stopping a Complete ORACLE_HOME Component Stack .......................................................4-9 fe r a
Practices for Lesson 5: Upgrading and Patching Oracle RAC.....................................................................5-1
t r a ns
o n -
Practices for Lesson 5: Overview ...................................................................................................................5-2
an
Practice 5-1 Patching the RAC Database Home ............................................................................................5-3
s
) ha deฺ
Practices for Lesson 6: Managing Backup and Recovery for RAC .............................................................6-1

o m ui
Practices for Lesson 6: Overview ...................................................................................................................6-2
c
a il ent G

Practice 6-1: Configuring ARCHIVELOG Mode .............................................................................................6-3
Practice 6-2: Configuring RMAN and Performing Parallel
@ gmBackups t u d
...............................................................6-7

b
Practices for Lesson 7: Global Resource Management d i s S
Concepts ..............................................................7-1
i r h
h k ab se t
Practices for Lesson 7: Overview ...................................................................................................................7-2

a t
Practice 7-1: Buffer Cache Fusion u
.................................................................................................................7-3
t o
Practice 7-2: Row Cache
i m
r (CacheeCoordination
se for Procedure and Packages ........................................................7-28
Coordination for Sequences ..................................................................................7-12
b
Practice 7-3: Library
a n
Practice K
u l lic Coordination ...................................................................................................7-34
7-4: Global Enqueue

s a n 7-5: Results Cache Coordination .....................................................................................................7-43


Practice

Ah Practices for Lesson 8: RAC Database Monitoring and Tuning ..................................................................8-1


Practices for Lesson 8: Overview ...................................................................................................................8-2
Practice 8-1: ADDM and RAC Part I ..............................................................................................................8-3
Practice 8-2: ADDM and RAC Part II .............................................................................................................8-10
Practice 8-3: ADDM and RAC Part III ............................................................................................................8-14
Practices for Lesson 9: Managing High Availability of Services .................................................................9-1
Practices for Lesson 9: Overview ...................................................................................................................9-2
Practice 9-1: Working with Services ...............................................................................................................9-3
Practice 9-2: Monitoring Services...................................................................................................................9-10
Practices for Lesson 10: High Availability for Connections and Applications ...........................................10-1
Practices for Lesson 10: Overview .................................................................................................................10-2
Practice 10-1: Using Application Continuity ...................................................................................................10-3
Practices for Lesson 11: Oracle RAC One Node ...........................................................................................11-1
Practices for Lesson 11: Overview .................................................................................................................11-2
Practice 11-1: RAC One Node .......................................................................................................................11-3

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

Oracle Database 12c: RAC Administration Table of Contents


i
Practices for Lesson 12: Multitenant Architecture and RAC Environment .................................................12-1
Practices for Lesson 12: Overview .................................................................................................................12-2
Practice 12-1: Creating a CDB .......................................................................................................................12-3
Practice 12-2: Cloning a PDB in the RAC CDB ..............................................................................................12-18
Practice 12-3: Affinitizing PDB Services to CDB Instances ............................................................................12-22
Practice 12-4: Dropping a PDB ......................................................................................................................12-33
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Practices for Lesson 13: Quality of Service Management............................................................................13-1


Practices for Lesson 13..................................................................................................................................13-2

ble
fe r a
an s
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Oracle Database 12c: RAC Administration Table of Contents


ii
Course Practice Environment: Security Credentials

For operating system (Linux) usernames and passwords, see the following:
• If you are attending a classroom-based or live virtual class, ask your instructor or LVC
producer for OS credential information.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

• If you are using a self-study format, refer to the communication that you received from
Oracle University for this course.

For product-specific credentials used in this course, see the following table:

Product-Specific Credentials
Product/Application Username Password
ble
Enterprise Manager Database Express SYS oracle_4U
fe r a
ans
Database (orcl) SYS oracle_4U
n - t r
Database (orcl) no
SYSTEM
a
oracle_4U
Database (orcl) ASMSNMP
h a s oracle_4U
DBSNMP m
) i d eฺ
Database (orcl)
l ฺ c o G u oracle_4U
Database (orcl) JMW i
a den t JMW
g m tu
d @ s S
a b irb thi
t h k u se
( m a to
e
a bir icens
u l K l
n
Ahsa

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

Course Practice Environment: Security Credentials


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

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Course Practice Environment: Security Credentials


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

ble
fe r a
ans
n - t r
a no
Practices for h a s ฺ 1: Grid
Lesson
m )
Infrastructure
o u i de
Overview
a ilฺc ent G
@ gm
Chapter 1 d
tu
d s S
a b irb thi
t h k u se
( m a to
e
a bir icens
n u lK l
hs a
A

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

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 1
Practices for Lesson 1: Overview

Practices Overview
In this practice, you will install and configure a new Cluster. You will install it to three nodes:
host01, host02, and host03.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 2
Practice 1-1: Installing Clusterware

1. As the root user, confirm your three nodes are up and running with the xm list
command. Then restart the NAMED service to ensure viability and availability of the service
for the software installation.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

[vncuser@classroom_pc ~]$ su –

[root@classroom_pc ~]# xm list


Name ID Mem VCPUs State Time(s)
Domain-0 0 1024 2 r----- 457173.8
host01 82 5800 1 -b---- 21.3
host02 83 4100 2 -b---- 27.9
host03 86 4100 2 -b---- 16.1
ble
fe r a
[root@classroom_pc ~]# service named restart
t r a ns
Stopping named: .
no n- [ OK ]
Starting named:
s a [ OK ]

) a
h deฺ
[root@classroom_pc ~]#
c o m u i

ail dent G
2. Open an ssh session as root to host01.
m
g Start the
tulocal naming cache daemon on all
d @ s S
a b irb nscd
three cluster nodes with the service
thicommand.
nscd start command. To make sure nscd starts
at reboot, execute the chkconfig
h k u s e Perform these steps on all three of
your nodes. a t o
t~]#
i ( m
r ens
[root@classroom_pc e ssh host01
b
u l Ka lic password:
root@host01's

san [root@host01 ~]# service nscd start


Ah Starting nscd: [ OK ]
[root@host01 ~]# chkconfig nscd on

[root@host01 ~]# ssh host02 service nscd start


Starting nscd: [ OK ]
[root@host01 ~]# ssh host02 chkconfig nscd on

[root@host01 ~]# ssh host03 service nscd start


Starting nscd: [ OK ]
[root@host01 ~]# ssh host03 chkconfig nscd on

[root@host01 ~]#

3. As the root user, run the /stage/RAC/labs/less_01/limits.sh script on host01.


This script replaces the profile for the oracle and grid users and replaces
/etc/profile. It replaces the /etc/security/limits.conf file with a new one with
entries for oracle and grid. It also installs the CVU rpm.

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

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 3
[root@host01 ~]# cat /stage/RAC/labs/less_01/bash_profile
# .bash_profile

# Get the aliases and functions


if [ -f ~/.bashrc ]; then
. ~/.bashrc
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin
export PATH

umask 022

[root@host01 ~]# cat /stage/RAC/labs/less_01/profile


ble
# /etc/profile
fe r a
ans
# System wide environment and startup programs, for login setup
n - t r
# Functions and aliases go in /etc/bashrc
a no
pathmunge () { h a s ฺ
m )
if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)"
o u i de ; then
if [ "$2" = "after" ] ; then
a ilฺc ent G
gm tud
PATH=$PATH:$1
else
b d @ s S
PATH=$1:$PATH
i r h i
fi
h k ab se t
fi
a t t o u
}
i m
r ( ense
b
# ksh
u l K-zaworkaround
lic -a -x /usr/bin/id ]; then
san
if [ "$EUID"

Ah
EUID=`id -u`
UID=`id -ru`
fi

# Path manipulation
if [ "$EUID" = "0" ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
fi

# No core files by default


ulimit -S -c 0 > /dev/null 2>&1

if [ -x /usr/bin/id ]; then
USER="`id -un`"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"

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

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 4
fi

HOSTNAME=`/bin/hostname`
HISTSIZE=1000

if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then


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

INPUTRC=/etc/inputrc
fi

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC

for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
. $i
fi
done
ble
fe r a
if [ $USER = "oracle" ] || [ $USER = "grid" ]; then
ans
umask 022
n - t r
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384 a no
ulimit -n 65536 h a s ฺ
else
o m )
u i de
ulimit -u 16384 -n 65536
a ilฺc ent G
gm tud
fi
fi
b d @ s S
unset i
i r h i
unset pathmunge
h k ab se t
[root@host01 m a t o u
t cat /stage/RAC/labs/less_01/limits.conf
r ( ense
~]#
b i
#
u l Ka -- priority
lic - max - the priority to run user process with
a
s #n
# locks number of file locks the user can hold

Ah
- sigpending - max number of pending signals
# - msgqueue - max memory used by POSIX message queues
# - nice - max nice priority allowed to raise to
# - rtprio - max realtime priority
#<domain> <type> <item> <value>

#* soft core 0
#* hard rss 10000
#@student hard nproc 20
#@faculty soft nproc 20
#@faculty hard nproc 50
#ftp hard nproc 0
#@student - maxlogins 4
# End of file
oracle soft nofile 131072
oracle hard nofile 131072
oracle soft nproc 131072
oracle hard nproc 131072
oracle soft core unlimited

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

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 5
oracle hard core unlimited
oracle soft memlock 3500000
oracle hard memlock 3500000
grid soft nofile 131072
grid hard nofile 131072
grid soft nproc 131072
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

grid hard nproc 131072


grid soft core unlimited
grid hard core unlimited
grid soft memlock 3500000
grid hard memlock 3500000
# Recommended stack hard limit 32MB for oracle installations
# oracle hard stack 32768

[root@host01 ~]# /stage/RAC/labs/less_01/limits.sh


...
ble
fe r a
[root@host01 ~]#
ans
n - t r
4. a no
Create the installation directories for grid and oracle-owned software. Set the ownership
a s ฺ
and permissions of the directories using the /stage/RAC/labs/less_01/cr_dir.sh
h
script.
o m )
u i de
ilฺc ent G
[root@host01 ~]# cat /stage/RAC/labs/less_01/cr_dir.sh
a
@ gm tud
#!/bin/bash
b d i s S
b i r t h
h k a s e
a t
mkdir -p /u01/app/12.1.0/grid
t o u
m
( nse
bir/u01/app/oracle
mkdir -p /u01/app/grid
mkdir a-p
l K l i ce
a n u -R grid:oinstall /u01
chown
s
Ah chown oracle:oinstall /u01/app/oracle
chmod -R 775 /u01/

ssh host02 mkdir -p /u01/app/12.1.0/grid


ssh host02 mkdir -p /u01/app/grid
ssh host02 mkdir -p /u01/app/oracle
ssh host02 chown -R grid:oinstall /u01
ssh host02 chown oracle:oinstall /u01/app/oracle
ssh host02 chmod -R 775 /u01/

ssh host03 mkdir -p /u01/app/12.1.0/grid


ssh host03 mkdir -p /u01/app/grid
ssh host03 mkdir -p /u01/app/oracle
ssh host03 chown -R grid:oinstall /u01
ssh host03 chown oracle:oinstall /u01/app/oracle
ssh host03 chmod -R 775 /u01/
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 6
[root@host01 ~]# /stage/RAC/labs/less_01/cr_dir.sh
...
[root@host01 ~]#
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

5. Next, establish a terminal session connected to host01 as the grid OS user. Ensure that
you specify the –X option for ssh to configure the X environment properly for the grid
user.
[root@classroom_pc ~]$ ssh –X grid@host01
grid@host01's password:
[grid@host01 ~]$

6. Start the Oracle Clusterware release 12.1 installer. ble


fe r a
[grid@host01 ~]$ /stage/clusterware/runInstaller
ans
Starting Oracle Universal Installer...
n - t r
a no
7. On the Select Installation Option screen, click Next to accept thesdefault selection (Install
and Configure Oracle Grid Infrastructure for a Cluster). ) h
a eฺ
c o m uid
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
u l Ka lic
san
Ah

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

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 7
8. On the Select Cluster Type screen, select Configure a Standard cluster and click Next.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
h a s ฺ
o m )
u i de
a ilฺc ent G
@ gm tud
b d i s S
b
9. On the Select Installation Typei r
page, t h
choose Advanced installation and click Next.
k a e
a th to us
i r (m nse
l K ab lice
a n u
s
Ah

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

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 8
10. On the Select Product Languages screen, click Next to accept the default selection
(English).
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 9
11. Use the Grid Plug and Play Information screen to configure the following settings:
• Cluster Name: cluster01
• SCAN Name: cluster01-scan.cluster01.example.com
• SCAN Port: 1521
• GNS VIP Address: 192.0.2.155
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

• GNS Sub Domain: cluster01.example.com


Make sure that the “Configure GNS” and “Configure nodes Virtual IPs…” check boxes are
selected. Click the “create a new GNS” option button and then click Next.

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 10
12. On the Cluster Node Information screen, click Add to begin the process of specifying
additional cluster nodes.
Click the Add button, add host02.example.com, and click OK. Click the Add button
again, add host03.example.com, and click OK.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 11
13. Click the SSH Connectivity button. Enter the grid password into the OS Password field
and click Test to confirm that the required SSH connectivity is configured across the cluster.
Your lab environment is preconfigured with the required SSH connectivity so you will next
see a dialog confirming this. Click OK to continue. Review the information in the Cluster
Node Information page and click Next.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 12
14. On the Specify Network Interface Usage screen, ensure that network interface eth0 is
designated as the Public network and that network interface eth1 is designated as the
Private network. The eth2 interface should also be designated Private network. Click Next
to continue.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 13
15. On the Storage Option Information page, select Use Standard ASM for storage and click
Next.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
h a s ฺ
o m )
u i de
a ilฺc ent G
@ gm tud
16. On the Create ASM Disk Grouprb d click
screen, i s S Discovery Path to customize the ASM
Change
Disk Discovery Path.
i
ab se t h
t h k u
m a t o
b i r ( ense
u l Ka lic
san
Ah

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

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 14
17. In the Change Disk Discovery Path dialog box, set the Disk Discovery Path to
/dev/asmdisk* and click OK.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 15
18. On the Create ASM Disk Group screen, make sure the Disk group name is DATA and
select the first 10 candidate disks in the list:
• /dev/asmdisk1p1
• /dev/asmdisk1p10
• /dev/asmdisk1p11
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

• /dev/asmdisk1p12
• /dev/asmdisk1p2
• /dev/asmdisk1p3
• /dev/asmdisk1p4
• /dev/asmdisk1p5
• /dev/asmdisk1p6
• /dev/asmdisk1p7
ble
fe r a
Select Normal for the Redundancy and click Next to continue. ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 16
19. On the Specify ASM Password screen, select “Use same passwords for these accounts”
and enter the password for the SYS and ASMSNMP database accounts. Then click Next to
continue.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
h a s ฺ
o m )
u i de
a ilฺc ent G
@ gm tud
b d i s S
i r h
t click Next to accept the default setting (Do not use
h k ab screen,
20. On the Failure Isolation Support
s e
IPMI).
a t t o u
i m
r ( ense
b
u l Ka lic
san
Ah

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

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 17
21. On the Specify Management Options page, click Next to continue.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 18
22. On the Privileged Operating System Groups, the values should default to the following:
• Oracle ASM Administrator Group: asmadmin
• Oracle ASM DBA Group: asmdba
• Oracle ASM Operator Group: asmoper
Click Next to accept the default values.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 19
23. On the Specify Installation Location screen, change the value of the Default Software
Location to /u01/app/12.1.0/grid.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 20
24. On the Create Inventory screen, click Next to accept the default installation inventory
location of /u01/app/oraInventory.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
h a s ฺ
o m )
u i de
a ilฺc ent G
@ gm tud
b d i s S click Next to proceed.
i r h
25. On the Root script execution configuration screen,
h k ab se t
a t t o u
i m
r ( ense
b
u l Ka lic
san
Ah

26. Wait while a series of prerequisite checks are performed.

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

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 21
27. Because of the constraints of this lab environment, you may see a series of warnings
resulting from the prerequisite checks. If the warnings relate to ‘Device Checks for ASM’ or
‘Physical Memory’ (as illustrated in the following screenshot), you may safely ignore it.
Select Ignore All and then click Next to continue.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 22
28. In the confirmation dialog, click Yes to ignore the issues flagged by the installer.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
h a s ฺ
o m )
u i de
a ilฺc ent G
@ gm tud
29. Examine the Summary screen. When
b S Install to begin the installation. Oracle
d ready,isclick
b i
Grid Infrastructure release 12.1 rwill nowt h
install on the cluster nodes.
k a e
a th to us
i r (m nse
l K ab lice
a n u
s
Ah

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

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 23
The Install Product screen follows the course of the installation.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
h a s ฺ
o m )
u i deand displays the
lฺcroot nterminal
30. Toward the end of the installation, Oracle Universal
to ithe
Execute Configuration scripts dialog box. Go a
Installer
t
pauses
G opened earlier on host01
and execute the orainstRoot.sh scripts u denodes. When finished, execute the
gmon alltthree
root.sh scripts on all three nodesb @
dalso. is S
b i r th
k a e
a th to us
i r (m nse
l K ab lice
a n u
s
Ah

[root@host01 ~]# /u01/app/oraInventory/orainstRoot.sh


Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /u01/app/oraInventory to oinstall.


The execution of the script is complete.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 24
[root@host01 ~]# ssh host02 /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Changing groupname of /u01/app/oraInventory to oinstall.


The execution of the script is complete.

[root@host01 ~]# ssh host03 /u01/app/oraInventory/orainstRoot.sh


Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
ble
fe r a
ans
Changing groupname of /u01/app/oraInventory to oinstall.
n - t r
no
The execution of the script is complete.
[root@host01 ~]#
s ฺa
) h a e
31. Next, execute the root.sh scripts on all three nodes o m
from the u i
root
dterminal window on
i l ฺ c t G
host01.
m a den
@ g
[root@host01 ~]# /u01/app/12.1.0/grid/root.sh tu
d
b thi
Performing root useriroperation. s S
a b
t h k u se
The following
( m a environment
to variables are set as:
e
a bir icens grid
ORACLE_OWNER=

u l K ORACLE_HOME=
l /u01/app/12.1.0/grid

san
Ah Enter the full pathname of the local bin directory:
[/usr/local/bin]:
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...

Creating /etc/oratab file...


Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Using configuration parameter file:
/u01/app/12.1.0/grid/crs/install/crsconfig_params
2015/01/22 10:54:43 CLSRSC-4001: Installing Oracle Trace File
Analyzer (TFA) Collector.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 25
2015/01/22 10:55:35 CLSRSC-4002: Successfully installed Oracle
Trace File Analyzer (TFA) Collector.

2015/01/22 10:55:36 CLSRSC-363: User ignored prerequisites during


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

OLR initialization - successful


root wallet
root wallet cert
root cert export
peer wallet
profile reader wallet
ble
pa wallet
fe r a
peer wallet keys
ans
pa wallet keys
n - t r
o
peer cert request
s an
pa cert request
) ha deฺ
peer cert
c o m ui
pa cert
a il ent G

peer root cert TP
@ gm tud
profile reader root cert TP
b d i s S
i r h
pa root cert TP
h k ab se t
peer pa cert TP
a t t o u
m
r ( ense
pa peer cert TP
i
b
l Ka lic
profile reader pa cert TP

a n u profile reader peer cert TP

Ahs peer user cert


pa user cert
2015/01/22 10:56:39 CLSRSC-330: Adding Clusterware entries to
file 'oracle-ohasd.conf'

CRS-4133: Oracle High Availability Services has been stopped.


CRS-4123: Oracle High Availability Services has been started.
CRS-4133: Oracle High Availability Services has been stopped.
CRS-4123: Oracle High Availability Services has been started.
CRS-2672: Attempting to start 'ora.evmd' on 'host01'
CRS-2672: Attempting to start 'ora.mdnsd' on 'host01'
CRS-2676: Start of 'ora.mdnsd' on 'host01' succeeded
CRS-2676: Start of 'ora.evmd' on 'host01' succeeded
CRS-2672: Attempting to start 'ora.gpnpd' on 'host01'
CRS-2676: Start of 'ora.gpnpd' on 'host01' succeeded
CRS-2672: Attempting to start 'ora.cssdmonitor' on 'host01'
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 26
CRS-2672: Attempting to start 'ora.gipcd' on 'host01'
CRS-2676: Start of 'ora.cssdmonitor' on 'host01' succeeded
CRS-2676: Start of 'ora.gipcd' on 'host01' succeeded
CRS-2672: Attempting to start 'ora.cssd' on 'host01'
CRS-2672: Attempting to start 'ora.diskmon' on 'host01'
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

CRS-2676: Start of 'ora.diskmon' on 'host01' succeeded


CRS-2676: Start of 'ora.cssd' on 'host01' succeeded

ASM created and started successfully.

Disk Group DATA created successfully.

CRS-2672: Attempting to start 'ora.crf' on 'host01'


ble
CRS-2672: Attempting to start 'ora.storage' on 'host01'
fe r a
ans
CRS-2676: Start of 'ora.storage' on 'host01' succeeded
n - t r
CRS-2676: Start of 'ora.crf' on 'host01' succeeded
o
CRS-2672: Attempting to start 'ora.crsd' on 'host01'
s an
CRS-2676: Start of 'ora.crsd' on 'host01' succeeded
) ha deฺ
CRS-4256: Updating the profile
c o m ui
Successful addition of voting disk a il ent G

725fb3575cf44f7cbf69f841110f675d.
@ gm tud
b d
Successful addition of voting disk
i s S
i r h
h k ab se t
a4f5ddfc663a4f5ebfa319690cd60fb0.

a t t o u
Successful addition of voting disk
m
r ( ense
c1f6a060817e4fcebfcea451c7b23364.
i
b
l Ka
Successfully replaced voting disk group with +DATA.
u lic
CRS-4256: Updating the profile
a n
Ahs CRS-4266: Voting file(s) successfully replaced
## STATE File Universal Id File Name Disk
group
-- ----- ----------------- --------- ---------
1. ONLINE 725fb3575cf44f7cbf69f841110f675d (/dev/asmdisk1p1)
[DATA]
2. ONLINE a4f5ddfc663a4f5ebfa319690cd60fb0 (/dev/asmdisk1p10)
[DATA]
3. ONLINE c1f6a060817e4fcebfcea451c7b23364 (/dev/asmdisk1p11)
[DATA]
Located 3 voting disk(s).
CRS-2791: Starting shutdown of Oracle High Availability Services-
managed resources on 'host01'
CRS-2673: Attempting to stop 'ora.crsd' on 'host01'
CRS-2677: Stop of 'ora.crsd' on 'host01' succeeded
CRS-2673: Attempting to stop 'ora.ctssd' on 'host01'
CRS-2673: Attempting to stop 'ora.mdnsd' on 'host01'
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 27
CRS-2673: Attempting to stop 'ora.gpnpd' on 'host01'
CRS-2673: Attempting to stop 'ora.drivers.acfs' on 'host01'
CRS-2677: Stop of 'ora.drivers.acfs' on 'host01' succeeded
CRS-2677: Stop of 'ora.ctssd' on 'host01' succeeded
CRS-2673: Attempting to stop 'ora.evmd' on 'host01'
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

CRS-2673: Attempting to stop 'ora.storage' on 'host01'


CRS-2677: Stop of 'ora.storage' on 'host01' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'host01'
CRS-2677: Stop of 'ora.mdnsd' on 'host01' succeeded
CRS-2677: Stop of 'ora.gpnpd' on 'host01' succeeded
CRS-2677: Stop of 'ora.evmd' on 'host01' succeeded
CRS-2677: Stop of 'ora.asm' on 'host01' succeeded
CRS-2673: Attempting to stop 'ora.cluster_interconnect.haip' on
ble
'host01'
fe r a
CRS-2677: Stop of 'ora.cluster_interconnect.haip' on 'host01'
ans
succeeded
n - t r
o
CRS-2673: Attempting to stop 'ora.cssd' on 'host01'
s an
CRS-2677:
ha deฺ
Stop of 'ora.cssd' on 'host01' succeeded
)
CRS-2673:
m ui
Attempting to stop 'ora.crf' on 'host01'
c o
CRS-2677:
il ent G

Stop of 'ora.crf' on 'host01' succeeded
a
CRS-2673:
gm tud
Attempting to stop 'ora.gipcd' on 'host01'
@
CRS-2677: d S
Stop of 'ora.gipcd' on 'host01' succeeded
b i s
i r h
CRS-2793:
ab se t
Shutdown of Oracle High Availability Services-managed
h k
resources
a t u
on 'host01' has completed
t o
CRS-4133:
i m
r ( ense
Oracle High Availability Services has been stopped.
b
l Ka
CRS-4123: Starting Oracle High Availability Services-managed
u resources lic
a n
hs
CRS-2672: Attempting to start 'ora.mdnsd' on 'host01'
A CRS-2672: Attempting to start 'ora.evmd' on 'host01'
CRS-2676: Start of 'ora.mdnsd' on 'host01' succeeded
CRS-2676: Start of 'ora.evmd' on 'host01' succeeded
CRS-2672: Attempting to start 'ora.gpnpd' on 'host01'
CRS-2676: Start of 'ora.gpnpd' on 'host01' succeeded
CRS-2672: Attempting to start 'ora.gipcd' on 'host01'
CRS-2676: Start of 'ora.gipcd' on 'host01' succeeded
CRS-2672: Attempting to start 'ora.cssdmonitor' on 'host01'
CRS-2676: Start of 'ora.cssdmonitor' on 'host01' succeeded
CRS-2672: Attempting to start 'ora.cssd' on 'host01'
CRS-2672: Attempting to start 'ora.diskmon' on 'host01'
CRS-2676: Start of 'ora.diskmon' on 'host01' succeeded
CRS-2676: Start of 'ora.cssd' on 'host01' succeeded
CRS-2672: Attempting to start 'ora.cluster_interconnect.haip' on
'host01'

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

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 28
CRS-2672: Attempting to start 'ora.ctssd' on 'host01'
CRS-2676: Start of 'ora.ctssd' on 'host01' succeeded
CRS-2676: Start of 'ora.cluster_interconnect.haip' on 'host01'
succeeded
CRS-2672: Attempting to start 'ora.asm' on 'host01'
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

CRS-2676: Start of 'ora.asm' on 'host01' succeeded


CRS-2672: Attempting to start 'ora.storage' on 'host01'
CRS-2676: Start of 'ora.storage' on 'host01' succeeded
CRS-2672: Attempting to start 'ora.crf' on 'host01'
CRS-2676: Start of 'ora.crf' on 'host01' succeeded
CRS-2672: Attempting to start 'ora.crsd' on 'host01'
CRS-2676: Start of 'ora.crsd' on 'host01' succeeded
CRS-6023: Starting Oracle Cluster Ready Services-managed
ble
resources
fe r a
CRS-6017: Processing resource auto-start for servers: host01
ans
CRS-6016: Resource auto-start has completed for server host01
n - t r
no
CRS-6024: Completed start of Oracle Cluster Ready Services-
a
managed resources
h a s ฺ
o m )
u i de
CRS-4123: Oracle High Availability Services has been started.

Clusterware stack a ilฺc ent G


2015/01/22 11:05:01 CLSRSC-343: Successfully started Oracle

@ gm tud
b
CRS-2672: Attemptingirto
S
dstart is'ora.asm'
a b e t h on 'host01'
CRS-2676: Start kof 'ora.asm'
a th totousstarton'ora.DATA.dg'
'host01' succeeded

( m
CRS-2672: Attempting
e on 'host01'

a bir iStart
CRS-2676:
c e nsof 'ora.DATA.dg' on 'host01' succeeded
u l K
2015/01/22l 11:06:44 CLSRSC-325: Configure Oracle Grid
sa n Infrastructure for a Cluster ... succeeded
Ah
[root@host01 ~]# ssh host02 /u01/app/12.1.0/grid/root.sh
Performing root user operation.

The following environment variables are set as:


ORACLE_OWNER= grid
ORACLE_HOME= /u01/app/12.1.0/grid

Enter the full pathname of the local bin directory:


[/usr/local/bin]:
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...

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

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 29
Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Now product-specific root actions will be performed.


Using configuration parameter file:
/u01/app/12.1.0/grid/crs/install/crsconfig_params
2015/01/22 11:09:36 CLSRSC-4001: Installing Oracle Trace File
Analyzer (TFA) Collector.

2015/01/22 11:10:36 CLSRSC-4002: Successfully installed Oracle


Trace File Analyzer (TFA) Collector.
bl e
fe r a
2015/01/22 11:10:38 CLSRSC-363: User ignored prerequisites during
n s
installation
n - tra
a no
OLR initialization - successful
h a s ฺ entries to
2015/01/22 11:12:14 CLSRSC-330: Adding Clusterware
file 'oracle-ohasd.conf' o m )
u i de
a ilฺc ent G
CRS-4133: Oracle High Availability
@ gm tuServices
d has been stopped.
CRS-4123: Oracle Highrb d S
is Services has been started.
CRS-4133: Oracleka b i Availability
t h
h u s e
High Availability Services has been stopped.
CRS-4123: Oracle t
a High to Availability Services has been started.
( m e
CRS-2791:
a c e ns onshutdown
bir resources
Starting of Oracle High Availability Services-

u l K
managed
liAttempting to stop 'ora.drivers.acfs' on 'host02'
'host02'

sa n CRS-2673:

Ah CRS-2677:
CRS-2793:
Stop of 'ora.drivers.acfs' on 'host02' succeeded
Shutdown of Oracle High Availability Services-managed
resources on 'host02' has completed
CRS-4133: Oracle High Availability Services has been stopped.
CRS-4123: Starting Oracle High Availability Services-managed
resources
CRS-2672: Attempting to start 'ora.mdnsd' on 'host02'
CRS-2672: Attempting to start 'ora.evmd' on 'host02'
CRS-2676: Start of 'ora.mdnsd' on 'host02' succeeded
CRS-2676: Start of 'ora.evmd' on 'host02' succeeded
CRS-2672: Attempting to start 'ora.gpnpd' on 'host02'
CRS-2676: Start of 'ora.gpnpd' on 'host02' succeeded
CRS-2672: Attempting to start 'ora.gipcd' on 'host02'
CRS-2676: Start of 'ora.gipcd' on 'host02' succeeded
CRS-2672: Attempting to start 'ora.cssdmonitor' on 'host02'
CRS-2676: Start of 'ora.cssdmonitor' on 'host02' succeeded
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 30
CRS-2672: Attempting to start 'ora.cssd' on 'host02'
CRS-2672: Attempting to start 'ora.diskmon' on 'host02'
CRS-2676: Start of 'ora.diskmon' on 'host02' succeeded
CRS-2676: Start of 'ora.cssd' on 'host02' succeeded
CRS-2672: Attempting to start 'ora.cluster_interconnect.haip' on
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

'host02'
CRS-2672: Attempting to start 'ora.ctssd' on 'host02'
CRS-2676: Start of 'ora.ctssd' on 'host02' succeeded
CRS-2676: Start of 'ora.cluster_interconnect.haip' on 'host02'
succeeded
CRS-2672: Attempting to start 'ora.asm' on 'host02'
CRS-2676: Start of 'ora.asm' on 'host02' succeeded
CRS-2672: Attempting to start 'ora.storage' on 'host02'
ble
CRS-2676: Start of 'ora.storage' on 'host02' succeeded
fe r a
CRS-2672: Attempting to start 'ora.crf' on 'host02'
ans
CRS-2676: Start of 'ora.crf' on 'host02' succeeded
n - t r
o
CRS-2672: Attempting to start 'ora.crsd' on 'host02'
s an
CRS-2676: Start of 'ora.crsd' on 'host02' succeeded
) ha deฺ
c o m ui
CRS-6017: Processing resource auto-start for servers: host02
il ent G

CRS-2672: Attempting to start 'ora.net1.network' on 'host02'
a
gm tud
CRS-2676: Start of 'ora.net1.network' on 'host02' succeeded
@
b d i s S
CRS-2672: Attempting to start 'ora.ons' on 'host02'
i r h
h k ab se t
CRS-2676: Start of 'ora.ons' on 'host02' succeeded

a t t o u
CRS-2673: Attempting to stop 'ora.LISTENER_SCAN1.lsnr' on
'host01'
i m
r ( ense
b
l Ka
CRS-2677: Stop of 'ora.LISTENER_SCAN1.lsnr' on 'host01' succeeded
u lic
CRS-2673: Attempting to stop 'ora.scan1.vip' on 'host01'
a n
Ahs CRS-2677: Stop of 'ora.scan1.vip' on 'host01' succeeded
CRS-2672: Attempting to start 'ora.scan1.vip' on 'host02'
CRS-2676: Start of 'ora.scan1.vip' on 'host02' succeeded
CRS-2672: Attempting to start 'ora.LISTENER_SCAN1.lsnr' on
'host02'
CRS-2676: Start of 'ora.LISTENER_SCAN1.lsnr' on 'host02'
succeeded
CRS-6016: Resource auto-start has completed for server host02
CRS-6024: Completed start of Oracle Cluster Ready Services-
managed resources
CRS-4123: Oracle High Availability Services has been started.
2015/01/22 11:18:37 CLSRSC-343: Successfully started Oracle
Clusterware stack

2015/01/22 11:18:52 CLSRSC-325: Configure Oracle Grid


Infrastructure for a Cluster ... succeeded

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

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 31
[root@host01 ~]# ssh host03 /u01/app/12.1.0/grid/root.sh
Performing root user operation.

The following environment variables are set as:


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

ORACLE_OWNER= grid
ORACLE_HOME= /u01/app/12.1.0/grid

Enter the full pathname of the local bin directory:


[/usr/local/bin]:
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...
ble
fe r a
ans
Creating /etc/oratab file... n - t r
Entries will be added to the /etc/oratab file as needed by
a no
h a s ฺ
Database Configuration Assistant when a database is created
Finished running generic part of root script.
o m )
u i de
a ilฺc ent G
Now product-specific root actions will be performed.
gm tud
Using configuration parameter file:
@
b d i s S
/u01/app/12.1.0/grid/crs/install/crsconfig_params
i r h
h k ab se t
2015/01/22 11:30:31 CLSRSC-4001: Installing Oracle Trace File

a t
Analyzer (TFA) Collector.
t o u
i m
r ( 11:31:29
se CLSRSC-4002: Successfully installed
b e n
Ka FilelicAnalyzer (TFA) Collector.
2015/01/22 Oracle

n u l
Trace

sa
Ah 2015/01/22 11:31:33 CLSRSC-363: User ignored prerequisites during
installation

OLR initialization - successful


2015/01/22 11:33:18 CLSRSC-330: Adding Clusterware entries to
file 'oracle-ohasd.conf'

CRS-4133: Oracle High Availability Services has been stopped.


CRS-4123: Oracle High Availability Services has been started.
CRS-4133: Oracle High Availability Services has been stopped.
CRS-4123: Oracle High Availability Services has been started.
CRS-2791: Starting shutdown of Oracle High Availability Services-
managed resources on 'host03'
CRS-2673: Attempting to stop 'ora.drivers.acfs' on 'host03'
CRS-2677: Stop of 'ora.drivers.acfs' on 'host03' succeeded

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

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 32
CRS-2793: Shutdown of Oracle High Availability Services-managed
resources on 'host03' has completed
CRS-4133: Oracle High Availability Services has been stopped.
CRS-4123: Starting Oracle High Availability Services-managed
resources
CRS-2672: Attempting to start 'ora.mdnsd' on 'host03'
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

CRS-2672: Attempting to start 'ora.evmd' on 'host03'


CRS-2676: Start of 'ora.mdnsd' on 'host03' succeeded
CRS-2676: Start of 'ora.evmd' on 'host03' succeeded
CRS-2672: Attempting to start 'ora.gpnpd' on 'host03'
CRS-2676: Start of 'ora.gpnpd' on 'host03' succeeded
CRS-2672: Attempting to start 'ora.gipcd' on 'host03'
CRS-2676: Start of 'ora.gipcd' on 'host03' succeeded
ble
CRS-2672: Attempting to start 'ora.cssdmonitor' on 'host03'
fe r a
CRS-2676: Start of 'ora.cssdmonitor' on 'host03' succeeded
ans
CRS-2672: Attempting to start 'ora.cssd' on 'host03'
n - t r
CRS-2672: no
Attempting to start 'ora.diskmon' on 'host03'
a
CRS-2676: a s ฺ
Start of 'ora.diskmon' on 'host03' succeeded
h
CRS-2676:
m ) i
Start of 'ora.cssd' on 'host03' succeeded
o u de
CRS-2672:
ilฺc ent G
Attempting to start 'ora.cluster_interconnect.haip' on
a
'host03'
@ gm'ora.ctssd'
tud on 'host03'
CRS-2672: Attempting to start
d S
CRS-2676:
b i rb thison 'host03' succeeded
Start of 'ora.ctssd'
CRS-2676:
t
Start h kofa 'ora.cluster_interconnect.haip'
u se on 'host03'
succeeded
(m a t o
i r s e
a b icen
CRS-2672: Attempting to start 'ora.asm' on 'host03'

n u lK
CRS-2676: lStart of 'ora.asm' on 'host03' succeeded
hs a CRS-2672: Attempting to start 'ora.storage' on 'host03'
A CRS-2676: Start of 'ora.storage' on 'host03' succeeded
CRS-2672: Attempting to start 'ora.crf' on 'host03'
CRS-2676: Start of 'ora.crf' on 'host03' succeeded
CRS-2672: Attempting to start 'ora.crsd' on 'host03'
CRS-2676: Start of 'ora.crsd' on 'host03' succeeded
CRS-6017: Processing resource auto-start for servers: host03
CRS-2673: Attempting to stop 'ora.LISTENER_SCAN2.lsnr' on
'host01'
CRS-2672: Attempting to start 'ora.net1.network' on 'host03'
CRS-2676: Start of 'ora.net1.network' on 'host03' succeeded
CRS-2672: Attempting to start 'ora.ons' on 'host03'
CRS-2677: Stop of 'ora.LISTENER_SCAN2.lsnr' on 'host01' succeeded
CRS-2673: Attempting to stop 'ora.scan2.vip' on 'host01'
CRS-2677: Stop of 'ora.scan2.vip' on 'host01' succeeded
CRS-2672: Attempting to start 'ora.scan2.vip' on 'host03'

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

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 33
CRS-2676: Start of 'ora.scan2.vip' on 'host03' succeeded
CRS-2673: Attempting to stop 'ora.scan2.vip' on 'host03'
CRS-2676: Start of 'ora.ons' on 'host03' succeeded
CRS-2677: Stop of 'ora.scan2.vip' on 'host03' succeeded
CRS-2672: Attempting to start 'ora.scan2.vip' on 'host02'
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

CRS-2676: Start of 'ora.scan2.vip' on 'host02' succeeded


CRS-2672: Attempting to start 'ora.LISTENER_SCAN2.lsnr' on
'host02'
CRS-2676: Start of 'ora.LISTENER_SCAN2.lsnr' on 'host02'
succeeded
CRS-2673: Attempting to stop 'ora.LISTENER_SCAN2.lsnr' on
'host02'
CRS-2677: Stop of 'ora.LISTENER_SCAN2.lsnr' on 'host02' succeeded
ble
CRS-2673: Attempting to stop 'ora.scan2.vip' on 'host02'
fe r a
CRS-2677: Stop of 'ora.scan2.vip' on 'host02' succeeded
ans
CRS-2672: Attempting to start 'ora.scan2.vip' on 'host03'
n - t r
o
an
CRS-2676: Start of 'ora.scan2.vip' on 'host03' succeeded
s
CRS-2672: Attempting to start 'ora.LISTENER_SCAN2.lsnr' on
ha deฺ
'host03' )
m ui
c o
il ent G
CRS-2676: Start of 'ora.LISTENER_SCAN2.lsnr' on 'host03'
succeeded a ฺ
gm tud
CRS-6016: Resource auto-start has completed for server host03
@
b d i s S
i r
CRS-6024: Completed start of Oracle Cluster Ready Services-
h
managed resources
h k ab se t
a t o u
CRS-4123: Oracle High Availability Services has been started.
t
i m
r ( ense
2015/01/22 11:40:06 CLSRSC-343: Successfully started Oracle
b
l Ka lic
Clusterware stack

a n u
Ahs 2015/01/22 11:40:22 CLSRSC-325: Configure Oracle Grid
Infrastructure for a Cluster ... succeeded

[root@host01 ~]#

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

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 34
32. When the root.sh script finishes executing on host03, return to the Execute
Configuration scripts dialog box and click OK. This will return you to the Installer where it
continues on the Configure Oracle Grid Infrastructure for a Cluster step.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
h
33. After configuration completes you will see the following message: a s ฺ
o m
“The installation of Oracle Grid Infrastructure for a Cluster u de
)was successful”
i
Click Close to close Oracle Universal Installer.ailฺ
c t G
n
@ gm tude
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
u l Ka lic
san
Ah

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

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 35
34. Back in your terminal session, configure the environment using the oraenv script. Enter
+ASM1 when you are prompted for an ORACLE_SID value.
[grid@host01 ~]$ . oraenv
ORACLE_SID = [grid] ? +ASM1
The Oracle base has been set to /u01/app/grid
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

[grid@host01 ~]$

35. Now check the status of the cluster. Ensure that all the listed services are online on all the
cluster nodes.
[grid@host01 ~]$ crsctl check cluster -all
**************************************************************
host01:
CRS-4537: Cluster Ready Services is online
ble
CRS-4529: Cluster Synchronization Services is online
fe r a
ans
CRS-4533: Event Manager is online
n - t r
**************************************************************
o
host02:
s an
CRS-4537: Cluster Ready Services is online
) ha deฺ
CRS-4529: Cluster Synchronization Services is online
c o m ui
CRS-4533: Event Manager is online a il ent G

gm tud
**************************************************************
@
b d i s S
host03:
i r h
k ab se t
CRS-4537: Cluster Ready Services is online
h
a t t o u
CRS-4529: Cluster Synchronization Services is online
i m
r ( ense
b
CRS-4533: Event Manager is online

n u l Ka lic
**************************************************************

hs a [grid@host01 ~]$
A
36. List the Clusterware resources. Ensure that all the Clusterware resources are running as
shown in the following output.
[grid@host01 ~]$ crsctl status resource -t
----------------------------------------------------------------
Name Target State Server State details
----------------------------------------------------------------
Local Resources
----------------------------------------------------------------
ora.DATA.dg
ONLINE ONLINE host01 STABLE
ONLINE ONLINE host02 STABLE
ONLINE ONLINE host03 STABLE
ora.LISTENER.lsnr
ONLINE ONLINE host01 STABLE

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

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 36
ONLINE ONLINE host02 STABLE
ONLINE ONLINE host03 STABLE
ora.asm
ONLINE ONLINE host01 Started,STABLE
ONLINE ONLINE host02 Started,STABLE
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ONLINE ONLINE host03 Started,STABLE


ora.net1.network
ONLINE ONLINE host01 STABLE
ONLINE ONLINE host02 STABLE
ONLINE ONLINE host03 STABLE
ora.ons
ONLINE ONLINE host01 STABLE
ONLINE ONLINE host02 STABLE
ble
ONLINE ONLINE host03 STABLE
fe r a
ans
----------------------------------------------------------------
n - t r
Cluster Resources
o
an
----------------------------------------------------------------
s
ora.LISTENER_SCAN1.lsnr
) ha deฺ
1 ONLINE ONLINE host02
c o m uiSTABLE
ora.LISTENER_SCAN2.lsnr a il ent G

1 ONLINE ONLINE gm tud
host01
@ STABLE
b d i s S
ora.LISTENER_SCAN3.lsnr
i r h
1
k ab se t
ONLINE ONLINE
h
host03 STABLE
ora.MGMTLSNR a t t o u
1 i m
r ( ense
ONLINE ONLINE host01 169.254.68.205
b
l Ka lic 192.168.1.101

a n u 192.168.2.1

Ahs ora.cvu
01,STABLE

1 ONLINE ONLINE host01 STABLE


ora.gns
1 ONLINE ONLINE host01 STABLE
ora.gns.vip
1 ONLINE ONLINE host01 STABLE
ora.host01.vip
1 ONLINE ONLINE host01 STABLE
ora.host02.vip
1 ONLINE ONLINE host02 STABLE
ora.host03.vip
1 ONLINE ONLINE host03 STABLE
ora.mgmtdb
1 ONLINE ONLINE host01 Open,STABLE
ora.oc4j
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 37
1 ONLINE ONLINE host01 STABLE
ora.scan1.vip
1 ONLINE ONLINE host02 STABLE
ora.scan2.vip
1 ONLINE ONLINE host01 STABLE
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ora.scan3.vip
1 ONLINE ONLINE host03 STABLE
----------------------------------------------------------------
[grid@host01 ~]$

37. Stop and disable the ora.cvu resource using SRVCTL to conserve disk space.
[grid@host01 ~]$ srvctl stop cvu
ble
fe r a
[grid@host01 ~]$ srvctl disable cvu
ans
n - t r
[grid@host01 ~]$
a no
h a s ฺ
38. Next, you will create another ASM disk group to host the)Fast Recovery
o m u i de Area (FRA). Start
the ASM Configuration Assistant (asmca).
a ilฺc ent G
[grid@host01 ~]$ asmca
@ gm tud
b d i s S
39. After the ASM Configurationb i r t h
h k a Assistant
s e appears, click Create.

a t t o u
i m
r ( ense
b
u l Ka lic
san
Ah

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

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 38
40. In the Create Disk Group window, enter FRA as the disk group name and select the first
three candidate disks (/dev/asmdisk1p8, /dev/asmdisk1p9, and
/dev/asmdisk2p1). Make sure the Redundancy is External. Then click OK to create the
disk group.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
h a s ฺ
o m )
u i de
a ilฺc ent G
@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
l
41. After
u Ktheadisk group
lic creation process completes you will see a dialog window indicating that
santhe disk group has been created. Click OK to proceed.
Ah

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

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 39
42. Click Exit to quit the ASM Configuration Assistant.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
h a s ฺ
o m )
u i de
a ilฺcConfiguration
43. Click Yes to confirm that you want to quit the ASM
n t G Assistant.
@ gm tude
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
u l Ka lic
anClose all terminal windows opened for these practices.
s44.
Ah

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

Practices for Lesson 1: Grid Infrastructure Overview


Chapter 1 - Page 40
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
Practices for h a s ฺ 2: RAC
Lesson
Databases o m ) i de &
Overview
u
a ilฺc ent G
Architecture
@ gm tud
b d Chapter
i s S 2
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 2: RAC Databases Overview & Architecture


Chapter 2 - Page 1
Practices for Lesson 2

There are no practices for this lesson.


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

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 2: RAC Databases Overview & Architecture


Chapter 2 - Page 2
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
Practices for h a s ฺ 3:
Lesson
Installingo m )
and u i de
Configuring
a
Oracleilฺc RAC
n t G
@ gm tude
b d Chapter
i s S 3
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 3: Installing and Configuring Oracle RAC


Chapter 3 - Page 1
Practice 3-1: Installing RAC Database

Overview
In this practice you will install Oracle Database 12c.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

1. Establish an ssh connection to host01 using the –X option as the oracle user.
[vncuser@classsroom_pc ~]$ ssh -X oracle@host01
oracle@host01's password:
[oracle@host01 ~]$

2. Change directory to /stage/database and start the installer.


[oracle@host01 ~]$ cd /stage/database
ble
[oracle@host01 database]$ ./runInstaller
fe r a
Starting Oracle Universal Installer...
ans
Checking Temp space: must be greater than 500 MB. Actual 7934 MB Passed
n - t r
Checking swap space: must be greater than 150 MB. Actual 8632 MB
a no
Passed

h a s ฺ
Checking monitor: must be configured to display at least 256 colors.
) de
Actual 16777216 Passed
o m u i
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2013-
05-22_03-35-08PM. Please wait ...
a ilฺc ent G
@ gm tud
3. On the Confirm Security Updates b d deselect
screen, i s S “I wish to receive security updates” and
i r h
twill not configure security updates.
h k ab thatsyou
click Next. Click Yes to confirm
e
a t t o u
i m
r ( ense
b
u l Ka lic
san
Ah

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

Practices for Lesson 3: Installing and Configuring Oracle RAC


Chapter 3 - Page 2
4. On the Select Installation Option screen, select “Install database software only” and click
Next.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
h a s ฺ
o m )
u i de
a ilฺc ent G
@ gm tud
b d i s S
i r
b screen,
5. On the Grid Installation Options h
tclick Next to accept the default selection (Oracle
h k adatabase s e
Real Application Clusters
a t t o u installation).

i m
r ( ense
b
u l Ka lic
san
Ah

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

Practices for Lesson 3: Installing and Configuring Oracle RAC


Chapter 3 - Page 3
6. On the Select List of Nodes screen, ensure that host01, host02, and host03 are
selected, and then click SSH Connectivity.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
h a s ฺ
o m )
u i de
a ilฺc ent G
@ gm tud
7. Enter the password for the oracle
b duser inithe
s SOS Password field and click Test to confirm
b i r
that SSH connectivity is configured for t
theh cluster. Your laboratory environment is
k a e
preconfigured with thehrequired SSH
this. Click OK tom a t
continue. t o us connectivity so you will next see a dialog confirming
b i r ( ense
u l Ka lic
san
Ah

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

Practices for Lesson 3: Installing and Configuring Oracle RAC


Chapter 3 - Page 4
8. If the required SSH connectivity was not present you could now click Setup to perform the
required configuration. However, since the laboratory environment is already configured
correctly, click Next to continue.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
h a s ฺ
o m )
u i de
a ilฺc ent G
@ gm tud
b d i s S
i r h
t click Next to accept the default selection
ab sscreen,
9. On the Select Product Languages
h k e
(English). a t t o u
i m
r ( ense
b
u l Ka lic
san
Ah

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

Practices for Lesson 3: Installing and Configuring Oracle RAC


Chapter 3 - Page 5
10. On the Select Database Edition screen, click Next to accept the default selection
(Enterprise Edition).
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
h a s ฺ
o m )
u i de
a ilฺc ent G
@ gm tud
11. On the Specify Installation Locationb S Next to accept the default installation
dscreen,isclick
location. The Oracle base a i r t h
b bee/u01/app/oracle
should and the Software location should
t h k u s
be /u01/app/oracle/product/12.1.0/dbhome_1.
m a t o
b i r ( ense
u l Ka lic
san
Ah

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

Practices for Lesson 3: Installing and Configuring Oracle RAC


Chapter 3 - Page 6
12. On the Privileged Operating System Groups screen, click Next to accept the default
settings. They should all be dba except Database Operator, which should be oper.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
h a s ฺ
o m )
u i de
a ilฺc ent G
@ gm tud
b d i s S
i r h
t a series of prerequisite checks is performed.
13. On the System Prerequisite
h k abCheckssepage,
a t t o u
i m
r ( ense
b
u l Ka lic
san
Ah

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

Practices for Lesson 3: Installing and Configuring Oracle RAC


Chapter 3 - Page 7
14. The installer will find issues with the value of MEMLOCK for the oracle user in the
/etc/security/limits.conf file across the three nodes. Click the Fix and Check
Again button.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
h a s ฺ
o m )
u i de
a ilฺc ent G
@ gm tud
b d i s S
b i r t h
aa
15. The installer will display k dialog boxs e
for executing the fixup scripts. Follow the instructions
and execute them on a h
thost01, o u and host03 as the root user as shown below.
m t host02,

b i r ( ense
u l Ka lic
san
Ah

[root@host01 ~]# /tmp/CVU_12.1.0.2.0_oracle/runfixup.sh


All Fix-up operations were completed successfully.

[root@host01 ~]# ssh host02 /tmp/CVU_12.1.0.2.0_oracle/runfixup.sh


All Fix-up operations were completed successfully.

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

Practices for Lesson 3: Installing and Configuring Oracle RAC


Chapter 3 - Page 8
[root@host01 ~]# ssh host03 /tmp/CVU_12.1.0.2.0_oracle/runfixup.sh
All Fix-up operations were completed successfully.

[root@host01 ~]#
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

16. When the scripts have been executed on all the three nodes, click the OK button.

ble
fe r a
ans
n - t r
a no
h a s ฺ
o m )
u i de
a ilฺc ent G
17. On the Perform Prerequisite Checks page,
@ gmclick Ignore
t ud All and then click Next to continue.
d S
b i r some ofththeisprerequisites and continue the installation.
Click Yes when asked to ignore b

t h ka use
( m a to
e
a bir icens
u l K l
san
Ah

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

Practices for Lesson 3: Installing and Configuring Oracle RAC


Chapter 3 - Page 9
18. Examine the Summary screen. When ready, click Install to start the installation.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
h a s ฺ
o m )
u i de
a ilฺc ent G
@ gm tud
b
19. Oracle Database release 12.1 software S on the cluster. The Install Product
d nowisinstalls
screen follows the course a ofb
i r t h
the installation.
h k u s e
a t t o
i m
r ( ense
b
u l Ka lic
san
Ah

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

Practices for Lesson 3: Installing and Configuring Oracle RAC


Chapter 3 - Page 10
20. Near the end of the installation process, you will see the Execute Configuration scripts
dialog box.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
t r a ns
From your root terminal session on host01, execute the root scripts ono n -
host01,
host02, and host03. Press the Enter key when you are prompted
s afornthe local bin
directory location as shown below.
) ha deฺ
o m ui
[root@host01 ~]# /u01/app/oracle/product/12.1.0/dbhome_1/root.sh
c
Performing root user operation foraiOracle l ฺ n t
12c G
@ gm tude
b dvariables
i s Sare set as:
The following environment
i r h
k
ORACLE_OWNER= oracle
h ab se t
ORACLE_HOME= a t o u
t /u01/app/oracle/product/12.1.0/dbhome_1
i m
r ( ense
b
l
Enter
u Kathe full lic pathname of the local bin directory:
san
[/usr/local/bin]:

Ah The contents of "dbhome" have not changed. No need to overwrite.


The contents of "oraenv" have not changed. No need to overwrite.
The contents of "coraenv" have not changed. No need to overwrite.

Entries will be added to the /etc/oratab file as needed by


Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
You have new mail in /var/spool/mail/root

[root@host01 ~]# ssh host02


/u01/app/oracle/product/12.1.0/dbhome_1/root.sh
root@host02's password:
Performing root user operation for Oracle 12c

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

Practices for Lesson 3: Installing and Configuring Oracle RAC


Chapter 3 - Page 11
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/12.1.0/dbhome_1

Enter the full pathname of the local bin directory:


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

[/usr/local/bin]:
The contents of "dbhome" have not changed. No need to overwrite.
The contents of "oraenv" have not changed. No need to overwrite.
The contents of "coraenv" have not changed. No need to overwrite.

Entries will be added to the /etc/oratab file as needed by


Database Configuration Assistant when a database is created
Finished running generic part of root script.
ble
Now product-specific root actions will be performed.
fe r a
ans
[root@host01 ~]# ssh host03 n - t r
/u01/app/oracle/product/12.1.0/dbhome_1/root.sh
a no
root@host03's password:
h a s ฺ
o m
Performing root user operation for Oracle 12c )
u i de
a i lฺc nt G
gm tare
The following environment variables
u deset as:
ORACLE_OWNER= oracle d@ S
i r b h i s
h k ab se t
ORACLE_HOME= /u01/app/oracle/product/12.1.0/dbhome_1

a t t o u
i r m
( nse of the local bin directory:
Enter the full pathname

l ab ce
[/usr/local/bin]:
contentsli of "dbhome" have not changed. No need to overwrite.
K
a n u contents of "oraenv" have not changed. No need to overwrite.
The
s The
Ah The contents of "coraenv" have not changed. No need to overwrite.

Entries will be added to the /etc/oratab file as needed by


Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.

[root@host01 ~]#

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

Practices for Lesson 3: Installing and Configuring Oracle RAC


Chapter 3 - Page 12
21. After you have executed the required configuration script on your cluster nodes, return to
the Execute Configuration scripts dialog box and click OK to proceed.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
h a s ฺ
m
22. After configuration completes you will see the Finish screen. e to close Oracle
) ClickidClose
o u
Universal Installer.
a ilฺc ent G
@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
u l Ka lic
san
Ah

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

Practices for Lesson 3: Installing and Configuring Oracle RAC


Chapter 3 - Page 13
Practice 3-2: Creating a RAC Database

Overview
In this practice you will create an Oracle RAC database.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

1. Using the same oracle terminal session from the previous practice, change directory to
/u01/app/oracle/product/12.1.0/dbhome_1/bin/ and execute dbca.
[oracle@host01 database]$ cd
/u01/app/oracle/product/12.1.0/dbhome_1/bin
[oracle@host01 bin]$ ./dbca

2. On the Database Operation screen, click Next to accept the default (Create Database).

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 3: Installing and Configuring Oracle RAC


Chapter 3 - Page 14
3. On the Creation Mode screen, click Next to accept the default selection (Advanced Mode).
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
o
4. an
On the Database Template screen, click Next to accept the default settings for a Policy-
s
Managed RAC Database using the General Purpose template).
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 3: Installing and Configuring Oracle RAC


Chapter 3 - Page 15
5. On the Database Identification screen, specify orcl as the Global Database Name and
click Next.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
h a s ฺ
o m )
u i de
a ilฺc ent G
@ gm tud
b S for the Server pool Name and set its
d specifyisorcldb
6. On the Database Placement screen,
cardinality to 3. Click Nexta
i r
tobproceed. t h
h k u s e
a t t o
i m
r ( ense
b
u l Ka lic
san
Ah

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

Practices for Lesson 3: Installing and Configuring Oracle RAC


Chapter 3 - Page 16
7. On the Management Options screen, deselect Run Cluster Verification Utility (CVU) Checks
Periodically. Ensure Configure EM Database Express is selected and accept the default
port value of 5500. Click Next to continue.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
h a s ฺ
o m )
u i de
a ilฺc ent G
@ gm tud
b d i s S
i r h
t Use the Same Administrative Passwords for All
8. On the Database Credentials
h k abscreen,s e select
Accounts and enterathet password
t o ufor the SYS, SYSTEM, and DBSNMP accounts. Then
m
r ( ense
click Next to continue.
i
b
u l Ka lic
san
Ah

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

Practices for Lesson 3: Installing and Configuring Oracle RAC


Chapter 3 - Page 17
9. On the Storage Locations screen, make the following adjustments:
• Database File Locations: +DATA
• Fast Recovery Area: +FRA
• Fast Recovery Area Size: 5160
• Click Next to continue.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 3: Installing and Configuring Oracle RAC


Chapter 3 - Page 18
10. On the Database Options screen, select Sample Schemas and click Next.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
h a s ฺ
o m )
u i de
a ilฺc ent G
@ gm tud
d database
A dialog box regarding policy-managed
b i s S instance placement on the local node
i r t h
h k ab sis edisplayed.
and sample schema configuration Click Yes to continue.

a t t o u
i m
r ( ense
b
u l Ka lic
san
Ah

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

Practices for Lesson 3: Installing and Configuring Oracle RAC


Chapter 3 - Page 19
11. On the Memory tab, in the Initialization Parameters screen, set Memory Size (SGA and
PGA) to 1000 and click the Character Sets tab.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
h a s ฺ
o m )
u i de
a ilฺc ent G
@ gm tud
b d i s S
i r h
t Parameters screen, select Use Unicode
(AL32UTF8) and clickth k btheuInitialization
12. On the Character Sets tab,ain
Next. se
( m a to
e
a bir icens
u l K l
san
Ah

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

Practices for Lesson 3: Installing and Configuring Oracle RAC


Chapter 3 - Page 20
13. On the Creation Options screen, click Next to accept the default selection (Create
Database).
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
t are performed.
h k ab checks
14. Wait while a series of prerequisite
s e
a t t o u
i m
r ( ense
b
u l Ka lic
san
Ah

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

Practices for Lesson 3: Installing and Configuring Oracle RAC


Chapter 3 - Page 21
15. Examine the Summary screen. When you are ready, click Finish to start the database
creation process.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
t the Progress Page.
k abprocess
16. Follow the database creation
h s eon
a t t o u
i m
r ( ense
b
u l Ka lic
san
Ah

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

Practices for Lesson 3: Installing and Configuring Oracle RAC


Chapter 3 - Page 22
17. Examine the dialog which indicates that the database creation process is completed. Take
note of the EM Database Express URL. When you are ready, click Exit to continue.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r t h
k ab Configuration
18. Click Close to quit the Database
h s e Assistant.
a t to u
( m e
a bir icens
u l K l
san
Ah

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

Practices for Lesson 3: Installing and Configuring Oracle RAC


Chapter 3 - Page 23
19. Back in the oracle user terminal, configure the environment using the oraenv script.
Enter orcl when you are prompted for an ORACLE_SID value.
[oracle@host01 bin]$ . oraenv
ORACLE_SID = [oracle] ? orcl
The Oracle base has been set to /u01/app/oracle
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

[oracle@host01 bin]$

20. Use the srvctl command to check which cluster nodes the database instances are
running.
[oracle@host01 bin]$ srvctl status database -db orcl
Instance orcl_1 is running on node host03
Instance orcl_2 is running on node host01
ble
Instance orcl_3 is running on node host02
fe r a
[oracle@host01 bin]$
ans
n - t r
o
an
21. Close all terminal windows opened for these practices.
s
ha deฺ
)
m ui
c o
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 3: Installing and Configuring Oracle RAC


Chapter 3 - Page 24
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
Practices for h a s ฺ 4:
Lesson
Oracle o m
RAC
) i de
Administration
u
a ilฺc ent G
@ gm t 4d
Chapteru
d S
b i rb this
t h ka use
( m a to
e
a bir icens
n u lK l
hs a
A

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

Practices for Lesson 4: Oracle RAC Administration


Chapter 4 - Page 1
Practices for Lesson 4: Overview

Practices Overview
In these practices, you will contrast operating systems, password file authenticated connections,
and Oracle database authenticated connections. You will also learn to stop a complete
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ORACLE_HOME component stack.

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 4: Oracle RAC Administration


Chapter 4 - Page 2
Practice 4-1: Operating System and Password File Authenticated
Connections

Overview
In this practice, you adjust initialization parameters in the SPFILE, and stop and start the ASM
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

instances on local and remote nodes.

1. Connect to your first node as the oracle user and set up your environment variables by
using the oraenv script.
[vncuser@classroom_pc ~]$ ssh oracle@host01
Password:
[oracle@host01 ~]$ . oraenv
ble
ORACLE_SID = [oracle] ? orcl
fe r a
The Oracle base has been set to /u01/app/oracle
ans
[oracle@host01 ~]$$
n - t r
a no
a s onฺ your machine by
2. Identify all the database instance names that are currently executing
h
using the Linux ps command.
o m )
u i de
a ฺc nt G
Note: All database instances have a mandatoryilbackground process named pmon, and the
instance name will be part of the completem de
g processtuname.
[oracle@host01 ~]$ psbd @ s S -i pmon
i r h
t ?i
-ef | grep
3529 ab 1 0 e
grid
t h k u s 06:45 00:00:16 asm_pmon_+ASM1
grid
m a
15479
t o
1 0 Nov20 ? 00:12:12 mdb_pmon_-MGMTDB
oracle
b i r ( 15813
e n se 1 0 08:02 ? 00:00:18 ora_pmon_orcl_3

u l Ka
oracle c 16483 0 15:24 pts/1 00:00:00 grep -i pmon
li19607
san
Ah 3. Attempt to make a local connection to the orcl_n instance by using SQL*Plus with the
sysdba privilege. This is known as operating system authentication because a password is
not needed. What happens when you are trying to connect to the instance?
[oracle@host01 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Sep 11 15:25:43


2014

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

Connected to an idle instance.

SQL> exit
Disconnected
[oracle@host01 ~]$

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

Practices for Lesson 4: Oracle RAC Administration


Chapter 4 - Page 3
4. Attempt to connect to the instance by using a network connection string @orcl with the
sysdba privilege. This is known as password file authentication. Is the connection
successful this time?
[oracle@host01 ~]$ sqlplus sys@orcl as sysdba
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

SQL*Plus: Release 12.1.0.2.0 Production on Wed Sep 11 15:27:50


2014

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

Enter password: **** << Password is not displayed

Connected to:
ble
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 -
fe r a
64bit Production
ans
With the Partitioning, Real Application Clusters, Automatic
n - t r
Storage Management, OLAP,
a no
Advanced Analytics and Real Application Testing options
h a s ฺ
o m )
u i de
SQL> exit
a ilฺc12cenEnterprise
tG
Disconnected from Oracle Database
g m tud Edition Release
12.1.0.2.0 - 64bit Production
b d @ Application
s S
With the Partitioning,
b i r Real
t h i Clusters, Automatic
a e
thk toandusReal Application Testing options
Storage Management, OLAP,
a
Advanced Analytics
(m ns~]$
i r
[oracle@host01 e
b e
n l Ka lic
u the values of the environment variables (ORACLE_BASE, ORACLE_HOME,
hs a
5. Display
A ORACLE_SID, and so on) that were defined with the oraenv script in step 1.
[oracle@host01 ~]$ env | grep ORA
ORACLE_SID=orcl
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1
[oracle@host01 ~]$

6. Modify the ORACE_SID environment variable to match the actual database instance name
for the orcl database.
[oracle@host01 ~]$ export ORACLE_SID=orcl_3
[oracle@host01 ~]$

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

Practices for Lesson 4: Oracle RAC Administration


Chapter 4 - Page 4
7. Attempt the local connection with system authentication to the local instance by using
SQL*Plus with the sysdba privilege. This is the same command as in step 3.
[oracle@host01 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Sep 11 15:35:32


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

2014

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

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 -
64bit Production
ble
With the Partitioning, Real Application Clusters, Automatic
fe r a
Storage Management, OLAP,
ans
Advanced Analytics and Real Application Testing options
n - t r
a no
SQL>
h a s ฺ
o m )
u i de
a ilฺc entdynamic
8. Query the instance_name column of the v$instance
G performance view to
m ExittuSQL*Plus
validate the instance that you connectedgwith. d when finished.
d @ S
SQL> select instance_name
b i rb tfrom
h is v$instance;
t h ka use
m
INSTANCE_NAME
( a to
e
bir icens
----------------
a
u l K
orcl_3 l
san
Ah SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release
12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic
Storage Management, OLAP,
Advanced Analytics and Real Application Testing options
[oracle@host01 ~]$

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

Practices for Lesson 4: Oracle RAC Administration


Chapter 4 - Page 5
Practice 4-2: Oracle Database Authenticated Connections

Overview
In this practice, you will make multiple Oracle database authenticated connections to a
database instance and notice the effects of load-balanced connections.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

1. From your first node, connected as the oracle user, validate the instance names on each
host.
[oracle@host01 ~]$ srvctl status database -d orcl
Instance orcl_1 is running on node host02
Instance orcl_2 is running on node host03
Instance orcl_3 is running on node host01
ble
[oracle@host01 ~]$
fe r a
t r a ns
2. Connect to a database instance by using SQL*Plus with the system account. o n - This is known
as Oracle database authentication. After it is connected, query the a n
instance_name
column from the v$instance dynamic performance view. a s
m ) h below:
i d eฺ
Note: Your instance names may vary from the oneso
l ฺ c displayed
G u
i t
[oracle@host01 ~]$ sqlplus system@orcl
g ma tuden
b d @ sS
a b i r
SQL*Plus: Release 12.1.0.2.0
e thi Production on Wed Sep 11 16:02:01
thk to us
2014
a
(m(c)ns1982,
i r e 2014, Oracle. All rights reserved.
b
Copyright
e
u l Ka lic
san Enter password: ***** << Password is not displayed
Ah Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 -
64bit Production
With the Partitioning, Real Application Clusters, Automatic
Storage Management, OLAP,
Advanced Analytics and Real Application Testing options

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
orcl_2

SQL>

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

Practices for Lesson 4: Oracle RAC Administration


Chapter 4 - Page 6
3. Use the SQL*Plus host command to temporarily exit SQL*Plus and return to the operating
system prompt.
Note: SQL*Plus is still running when this is performed. Repeat the previous step from the
operating system prompt to establish a second SQL*Plus session and database instance
connection. What instance name did you connect to?
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

SQL> !
[oracle@host01 ~]$ sqlplus system@orcl

SQL*Plus: Release 12.1.0.2.0 Production on Wed Sep 11 16:07:15


2014

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

ble
Enter password: ***** << Password is not displayed
fe r a
Last Successful login time: Wed Sep 11 2014 16:02:32 +00:00
ans
n - t r
o
Connected to:
s an
64bit Production ) ha deฺ
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 -

c o m ui
il ent G

With the Partitioning, Real Application Clusters, Automatic
a
gm tud
Storage Management, OLAP,

b d @ s S
Advanced Analytics and Real Application Testing options
i r h i
h k ab se tfrom v$instance;
SQL> select instance_name
a t t o u
i m
r ( ense
b
INSTANCE_NAME

u Ka lic
l ----------------
a n
hs
orcl_1
A
SQL>

4. Use the SQL*Plus host command to temporarily exit SQL*Plus and return to the operating
system prompt. Note: SQL*Plus is still running when this is performed. Validate that you are
still on your first node. Repeat the previous step from the operating system prompt to
establish a third SQL*Plus session and database instance connection. What instance name
did you connect to?
SQL> !
[oracle@host01 ~]$ sqlplus system@orcl
SQL*Plus: Release 12.1.0.2.0 Production on Wed Sep 11 16:07:15
2014

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

Enter password: ***** << Password is not displayed

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

Practices for Lesson 4: Oracle RAC Administration


Chapter 4 - Page 7
Last Successful login time: Wed Sep 11 2014 16:02:32 +00:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 -
64bit Production
With the Partitioning, Real Application Clusters, Automatic
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Storage Management, OLAP,


Advanced Analytics and Real Application Testing options

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
orcl_3
ble
fe r a
SQL>
ans
n - t r
5. no
Exit the three SQL*Plus sessions that are currently executing on the first node.
a
h a s ฺ
) de Edition Release
SQL> exit
o m u i
12.1.0.2.0 - 64bit Production ilฺc
Disconnected from Oracle Database 12c Enterprise
a n t G
With the Partitioning, Real gm t u
Applicationde Clusters, Automatic
Storage Management, OLAP,
b d @ s S
i
Advanced Analyticsb and Realr h i
t Application Testing options
h k a s e
a t t o u
i m
r ( ense
[oracle@host01 ~]$ exit
b
l Ka lic
exit

a n u
hs
SQL> exit
A Disconnected from Oracle Database 12c Enterprise Edition Release
12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic
Storage Management, OLAP,
Advanced Analytics and Real Application Testing options
[oracle@host01 ~]$ exit
exit

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release
12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic
Storage Management, OLAP,
Advanced Analytics and Real Application Testing options

[oracle@host01 ~]$

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

Practices for Lesson 4: Oracle RAC Administration


Chapter 4 - Page 8
Practice 4-3: Stopping a Complete ORACLE_HOME Component Stack

Overview
In this practice, you will use the srvctl utility to stop all resource components executing from a
single Oracle home location.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

1. Validate that the instances are running on each node of the cluster using the ps command.
[oracle@host01 ~]$ ps -ef|grep -i pmon
grid 3529 1 0 06:45 ? 00:00:18 asm_pmon_+ASM1
oracle 15813 1 0 08:02 ? 00:00:20 ora_pmon_orcl_3
grid 23591 1 0 06:45 ? 00:00:06 mdb_smon_-MGMTDB
oracle 24700 16483 0 16:25 pts/1 00:00:00 grep -i pmon
ble
fe r a
ans
[oracle@host01 ~]$ ssh host02 ps -ef|grep -i pmon
n - t r
no
grid 5973 1 0 07:45 ? 00:00:21 asm_pmon_+ASM2
oracle 7114 1 0 08:01 ? a
00:00:24 ora_pmon_orcl_1
s ฺ
h a
[oracle@host01 ~]$ ssh host03 ps -ef|grep o m u de
) -i ipmon
1 0 13:49 a ? ilฺ
c 00:00:07
t G
oracle 3034
m e n ora_pmon_orcl_2
grid 3682 1 0 13:51
@ g ? tud 00:00:06 asm_pmon_+ASM3
[oracle@host01 ~]$ rb d i s S
i
ab se t h
h k
t helptoforuthe srvctl status home command.
2. Display the syntaxm a
usage
b i r ( ens~]$ e
l K a l ic
[oracle@host01 srvctl status home -help

a n u
s
Ah Displays the current state of of all resources for the Oracle
home.

Usage: srvctl status home -oraclehome <oracle_home> -statefile


<state_file> -node <node_name>
-oraclehome <path> Oracle home path
-statefile <state_file> Specify a file path for the
srvctl status home command to store the state of the resources
-node <node_name> Node name
-help Print usage
[oracle@host01 ~]$

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

Practices for Lesson 4: Oracle RAC Administration


Chapter 4 - Page 9
3. Use the srvctl status home command to check the state of all resources running from
the /u01/app/oracle/product/12.1.0/dbhome_1 home location. Create the
required state file in the /tmp directory with the file name host01_dbhome_state1.dmp
for the first node only.
[oracle@host01 ~]$ srvctl status home -oraclehome
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

/u01/app/oracle/product/12.1.0/dbhome_1 -statefile
/tmp/host01_dbhome_state1.dmp -node host01
Database orcl is running on node host01
[oracle@host01 ~]$

4. Display the syntax usage help for the srvctl stop home command.
[oracle@host01 ~]$ srvctl stop home -help
bl e
fe r a
Stops all Oracle clusterware resources that run from the Oracle
n s
home.
n - tra
a no-statefile
Usage: srvctl stop home -oraclehome <oracle_home>
<state_file> -node <node_name> [-stopoption h a s<stop_options>]
ฺ [-
force] )
m uid e
c o
-oraclehome <path>
a il ent Ghome path
ฺ Oracle
-statefile <state_file>
@ gm t u dSpecify a file path for the
srvctl stop home command
b d to
i s S
store the state of the resources
-node <node_name> r
bi e th Node name
k a
-stopoption
a
database.mExamples t o us
th <stop_options> Stop options for the

r ( ensIMMEDIATE,
e of shutdown options are NORMAL,
b i
TRANSACTIONAL,
a or ABORT.
li c
nul K -force Force stop

sa -help Print usage


Ah
[oracle@host01 ~]$

5. Stop all resources executing from /u01/app/oracle/product/12.1.0/dbhome_1. Do


not use the optional parameters identified by square brackets “[]” displayed in the syntax
usage help.
[oracle@host01 ~]$ srvctl stop home -oraclehome
/u01/app/oracle/product/12.1.0/dbhome_1 -node host01 -statefile
/tmp/host01_dbhome_state2.dmp

[oracle@host01 ~]$

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

Practices for Lesson 4: Oracle RAC Administration


Chapter 4 - Page 10
6. Check the status of the database instances on each node.
[oracle@host01 ~]$ srvctl status database -d orcl
Instance orcl_1 is running on node host02
Instance orcl_2 is running on node host03
Instance orcl_3 is not running on node host01
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

[oracle@host01 ~]$

7. Start all resources for the /u01/app/oracle/product/12.1.0/dbhome_1 home using


the state file created by the stop command.
[oracle@host01 ~]$ srvctl start home -oraclehome
/u01/app/oracle/product/12.1.0/dbhome_1 -node host01 -statefile
/tmp/host01_dbhome_state2.dmp
ble
[oracle@host01 ~]$
fe r a
ans
8. Check the status of the database instances on each node. n - t r
o
[oracle@host01 ~]$ srvctl status database -ds orcl an
Instance orcl_1 is running on node host02 ) ha deฺ
Instance orcl_2 is running on nodeco m ui
Instance orcl_3 is running on a
ฺ host03
il host01
n t G
gm tude
node
[oracle@host01 ~]$
b d @ s S
b i r t h i
h k aopened s e
a t
9. Close all terminal windows
t o u for this practice.

i r (m nse
l K ab lice
a n u
s
Ah

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

Practices for Lesson 4: Oracle RAC Administration


Chapter 4 - Page 11
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 4: Oracle RAC Administration


Chapter 4 - Page 12
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
Practices )for s ฺ 5:
haLesson
m i e
dPatching
Upgrading o u
and
a ilฺc RAC
n t G
@ gm tude
Oracle
b d Chapter
i s S 5
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 5: Upgrading and Patching Oracle RAC


Chapter 5 - Page 1
Practices for Lesson 5: Overview
Practices Overview
In this practice you will apply patch 20108098 to the Oracle RAC database homes on all three
nodes. This patch fixes a problem with the GV$_SEQUENCES global view and is necessary to
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

complete all lesson 7 practices.

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 5: Upgrading and Patching Oracle RAC


Chapter 5 - Page 2
Practice 5-1 Patching the RAC Database Home

1. Establish an ssh connection using the –X option as the oracle user. Use oraenv to set
the Oracle environment.
[vncuser@classsroom_pc ~]$ ssh -X oracle@host01
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

oracle@host01's password:

[oracle@host01 ~]$ . oraenv


ORACLE_SID = [oracle] ? orcl
The Oracle base has been set to /u01/app/oracle
[oracle@host01 ~]$

ble
2. The patch you will install is 20108098. It is located in /stage/patch/20108098. It fixes
fe r a
an issue with the GV$_SEQUENCES view. Navigate to the directory and take a few moments
ans
to view the README file, particularly Section I (Prerequisites) and Section II (Installation).
n - t r
[oracle@host01 ~]$ cd /stage/patch/20108098
a no
h a s ฺ
[oracle@host01 20108098]$ ls -al
o m )
u i de
total 24
a ilฺc20e20:05
n t G.
drwxrwxr-x 4 root root
@ gm tu22
4096 Jan
d 18:31 ..
drwxr-xr-x 3 oracle oinstall
d S
4096 Jan
is Jan 20 20:05 etc
drwxr-xr-x 3 root b i
root rb 4096
t h
drwxr-xr-x 3 roott h karootuse 4096 Jan 20 20:05 files
-rw-rw-r-- (1m
a
root erootto 5855 Jan 20 20:05 README.txt
i r n s
l K ab lice20108098]$ cat README.txt
a n u
[oracle@host01
s
Ah Oracle Database 12c Release 12.1.0.2.0
ORACLE DATABASE Patch for Bug# 20108098 for Linux-x86-64 Platforms

This patch is RAC Rolling Installable - Please read My Oracle


Support Document 244241.1
https://support.us.oracle.com/oip/faces/secure/km/DocumentDisplay.j
spx?id=244241.1 Rolling Patch - OPatch Support for RAC.

This patch is Data Guard Standby-First Installable - Please read My


Oracle Support Note 1265700.1
https://support.us.oracle.com/oip/faces/secure/km/DocumentDisplay.j
spx?id=1265700.1
Oracle Patch Assurance - Data Guard Standby-First Patch Apply for
details on how to remove risk and reduce downtime when applying
this patch.

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

Practices for Lesson 5: Upgrading and Patching Oracle RAC


Chapter 5 - Page 3
Released: Tue Jan 20 11:47:25 2015

This document describes how you can install the ORACLE DATABASE
interim patch for bug# 20108098 on your Oracle Database 12c
Release 12.1.0.2.0
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

(I) Prerequisites
--------------------
Before you install or deinstall the patch, ensure that you meet the
following requirements:

Note: In case of an Oracle RAC environment, meet these


prerequisites on each of the nodes.
bl e
Ensure that the Oracle home on which you are installingfe r a
1.
n s the
patch or from which you are rolling back the patch is Oracle
Database 12c Release 12.1.0.2.0. n - tra
a no
2. Oracle recommends that you use the latest
h a s version
ฺ available
for 12c Release 12.1.0.2.0. If you do not m )
have i e
d Release Release
OPatch 12c
o u
12.1.0.1.4 or the latest version available
a ilฺc e6880880
n t G for 12.1.0.2.0
for 12c

gm tud
12.1.0.2.0,then download it from patch#
release.
b d @ s S
i r h i
t OPatch documentation, including any
k
For information
h ab abouts e
known issues, a see o u Support Document 293369.1 OPatch
t My tOracle
documentation
i m
r ( ense
list:
b
u l Ka lic
https://support.oracle.com/CSP/main/article?cmd=show&type=NOT&id=22
san4346.1
Ah
3. Ensure that you set (as the home user) the ORACLE_HOME
environment variable to the Oracle home.

4. Ensure that the $PATH definition has the following


executables: make, ar, ld and nm. The location of these executables
depends on your operating system. On many operating systems, they
are located in /usr/ccs/bin.

5. Ensure that you verify the Oracle Inventory because OPatch


accesses it to install the patches. To verify the inventory, run
the following command.
$ opatch lsinventory
Note:
- If this command succeeds, it will list the Top-
Level Oracle Products and one-off patches if any that are installed
in the Oralce Home.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 5: Upgrading and Patching Oracle RAC


Chapter 5 - Page 4
- Save the output so you have the status
prior to the patch apply.
- If the command displays some errors, then contact
Oracle Support and resolve the issue first before proceeding
further.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

6. (Only for Installation) Maintain a location for storing the


contents of the patch ZIP file. In the rest of the document, this
location (absolute path) is referred to as <PATCH_TOP_DIR>. Extract
the contents of the patch ZIP file to the location (PATCH_TOP_DIR)
you have created above. To do so, run the following command:
$ unzip -d <PATCH_TOP_DIR> p20108098_121020_Linux-x86-
64.zip

ble
fe r a
7. (Only for Installation) Determine whether any currently
ans
installed interim patches conflict with this patch 20108098 as
n - t r
no
shown below:
$ cd <PATCH_TOP_DIR>/20108098
s ฺa
h a
) de
$ opatch prereq CheckConflictAgainstOHWithDetail -ph ./
o m u i
The report will indicate the a ilฺcpatches
n t Gthat conflict with
this patch and the patches forgm which u
t decurrent 20108098 is a
the
superset.
b d @ s S
i r h i
Note: thk
ab se t
a t o u
i r
When m
( nse
OPatch starts, it validates the patch and ensures that
a
there areb iceno conflicts with the software already installed in the
u l K
ORACLE_HOME. l OPatch categorizes conflicts into the following types:
san - Conflicts with a patch already applied to the
Ah ORACLE_HOME that is a subset of the patch you are trying to apply
- In this case, continue with the patch installation because the
new patch contains all the fixes from the existing patch in the
ORACLE_HOME. The subset patch will automatically be rolled back
prior to the installation of the new patch.
- Conflicts with a patch already applied to the
ORACLE_HOME - In this case, stop the patch installation and contact
Oracle Support Services.

8. Ensure that you shut down all the services running from the
Oracle home.
Note:
- For a Non-RAC environment, shut down all
the services running from the Oracle home.
- For a RAC environment, shut down all the
services (database, ASM, listeners, nodeapps, and CRS daemons)
running from the Oracle home of the node you want to patch. After

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

Practices for Lesson 5: Upgrading and Patching Oracle RAC


Chapter 5 - Page 5
you patch this node, start the services on this node. Repeat this
process for each of the other nodes of the Oracle RAC system.
OPatch is used on only one node at a time.

(II) Installation
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

-----------------
To install the patch, follow these steps:

1. Set your current directory to the directory where the patch


is located and then run the OPatch utility by entering the
following commands:

$ cd <PATCH_TOP_DIR>/20108098
ble
fe r a
ans
$ opatch apply
n - t r
2. a no
Verify whether the patch has been successfully installed by
running the following command: h a s ฺ
o m )
u i de
$ opatch lsinventory
a ilฺc ent G
@ gm tud
3. Start the services
i r b d from istheSOracle home.
a b e th
k
th to us
a
(m nse
i r
(III) Deinstallation
K ab lice
----------------------
l
a n u
Ensure to follow the Prerequsites (Section I). To deinstall the
s patch, follow these steps:
Ah
1. Deinstall the patch by running the following command:

$ opatch rollback -id 20108098

2. Start the services from the Oracle home.

3. Ensure that you verify the Oracle Inventory and compare the
output with the one run before the patch installation and re-apply
any patches that were rolled back as part of this patch apply. To
verify the inventory, run the following command:

$ opatch lsinventory

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

Practices for Lesson 5: Upgrading and Patching Oracle RAC


Chapter 5 - Page 6
(IV) Bugs Fixed by This Patch
---------------------------------
The following are the bugs fixed by this patch:
20108098: GV$_SEQUENCES BROKEN
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

-------------------------------------------------------------------
Copyright 2015, Oracle and/or its affiliates. All rights reserved.
-------------------------------------------------------------------
[oracle@host01 20108098]$

3. Make sure that your PATH definition points to the make, ar, ld and nm executables. In our
practice environment, they are located in /usr/bin.
[oracle@host01 ~]$ which make ar ld nm ble
fe r a
/usr/bin/make
ans
/usr/bin/ar
n - t r
/usr/bin/ld
a no
/usr/bin/nm
h a s ฺ
[oracle@host01 ~]$ echo $PATH
o m )
u i de
ilฺc ent G
/usr/lib64/qt-
a
3.3/bin:/usr/local/bin:/bin:/usr/bin:/home/oracle/bin:/u01/app/orac
le/product/12.1.0/dbhome_1/bin
@ gm tud
[oracle@host01 ~]$ b d i s S
i r h
h k ab se t
a t in your
4. Put the OPatch directory t o upath and verify that OPatch has access to the Oracle
i m
( opatch
r the
inventory with se lsinventory command.
b e n
Ka
[oracle@host01
u l lic ~]$ export
san
PATH=$PATH:/u01/app/oracle/product/12.1.0/dbhome_1/OPatch

Ah [oracle@host01 ~]$ opatch lsinventory


Oracle Interim Patch Installer version 12.1.0.1.3
Copyright (c) 2015, Oracle Corporation. All rights reserved.

Oracle Home : /u01/app/oracle/product/12.1.0/dbhome_1


Central Inventory : /u01/app/oraInventory
from :
/u01/app/oracle/product/12.1.0/dbhome_1/oraInst.loc
OPatch version : 12.1.0.1.3
OUI version : 12.1.0.2.0
Log file location :
/u01/app/oracle/product/12.1.0/dbhome_1/cfgtoollogs/opatch/opatch20
15-01-23_08-20-11AM_1.log

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

Practices for Lesson 5: Upgrading and Patching Oracle RAC


Chapter 5 - Page 7
Lsinventory Output file location :
/u01/app/oracle/product/12.1.0/dbhome_1/cfgtoollogs/opatch/lsinv/ls
inventory2015-01-23_08-20-11AM.txt

-------------------------------------------------------------------
Installed Top-level Products (1):
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Oracle Database 12c


12.1.0.2.0
There are 1 products installed in this Oracle Home.

There are no Interim patches installed in this Oracle Home.


ble
fe r a
ans
Rac system comprising of multiple nodes
n - t r
Local node = host01
a no
Remote node = host02
h a s ฺ
Remote node = host03
o m )
u i de
a ilฺc ent G
gm tud
-------------------------------------------------------------------
@
b d i s S
i r h
ab se t
OPatch succeeded.
[oracle@host01 ~]$
t h k u
m a t o
b i r ( eany n e
scurrently
l K athe opatch
5. Determine whether
l ic prereq command installed interim patches conflict with patch 20108098 by

n u
running as shown below.
sa [oracle@host01 20108098]$ opatch prereq
Ah CheckConflictAgainstOHWithDetail -ph ./
Oracle Interim Patch Installer version 12.1.0.1.3
Copyright (c) 2015, Oracle Corporation. All rights reserved.

PREREQ session

Oracle Home : /u01/app/oracle/product/12.1.0/dbhome_1


Central Inventory : /u01/app/oraInventory
from :
/u01/app/oracle/product/12.1.0/dbhome_1/oraInst.loc
OPatch version : 12.1.0.1.3
OUI version : 12.1.0.2.0
Log file location :
/u01/app/oracle/product/12.1.0/dbhome_1/cfgtoollogs/opatch/opatch20
15-01-23_08-28-08AM_1.log

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

Practices for Lesson 5: Upgrading and Patching Oracle RAC


Chapter 5 - Page 8
Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

[oracle@host01 20108098]$

6. Open a second ssh connection as the oracle user. Set the environment and use the
SRVCTL command to determine which instances are running on the three nodes. Shut
down the instance running on the local node, host01.
[vncuser@classsroom_pc ~]$ ssh oracle@host01
oracle@host01's password:
[oracle@host01 ~]$
ble
fe r a
ans
[oracle@host01 ~]$ . oraenv
n - t r
ORACLE_SID = [oracle] ? orcl
The Oracle base has been set to /u01/app/oracle a no
h a s ฺ
) de
[oracle@host01 ~]$
o m u i
[oracle@host01 ~]$ srvctl status database a ilฺc en-dt Gorcl
Instance orcl_1 is running on g
m tud
b @ node host02
d on nodes Shost03
Instance orcl_2 is running
i r h i
ab seont node host01
Instance orcl_3 iskrunning
h
a t t o u
i m
r ( e~]$ sesrvctl stop instance -d orcl -i orcl_3
b
[oracle@host01 n
l Ka
[oracle@host01
u lic ~]$
san
Ah 7. Return to the first terminal and start the patch installation by executing opatch apply.
When OPatch asks “Is the local system ready for patching?”, answer yes by typing Y and
pressing Enter.
[oracle@host01 20108098]$ opatch apply
Oracle Interim Patch Installer version 12.1.0.1.3
Copyright (c) 2015, Oracle Corporation. All rights reserved.

Oracle Home : /u01/app/oracle/product/12.1.0/dbhome_1


Central Inventory : /u01/app/oraInventory
from :
/u01/app/oracle/product/12.1.0/dbhome_1/oraInst.loc
OPatch version : 12.1.0.1.3
OUI version : 12.1.0.2.0

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

Practices for Lesson 5: Upgrading and Patching Oracle RAC


Chapter 5 - Page 9
Log file location :
/u01/app/oracle/product/12.1.0/dbhome_1/cfgtoollogs/opatch/20108098
_Jan_23_2015_08_33_24/apply2015-01-23_08-33-24AM_1.log

Applying interim patch '20108098' to OH


'/u01/app/oracle/product/12.1.0/dbhome_1'
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Verifying environment and performing prerequisite checks...


All checks passed.

This node is part of an Oracle Real Application Cluster.


Remote nodes: 'host02' 'host03'
Local node: 'host01'
Please shutdown Oracle instances running out of this ORACLE_HOME on
the local system. ble
fe r a
(Oracle Home = '/u01/app/oracle/product/12.1.0/dbhome_1')
ans
n - t r
Is the local system ready for patching? [y|n]
a no
y
h a s ฺ
o m )
u i de
ilฺc ent G
User Responded with: Y
Backing up files... a
@ gm tud
b d i s S
i r
Patching component oracle.rdbms, h 12.1.0.2.0...

h k ab se t
Verifying the a
t t o u
i m update...
r ( ense
b
a system
The
u l Klocal lic has been patched. You can restart Oracle
san
instances on it.
Ah
Patching in rolling mode.

Remaining nodes to be patched:


'host02' 'host03'

What is the next node to be patched?

When patching is finished on host01, the OPatch dialog will inform you that the instance
can be restarted on host01 and will prompt you for the name of the next node to patch,
host02. Before continuing, go to the next step.

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

Practices for Lesson 5: Upgrading and Patching Oracle RAC


Chapter 5 - Page 10
8. Go to the second terminal window and restart the instance on host01.
... Output from step 6 ****
[oracle@host01 ~]$ srvctl status database -d orcl
Instance orcl_1 is running on node host02
Instance orcl_2 is running on node host03
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Instance orcl_3 is running on node host01

[oracle@host01 ~]$ srvctl stop instance -d orcl -i orcl_3

[oracle@host01 ~]$ srvctl start instance -d orcl -i orcl_3

[oracle@host01 ~]$
ble
fe r a
9. From the second terminal window, stop the instance on host02.
ans
... Output from step 6 ****
n - t r
[oracle@host01 ~]$ srvctl status database -d orcl
a no
Instance orcl_1 is running on node host02
h a s ฺ
Instance orcl_2 is running on node host03
o m )
u i de
ilฺc ent G
Instance orcl_3 is running on node host01
a
@ gm tud -d orcl -i orcl_3
d
[oracle@host01 ~]$ srvctl stop S
instance
b i rb this
ka 8 u****
... Output from hstep
t se
( m a~]$ srvctl
to start instance -d orcl -i orcl_3
[oracle@host01
e
a bir icens
u l K l ~]$ srvctl stop instance -d orcl -i orcl_1
[oracle@host01
san
Ah [oracle@host01 ~]$

10. Return to the first terminal window, type host02 and press Enter. When asked “Is the
node ready for patching? [y|n]”, answer Y and press Enter.
What is the next node to be patched?
host02
You have selected 'host02' from 'host02' 'host03'

The node 'host02' will be patched next.

Please shutdown Oracle instances running out of this ORACLE_HOME on


'host02'.
(Oracle Home = '/u01/app/oracle/product/12.1.0/dbhome_1')

Is the node ready for patching? [y|n]


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

Practices for Lesson 5: Upgrading and Patching Oracle RAC


Chapter 5 - Page 11
y
User Responded with: Y
Updating nodes 'host02'
Apply-related files are:
FP =
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

"/u01/app/oracle/product/12.1.0/dbhome_1/.patch_storage/20108098_Ja
n_20_2015_12_04_56/rac/copy_files.txt"
DP =
"/u01/app/oracle/product/12.1.0/dbhome_1/.patch_storage/20108098_Ja
n_20_2015_12_04_56/rac/copy_dirs.txt"
MP =
"/u01/app/oracle/product/12.1.0/dbhome_1/.patch_storage/20108098_Ja
n_20_2015_12_04_56/rac/make_cmds.txt"
RC =
ble
"/u01/app/oracle/product/12.1.0/dbhome_1/.patch_storage/20108098_Ja
fe r a
n_20_2015_12_04_56/rac/remote_cmds.txt"
ans
n - t r
o
an
Instantiating the file
s
"/u01/app/oracle/product/12.1.0/dbhome_1/.patch_storage/20108098_Ja
ha deฺ
)
n_20_2015_12_04_56/rac/copy_files.txt.instantiated" by replacing
m ui
$ORACLE_HOME in
c o
il ent G

"/u01/app/oracle/product/12.1.0/dbhome_1/.patch_storage/20108098_Ja
a
gm tud
n_20_2015_12_04_56/rac/copy_files.txt" with actual path.
@
Propagating files to remote nodes...
b d i s S
i r h
Instantiating the file
h k ab se t
a t t o u
"/u01/app/oracle/product/12.1.0/dbhome_1/.patch_storage/20108098_Ja

i m
n_20_2015_12_04_56/rac/copy_dirs.txt.instantiated" by replacing
r ( ense
$ORACLE_HOME in
b
l Ka lic
"/u01/app/oracle/product/12.1.0/dbhome_1/.patch_storage/20108098_Ja

a n un_20_2015_12_04_56/rac/copy_dirs.txt" with actual path.

Ahs Propagating directories to remote nodes...


Instantiating the file
"/u01/app/oracle/product/12.1.0/dbhome_1/.patch_storage/20108098_Ja
n_20_2015_12_04_56/rac/make_cmds.txt.instantiated" by replacing
$ORACLE_HOME in
"/u01/app/oracle/product/12.1.0/dbhome_1/.patch_storage/20108098_Ja
n_20_2015_12_04_56/rac/make_cmds.txt" with actual path.
Running command on remote node 'host02':
cd /u01/app/oracle/product/12.1.0/dbhome_1/rdbms/lib; /usr/bin/make
-f ins_rdbms.mk ioracle
ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1 || echo
REMOTE_MAKE_FAILED::>&2

The node 'host02' has been patched. You can restart Oracle
instances on it.

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

Practices for Lesson 5: Upgrading and Patching Oracle RAC


Chapter 5 - Page 12
The node 'host03' will be patched next.

Please shutdown Oracle instances running out of this ORACLE_HOME on


'host03'.
(Oracle Home = '/u01/app/oracle/product/12.1.0/dbhome_1')
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

11. Go to the second terminal window and restart the instance on host02.
... Output from step 6 ****
[oracle@host01 ~]$ srvctl status database -d orcl
Instance orcl_1 is running on node host02
Instance orcl_2 is running on node host03
Instance orcl_3 is running on node host01 ble
fe r a
ans
[oracle@host01 ~]$ srvctl stop instance -d orcl -i orcl_3
n - t r
a no
... Output from step 8 ****
h a s ฺ
) de
[oracle@host01 ~]$ srvctl start instance -d orcl -i orcl_3
o m u i
... Output from step 9 **** a ilฺc ent G
[oracle@host01 ~]$ srvctl stopginstance
m tud -d orcl -i orcl_1
b d @ s S
i r h i
t instance -d orcl -i orcl_1
ab sstart
[oracle@host01 ~]$ksrvctl
h e
a t t o u
i m
r ( e~]$ se
b
[oracle@host01 n
u l Ka lic
s12.anFrom the second terminal window stop the instance on host03.
Ah ... Output from step 6 ****
[oracle@host01 ~]$ srvctl status database -d orcl
Instance orcl_1 is running on node host02
Instance orcl_2 is running on node host03
Instance orcl_3 is running on node host01

[oracle@host01 ~]$ srvctl stop instance -d orcl -i orcl_3

... Output from step 8 ****


[oracle@host01 ~]$ srvctl start instance -d orcl -i orcl_3

... Output from step 9 ****


[oracle@host01 ~]$ srvctl stop instance -d orcl -i orcl_1

... Output from step 11 ****


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

Practices for Lesson 5: Upgrading and Patching Oracle RAC


Chapter 5 - Page 13
[oracle@host01 ~]$ srvctl start instance -d orcl -i orcl_1

[oracle@host01 ~]$ srvctl stop instance -d orcl -i orcl_2

[oracle@host01 ~]$
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

13. Return to the first terminal window and indicate host03 is ready for patching by typing Y
and pressing Enter.
Is the node ready for patching? [y|n]
y

User Responded with: Y


Updating nodes 'host03' ble
fe r a
Apply-related files are:
ans
FP =
n - t r
"/u01/app/oracle/product/12.1.0/dbhome_1/.patch_storage/20108098_Ja
o
n_20_2015_12_04_56/rac/copy_files.txt"
s an
DP =
) ha deฺ
c o m ui
"/u01/app/oracle/product/12.1.0/dbhome_1/.patch_storage/20108098_Ja
n_20_2015_12_04_56/rac/copy_dirs.txt"
a il ent G

MP =
@ gm tud
b i s S
"/u01/app/oracle/product/12.1.0/dbhome_1/.patch_storage/20108098_Ja
d
i r h
n_20_2015_12_04_56/rac/make_cmds.txt"
RC =
h k ab se t
a t t o u
"/u01/app/oracle/product/12.1.0/dbhome_1/.patch_storage/20108098_Ja
m
r ( ense
n_20_2015_12_04_56/rac/remote_cmds.txt"
i
b
u l Ka ic to remote nodes...
lfiles
sanPropagating directories to remote nodes...
Propagating

Ah Instantiating the file


"/u01/app/oracle/product/12.1.0/dbhome_1/.patch_storage/20108098_Ja
n_20_2015_12_04_56/rac/make_cmds.txt.instantiated" by replacing
$ORACLE_HOME in
"/u01/app/oracle/product/12.1.0/dbhome_1/.patch_storage/20108098_Ja
n_20_2015_12_04_56/rac/make_cmds.txt" with actual path.
Running command on remote node 'host03':
cd /u01/app/oracle/product/12.1.0/dbhome_1/rdbms/lib; /usr/bin/make
-f ins_rdbms.mk ioracle
ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1 || echo
REMOTE_MAKE_FAILED::>&2

The node 'host03' has been patched. You can restart Oracle
instances on it.

There were relinks on remote nodes. Remember to check the binary


size and timestamp on the nodes 'host02' 'host03' .
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 5: Upgrading and Patching Oracle RAC


Chapter 5 - Page 14
The following make commands were invoked on remote nodes:
'cd /u01/app/oracle/product/12.1.0/dbhome_1/rdbms/lib;
/usr/bin/make -f ins_rdbms.mk ioracle
ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1
'
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Patch 20108098 successfully applied


Log file location:
/u01/app/oracle/product/12.1.0/dbhome_1/cfgtoollogs/opatch/20108098
_Jan_23_2015_08_33_24/apply2015-01-23_08-33-24AM_1.log

OPatch succeeded.

[oracle@host01 20108098]$ ble


fe r a
ans
14. After OPatch has finished patching host03, go to the second terminal window and start the
n - t r
instance on host03.
a no
... Output from step 6 ****
[oracle@host01 ~]$ srvctl status database )
as
-dhorcl eฺ
c o m uid
Instance orcl_1 is running on node host02
a l ฺ
ihost03 n t G
gm host01 ude
Instance orcl_2 is running on node
Instance orcl_3 is running @
d on node S t
b i r b t h is
h a
ksrvctl e instance -d orcl -i orcl_3
sstop
[oracle@host01 ~]$
a t to u
( m e
s 8 ****
a bir from
... Output
c e nstep
u l K li ~]$ srvctl start instance -d orcl -i orcl_3
[oracle@host01
san
Ah ... Output from step 9 ****
[oracle@host01 ~]$ srvctl stop instance -d orcl -i orcl_1

... Output from step 11 ****


[oracle@host01 ~]$ srvctl start instance -d orcl -i orcl_1

... Output from step 12 ****


[oracle@host01 ~]$ srvctl stop instance -d orcl -i orcl_2

[oracle@host01 ~]$ srvctl start instance -d orcl -i orcl_2

[oracle@host01 ~]$

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

Practices for Lesson 5: Upgrading and Patching Oracle RAC


Chapter 5 - Page 15
15. Return to the first terminal session and run the opatch lsinventory command to
ensure the Oracle homes on all three nodes were patched successfully.
[oracle@host01 20108098]$ opatch lsinventory
Oracle Interim Patch Installer version 12.1.0.1.3
Copyright (c) 2015, Oracle Corporation. All rights reserved.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Oracle Home : /u01/app/oracle/product/12.1.0/dbhome_1


Central Inventory : /u01/app/oraInventory
from :
/u01/app/oracle/product/12.1.0/dbhome_1/oraInst.loc
OPatch version : 12.1.0.1.3
OUI version : 12.1.0.2.0
ble
Log file location :
fe r a
/u01/app/oracle/product/12.1.0/dbhome_1/cfgtoollogs/opatch/opatch20
ans
15-01-23_08-50-22AM_1.log
n - t r
n o
Lsinventory Output file location : s ฺa
h a
) de
/u01/app/oracle/product/12.1.0/dbhome_1/cfgtoollogs/opatch/lsinv/ls
inventory2015-01-23_08-50-22AM.txt
o m u i
a ilฺc ent G
gm tud
-------------------------------------------------------------------
@
b d (1):
i s S
Installed Top-level Products
i r h
h k ab se t
Oracle Database
12.1.0.2.0 (m
at12c to u
There a bir 1 products
e n se installed in this Oracle Home.
u l K are
lic
san
Ah Interim patches (1) :

Patch 20108098 : applied on Fri Jan 23 08:35:48 UTC 2015


Unique Patch ID: 18461252
Created on 20 Jan 2015, 12:04:56 hrs PST8PDT
Bugs fixed:
20108098

Rac system comprising of multiple nodes


Local node = host01
Remote node = host02
Remote node = host03

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

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

Practices for Lesson 5: Upgrading and Patching Oracle RAC


Chapter 5 - Page 16
OPatch succeeded.
[oracle@host01 20108098]$

16. When finished, close all terminal windows opened for practice.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 5: Upgrading and Patching Oracle RAC


Chapter 5 - Page 17
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 5: Upgrading and Patching Oracle RAC


Chapter 5 - Page 18
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
Practices for h a s ฺ 6:
Lesson
Managing o m ) i
Backup
u de and
a ilฺc enfor
Recovery t G RAC
@ gm tud
b d Chapter
i s S 6
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 6: Managing Backup and Recovery for RAC


Chapter 6 - Page 1
Practices for Lesson 6: Overview

Practices Overview
In this practice, you will configure ARCHIVELOG mode for your RAC database, configure
instance-specific connect strings for RMAN, and configure persistent RMAN settings.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 6: Managing Backup and Recovery for RAC


Chapter 6 - Page 2
Practice 6-1: Configuring ARCHIVELOG Mode

Overview
In this practice, you adjust initialization parameters in the SPFILE, and stop and start the ASM
instances on local and remote nodes.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

1. Open a terminal session to host01 as the oracle user and set up the environment
variables using the oraenv script for the database instance. Determine the instance
running on host01 (the local machine). Change the value of the ORACLE_SID variable to
allow local system authenticated connections.
[vncuser@classroom_pc ~] ssh oracle@host01
Password:
[oracle@host01 ~]$ . oraenv
ble
ORACLE_SID = [oracle] ? orcl
fe r a
The Oracle base has been set to /u01/app/oracle
ans
n - t r
[oracle@host01 ~]$ no
srvctl status database -db orcl
a
Instance orcl_1 is a
running on node host02
h s ฺ
Instance orcl_2 is
m )
running on node host03
o u i de
Instance orcl_3 is
ilฺc ent G
running on node host01
a
@ gm tud
[oracle@host01 ~]$ export
[oracle@host01 ~]$bir
bd this S
ORACLE_SID=orcl_3

t h ka use
( m a using tooperating system authentication to the database instance,
2. Make a localrconnection e
ns log list SQL command to determine whether the database
and thena busei theicarchive
e
l
isuin K
ARCHIVELOG l mode. Exit SQL*Plus when done.
san [oracle@host01 ~]$ sqlplus / as sysdba
Ah
SQL*Plus: Release 12.1.0.2.0 Production on Mon Jan 13 17:24:39
2014

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

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

SQL> archive log list


Database log mode No Archive Mode

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

Practices for Lesson 6: Managing Backup and Recovery for RAC


Chapter 6 - Page 3
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 80
Current log sequence 81
SQL> exit
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Disconnected from Oracle Database 12c Enterprise Edition Release


12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic
Storage Management, OLAP,
Advanced Analytics and Real Application Testing options
[oracle@host01 ~]$

3. Stop the orcl database on each node of the cluster by using the srvctl stop
ble
database command.
fe r a
[oracle@host01 ~]$ srvctl stop database -d orcl
ans
[oracle@host01 ~]$ n - t r
a no
4. Verify that the orcl database is not running on any node ofhthea sclusterฺ by using the
srvctl status database command.
o m )
u i de
c
ilฺdatabase
t G-d orcl
[oracle@host01 ~]$ srvctl status a n
de host02
Instance orcl_1 is not running
@ gm ontunode
b drunningi s S
Instance orcl_2 is not
b i r t h on node host03
Instance orcl_3ka e
t h u s
is not running on node host01
[oracle@host01
( m a ~]$to
b i r ense
l
5. Make
u Kaalocal connection
lic using operating system authentication to the local database
saninstance, and then start up the database on only the first node with the mount option.
Ah [oracle@host01 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Thu Sep 12 06:52:26


2014

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

Connected to an idle instance.

SQL> startup mount


ORACLE instance started.

Total System Global Area 1018830848 bytes


Fixed Size 2295992 bytes
Variable Size 427820872 bytes

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

Practices for Lesson 6: Managing Backup and Recovery for RAC


Chapter 6 - Page 4
Database Buffers 583008256 bytes
Redo Buffers 5705728 bytes
Database mounted.
SQL>
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

6. Issue the alter database archivelog SQL command to change the archive mode of
the database, and then verify the results by using the archive log list SQL command.
SQL> alter database archivelog;

Database altered.

SQL> archive log list


Database log mode Archive Mode ble
fe r a
Automatic archival Enabled
ans
Archive destination USE_DB_RECOVERY_FILE_DEST
n - t r
Oldest online log sequence 80
a no
Next log sequence to archive
h a s ฺ
81
Current log sequence
o m )
u
81
i de
ilฺc ent G
SQL>
a
7. Shut down the database instance with @ gm tud option and exit SQL*Plus. Use the
the immediate
b d instances
i s Son all nodes of the cluster.
i r
srvctl utility to restart the database h
k
SQL> shutdownhimmediateab se t
a t t o u
ORA-01109:
i r m
( nsedatabase not open

l K ab lice
a n u
s Database dismounted.
Ah ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release
12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic
Storage Management, OLAP,
Advanced Analytics and Real Application Testing options

[oracle@host01 ~]$ srvctl start database -d orcl


[oracle@host01 ~]$

8. Verify that the orcl database is running on all the three nodes of your cluster by using the
srvctl status database command.
[oracle@host01 ~]$ srvctl status database -d orcl
Instance orcl_1 is running on node host03
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 6: Managing Backup and Recovery for RAC


Chapter 6 - Page 5
Instance orcl_2 is running on node host02
Instance orcl_3 is running on node host01
[oracle@host01 ~]$
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 6: Managing Backup and Recovery for RAC


Chapter 6 - Page 6
Practice 6-2: Configuring RMAN and Performing Parallel Backups

Overview
In this practice, you will designate all three instances (orcl_1, orcl_2 and orcl_3) of your
policy-managed database responsible for performing parallel backups of the database. The
database will be backed up to the +FRA ASM disk group by default.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

1. Using the recovery manager utility (RMAN), connect to the orcl database as the target
database.
[oracle@host01 ~]$ rman target /

Recovery Manager: Release 12.1.0.2.0 - Production on Thu Sep 12


09:03:24 2014
ble
fe r a
Copyright (c) 1982, 2014, Oracle and/or its affiliates.
t r a ns
All

n-
rights reserved.

a no
connected to target database: ORCL (DBID=1352492209)
h a s ฺ
o m )
u i de
RMAN>
a ilฺc ent G
@ gm tud
b d
2. Display all of the current RMAN settings.
i s S
RMAN> show all; b i r t h
h k a s e
a t t o u
r m
( nse
using target
i database control file instead of recovery catalog

l K abconfiguration
RMAN
l ice parameters for database with db_unique_name

a n u ORCL are:
s
Ah
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO
'%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO
BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; #
default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; #
default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT'
OPTIMIZE FOR LOAD TRUE ; # default
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 6: Managing Backup and Recovery for RAC


Chapter 6 - Page 7
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_orcl_3.f'; #
default
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

RMAN>

3. Configure RMAN to automatically back up the control file and server parameter file each
time any backup operation is performed.
RMAN> configure controlfile autobackup on;

new RMAN configuration parameters:


ble
CONFIGURE CONTROLFILE AUTOBACKUP ON;
fe r a
new RMAN configuration parameters are successfully stored
ans
n - t r
RMAN>
a no
h a s ฺ
4. Configure channels to use automatic load balancing. Set
o m )parallelism
u i deto 3, and then
configure the connect string.
a ilฺc ent G
RMAN> CONFIGURE DEVICE TYPE
@ gm u d
disk PARALLELISM
t 3;
b d i s S
i r t h
new RMAN configuration
h k ab sparameters:
e
CONFIGURE DEVICEa t TYPEt o uDISK PARALLELISM 3 BACKUP TYPE TO
BACKUPSET;
i m
r ( configuration
se
a b e n
l
new
K RMAN
l ic parameters are successfully stored

a n u
s
Ah
RMAN> configure channel device type disk connect =
'sys/sys_password@orcl';

new RMAN configuration parameters:


CONFIGURE CHANNEL DEVICE TYPE DISK CONNECT '*';
new RMAN configuration parameters are successfully stored

RMAN>

5. Open a second terminal session as the oracle user and set up the environment variables
for the orcl database. Invoke SQL*plus as the system user, and run the
/stage/RAC/labs/less_06/monitor_rman.sql script. Do not exit the first session
with the RMAN prompt or this second session with the SQL prompt.
[oracle@host01 ~]$ . oraenv
ORACLE_SID = [oracle] ? orcl
The Oracle base has been set to /u01/app/oracle
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 6: Managing Backup and Recovery for RAC


Chapter 6 - Page 8
[oracle@host01 ~]$ export ORACLE_SID=orcl_3
[oracle@host01 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Thu Sep 12 09:16:51


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

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

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 -
64bit Production
With the Partitioning, Real Application Clusters, Automatic
ble
Storage Management, OLAP,
fe r a
Advanced Analytics and Real Application Testing options
ans
n - t r
SQL> @/stage/RAC/labs/less_06/monitor_rman.sql
a no
h a s ฺ
no rows selected
o m )
u i de
a ilฺc ent G
SQL>
@ gm tud
b d i s S
6. In the first session with the RMANi r h
b onlyeont the designated
prompt, perform a full database backup with archive
logs. The backup should h k a
happen s nodes (your first and second
a t o u
nodes) as the backup nodes.t Do not wait for this step to finish before proceeding to
i
the next step.r (m nse
l K ab backup
RMAN> l ice database plus archivelog;
a n u
s
Ah Starting backup at 09-DEC-14
current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=237 instance=orcl_1 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=38 instance=orcl_2 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=95 instance=orcl_3 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=3 sequence=62 RECID=2 STAMP=865871218
input archived log thread=1 sequence=79 RECID=5 STAMP=865877087
channel ORA_DISK_1: starting piece 1 at 09-DEC-14
channel ORA_DISK_2: starting archived log backup set
channel ORA_DISK_2: specifying archived log(s) in backup set

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

Practices for Lesson 6: Managing Backup and Recovery for RAC


Chapter 6 - Page 9
input archived log thread=2 sequence=50 RECID=1 STAMP=865871217
input archived log thread=3 sequence=63 RECID=4 STAMP=865877085
channel ORA_DISK_2: starting piece 1 at 09-DEC-14
channel ORA_DISK_3: starting archived log backup set
channel ORA_DISK_3: specifying archived log(s) in backup set
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

input archived log thread=2 sequence=51 RECID=3 STAMP=865877085


channel ORA_DISK_3: starting piece 1 at 09-DEC-14
channel ORA_DISK_1: finished piece 1 at 09-DEC-14
piece
handle=+FRA/ORCL/BACKUPSET/2014_12_09/annnf0_tag20141209t172454_
0.268.865877097 tag=TAG20141209T172454 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:18
channel ORA_DISK_2: finished piece 1 at 09-DEC-14
ble
piece
fe r a
handle=+FRA/ORCL/BACKUPSET/2014_12_09/annnf0_tag20141209t172454_
ans
0.269.865877097 tag=TAG20141209T172454 comment=NONE
n - t r
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:17 o
channel ORA_DISK_3: finished piece 1 at 09-DEC-14
s an
piece ) ha deฺ
o m ui
handle=+FRA/ORCL/BACKUPSET/2014_12_09/annnf0_tag20141209t172454_
c
a il ent G

0.270.865877103 tag=TAG20141209T172454 comment=NONE
gm tud
channel ORA_DISK_3: backup set complete, elapsed time: 00:00:15
@
b d
Finished backup at 09-DEC-14
i s S
i r h
h k ab se t
a
Starting backup u
t atto09-DEC-14
m
( nsORA_DISK_3
using rchannel
i e
b e
u Ka channel
l using lic ORA_DISK_1
a n using channel ORA_DISK_2

Ahs channel ORA_DISK_1: starting full datafile backup set


channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00003
name=+DATA/ORCL/DATAFILE/sysaux.277.864216781
channel ORA_DISK_1: starting piece 1 at 09-DEC-14
channel ORA_DISK_2: starting full datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
input datafile file number=00005
name=+DATA/ORCL/DATAFILE/example.285.864217099
input datafile file number=00007
name=+DATA/ORCL/DATAFILE/undotbs3.287.864218103
input datafile file number=00006
name=+DATA/ORCL/DATAFILE/users.279.864216961
channel ORA_DISK_2: starting piece 1 at 09-DEC-14
channel ORA_DISK_3: starting full datafile backup set
channel ORA_DISK_3: specifying datafile(s) in backup set

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

Practices for Lesson 6: Managing Backup and Recovery for RAC


Chapter 6 - Page 10
input datafile file number=00001
name=+DATA/ORCL/DATAFILE/system.278.864216867
input datafile file number=00004
name=+DATA/ORCL/DATAFILE/undotbs1.280.864216963
input datafile file number=00002
name=+DATA/ORCL/DATAFILE/undotbs2.286.864218101
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

channel ORA_DISK_3: starting piece 1 at 09-DEC-14


channel ORA_DISK_2: finished piece 1 at 09-DEC-14
piece
handle=+FRA/ORCL/BACKUPSET/2014_12_09/nnndf0_tag20141209t172516_
0.272.865877127 tag=TAG20141209T172516 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:03:52
channel ORA_DISK_3: finished piece 1 at 09-DEC-14
piece
ble
handle=+FRA/ORCL/BACKUPSET/2014_12_09/nnndf0_tag20141209t172516_
fe r a
0.273.865877129 tag=TAG20141209T172516 comment=NONE
ans
channel ORA_DISK_3: backup set complete, elapsed time: 00:04:30
n - t r
o
channel ORA_DISK_1: finished piece 1 at 09-DEC-14
s an
piece
) ha deฺ
handle=+FRA/ORCL/BACKUPSET/2014_12_09/nnndf0_tag20141209t172516_
c o m ui
il ent G

0.271.865877117 tag=TAG20141209T172516 comment=NONE
a
gm tud
channel ORA_DISK_1: backup set complete, elapsed time: 00:05:43
Finished backup at 09-DEC-14
b d @ s S
b i r t h i
Starting backupka s e
a t h at 09-DEC-14
o u
current logm t
archived
( nsORA_DISK_3
e
b
using i rchannel
e
u Ka channel
l using lic ORA_DISK_1
a n
hs
using channel ORA_DISK_2
A channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=2 sequence=52 RECID=7 STAMP=865877462
channel ORA_DISK_1: starting piece 1 at 09-DEC-14
channel ORA_DISK_2: starting archived log backup set
channel ORA_DISK_2: specifying archived log(s) in backup set
input archived log thread=3 sequence=64 RECID=8 STAMP=865877463
channel ORA_DISK_2: starting piece 1 at 09-DEC-14
channel ORA_DISK_3: starting archived log backup set
channel ORA_DISK_3: specifying archived log(s) in backup set
input archived log thread=1 sequence=80 RECID=6 STAMP=865877461
channel ORA_DISK_3: starting piece 1 at 09-DEC-14
channel ORA_DISK_1: finished piece 1 at 09-DEC-14

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

Practices for Lesson 6: Managing Backup and Recovery for RAC


Chapter 6 - Page 11
piece
handle=+FRA/ORCL/BACKUPSET/2014_12_09/annnf0_tag20141209t173104_
0.277.865877465 tag=TAG20141209T173104 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
channel ORA_DISK_2: finished piece 1 at 09-DEC-14
piece
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

handle=+FRA/ORCL/BACKUPSET/2014_12_09/annnf0_tag20141209t173104_
0.278.865877465 tag=TAG20141209T173104 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_3: finished piece 1 at 09-DEC-14
piece
handle=+FRA/ORCL/BACKUPSET/2014_12_09/annnf0_tag20141209t173104_
0.279.865877465 tag=TAG20141209T173104 comment=NONE
channel ORA_DISK_3: backup set complete, elapsed time: 00:00:01
ble
Finished backup at 09-DEC-14
fe r a
t r a ns
Starting Control File and SPFILE Autobackup at 09-DEC-14
o n -
piece
s an
comment=NONE ) ha deฺ
handle=+FRA/ORCL/AUTOBACKUP/2014_12_09/s_865877467.280.865877471

c o m uati 09-DEC-14
Finished Control File and SPFILE ฺAutobackup
a il ent G
@ gm tud
RMAN>
b d i s S
i r t h
h k ab rerun s e
7. While the backup is in
a t progress
progress,
t o u the query in the second terminal window to monitor
the RMAN backup
i r ( m se
session within the cluster. The backup should be done in
abthework
parallel, with n
distributed to all three nodes of the cluster. Enter the slash (/) symbol
K
andl press l icekey to rerun the query. It may be necessary to do this multiple times
Enter
a n u the output appears. When the backup finishes, exit SQL*Plus.
until
s
Ah SQL> /
no rows selected

SQL> /

INST_ID SID SERIAL# CONTEXT SOFAR TOTALWORK %_COMPLETE


------- ---- ---------- ------- ---------- ---------- ----------
1 237 45393 1 106494 139004 76.61
2 38 11464 1 53233 53369 99.75

SQL> /

INST_ID SID SERIAL# CONTEXT SOFAR TOTALWORK %_COMPLETE


------- ---- ---------- ------- ---------- ---------- ----------
3 95 42956 1 126 135040 .09

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

Practices for Lesson 6: Managing Backup and Recovery for RAC


Chapter 6 - Page 12
2 38 11464 1 634 169440 .37
1 237 45393 1 25086 256000 9.8

SQL> /
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

INST_ID SID SERIAL# CONTEXT SOFAR TOTALWORK %_COMPLETE


------- ---- ---------- ------- ---------- ---------- ----------
3 95 42956 1 25458 135040 18.85
2 38 11464 1 14584 169440 8.61
1 237 45393 1 32638 256000 12.75

SQL> exit

ble
[oracle@host01 ~]$
fe r a
t r a ns
8. Shut down the database using srvctl so ARCHIVELOG mode can be disabled o n - for your
RAC database.
s an
[oracle@host01 ~]$ srvctl stop database -d
) haorcl d e ฺ
[oracle@host01 ~]$ m
co t Gu i
i l
a denฺ
g m u
system tauthentication
d @
9. Make a local connection using operating
s S to the local database
b thoni only the first node with the mount option.
instance, and then start up theirdatabase
Disable ARCHIVELOG mode a bwith thee
k the archive noarchivelog statement.
t h u s alterlogdatabase
m a
Confirm this operation with
t o list statement. Shut down the database

b i r ( when
and exit SQL*Plus
e n e
sfinished.
u l Ka lic ~]$ sqlplus / as sysdba
[oracle@host01

san
Ah SQL*Plus: Release 12.1.0.2.0 Production on Thu Sep 12 12:30:00
2014

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

Connected to an idle instance.

SQL> startup mount


ORACLE instance started.

Total System Global Area 1018830848 bytes


Fixed Size 2295992 bytes
Variable Size 427820872 bytes
Database Buffers 583008256 bytes
Redo Buffers 5705728 bytes
Database mounted.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 6: Managing Backup and Recovery for RAC


Chapter 6 - Page 13
SQL> alter database noarchivelog;

Database altered.

SQL> archive log list


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

Database log mode No Archive Mode


Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 87
Current log sequence 88

SQL> shutdown immediate;


ORA-01109: database not open
ble
fe r a
ans
n - t r
no
Database dismounted.
ORACLE instance shut down.
s ฺa
SQL> exit h a
o m )
u i de
Disconnected from Oracle Database 12c Enterprise Edition Release
12.1.0.2.0 - 64bit Production
a ilฺc ent G
gm tud
With the Partitioning, Real Application Clusters, Automatic
@
Storage Management, OLAP,
b d i s S
i r h
h k ab se t
Advanced Analytics and Real Application Testing options

a t
[oracle@host01 ~]$
t o u
i m
r ( ense
b
u l Kawindows.
10. Use srvctl
terminal
lic your database. Ensure that all instances are up, and then exit all
to restart

san
Ah [oracle@host01 ~]$ srvctl start database -d orcl

[oracle@host01 ~]$ srvctl status database -d orcl


Instance orcl_1 is running on node host03
Instance orcl_2 is running on node host02
Instance orcl_3 is running on node host01
[oracle@host01 ~]$

11. Close all terminal windows opened for this practice.

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

Practices for Lesson 6: Managing Backup and Recovery for RAC


Chapter 6 - Page 14
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
Practices )for s ฺ 7:
haLesson
Global o m u i
Resource de
a ilฺc ent G Concepts
Management
@ gm tud
b d Chapter
i s S 7
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 1
Practices for Lesson 7: Overview
Practices Overview
In this practice, you will explore the dynamics of Cache Fusion, Sequences, Library Cache,
Global Enqueues, and Results Cache in an Oracle RAC environment.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 2
Practice 7-1: Buffer Cache Fusion
Overview
In this lesson, you will examine the workings of cache fusion in an Oracle RAC database.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

1. Open a terminal session on your desktop to host01 as the oracle user.


[vncuser@classsroom_pc ~]$ ssh oracle@host01
oracle@host01's password:
Last login: Wed Dec 10 17:47:14 2014 from 192.0.2.1
[oracle@host01 ~]$

2. Change the directory to /stage/RAC/labs/less_07. Set the environment and copy


/stage/RAC/labs/less_07/tnsnames.ora to file to ble
$ORACLE_HOME/network/admin on each node. Check which instance is running on fe r a
host01. ans
n - t r
[oracle@host01 ~]$ cd /stage/RAC/labs/less_07
a no
h a s ฺ
) de
[oracle@host01 less_07]$ . oraenv
ORACLE_SID = [oracle] ? orcl o m u i
The Oracle base has been set to a lฺc nt G
i/u01/app/oracle
@ gm tude
b i s S
d cp tnsnames.ora
[oracle@host01 less_07]$
i r h
k ab se t
/u01/app/oracle/product/12.1.0/dbhome_1/network/admin/tnsnames.ora
h
a t t o u
i m
r ( ensless_07]$
[oracle@host01 e ssh host02 cp
b
u Ka lic
/stage/RAC/labs/less_07/tnsnames.ora
l /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/tnsnames.ora
a n
Ahs [oracle@host01 less_07]$ ssh host03 cp
/stage/RAC/labs/less_07/tnsnames.ora
/u01/app/oracle/product/12.1.0/dbhome_1/network/admin/tnsnames.ora

[oracle@host01 less_07]$ ps -ef|grep ora_smon


oracle 12256 1 0 Dec09 ? 00:00:19 ora_smon_orcl_3
oracle 29985 28381 0 17:50 pts/1 00:00:00 grep ora_smon

[oracle@host01 less_07]$ export ORACLE_SID=orcl_3

[oracle@host01 less_07]$

3. Start SQL*Plus and verify the local instance name.


[oracle@host01 less_07]$ sqlplus / as sysdba

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 3
SQL*Plus:Release 12.1.0.2 Production on Wed Dec 10 19:22:12 2014

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

Connected to:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 -


64bit Production
With the Partitioning, Real Application Clusters, Automatic
Storage Management, OLAP,
Advanced Analytics and Real Application Testing options

SYS@orcl_3 SQL> select instance_name from v$instance;


Hit Any Key to Continue
ble
fe r a
INSTANCE_NAME
ans
----------------
n - t r
orcl_3
a no
h a s ฺ
1 row selected.
o m )
u i de
a ilฺc ent G
SYS@orcl_3 SQL>
@ gm tud
b d i s S
i r h
h k ab userseas tshown below.
4. Configure the scott database
SYS@orcl_3 a t alter
SQL>
t o uuser scott identified by tiger account
unlock; (m
b i r ense
u l Ka altered.
lic
san
User

Ah SYS@orcl_3 SQL>

5. Find the block ID and file number for the block containing the record for employee number
7521 from the SCOTT.EMP table.
SYS@orcl_3 SQL> select empno, ename,
dbms_rowid.rowid_relative_fno(rowid) fileno,
dbms_rowid.rowid_block_number(rowid) block_no
from scott.emp where empno = 7521;

Hit Any Key to Continue

EMPNO ENAME FILENO BLOCK_NO


---------- ---------- ---------- ----------
7521 WARD 6 197

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 4
1 row selected.

SYS@orcl_3 SQL>

6. Using the file and block number identified, check the status of the block in GV$BH as shown
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

below.
SYS@orcl_3 SQL> select inst_id,file#,block#,status,dirty from
gv$bh where file#=6 and block# = 197 and status !='free'
order by 1,2,3;

no rows selected

SYS@orcl_3 SQL>
ble
fe r a
ans
7. Read the record for WARD from the SCOTT.EMP table and recheck the block status in
n - t r
no
GV$BH. What do you see?

s ฺa
SYS@orcl_3 SQL> select * from scott.emp where ename = 'WARD';
h a
) de
Hit Any Key to Continue
o m u i
EMPNO ENAME JOB a ilฺc enMGR
t GHIREDATE
DEPTNO gm
SAL COMM
---------- ----------bd
tud
@ s S----------
i r ---------
t h i --------------------
---------- ----------
h k ab SALESMAN
----------
s e
a t
7521 WARD
t o u 7698 22-feb-1981 00:00:00
1250
i r (m nse
500 30
ab selected.
l 1Krow lice
a n u
Ahs SYS@orcl_3 SQL> select inst_id,file#,block#,status,dirty from
gv$bh where file#=6 and block# = 197 and status !='free'
order by 1,2,3;
Hit Any Key to Continue

INST_ID FILE# BLOCK# STATUS D


---------- ---------- ---------- ---------- -
3 6 197 scur N

1 row selected.

SYS@orcl_3 SQL>
GV$BH shows that the local instance (orcl_3) has cached the block image in SCUR
(shared current) mode.

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 5
8. Open a terminal session on your desktop to host02 as the oracle user. Change directory
to /stage/RAC/labs/less_07, check which instance is running on host02, and set
the environment.
[vncuser@classsroom_pc ~]$ ssh oracle@host02
oracle@host02's password:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Last login: Wed Dec 10 17:47:14 2014 from 192.0.2.1

[oracle@host02 ~]$ cd /stage/RAC/labs/less_07

[oracle@host02 less_07]$ ps -ef|grep ora_smon


oracle 12256 1 0 Dec09 ? 00:00:19 ora_smon_orcl_1
oracle 29985 28381 0 17:50 pts/1 00:00:00 grep ora_smon

ble
[oracle@host02 less_07]$ . oraenv
fe r a
ORACLE_SID = [oracle] ? orcl
ans
The Oracle base has been set to /u01/app/oracle n - t r
a no
[oracle@host02 less_07]$ export ORACLE_SID=orcl_1 h a s ฺ
[oracle@host02 less_07]$
o m )
u i de
a ilฺc ent G
gmfor WARD
9. On host02, start SQL*Plus, read the record
@ tud from the SCOTT.EMP table and
d S
b i rb Whatthdoisyou see?
recheck the block status in GV$BH.
a
[oracle@host02 kless_07]$
h sesqlplus / as sysdba
a t to u
( m e
SQL*Plus:
a e ns 12.1.0.2.0 Production on Mon Jan 5 14:01:26
bir icRelease
u l K
2015 l
san
Ah Copyright (c) 1982, 2014, Oracle. All rights reserved.

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

SYS@orcl_1 SQL> select * from scott.emp where ename = 'WARD';

EMPNO ENAME JOB MGR HIREDATE SAL


COMM

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 6
---------- ---------- --------- ---------- --------- ----------
----------
DEPTNO
----------
7521 WARD SALESMAN 7698 22-FEB-81 1250
500
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

30

SYS@orcl_1 SQL> select inst_id,file#,block#,status,dirty from


gv$bh where file#=6 and block# = 197 and status !='free'
order by 1,2,3;

ble
INST_ID FILE# BLOCK# STATUS D
fe r a
---------- ---------- ---------- ---------- -
ans
1 6 197 scur N
n - t r
3 6 197 scur
a no N

h a s ฺ
SYS@orcl_1 SQL>
o m )
u i de
You should see that both instance 1 (orcl_1) and
a ilฺcinstance
n t G3 (orcl_3) have cached the
block image in SCUR (shared current) mode.
@ gm tude
S
d toishost03
10. Open a terminal session on b i
yourrbdesktop
t h as the oracle user. Change the
h k a s e
a t o u
directory to /stage/RAC/labs/less_07, check which instance is running on host03,

i r ( m se t
and set the environment.

a b icen
[vncuser@classsroom_pc ~]$ ssh oracle@host03
u K l
l oracle@host03's password:
n
sa Last login: Wed Dec 10 17:57:14 2014 from 192.0.2.1
Ah
[oracle@host03 ~]$ cd /stage/RAC/labs/less_07

[oracle@host03 less_07]$ ps -ef|grep ora_smon


oracle 6889 1 0 2014 ? 00:01:04 ora_smon_orcl_2
oracle 21252 19534 0 14:25 pts/0 00:00:00 grep ora_smon

[oracle@host03 less_07]$ . oraenv


ORACLE_SID = [oracle] ? orcl
The Oracle base has been set to /u01/app/oracle

[oracle@host03 less_07]$ export ORACLE_SID=orcl_2


[oracle@host03 less_07]$

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 7
11. From host03, start SQL*Plus, read the record for WARD from the SCOTT.EMP table, and
recheck the block status in GV$BH. What do you see?
[oracle@host03 less_07]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Mon Jan 5 14:27:08


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

2015

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

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 -
64bit Production
ble
With the Partitioning, Real Application Clusters, Automatic
fe r a
Storage Management, OLAP,
ans
Advanced Analytics and Real Application Testing options
n - t r
n o
SYS@orcl_2 SQL> select * from scott.emp where a
s ename = 'WARD';
h a ฺ
Hit Any Key to Continue
o m )
u i de
a ilฺc enMGR
t GHIREDATE
EMPNO ENAME JOB
DEPTNO g
m tud
SAL COMM
b @
d--------- s S---------- --------------------
---------- ---------- i r t h i
k ab ----------
---------- ----------
h s e
7521 a t
WARD
t o uSALESMAN 7698 22-feb-1981 00:00:00
1250 r ( m 500se
bi icen
30

lK a l
a n u 1 row selected.

Ahs
SYS@orcl_2 SQL> select inst_id,file#,block#,status,dirty from
gv$bh where file#=6 and block# = 197 and status !='free'
order by 1,2,3;
Hit Any Key to Continue

INST_ID FILE# BLOCK# STATUS D


---------- ---------- ---------- ---------- -
1 6 197 scur N

2 6 197 scur N

3 6 197 scur N

3 rows selected.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 8
SYS@orcl_2 SQL>
You should see that all three instances have cached the block image in SCUR (shared
current) mode.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

12. Next, let’s engineer a read/write for the block from the instance on host01. Use the
cf_upward.sql script to do this. Recheck the block status in GV$BH. What do you see?
SYS@orcl_3 SQL> !cat cf_upward.sql
update scott.emp set sal = sal + 0 where ename = 'WARD';

SYS@orcl_3 SQL> @cf_upward.sql

1 row updated.
ble
fe r a
ans
SYS@orcl_3 SQL> commit;
n - t r
Commit complete. a no
h a s ฺ
o m )
u i de
SYS@orcl_3 SQL> select inst_id,file#,block#,status,dirty from
gv$bh where file#=6 and block# =ilฺ197 c andt status
G
m a e n !='free'
order by 1,2,3;
d @ g
S tud
Hit Any Key to Continue
b i rb this
ka use BLOCK# STATUS
INST_ID ath FILE#
m t o D
i r ( e----------
----------
b n se ---------- ---------- -

n u l Ka li1c 6 197 cr N

hs a
A 2 6 197 cr N

3 6 197 xcur Y
6 197 cr N

4 rows selected.

SYS@orcl_3 SQL>
The updating instance now holds an XCUR (exclusive current) image for the block and all
SCURs have been downgraded to CR. Note that the XCUR shows dirty. When you have a
read/write condition, existing SCURs are downgraded to CR while the updating instance will
indicate an XCUR. No other instance can have either a shared or exclusive image of the
same block.

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 9
13. Go to host02 and engineer a write/write for the block from the local instance. Use the
cf_upward.sql script to do this. Recheck the block status in GV$BH. What do you see?
SYS@orcl_1 SQL>@cf_upward.sql

1 row updated.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

SYS@orcl_1 SQL> commit;

Commit complete.

SYS@orcl_1 SQL> select inst_id,file#,block#,status,dirty from


gv$bh where file#=6 and block# = 197 and status !='free'
order by 1,2,3;
ble
Hit Any Key to Continue
fe r a
ans
INST_ID FILE# BLOCK# STATUS D n - t r
o
---------- ---------- ---------- ----------
s an -
1 6 197 xcur
) ha deฺ Y
6 197 cr
c o m ui N
6 197 cr
a il ent G
ฺ N

@ gm tud
2 6 d
b i s S cr
197 N
i r h
h k ab se t
3 t 6u
m a t o 197 pi Y

b i r ( ense 6 197 cr N

n u l Ka lic
hs a 6 rows selected.
A
SYS@orcl_1 SQL>
The updating instance (orcl_1) now holds an XCUR (exclusive current) image for the
block. The old XCUR held by instance 3 has been downgraded to a PI (past image). Note
that the XCUR and PI both show as dirty. The past image is nothing more than a copy of a
dirty block that is used by the Global Cache Service. Past images of blocks are maintained
by GCS until writes covering those versions are recorded. Past images are used in failure
recovery. Once a later image is written from any instance, the PI image is converted to CR.

14. From host01 (instance 3) issue a checkpoint. Recheck the block status in GV$BH. What do
you see?
SYS@orcl_3 SQL> alter system checkpoint;

System altered.

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 10
SYS@orcl_3 SQL> select inst_id,file#,block#,status,dirty from
gv$bh where file#=6 and block# = 197 and status !='free'
order by 1,2,3; 2 3
Hit Any Key to Continue
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

INST_ID FILE# BLOCK# STATUS D


---------- ---------- ---------- ---------- -
1 6 197 xcur N
6 197 cr N
6 197 cr N

2 6 197 cr N

ble
3 6 197 cr N
fe r a
6 197 cr N
ans
n - t r
a no
6 rows selected.
h a s ฺ
o m )
u i de
SYS@orcl_3 SQL>
a ilฺc ent G
The PI image has been converted to a CR
@ gm t Nodimages are dirty after the
image. u
d S
checkpoint.
b i rb this
a e
15. Close all terminals a thk fortothisuspractice.
opened
i r (m nse
l K ab lice
a n u
s
Ah

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 11
Practice 7-2: Row Cache Coordination for Sequences
Overview
In this practice you will examine the behavior of cached and non-cached sequences in a RAC
database and the resource coordination provided by RAC for a row cache resource.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

1. Establish an ssh connection option as the oracle user. Use oraenv to set the Oracle
environment. Change the directory to /stage/RAC/labs/less_07. Connect to instance
1 (orcl_1).
[vncuser@classsroom_pc ~]$ ssh oracle@host01
oracle@host01's password:

[oracle@host01 ~]$ . oraenv


ble
ORACLE_SID = [oracle] ? orcl
fe r a
The Oracle base has been set to /u01/app/oracle
ans
n - t r
[oracle@host01 ~]$ cd /stage/RAC/labs/less_07
a no
h a s ฺ
m )
[oracle@host01 less_07]$ sqlplus sys/sys_password@orcl_1
o u i de as sysdba

a ilฺc ent G
gm tud on Tue Jan 27 07:16:33 2015
SQL*Plus: Release 12.1.0.2.0 Production
@
b d i s S
i r t h
h k ab sOracle.
Copyright (c) 1982, 2014,
e All rights reserved.

a t t o u
Connected to:m
ir ( en12c seEnterprise Edition Release 12.1.0.2.0 - 64bit
Oracleab
u l K
Production lic
Database

sanWith the Partitioning, Real Application Clusters, Automatic Storage


Ah Management, OLAP,
Advanced Analytics and Real Application Testing options

2. Run the seq_lock_typ.sql script to view sequence lock types.


SYS@orcl_1 SQL> !cat seq_lock_typ.sql
col type for a2
col name for a20
col id1_tag for a10
col id2_tag for a10
col description for a40
select type,name,id1_tag, id2_tag,description from v$lock_type
where name like '%Sequence%';

SYS@orcl_1 SQL> @seq_lock_typ


Hit Any Key to Continue
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 12
TY NAME ID1_TAG ID2_TAG DESCRIPTION
-- ----------------- -------- ------- ----------------------------------------
SQ Sequence Cache object # 0 Lock to ensure that only one process can
replenish the sequence cache
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

SV Sequence Ordering object # 0 Lock to ensure ordered sequence allocati


on in RAC mode

2 rows selected.

SYS@orcl_1 SQL>
SQ lock is used both in RAC and single instance to single thread cache replenishment for a
specific sequence. The SV lock is used to coordinate number ordering when using RAC
ble
and the ORDERED option for a sequence.
fe r a
t r a ns
n - no cache
3. Next we will create five sequences. First, create a sequence with no order and
o
an
called rac_nocache_noorder.
SYS@orcl_1 SQL> create sequence rac_nocache_noorder s
ha deฺ
2 start with 1 increment by 1 )
m ui
c o
3 nocache noorder;
a il ent G

@ gm tud
Sequence created.
b d i s S
i r h
SYS@orcl_1 SQL>
h k ab se t
a t t o u
i m
ra (sequence e order but no cache called rac_nocache_order.
susing
b e n
Ka SQL>
4. Next, create
u l
SYS@orcl_1 lic create sequence rac_nocache_order
san 2 start with 1 increment by 1
Ah 3 nocache order;

Sequence created.

SYS@orcl_1 SQL>

5. Create a sequence using cache but no order called rac_cache_noorder.


SYS@orcl_1 SQL> create sequence rac_cache_noorder
2 start with 1 increment by 1
3 cache 50000 noorder;

Sequence created.

SYS@orcl_1 SQL>

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 13
6. Create a sequence using cache and order called rac_cache_order.
SYS@orcl_1 SQL> create sequence rac_cache_order
2 start with 1 increment by 1
3 cache 50000 order;
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Sequence created.

SYS@orcl_1 SQL>

7. Create another sequence using cache and order called rac_gap_order.


SYS@orcl_1 SQL> create sequence rac_gap_order
2 start with 1 increment by 1
ble
3 cache 50000 order;
fe r a
ans
Sequence created.
n - t r
a no
SYS@orcl_1 SQL>
h a s ฺ
o m )
u i de
a ilฺinctheedata
8. Let’s take a look at the newly created sequences
n tG dictionary using the
seq_dd.sql script.
@ gm tud
S
rbd this
SYS@orcl_1 SQL> !cat seq_dd.sql
col sequence_owner forba14 i
col sequence_namehfor
t ka a20use
( m a o
tMIN_VALUE,
select SEQUENCE_NAME,
i r s e INCREMENT_BY, CYCLE_FLAG, ORDER_FLAG,

a b icen
CACHE_SIZE, LAST_NUMBER from dba_sequences where sequence_name like
l K
'%RAC_%ORDER';
u l
san
Ah SYS@orcl_1 SQL> @seq_dd.sql
Hit Any Key to Continue

SEQUENCE_NAME MIN_VALUE INCREMENT_BY C O CACHE_SIZE LAST_NUMBER


-------------------- ---------- ------------ - - ---------- -----------
RAC_CACHE_NOORDER 1 1 N N 50000 1
RAC_CACHE_ORDER 1 1 N Y 50000 1
RAC_GAP_ORDER 1 1 N Y 50000 1
RAC_NOCACHE_NOORDER 1 1 N N 0 1
RAC_NOCACHE_ORDER 1 1 N Y 0 1

5 rows selected.

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 14
9. Now let’s look at the sequences in the row cache metadata. Use the seq_meta.sql script.
SYS@orcl_1 SQL> !cat seq_meta.sql
select inst_id,sequence_name,
active_flag,replenish_flag,wrap_flag,cycle_flag,order_flag,
min_value,nextvalue,increment_by,cache_size
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

from gv$_sequences
where sequence_name like '%RAC%'
order by inst_id,sequence_name;

SYS@orcl_1 SQL> @seq_meta


Hit Any Key to Continue

INST_ID SEQUENCE_NAME A R W C O MIN_VALUE NEXTVALUE INCREMENT_BY CACHE_SIZE


ble
------- -------------------- - - - - - --------- --------- ------------ ----------
fe r a
1 RAC_CACHE_NOORDER N N N N N 1 1 50000
ans
1 RAC_CACHE_ORDER N N Y N Y 1 1 50000
n - t r
no
1 RAC_GAP_ORDER N N Y N Y 1 1 50000
1 RAC_NOCACHE_NOORDER N N N N N 1
s ฺ a 1 0
1 RAC_NOCACHE_ORDER N N N N Y
h a
1 1 0

o m )
u i de
ilฺc ent G
5 rows selected.
a
SYS@orcl_1 SQL>
@ gm tud
b d in the i s S
i
Only Instance 1 currently has metadatar h row cache, since the sequences were
tinstance.
created there and not used
h k ainbany other
s e
a t t o u
i r
10. Let’s take a lookm
( nse
at the SV resources currently owned by LCK0 using the sv_res.sql
script. ab
l K l i ce
a n u
SYS@orcl_1 SQL> !cat sv_res.sql
s select l.inst_id,l.pid,p.program,l.resource_name2,
Ah l.owner_node,l.state,l.blocked,l.blocker
from gv$ges_enqueue l, gv$process p
where resource_name2 like '%SV%'
and p.spid = l.pid
order by 1;

SYS@orcl_1 SQL> @sv_res.sql


Hit Any Key to Continue

INST_ID PID PROGRAM RESOURCE_NAME2 OWNER_NODE STATE BLOCKED BLOCKER


------ ---- -------------------- -------------- ---------- ------- ------- -------
1 1788 oracle@host02 (LCK0) 93295,0,SV 0 GRANTED 0 0
1 1788 oracle@host02 (LCK0) 93294,0,SV 0 GRANTED 0 0

2 rows selected.

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 15
11. Determine the names for resources 93295 and 93294 (in this example).
SYS@orcl_1 SQL> col OBJECT_NAME format a20

SYS@orcl_1 SQL> select object_name, object_type from dba_objects


where object_id = 93295;
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Hit Any Key to Continue

OBJECT_NAME OBJECT_TYPE
-------------------- -----------------------
RAC_GAP_ORDER SEQUENCE

1 row selected.

ble
SYS@orcl_1 SQL> select object_name, object_type from dba_objects
fe r a
where object_id = 93294;
ans
Hit Any Key to Continue
n - t r
a no
OBJECT_NAME OBJECT_TYPE
h a s ฺ
-------------------- -----------------------
o m )
u i de
RAC_CACHE_ORDER SEQUENCE
a ilฺc ent G
@ gm tud
1 row selected.
b d i s S
i r h
SYS@orcl_1 SQL> thk
ab se t
a t o u
i m
( with ncache
rrequesting
Only sequences e and order get SV instance locks which are required to pass
sinstances.
b e
Ka
NEXTVAL
u l
to
lic
san
Ah 12. Now, let’s attempt to show gaps occurring in the RAC_GAP_ORDER sequence.
SYS@orcl_1 SQL> select rac_gap_order.nextval from dual;
Hit Any Key to Continue

NEXTVAL
----------
1

1 row selected.

*** Do it again ****

SYS@orcl_1 SQL> select rac_gap_order.nextval from dual;


Hit Any Key to Continue

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 16
NEXTVAL
----------
2

1 row selected.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

SYS@orcl_1 SQL>

13. Force a loss of the cached sequence numbers by flushing the shared pool.
SYS@orcl_1 SQL> alter system flush shared_pool;
System altered.
SYS@orcl_1 SQL>
ble
fe r a
14. Increment the RAC_GAP_ORDER sequence with cache and order again.
ans
SYS@orcl_1 SQL> select rac_gap_order.nextval from dual;
n - t r
Hit Any Key to Continue
a no
NEXTVAL
h a s ฺ
----------
o m )
u i de
50001
a ilฺc ent G
1 row selected.
@ gm tud
b d i s S
i r h
SYS@orcl_1 SQL>
h k ab se t
Note that NEXTVALaist now 50001.
t o uThis gap would occur in both single instance and RAC
databases. (m
b i r ense
u l Ka lic
sandbms_shared_pool.keep procedure. Keep the RAC_GAP_ORDER sequence to prevent
15. You must manually keep the sequence to prevent ageouts. This is done using the

Ah this condition.
SYS@orcl_1 SQL> exec dbms_shared_pool.keep('RAC_GAP_ORDER','Q');
PL/SQL procedure successfully completed.

SYS@orcl_1 SQL>

16. Increment the RAC_GAP_ORDER sequence and then flush the shared pool again. Increment
the sequence again. What do you observe?
SYS@orcl_1 SQL> select rac_gap_order.nextval from dual;
Hit Any Key to Continue

NEXTVAL
----------
50002

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 17
1 row selected.

SYS@orcl_1 SQL> alter system flush shared_pool;

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

SYS@orcl_1 SQL> select rac_gap_order.nextval from dual;


Hit Any Key to Continue

NEXTVAL
----------
50003

ble
1 row selected.
fe r a
ans
n - t r
no
SYS@orcl_1 SQL>

s ฺa
Because the sequence has been kept (for this instance), the cached values are not lost. If
h a
you are using cached sequences, you will need to initiate a keep for them when instances
o m ) i de
are restarted. In a RAC environment, the keep must be performed on all instances.
u
a ilฺc ent G
17. You can query gv$db_object_cache g tom d status of the RAC_GAP_ORDER
d @ S tuwhen
view the keep
sequence. Drop the RAC_GAP_ORDER
i r b t h i s
sequence finished. Note that it shows as kept
only in one instance. b
kaname e
SYS@orcl_1 SQL> tcol h u s
SYS@orcl_1 (SQL>
a
m col t o format a20

i r n s etype format a10


l K ab SQL>
SYS@orcl_1
l ice select name, type, kept, inst_id from
n u
gv$db_object_cache where kept = 'YES' and name like '%RAC_%';
sa
Ah NAME TYPE KEP INST_ID
-------------------- ---------- --- ----------
RAC_GAP_ORDER SEQUENCE YES 1

1 row selected.

SYS@orcl_1 SQL> drop sequence rac_gap_order;


Sequence dropped.

SYS@orcl_1 SQL>

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 18
18. Keep the remaining cached sequences. Starting with instance 1 (orcl_1) keep
RAC_CACHE_NOORDER and RAC_CACHE_ORDER.
SYS@orcl_1 SQL> exec dbms_shared_pool.keep ('RAC_CACHE_NOORDER','Q');
PL/SQL procedure successfully completed.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

SYS@orcl_1 SQL> exec dbms_shared_pool.keep ('RAC_CACHE_ORDER','Q');


PL/SQL procedure successfully completed.

SYS@orcl_1 SQL>

19. Check the keep status of the sequences using the view_obj_cache.sql script .
SYS@orcl_1 SQL> !cat view_obj_cache.sql
select inst_id, name, type, kept from gv$db_object_cache where name ble
like '%RAC_CACHE%' fe r a
ans
and type = 'SEQUENCE'
n - t r
order by 1,2; o
s an
SYS@orcl_1 SQL> @view_obj_cache
) ha deฺ
Hit Any Key to Continue
c o m ui
a il ent G

INST_ID NAME
@ gmTYPEtud KEP
d S
i
---------- --------------------
b rb this---------------- ---
t h ka use SEQUENCE
1 RAC_CACHE_NOORDER YES

( m a to
1 RAC_CACHE_ORDER SEQUENCE YES
ir ens e
a b
l
2 rows
u lic
K selected.
san
Ah 20. Now get the first value from the RAC_NOCACHE_NOORDER sequence in the first instance.
Check SQ enqueues on the first instance using the sq_enq.sql script.
SYS@orcl_1 SQL> select rac_nocache_noorder.nextval from dual;
Hit Any Key to Continue

NEXTVAL
----------
1
1 row selected.

SYS@orcl_1 SQL> !cat sq_enq.sql


select * from gv$enqueue_stat where eq_type = 'SQ' order by
inst_id;

SYS@orcl_1 SQL> @sq_enq

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 19
Hit Any Key to Continue

INST_ID EQ TOTAL_REQ# TOTAL_WAIT# SUCC_REQ# FAILED_REQ# CUM_WAIT_TIME CON_ID


------- -- ---------- ----------- ---------- ----------- ------------- ------
1 SQ 17 0 17 0 0 0
2 SQ 15 0 15 0 0 0
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

3 SQ 20 0 20 0 0 0

3 rows selected.

SYS@orcl_1 SQL>

21. Get the first value from the RAC_NOCACHE_ORDER sequence in the first instance. Check
ble
SQ enqueues on the first instance using the sq_enq.sql script.
fe r a
SYS@orcl_1 SQL> select rac_nocache_order.nextval from dual;
an s
Hit Any Key to Continue
n - t r
a no
NEXTVAL
h a s ฺ
----------
o m )
u i de
1
a ilฺc ent G
1 row selected.
@ gm tud
b d i s S
i r h
SYS@orcl_1 SQL> @sq_enq.sql
h k ab se t
a t
Hit Any Key to Continue
t o u
i m
( nse
rTOTAL_REQ#
INST_ID b
EQ
ice -----------
a-- ---------- TOTAL_WAIT# SUCC_REQ# FAILED_REQ# CUM_WAIT_TIME CON_ID
u l K
------- l ---------- ----------- ------------- ------
sa n 1 SQ 19 0 19 0 0 0
Ah 2 SQ 15 0 15 0 0 0
3 SQ 20 0 20 0 0 0

3 rows selected.

SYS@orcl_1 SQL>

22. Get the first value from the RAC_CACHE_NOORDER sequence in the first instance. Check
SQ enqueues on the first instance using the sq_enq.sql script.
SYS@orcl_1 SQL> select rac_cache_noorder.nextval from dual;
Hit Any Key to Continue

NEXTVAL
----------
1
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 20
1 row selected.

SYS@orcl_1 SQL> @sq_enq


Hit Any Key to Continue
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

INST_ID EQ TOTAL_REQ# TOTAL_WAIT# SUCC_REQ# FAILED_REQ# CUM_WAIT_TIME CON_ID


------- -- ---------- ----------- ---------- ----------- ------------- ------
1 SQ 24 0 24 0 0 0
2 SQ 16 0 16 0 0 0
3 SQ 21 0 21 0 0 0

3 rows selected.

ble
SYS@orcl_1 SQL>
fe r a
ans
23. Get the first value from the RAC_CACHE_ORDER sequence in the first instance. Check SQ
n - t r
enqueues on the first instance using the sq_enq.sql script.
a no
SYS@orcl_1 SQL> select rac_cache_order.nextval
h a sfrom ฺdual;
Hit Any Key to Continue
o m )
u i de
a ilฺc ent G
NEXTVAL
@ gm tud
----------
b d i s S
i r h
1
1 row selected. thk
ab se t
a t o u
i m
r (SQL>en@sq_enq.sql
se
a b
SYS@orcl_1
u l KAny lic
san
Hit Key to Continue

Ah INST_ID EQ TOTAL_REQ# TOTAL_WAIT# SUCC_REQ# FAILED_REQ# CUM_WAIT_TIME CON_ID


------- -- ---------- ----------- ---------- ----------- ------------- ------
1 SQ 25 0 25 0 0 0
2 SQ 16 0 16 0 0 0
3 SQ 21 0 21 0 0 0

3 rows selected.

SYS@orcl_1 SQL>

24. View the sequence data contained in the data dictionary using the seq_dd.sql script.
Compare that with the sequence metadata displayed in GV$_SEQUENCES using the
seq_meta_val.sql script.
SYS@orcl_1 SQL> @seq_dd

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 21
Hit Any Key to Continue

SEQUENCE_NAME MIN_VALUE INCREMENT_BY C O CACHE_SIZE LAST_NUMBER


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

RAC_CACHE_NOORDER 1 1 N N 50000 50001


RAC_CACHE_ORDER 1 1 N Y 50000 50001
RAC_NOCACHE_NOORDER 1 1 N N 0 2
RAC_NOCACHE_ORDER 1 1 N Y 0 2

4 rows selected.

SYS@orcl_1 SQL> !cat seq_meta_val.sql


ble
select inst_id,sequence_name,order_flag, nextvalue,cache_size from
fe r a
gv$_sequences where sequence_name like '%RAC_%ORDER'
ans
order by inst_id,sequence_name;
n - t r
n o
SYS@orcl_1 SQL> @seq_meta_val s ฺa
h a
Hit Any Key to Continue
o m )
u i de
lฺc nt GCACHE_SIZE
O aiNEXTVALUE
INST_ID SEQUENCE_NAME
gm- ----------
t u de ----------
---------- --------------------
b d @ s S
1 RAC_CACHE_NOORDER
b i r t h i N 2 50000
h k a s e
1 RAC_CACHE_ORDER
a t o u Y 2 50000

i r ( m se t
1 RAC_NOCACHE_NOORDER N 0

K a l i c en
b 1 RAC_NOCACHE_ORDER Y 0

n u l
sa 4 rows selected.
Ah
SYS@orcl_1 SQL>
In the data dictionary, the two non-cached sequences show a zero cache size as expected,
and the LAST_NUMBER column contains 2 for both of them. This represents the number
written to the data dictionary the last time it was updated for those sequences. For non-
cached sequences, each time a NEXTVAL is requested, the dictionary will be updated so
the LAST_NUMBER column shows the next value that will be allocated. In the row cache
metadata the NEXTVALUE column contains nulls for the non-cached sequences, because
no values are cached. For the cached sequences, the cache size is 50000. In the data
dictionary, the LAST_NUMBER column shows 50001 as that number is the value written to
the data dictionary for these two sequences when caching the first 50000 numbers for each
sequence in the row cache of instance 1. Notice that the NEXTVALUE column contains 2 in
the row cache metadata, as that represents the next cached number that will be allocated
for each of the cached sequences. The data dictionary will only need to be updated for
either of these sequences when cache replenishment occurs, either due to ageouts, or due
to exhausting the cached range of numbers.

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 22
25. Connect to the second instance and keep both cached sequences.
SYS@orcl_1 SQL> connect sys/sys_password@orcl_2 as sysdba
Connected.

SYS@orcl_2 SQL> exec dbms_shared_pool.keep ('RAC_CACHE_NOORDER','Q');


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

PL/SQL procedure successfully completed.

SYS@orcl_2 SQL> exec dbms_shared_pool.keep ('RAC_CACHE_ORDER','Q');

PL/SQL procedure successfully completed.

SYS@orcl_2 SQL>
ble
fe r a
ans
26. Use the view_obj_cache.sql script to view the cached sequences in the second
n - t r
instance. o
SYS@orcl_2 SQL> @view_obj_cache.sql
s an
) ha deฺ
Hit Any Key to Continue
c o m ui
INST_ID NAME a il ent G KEP
TYPE

---------- --------------------
@ gm----------------
tud ---
d s S
a b irb thiSEQUENCE
1 RAC_CACHE_NOORDER YES
e
thk to us
RAC_CACHE_ORDER SEQUENCE YES
m sea
(RAC_CACHE_NOORDER
i r
2
e n
b RAC_CACHE_ORDER SEQUENCE YES
l K a li c SEQUENCE YES
u
san
Ah
4 rows selected.

SYS@orcl_2 SQL>

27. Get the next value for the RAC_NOCACHE_NOORDER, RAC_NOCACHE_ORDER,


RAC_CACHE_NOORDER, and RAC_CACHE_ORDER sequences.
SYS@orcl_2 SQL> select rac_nocache_noorder.nextval from dual;
Hit Any Key to Continue
NEXTVAL
----------
2

1 row selected.
SYS@orcl_2 SQL> select rac_nocache_order.nextval from dual;
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 23
Hit Any Key to Continue
NEXTVAL
----------
2
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

1 row selected.

SYS@orcl_2 SQL> select rac_cache_noorder.nextval from dual;


Hit Any Key to Continue
NEXTVAL
----------
50001

ble
1 row selected.
fe r a
t r a ns
SYS@orcl_2 SQL> select rac_cache_order.nextval from dual;
o n -
Hit Any Key to Continue
s an
NEXTVAL
) ha deฺ
----------
c o m ui
2 a il ent G

@ gm tud
b d i s S
1 row selected.
i r h
h k ab se t
SYS@orcl_2 SQL> a t t o u
i m
r ( ense
b
l
28. From
u Kthea secondlicinstance, view the sequence data contained in the data dictionary using
santhe seq_dd.sql script. Compare that with the sequence metadata displayed in
Ah GV$_SEQUENCES using the seq_meta_val.sql script.
SYS@orcl_2 SQL> @seq_dd
Hit Any Key to Continue

SEQUENCE_NAME MIN_VALUE INCREMENT_BY C O CACHE_SIZE LAST_NUMBER


-------------------- ---------- ------------ - - ---------- -----------
RAC_CACHE_NOORDER 1 1 N N 50000 100001
RAC_CACHE_ORDER 1 1 N Y 50000 50001
RAC_NOCACHE_NOORDER 1 1 N N 0 3
RAC_NOCACHE_ORDER 1 1 N Y 0 3

4 rows selected.

SYS@orcl_2 SQL> @seq_meta_val


Hit Any Key to Continue
INST_ID SEQUENCE_NAME O NEXTVALUE CACHE_SIZE
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 24
---------- -------------------- - ---------- ----------
1 RAC_CACHE_NOORDER N 2 50000
RAC_CACHE_ORDER Y 2 50000
RAC_NOCACHE_NOORDER N 0
RAC_NOCACHE_ORDER Y 0
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

2 RAC_CACHE_NOORDER N 50002 50000


RAC_CACHE_ORDER Y 3 50000
RAC_NOCACHE_NOORDER N 0
RAC_NOCACHE_ORDER Y 0

8 rows selected.

ble
SYS@orcl_2 SQL>
fe r a
ans
By now you should have noticed that the non-cached sequences hit the data dictionary for
n - t r
each NEXTVAL requested while the cached sequences are not incremented in the data
o
dictionary because NEXTVAL is supplied from memory.
s an
ha deฺ
Note too that the sequence that is not ordered causes another range of 50000 numbers to
)
c o m ui
be cached in the second row cache. This is why the LAST_NUMBER column in the data
il ent G

dictionary contains 100001 for RAC_CACHE_NOORDER. The value for RAC_CACHE_ORDER
a
gm tud
remains at 50001 since all instances are in effect caching the same range of numbers. This
@
b i s S
can also be seen in the row cache metadata. RAC_CACHE_NOORDER has a NEXTVALUE of
d
i r h
2 in one instance but a NEXTVALUE of 50002 in another and no coordination is done to
k ab se t
allocate the numbers in order. RAC_CACHE_ORDER also has two different values for
h
a t t o u
NEXTVALUE having a 2 in one instance and a 3 in the other but the instance with the
i m
r ( ense
highest value in the row cache NEXTVALUE column owns the “true” next value and if
b
l Ka lic
another instance increments that sequence, the “true” next value will be passed by

a n utransferring the value in the SV lock to the requesting instance.

Ahs
29. Connect back to the first instance and get the next value for the RAC_NOCACHE_NOORDER,
RAC_NOCACHE_ORDER, .RAC_CACHE_NOORDER, and RAC_CACHE_ORDER sequences.
SYS@orcl_2 SQL> connect sys/sys_password@orcl_1 as sysdba
Connected.

SYS@orcl_1 SQL> select rac_nocache_noorder.nextval from dual;


Hit Any Key to Continue
NEXTVAL
----------
3

1 row selected.
SYS@orcl_1 SQL> select rac_nocache_order.nextval from dual;
Hit Any Key to Continue
NEXTVAL
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 25
----------
3

1 row selected.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

SYS@orcl_1 SQL> select rac_cache_noorder.nextval from dual;


Hit Any Key to Continue
NEXTVAL
----------
2

1 row selected.

ble
SYS@orcl_1 SQL> select rac_cache_order.nextval from dual;
fe r a
ans
Hit Any Key to Continue
n - t r
no
NEXTVAL
----------
s ฺa
3 h a
o m )
u i de
1 row selected. a ilฺc ent G
@ gm tud
b d i s S
SYS@orcl_1 SQL>
i r h
h k ab se t
t
30. View the sequenceadata contained
t o u in the data dictionary using the seq_dd.sql script.
i
Compare that
m
( thensequence
r with se metadata displayed in GV$_SEQUENCES using the
b e
Ka
seq_meta_val.sql
u l lic script. What are your observations?
sanSYS@orcl_1 SQL> @seq_dd.sql
Ah Hit Any Key to Continue

SEQUENCE_NAME MIN_VALUE INCREMENT_BY C O CACHE_SIZE LAST_NUMBER


-------------------- ---------- ------------ - - ---------- -----------
RAC_CACHE_NOORDER 1 1 N N 50000 100001
RAC_CACHE_ORDER 1 1 N Y 50000 50001
RAC_NOCACHE_NOORDER 1 1 N N 0 4
RAC_NOCACHE_ORDER 1 1 N Y 0 4

4 rows selected.

SYS@orcl_1 SQL> @seq_meta_val


Hit Any Key to Continue
INST_ID SEQUENCE_NAME O NEXTVALUE CACHE_SIZE
---------- -------------------- - ---------- ----------
1 RAC_CACHE_NOORDER N 3 50000
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 26
RAC_CACHE_ORDER Y 4 50000
RAC_NOCACHE_NOORDER N 0
RAC_NOCACHE_ORDER Y 0

2 RAC_CACHE_NOORDER N 50002 50000


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

RAC_CACHE_ORDER Y 3 50000
RAC_NOCACHE_NOORDER N 0
RAC_NOCACHE_ORDER Y 0

8 rows selected.

SYS@orcl_1 SQL>
The non-cached sequences update the data dictionary with each NEXTVAL, potentially ble
causing performance degradation. The best performance is usually obtained using cached fe r a
and ordered sequences.
ans
The RAC_CACHE_ORDER sequence got the correct value of 3, due to the resource n - t r
o
an
coordination provided by the SV lock. The RAC_CACHE_NOORDER sequence got the
s
ha deฺ
number 2. So the order of allocation for RAC_CACHE_ORDER was 1, 2, 3 as required. The
)
c o m ui
order of allocation for RAC_CACHE_NOORDER was 1, 50001, 2.

a il ent G

31. Drop all sequences created in this practice.
@ gm tud
SYS@orcl_1 SQL> drop sequence
b i S
d rac_nocache_noorder;
s
b i r t h
h k a s e
Sequence dropped.
a t t o u
i m
r (SQL>endrop
se sequence rac_nocache_order;
b
Ka
SYS@orcl_1
u l lic
sanSequence dropped.
Ah
SYS@orcl_1 SQL> drop sequence rac_cache_noorder;

Sequence dropped.

SYS@orcl_1 SQL> drop sequence rac_cache_order;

Sequence dropped.

SYS@orcl_1 SQL>

32. Close all terminal windows opened for this practice.

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 27
Practice 7-3: Library Cache Coordination for Procedure and Packages
Overview
In this lesson you explore the behavior of the library cache in a RAC environment.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

1. Establish an ssh connection as the oracle user. Use oraenv to set the Oracle
environment.
[vncuser@classsroom_pc ~]$ ssh oracle@host01
oracle@host01's password:

[oracle@host01 ~]$ . oraenv


ORACLE_SID = [oracle] ? orcl
The Oracle base has been set to /u01/app/oracle
ble
[oracle@host01 ~]$
fe r a
t r a ns
2. Change the directory to /stage/RAC/labs/less_07, check which instance o n - is running on
host01, and set ORACLE_SID.
s an
[oracle@host01 ~]$ cd /stage/RAC/labs/less_07
) ha deฺ
c o m ui
a ฺ
il ora_smon
n t G
[oracle@host01 less_07]$ ps -ef|grep
1 0 Dec09 g
m tud00:00:19e
oracle 12256
29985 28381 i0rb d @ ?
s S ora_smon_orcl_3
oracle
a b e thi
17:50 pts/1 00:00:00 grep ora_smon

thk to uexport
[oracle@host01aless_07]$
s
( m e
ORACLE_SID=orcl_3
[oracle@host01
a ns
bir iceless_07]$
u l K l
s3.anStart SQL*Plus and verify the SID using the show_my_sid.sql script.
Ah [oracle@host01 less_07]$ sqlplus / as sysdba

SQL*Plus:Release 12.1.0.2 Production on Wed Dec 10 19:22:12 2014

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

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

SYS@orcl_3 SQL> @show_my_sid


Hit Any Key to Continue

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 28
SID
----------
73
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

1 row selected.

SYS@orcl_3 SQL>

4. Next, create a stored procedure using the lc_demo.sql script. Take a moment and look
at the script to see what it does.
SYS@orcl_3 SQL> !cat lc_demo.sql
create or replace procedure lcdemo is ble
begin fe r a
ans
for i in 1 ..100000 loop
n - t r
dbms_lock.sleep (1);
a no
end loop;
h a s ฺ
) de
end;
o m u i
ilฺc ent G
/
SYS@orcl_3 SQL> a
@ gmcalledtulcdemo.
d
The script creates a long running procedure
d S
b i rb this
h a to compile
kscript se the lcdemo procedure, and then execute it.
5. Run the lc_demo.sql
t
a @lc_demo.sql
to u
SYS@orcl_3 (SQL> m e
a bir icens
u l K
Procedure
l
created.
san
Ah SYS@orcl_3 SQL> exec lcdemo

The session essentially hangs while it runs the lcdemo procedure.

6. Open another terminal window to host01, set the environment, change the directory to
/stage/RAC/labs/less_07 and connect to the same instance. Use the
show_my_sid.sql script to display the SID.
[vncuser@classsroom_pc ~]$ ssh oracle@host01
oracle@host01's password:

[oracle@host01 ~]$ . oraenv


ORACLE_SID = [oracle] ? orcl
The Oracle base has been set to /u01/app/oracle

[oracle@host01 ~]$ export ORACLE_SID=orcl_3


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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 29
[oracle@host01 ~]$ cd /stage/RAC/labs/less_07

[oracle@host01 less_07]$ sqlplus / as sysdba


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

SQL*Plus: Release 12.1.0.2.0 Production on Wed Jan 28 12:51:28 2015

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

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit
Production
With the Partitioning, Real Application Clusters, Automatic Storage
ble
Management, OLAP,
fe r a
Advanced Analytics and Real Application Testing options
ans
n - t r
o
SYS@orcl_3 SQL> @show_my_sid
s an
Hit Any Key to Continue
) ha deฺ
c o m ui
SID
a i l ฺ n t G
----------
@ gm tude
47
b d i s S
i r h
1 row selected. thk
ab se t
a t o u
i m
r (SQL>ense
b
Ka
SYS@orcl_3
u l lic
san
Ah 7. From the second terminal session, query V$SESSION and see what is held by the first SID.
SYS@orcl_3 SQL> select sid, event from v$session where sid = 73;
Hit Any Key to Continue

SID EVENT
---------- --------------------------------------------------------
73 PL/SQL lock timer

1 row selected.

SYS@orcl_3 SQL>

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 30
8. From the second terminal, attempt to drop the lcdemo procedure.
SYS@orcl_3 SQL> drop procedure lcdemo;

The session now hangs trying to drop the lcdemo preocedure.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

9. Now, open a third terminal window to host01. Set the environment, change the directory to
/stage/RAC/labs/less_07 and connect to the same instance. Query V$SESSION to
see what the session attempting to drop the lcdemo preocedure is waiting on.
[vncuser@classsroom_pc ~]$ ssh oracle@host01
oracle@host01's password:

[oracle@host01 ~]$ . oraenv


ORACLE_SID = [oracle] ? orcl ble
The Oracle base has been set to /u01/app/oracle fe r a
ans
n - t r
[oracle@host01 ~]$ export ORACLE_SID=orcl_3
a no
h a s ฺ
) de
[oracle@host01 ~]$ cd /stage/RAC/labs/less_07
o m u i
[oracle@host01 less_07]$ sqlplus /aias lฺcsysdba
n t G
@ gm tude
b i s S on Wed Jan 28 12:51:28
d Production
i
SQL*Plus: Release 12.1.0.2.0 r h 2015

h k ab se t
Copyright (c) a t 2014,
t o u Oracle. All rights reserved.
i m 1982,
r ( ense
b
u l Ka lic
sanConnected to:
Ah Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit
Production
With the Partitioning, Real Application Clusters, Automatic Storage
Management, OLAP,
Advanced Analytics and Real Application Testing options

SYS@orcl_3 SQL> select sid, event from v$session where sid=47;


Hit Any Key to Continue

SID EVENT
-------- ---------------------------
47 library cache pin

1 row selected.
SYS@orcl_3 SQL>

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 31
The dropping session is waiting on the library cache pin held by the first session. This
behavior is expected in a single-instance scenario as shown here.

10. Return to the second terminal session. Cancel the drop procedure lcdemo statement
by typing <Control-c>. Connect to a different instance. In this example, we will connect
to orcl_1. Use the show_my_sid.sql script to determine the session identifier.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

SYS@orcl_3 SQL> drop procedure lcdemo;


█ <Control-C>

SYS@orcl_3 SQL> connect sys/sys_password@orcl_1 as sysdba


Connected.

SYS@orcl_1 SQL> @show_my_sid


ble
fe r a
Hit Any Key to Continue
ans
n - t r
SID
a no
----------
h a s ฺ
18
o m )
u i de
a i lฺc nt G
1 row selected.
@ gm tude
b d i s S
i r h
SYS@orcl_1 SQL>
h k ab se t
a t t o u
i
11. Attempt to drop m
r ( theelcdemo
se procedure from the session connected to orcl_1. What
b n
Ka SQL>
happens?
u l lic drop procedure lcdemo;
san█
SYS@orcl_1

Ah Again, the statement hangs.

12. Go to the third terminal session and connect to orcl_1. Query V$SESSION to check what
the session attempting to drop the lcdemo preocedure is waiting on.
SYS@orcl_3 SQL> connect sys/sys_password@orcl_1 as sysdba
Connected.

SYS@orcl_1 SQL> select sid, event from v$session where sid = 18;
Hit Any Key to Continue

SID EVENT
---------- ---------------------------
18 library cache pin

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 32
1 row selected.
SYS@orcl_1 SQL>
The session connected to orcl_1 attempting to drop the lcdemo is waiting on a library
cache pin held by the session connected to orcl_3 currently executing that procedure.
This indicates that acquisition of library cache objects is coordinated in a RAC environment
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

among all instances in the cluster.

13. Close all terminals opened for this practice.

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 33
Practice 7-4: Global Enqueue Coordination
Overview
This practice will demonstrate how Global Enqueues are coordinated in an Oracle RAC
environment.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

1. Open a terminal session on your desktop to host01 as the oracle user.


[vncuser@classsroom_pc ~]$ ssh oracle@host01
oracle@host01's password:
Last login: Wed Dec 10 17:47:14 2014 from 192.0.2.1
[oracle@host01 ~]$

2. Change the directory to /stage/RAC/labs/less_07, check which instance is running on ble


host01, and set the environment.
fe r a
ans
[oracle@host01 ~]$ cd /stage/RAC/labs/less_07
n - t r
o
[oracle@host01 less_07]$ ps -ef|grep ora_smon
s an
oracle 12256 1 0 Dec09 ?
) ha deฺ
00:00:19 ora_smon_orcl_3
oracle 29985 28381 0 17:50 pts/1
c o m ui
00:00:00 grep ora_smon
a il ent G

m
[oracle@host01 less_07]$ . goraenvtud
b @
d? orclis S
ORACLE_SID = [oracle]
b i r th to /u01/app/oracle
The Oracle baseka e
th to us
has been set
a
(m nsless_07]$
i r e
a b
[oracle@host01
c e export ORACLE_SID=orcl_3
K li
ul [oracle@host01 less_07]$

h san
A 3. Start SQL*Plus and determine the SID. Run the query shown below against GV$LOCK to
show lock specifics. The query will only return rows when TYPE is TM (DML enqueue). The
query should return no rows at this stage.
[oracle@host01 less_07]$ sqlplus / as sysdba

SQL*Plus:Release 12.1.0.2 Production on Wed Dec 10 19:22:12 2014

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

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

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 34
SYS@orcl_3 SQL> select distinct sid from v$mystat;
Hit Any Key to Continue

SID
----------
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

61

1 row selected.

SYS@orcl_3 SQL> select inst_id, sid, type, id1, id2, lmode,


request, block from gv$lock where type = 'TM' order by 1,2;

no rows selected
ble
fe r a
SYS@orcl_3 SQL>
ans
n - t r
4. a no
Lock the HR.EMPLOYEES table in exclusive mode. Rerun the GV$LOCK query. The instance
h a s ฺ
ID (INST_ID) should be 3, and lock mode (LMODE) should be 6 (EXCLUSIVE). BLOCK
o m ) i de
should be 2, meaning that instances on other nodes are blocked from acquiring a lock on
u
ilฺc ent G
the object. Query DBA_OBJECTS by using the value of ID1 to verify that the results pertain
a
to the HR.EMPLOYEES table. m tud
ghr.employees
SYS@orcl_3 SQL> lock table
b d @ s S in exclusive mode;
r
bi e th i
k a
th to us
Table(s) Locked.
a
i r (m nse
b e select
Ka fromlicgv$lock
SYS@orcl_3 SQL> inst_id, sid, type, id1, id2, lmode, request,

n u l block where type = 'TM' order by 1,2;

hs a Hit Any Key to Continue


A
INST_ID SID TY ID1 ID2 LMODE REQUEST BLOCK
------- ----- -- ----- ----- ------ ------- -------
3 61 TM 92593 0 6 0 2

1 row selected.

SYS@orcl_3 SQL> col owner format a10


SYS@orcl_3 SQL> col object_name format a15
SYS@orcl_3 SQL> select owner, object_name from dba_objects where
object_id = 92593;
Hit Any Key to Continue

OWNER OBJECT_NAME
---------- ---------------
HR EMPLOYEES

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 35
1 row selected.

SYS@orcl_3 SQL>
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

5. From your desktop open a second terminal to host01 as the oracle user. Change the
directory to /stage/RAC/labs/less_07 and set the environment.
[vncuser@classsroom_pc ~]$ ssh oracle@host01
oracle@host01's password:
Last login: Wed Dec 10 17:47:27 2014 from 192.0.2.1

[oracle@host01 ~]$ cd /stage/RAC/labs/less_07

ble
[oracle@host01 less_07]$ . oraenv
fe r a
ORACLE_SID = [oracle] ? orcl
ans
n - t r
no
The Oracle base has been set to /u01/app/oracle

s ฺa
[oracle@host01 less_07]$ export ORACLE_SID=orcl_3h a
o m )
u i de
[oracle@host01 less_07]$ sqlplusilฺ/c as sysdbat G
a n
@ gm tude
b i s S on Thu Dec 11 11:20:49
d Production
SQL*Plus:Release 12.1.0.2
i r h 2014

h k ab se t
Copyright (c) a u Oracle. All rights reserved.
t 1982,to 2014,
i m
r ( ense
b
u Ka
l Connected licto:
a n Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 -
Ahs 64bit Production
With the Partitioning, Real Application Clusters, Automatic
Storage Management, OLAP,
Advanced Analytics and Real Application Testing options

SYS@orcl_3 SQL> select distinct sid from v$mystat;


Hit Any Key to Continue

SID
----------
67

1 row selected.

SYS@orcl_3 SQL>

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 36
6. From the second terminal window, attempt to lock the HR.EMPLOYEES table in exclusive
mode. What do you observe?
SYS@orcl_3 SQL> lock table hr.employees in exclusive mode;

7. Return to the first terminal window and rerun the query from step 5. What do you observe?
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

SYS@orcl_3 SQL> select inst_id, sid, type, id1, id2, lmode,


request, block from gv$lock where type = 'TM' order by 1,2;
Hit Any Key to Continue

INST_ID SID TY ID1 ID2 LMODE REQUEST BLOCK


------- ----- -- ----- ----- ------ ------- -------
3 61 TM 92593 0 6 0 1
67 TM 92593 0 0 6 0
ble
fe r a
2 rows selected. ans
n - t r
SYS@orcl_3 SQL> a no
h a s ฺ
m
8. Open another terminal window. This time connect toohost02
) i
asuthe
deoracle user. Change
the directory to /stage/RAC/labs/less_07 a lฺccheckntwhich
iand G instance is running on
de the SID.
gm andtudetermine
host02. Set the environment, start SQL*Plus,
b @
d~]$ ssh s S
[vncuser@classsroom_pc
b i r t h i oracle@host02
oracle@host02'ska
t h password:
u se
( m a to
e
bir icens~]$ cd /stage/RAC/labs/less_07
[oracle@host02
a
u l K l
san [oracle@host02 less_07]$ ps -ef|grep ora_smon
Ah oracle 12308 1 0 Dec09 ? 00:00:32 ora_smon_orcl_1
oracle 26462 26298 0 11:49 pts/0 00:00:00 grep ora_smon

[oracle@host02 less_07]$ . oraenv


ORACLE_SID = [oracle] ? orcl
The Oracle base has been set to /u01/app/oracle

[oracle@host02 less_07]$ export ORACLE_SID=orcl_1

[oracle@host02 less_07]$ sqlplus / as sysdba

SQL*Plus:Release 12.1.0.2 Production on Thu Dec 11 11:50:14 2014

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

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 37
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 -
64bit Production
With the Partitioning, Real Application Clusters, Automatic
Storage Management, OLAP,
Advanced Analytics and Real Application Testing options
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

SYS@orcl_1 SQL> select distinct sid from v$mystat;


Hit Any Key to Continue

SID
----------
75
ble
fe r a
1 row selected.
ans
n - t r
SYS@orcl_1 SQL>
a no
h a s ฺ
9. From the third terminal window (host02) attempt to lock
o m u i de
)the HR.EMPLOYEES table in
exclusive mode. What do you observe? il ฺ c t G
ma tuden in exclusive mode;
SYS@orcl_1 SQL> lock table ghr.employees

b d @ sS
10. Return to the first terminala b r
e thi the query from step 7 by entering / and
i and rerun
hkyou observe?
session
pressing Enter. What a tdo t o us
i r
SYS@orcl_3 (m SQL>n se/
b e
u l Ka Any Key
Hit lic to Continue
san
Ah INST_ID SID TY ID1 ID2 LMODE REQUEST BLOCK
------- ----- -- ----- ----- ------ ------- -------
1 75 TM 92593 0 0 6 0

3 61 TM 92593 0 6 0 1
67 TM 92593 0 0 6 0

3 rows selected.

SYS@orcl_3 SQL>

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 38
11. Open another terminal window. This time connect to host03 as the oracle user. Change
the directory to /stage/RAC/labs/less_07 and check which instance is running on
host03. Set the environment, start SQL*Plus, and determine the SID.
[vncuser@classsroom_pc ~]$ ssh oracle@host03
The authenticity of host 'host03 (192.0.2.103)' can't be
established.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

RSA key fingerprint is


e8:aa:00:2c:2e:5c:e4:d8:fe:fd:9b:3f:8c:8b:d4:0b.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'host03,192.0.2.103' (RSA) to the
list of known hosts.
oracle@host03's password:

[oracle@host03 ~]$ cd /stage/RAC/labs/less_07 ble


fe r a
ans
[oracle@host03 less_07]$ ps -ef|grep ora_smon
n - t r
o
an
oracle 18647 1 0 Dec09 ? 00:00:36 ora_smon_orcl_2
oracle 28904 28703 0 14:29 pts/0 s
00:00:00 grep ora_smon
ha deฺ
) i
[oracle@host03 less_07]$ . oraenv com u
ORACLE_SID = [oracle] ? orcl ai
l ฺ n t G
m e
The Oracle base has been@
d set
S tud
g to /u01/app/oracle
b i rb this
a
[oracle@host03 kless_07]$
h seexport ORACLE_SID=orcl_2
a t to u
( m e
bir icensless_07]$ sqlplus / as sysdba
[oracle@host03
a
n ul K l
sa SQL*Plus: Release 12.1.0.2.0 Production on Thu Dec 11 14:30:14
Ah 2014

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

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

SYS@orcl_2 SQL> select distinct sid from v$mystat;


Hit Any Key to Continue

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 39
----------
38

1 row selected.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

SYS@orcl_2 SQL>

12. From the new terminal, attempt to lock the HR.EMPLOYERES table in exclusive mode.
SYS@orcl_2 SQL> lock table hr.employees in exclusive mode;

13. Return to the first terminal window and rerun the query to view the lock status. What do you
observe?
ble
SYS@orcl_3 SQL> /
fe r a
Hit Any Key to Continue
ans
n - t r
INST_ID SID TY ID1 ID2 LMODE REQUEST BLOCK
a no
------- ----- -- ----- ----- ------ ------- -------
h a s ฺ
1 75 TM 92593 0 0 6
o m ) 0
u i de
ilฺc
0ma 0 en 6
tG
2 38 TM 92593
g t u d 0

b d @ sS
3 b i
61 TM 92593
a
r
e th0i 6 0 1
t k
67hTM 92593 us 0 0 6 0
a
(m nse t o
i r
b ice
l Ka
4 rows selected.
u l
a n
Ahs SYS@orcl_3 SQL>
Instance 3, SID 61 is holding the lock in exclusive mode (LMODE 6), blocking SID 67
(inst 3), 38 (inst 2), and SID 75 (inst 1) all requesting the lock in exclusive mode
(REQUEST 6).

14. Go to the first terminal session, (INST_ID 3, SID 61 in this example) and issue a rollback.
Query GV$LOCK when finished. What do you observe?
SYS@orcl_3 SQL> rollback;

Rollback complete.

SYS@orcl_3 SQL> select inst_id, sid, type, id1, id2, lmode,


request, block from gv$lock where type = 'TM' order by 1,2;
Hit Any Key to Continue

INST_ID SID TY ID1 ID2 LMODE REQUEST BLOCK


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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 40
------- ----- -- ----- ----- ------ ------- -------
1 75 TM 92593 0 6 0 2

2 38 TM 92593 0 0 6 0
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

3 67 TM 92593 0 0 6 0

3 rows selected.

SYS@orcl_3 SQL>
SID 75 (inst 1) holds the lock, the BLOCK value is 2, meaning the lock is not blocking
any blocked processes on the local node, but it may or may not be blocking processes
ble
on remote nodes. SID 38 (inst 2) and SID 67 (inst 3) are waiting for the lock in
fe r a
exclusive mode (LMODE 6).
ans
n - t r
o
an
15. Go to the terminal window for instance 1 (host02 in this example). Issue a rollback. When
s
ha deฺ
complete, go back to the first terminal window (host01) and query GV$LOCK again. What
)
do you see now?
c o m ui
a il ent G

SYS@orcl_1 SQL> rollback;
@ gm tud
Rollback complete.bir
bd this S
t h ka use
( m aSQL> to
b i r ense
SYS@orcl_1

u Ka
l SYS@orcl_3lic SQL> /
a n
Ahs Hit Any Key to Continue

INST_ID SID TY ID1 ID2 LMODE REQUEST BLOCK


------- ------ -- ------ ------- ----- ------- ------
2 38 TM 92593 0 6 0 2

3 67 TM 92593 0 0 6 0

2 rows selected.

SYS@orcl_3 SQL>
SID 38 (inst 1) holds the lock, the BLOCK value is 2, meaning the lock is not blocking
any blocked processes on the local node, but it may or may not be blocking processes
on remote nodes. SID 67 (inst 3) is waiting for the lock in exclusive mode (LMODE 6).

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 41
16. Go to the terminal window for instance 2 (host03 in this example). Issue a rollback. When
complete, go back to the first terminal window (host01) and query GV$LOCK again. What
do you see now?

SYS@orcl_2 SQL> rollback;


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

Rollback complete.

SYS@orcl_2 SQL>

SYS@orcl_3 SQL> /
Hit Any Key to Continue

ble
INST_ID SID TY ID1 ID2 LMODE REQUEST BLOCK
fe r a
------- ------ -- ------ ------- ----- -------
an
------s
3 67 TM 92593 0 6 n
0 - t r 2
a no
h a s ฺ
1 row selected.
o m )
u i de
a ilฺc ent G
SYS@orcl_3 SQL>
@ gm tud
SID 67 (inst 3) now holds theb d the BLOCK
i s S value is mode 2.
i r lock,
h
h k ab se t
a
17. Go to the terminal window u 3, (host01 and SID 67 in this example). Issue a
t fortoinstance
i
rollback. When
m
r (complete,
sego back to the first terminal window (host01) and query GV$LOCK
b e n
Ka do lyou
again. What
u l ic see now?
san
SYS@orcl_3 SQL> rollback;
Ah Rollback complete.

SYS@orcl_3 SQL>

### Switch terminal windows ###

SYS@orcl_3 SQL> /

no rows selected

SYS@orcl_3 SQL>

18. Close all terminals opened for this practice.

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 42
Practice 7-5: Results Cache Coordination
Overview
In this practice you will enable Results Cache for a table and examine Results Cache
coordination in an Oracle RAC database.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

1. Open a terminal session on your desktop to host01 as the oracle user.


[vncuser@classsroom_pc ~]$ ssh oracle@host01
oracle@host01's password:
Last login: Wed Dec 10 17:47:14 2014 from 192.0.2.1
[oracle@host01 ~]$

2. Change directory to /stage/RAC/labs/less_07, check which instance is running on ble


host01, and set the environment.
fe r a
ans
[oracle@host01 ~]$ cd /stage/RAC/labs/less_07
n - t r
o
[oracle@host01 less_07]$ ps -ef|grep ora_smon
s an
oracle 12256 1 0 Dec09 ?
) ha deฺ
00:00:19 ora_smon_orcl_3
oracle 29985 28381 0 17:50 pts/1
c o m ui
00:00:00 grep ora_smon
a il ent G

m
[oracle@host01 less_07]$ . goraenvtud
b @
d? orclis S
ORACLE_SID = [oracle]
b i r th to /u01/app/oracle
The Oracle baseka e
th to us
has been set
a
(m nsless_07]$
i r e
a b
[oracle@host01
c e export ORACLE_SID=orcl_3
K li
ul [oracle@host01 less_07]$

h san
A 3. Start SQL*Plus and determine the SID. Issue the SQL statement below to force result
cache creation for the HR.EMPLOYEES table. Find the object ID for the table by querying
DBA_OBJECTS.
[oracle@host01 less_07]$ sqlplus / as sysdba

SQL*Plus:Release 12.1.0.2 Production on Wed Dec 10 19:22:12 2014

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

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

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 43
SYS@orcl_3 SQL> alter table hr.employees result_cache (mode force);
Table altered.

SYS@orcl_3 SQL> select object_id from dba_objects where owner =


'HR' and object_name = 'EMPLOYEES';
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Hit Any Key to Continue

OBJECT_ID
----------
92593

1 row selected.

ble
SYS@orcl_3 SQL>
fe r a
t r a ns
o n
4. Query DBA_TABLES to confirm that a result cache has been enabled for the-EMPLOYEES
table.
s an
SYS@orcl_3 SQL> col owner format a10
) ha deฺ
SYS@orcl_3 SQL> col table_name formatma15
c o u i

SYS@orcl_3 SQL> col result_cacheil format ta15 G
a den result_cache from
SYS@orcl_3 SQL> select owner, g mtable_name,
tu
d @ s S
irb thi
dba_tables where table_name = 'EMPLOYEES';
a b
se
Hit Any Key to Continue
t h k u
a
OWNER (m TABLE_NAME
to
i r n s e RESULT_CACHE

l K ab lice--------------- ---------------
----------

a n u HR EMPLOYEES FORCE

Ahs
1 row selected.

SYS@orcl_3 SQL>

5. Let’s flush the results cache for all the three instances. Start with the instance running on
host01, then open terminal windows to host02 and host03, open a SQL*Plus
connection to the local instance, and flush the results cache for them also.
SYS@orcl_3 SQL> exec dbms_result_cache.flush;

PL/SQL procedure successfully completed.

SYS@orcl_3 SQL>

[vncuser@classsroom_pc ~]$ ssh oracle@host02


oracle@host02's password:
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 44
Last login: Wed Dec 10 17:47:14 2014 from 192.0.2.1

[oracle@host02 ~]$ ps -ef|grep ora_smon


oracle 5033 4984 0 07:12 pts/0 00:00:00 grep ora_smon
oracle 18647 1 0 Dec09 ? 00:03:03 ora_smon_orcl_1
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

[oracle@host02 ~]$ cd /stage/RAC/labs/less_07

[oracle@host02 less_07]$ . oraenv


ORACLE_SID = [oracle] ? orcl
The Oracle base has been set to /u01/app/oracle

[oracle@host02 less_07]$ export ORACLE_SID=orcl_1


ble
fe r a
[oracle@host02 less_07]$ sqlplus / as sysdba ans
n - t r
o
an
SQL*Plus:Release 12.1.0.2 Production on Tue Dec 16 07:23:31 2014
s
...
) ha deฺ
c o m ui
a il ent G

SYS@orcl_1 SQL> exec dbms_result_cache.flush;

@ gm tud
b d i s S
i r
PL/SQL procedure successfully
h completed.

h k ab se t
SYS@orcl_1 a t
SQL>
t o u
i m
r ( ense
b
n u l Ka lic
hs a [vncuser@classsroom_pc ~]$ ssh oracle@host03
A oracle@host03's password:
Last login: Wed Dec 10 17:47:14 2014 from 192.0.2.1

[oracle@host03 ~]$ ps -ef|grep ora_smon


oracle 5033 4984 0 07:12 pts/0 00:00:00 grep ora_smon
oracle 18647 1 0 Dec09 ? 00:03:03 ora_smon_orcl_2

[oracle@host03 ~]$ cd /stage/RAC/labs/less_07

[oracle@host03 less_07]$ . oraenv


ORACLE_SID = [oracle] ? orcl
The Oracle base has been set to /u01/app/oracle

[oracle@host03 less_07]$ export ORACLE_SID=orcl_2

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 45
[oracle@host03 less_07]$ sqlplus / as sysdba

SQL*Plus:Release 12.1.0.2 Production on Tue Dec 16 07:23:31 2014


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

SYS@orcl_2 SQL> exec dbms_result_cache.flush;

PL/SQL procedure successfully completed.

SYS@orcl_2 SQL>

6. Return to the host01 terminal and query GV$_RESULT_CACHE_STATISTICS and check


initial results cache statistics for all three instances. Take note of the values for BLOCK
ble
COUNT CURRENT, CREATE COUNT SUCCESS, and GLOBAL HIT COUNT.
fe r a
ans
SYS@orcl_3 SQL> select inst_id, name, value from
gv$result_cache_statistics order by 1,2; n - t r
Hit Any Key to Continue a no
h a s ฺ
INST_ID NAME
o m ) VALUE
u i de
a ilฺc ent G----------------------
---------- ------------------------------
1 Block Count Current
@ gm tud 0
d is S
b irb (Bytes)
Block Count
BlockaSize
Maximum
t h
3872

h k s e
u Failure
1024
a t
Create
t o
Count 0
i m
r ( eCreatese Count Success
b n 0

n u l Ka lic Delete Count Invalid 0

hs a Delete Count Valid 0


A Find Copy Count
Find Count
0
0
Global Hit Count 0
Global Miss Count 0
Hash Chain Length 0
Invalidation Count 0
Latch (Share) 0
Result Size Maximum (Blocks) 193

2 Block Count Current 0


Block Count Maximum 3872
Block Size (Bytes) 1024
Create Count Failure 0
Create Count Success 0
Delete Count Invalid 0

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 46
Delete Count Valid 0
Find Copy Count 0
Find Count 0
Global Hit Count 0
Global Miss Count 0
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Hash Chain Length 0


Invalidation Count 0
Latch (Share) 0
Result Size Maximum (Blocks) 193

3 Block Count Current 0


Block Count Maximum 3872
Block Size (Bytes) 1024
ble
Create Count Failure 0
fe r a
ans
Create Count Success 0
n - t r
Delete Count Invalid 0
o
Delete Count Valid
s an 0
Find Copy Count
) ha deฺ 0
3 Find Count
c o m ui 0
Global Hit Count a il ent G
ฺ 0
Global Miss Count
@ gm tud 0
b d i s S
i r
Hash Chain Length
h 0
k ab se t
Invalidation Count
h
0
a t t o
Latch (Share)u 0
i m
r ( enseResult Size Maximum (Blocks) 193
b
n u l Ka lic
hs a
7. From the host01 terminal, populate the results cache.
A SYS@orcl_3 SQL> set autotrace traceonly

SYS@orcl_3 SQL> select * from hr.employees;


Hit Any Key to Continue

107 rows selected.

Execution Plan
----------------------------------------------------------

Plan hash value: 1445457117


----------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes| Cost (%CPU)| Time |
----------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 107| 7383 | 3 (0)| 00:00:01 |
| 1 | RESULT CACHE |afz18h8m8pm02td181yj8 | | | | |

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 47
| 2 | TABLE ACCESS FULL| EMPLOYEES | 107 | 7383 | 3 (0)| 00:00:01 |
----------------------------------------------------------------------------------------

Result Cache Information (identified by operation id):


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

1 - column-count=11; dependencies=(HR.EMPLOYEES);
name="select * from hr.employees"

Statistics
----------------------------------------------------------
75 recursive calls
ble
0 db block gets
fe r a
189 consistent gets
ans
19 physical reads
n - t r
0 redo size
a no
10121 bytes sent via SQL*Net to client
h a s ฺ
628 bytes received via SQL*Net from client
o m )
u i de
ilฺc ent G
9 SQL*Net roundtrips to/from client
a
gm tud
5 sorts (memory)
0 sorts (disk)
b d @ s S
i r h i
ab se t
107 rows processed
h k u
t set tautotrace
SYS@orcl_3 m a
( SQL>nse
SQL> o off
i r
l K ab icphysical
SYS@orcl_3
the value lfor
e
n u
Note reads and the step for the result cache in the explain plan.
sa
Ah 8. Again, query GV$_RESULT_CACHE_STATISTICS and re-check results cache statistics for
all the three instances.
SYS@orcl_3 SQL> select inst_id, name, value from
gv$result_cache_statistics order by 1,2;
Hit Any Key to Continue

INST_ID NAME VALUE


---------- ------------------------------ ----------------------
1 Block Count Current 0
Block Count Maximum 3872
Block Size (Bytes) 1024
Create Count Failure 0
Create Count Success 0
Delete Count Invalid 0
Delete Count Valid 0

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 48
Find Copy Count 0
Find Count 0
Global Hit Count 0
Global Miss Count 0
Hash Chain Length 0
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Invalidation Count 0
Latch (Share) 0
Result Size Maximum (Blocks) 193

2 Block Count Current 0


Block Count Maximum 3872
Block Size (Bytes) 1024
Create Count Failure 0
ble
Create Count Success 0
fe r a
ans
Delete Count Invalid 0
n - t r
Delete Count Valid 0
o
Find Copy Count
s an 0
Find Count
) ha deฺ 0
Global Hit Count
c o m ui 0
Global Miss Count a il ent G
ฺ 0
Hash Chain Length
@ gm tud 0
b d i s S
i r
Invalidation Count
h 0
k ab se t
Latch (Share)
h
0
a t t o u
Result Size Maximum (Blocks) 193
i m
r ( ense
b
n u l Ka li3c Block Count Current 32

hs a Block Count Maximum 3872


A Block Size (Bytes) 1024
Create Count Failure 0
Create Count Success 1
Delete Count Invalid 0
Delete Count Valid 0
Find Copy Count 0
Find Count 0
Global Hit Count 0
Global Miss Count 0
Hash Chain Length 1
Invalidation Count 0
Latch (Share) 0
Result Size Maximum (Blocks) 193

SYS@orcl_3 SQL>

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 49
Note that Create Count Success for the local instance (orcl_3) has been incremented by
one, indicating results cache creation.

9. Rerun the query from the previous step.


SYS@orcl_3 SQL> set autotrace traceonly
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

SYS@orcl_3 SQL> select * from hr.employees;


Hit Any Key to Continue
107 rows selected.

Execution Plan
----------------------------------------------------------
Plan hash value: 1445457117
ble
fe r a
----------------------------------------------------------------------------------------
ans
|Id | Operation | Name |Rows |Bytes|Cost (%CPU)| Time |
n - t r
no
----------------------------------------------------------------------------------------
a
| 0 | SELECT STATEMENT
| 1 | RESULT CACHE
|
| afz18h8m8pm02td181yj8 |
h | s ฺ
| 107 | 7383|
a |
3 (0)| 00:00:01 |
| |
| 2 | TABLE ACCESS FULL| EMPLOYEES
o m u i de 3 (0)| 00:00:01 |
| ) 107| 7383|

ilฺc ent G
----------------------------------------------------------------------------------------
a
Result Cache Information@ gm tud by operation id):
b d i s S
(identified
i r t h
ab sedependencies=(HR.EMPLOYEES);
------------------------------------------------------
h k u
t * fromto hr.employees"
1 - column-count=11;
name="select
m a
b i r ( ense
u Ka
l Statistics lic
a n
hs
----------------------------------------------------------
A 0 recursive calls
0 db block gets
0 consistent gets
0 physical reads
0 redo size
10121 bytes sent via SQL*Net to client
628 bytes received via SQL*Net from client
9 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
107 rows processed

SYS@orcl_3 SQL> set autotrace off


SYS@orcl_3 SQL>

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 50
Note that the explain plan is the same as in the previous step (including result cache
identifier) but that there are no db block gets, consistent gets, or physical reads, indicating
the results cache was used.

10. Again, query GV$_RESULT_CACHE_STATISTICS from the host01 (instance 3) terminal


session and re-check results cache statistics for all three instances. What do you see?
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

SYS@orcl_3 SQL> select inst_id, name, value from


gv$result_cache_statistics order by 1,2;
Hit Any Key to Continue

INST_ID NAME VALUE


---------- ------------------------------ ----------------------
1 Block Count Current 0
ble
Block Count Maximum 3872
fe r a
Block Size (Bytes) 1024
ans
Create Count Failure 0
n - t r
o
an
Create Count Success 0
Delete Count Invalid s
ha deฺ
0
Delete Count Valid )
m ui 0
c o
Find Copy Count
a il ent G
ฺ 0

gm tud
Find Count 0
Global Hit Count
b d @ s S 0
i r h i
ab se t
Global Miss Count 0

t h k
Hash Chain Length
u 0
m a t o
r ( ense
Invalidation Count 0
b i
l Ka
Latch (Share) 0
u lic
Result Size Maximum (Blocks) 193
a n
Ahs 2 Block Count Current 0
Block Count Maximum 3872
Block Size (Bytes) 1024
Create Count Failure 0
Create Count Success 0
Delete Count Invalid 0
Delete Count Valid 0
Find Copy Count 0
Find Count 0
Global Hit Count 0
Global Miss Count 0
Hash Chain Length 0
Invalidation Count 0
Latch (Share) 0
Result Size Maximum (Blocks) 193
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 51
3 Block Count Current 32
Block Count Maximum 3872
Block Size (Bytes) 1024
Create Count Failure 0
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Create Count Success 1


Delete Count Invalid 0
Delete Count Valid 0
Find Copy Count 0
Find Count 1
Global Hit Count 0
Global Miss Count 0
Hash Chain Length 1
ble
Invalidation Count 0
fe r a
ans
Latch (Share) 0
n - t r
no
Result Size Maximum (Blocks) 193
a
s ฺ
SYS@orcl_3 SQL> h a
) by 1idande that block counts
o m u
ilฺc hit.ent G
Note that the find count for instance 3 has been incremented
have not been incremented indicating a resultacache

@ gm tud
b d by updating
11. Next, let’s invalidate the resultsrcache i s S the EMPLOYEES table.
i t
b hr.employeesh
SYS@orcl_3 SQL>ka update s e set salary = salary + 0;
a t h u
( m e to
107 b
a ir updated.
rows
c e ns
u l K li
san SYS@orcl_3 SQL> commit;
Ah
Commit complete.

SYS@orcl_3 SQL>

12. Set autotrace as shown below and repeat the EMPLOYEES query. What do you observe?
SYS@orcl_3 SQL> set autotrace traceonly

SYS@orcl_3 SQL> select * from hr.employees;


Hit Any Key to Continue

107 rows selected.

Execution Plan
----------------------------------------------------------
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 52
Plan hash value: 1445457117

----------------------------------------------------------------------------------------
|Id | Operation | Name | Rows | Bytes| Cost (%CPU)| Time |
----------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 107 | 7383 | 3 (0 | 00:00:01 |
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

| 1 | RESULT CACHE | afz18h8m8pm02td181yj8 | | | | |


| 2 | TABLE ACCESS FULL| EMPLOYEES | 107 | 7383 | 3 (0)| 00:00:01 |
----------------------------------------------------------------------------------------
Result Cache Information (identified by operation id):
------------------------------------------------------

1 - column-count=11; dependencies=(HR.EMPLOYEES);
name="select * from hr.employees"
ble
Statistics fe r a
ans
----------------------------------------------------------
n - t r
0 recursive calls o
0 db block gets
s an
15 consistent gets
) ha deฺ
0 physical reads
c o m ui
0 redo size a il ent G

gm tud
10121 bytes sent via SQL*Net to client
@
b d i s S
i r
628 bytes received via SQL*Net from client
h
k ab se t
9 SQL*Net roundtrips to/from client
h
a t t o
0 sorts (memory) u
i m
r ( ense
b 0 sorts (disk)

n u l Ka lic
107 rows processed

hs a
A SYS@orcl_3 SQL>
The result cache entry for this statement has been repopulated. This is apparent from the
execution plan as consistent gets has been incremented and is now 15.

13. Again, query GV$_RESULT_CACHE_STATISTICS from the host01 (instance 3) terminal


session and re-check results cache statistics for all three instances. What do you see?
SYS@orcl_3 SQL> set autotrace off

SYS@orcl_3 SQL> select inst_id, name, value from


gv$result_cache_statistics order by 1,2;
Hit Any Key to Continue

INST_ID NAME VALUE


---------- ------------------------------ ----------------------------
1 Block Count Current 0
Block Count Maximum 3872

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 53
Block Size (Bytes) 1024
Create Count Failure 0
Create Count Success 0
Delete Count Invalid 0
Delete Count Valid 0
Find Copy Count 0
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Find Count 0
Global Hit Count 0
Global Miss Count 0
Hash Chain Length 0
Invalidation Count 0
Latch (Share) 0
Result Size Maximum (Blocks) 193

ble
2 Block Count Current 0
fe r a
Block Count Maximum 3872
ans
Block Size (Bytes) 1024
n - t r
o
Create Count Failure
s an 0
Create Count Success
) ha deฺ 0
Delete Count Invalid
c o m ui 0
Delete Count Valid
a il ent G
ฺ 0
Find Copy Count
@ gm tud 0
Find Count
b d i s S 0
i r h
ab se t
Global Hit Count 0

t h k
Global Miss Count
u 0

m a t o
Hash Chain Length 0

b i r ( ense
Invalidation Count 0

n u l Ka lic Latch (Share) 0

hs a Result Size Maximum (Blocks) 193

A 3 Block Count Current 32


Block Count Maximum 3872
Block Size (Bytes) 1024
Create Count Failure 0
Create Count Success 2
Delete Count Invalid 0
Delete Count Valid 0
Find Copy Count 0
3 Find Count 1
Global Hit Count 0
Global Miss Count 0
Hash Chain Length 1
Invalidation Count 1
Latch (Share) 0
Result Size Maximum (Blocks) 193
45 rows selected.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 54
SYS@orcl_3 SQL>
Scanning down to instance 3, we can see that Create Count Success has been
incremented by 1 and is now 2 as a new results cache has been created, and
Invalidation Count is now 1 caused by the committed update to the table.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

14. Rerun the EMPLOYEES query and see if the newly cached results will be used.
SYS@orcl_3 SQL> set autotrace traceonly

SYS@orcl_3 SQL> select * from hr.employees;


Hit Any Key to Continue

107 rows selected.


ble
fe r a
Execution Plan
ans
---------------------------------------------------------- n - t r
Plan hash value: 1445457117 a no
h a s ฺ
o m )
u i de
----------------------------------------------------------------------------------------
|Id | Operation | Name
a ilฺc ent G Cost (%CPU)| Time |
| Rows | Bytes|

gm tud| 107 | 7383 | 3 (0)| 00:00:01 |


----------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT|
@ S | |
| 1 | RESULT CACHE
| 2 |TABLE ACCESS FULL| b i rbd this
| afz18h8bm8pm02td181yj8n4 | | |

ka use
EMPLOYEES | 107 | 7383 | 3 (0)| 00:00:01 |

t h
----------------------------------------------------------------------------------------
a
( m e to
bir Cache e s
nInformation
K a
Result
l i c (identified by operation id):
l ------------------------------------------------------
a n u
Ahs 1 - column-count=11; dependencies=(HR.EMPLOYEES);
name="select * from hr.employees"

Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
0 consistent gets
0 physical reads
0 redo size
10121 bytes sent via SQL*Net to client
628 bytes received via SQL*Net from client
9 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 55
107 rows processed

SYS@orcl_3 SQL>
From the statistics, we can see that no reads or block gets are performed. Looking at the
explain plan shows us that the newly cached results were used instead.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

15. Again, query GV$_RESULT_CACHE_STATISTICS from the host01 (instance 3) terminal


session and re-check results cache statistics for all three instances. What do you see?
SYS@orcl_3 SQL> set autotrace off

SYS@orcl_3 SQL> select inst_id, name, value from


gv$result_cache_statistics order by 1,2;
Hit Any Key to Continue
ble
fe r a
INST_ID NAME VALUE
ans
---------- ------------------------------ n - t r
----------------------
o
1 Block Count Current
s an 0
Block Count Maximum
) ha deฺ 3872
Block Size (Bytes)
c o m ui 1024
Create Count Failure
a il ent G
ฺ 0
Create Count Success
@ gm tud 0
b d
Delete Count Invalid
i s S 0
i r h
h k ab se t
Delete Count Valid 0
a t t o
Find Copy Count u 0

i m
r ( ense
Find Count 0
b
l Ka lic
Global Hit Count 0

a n u Global Miss Count 0

Ahs Hash Chain Length 0


Invalidation Count 0
Latch (Share) 0
Result Size Maximum (Blocks) 193

2 Block Count Current 0


Block Count Maximum 3872
Block Size (Bytes) 1024
Create Count Failure 0
Create Count Success 0
Delete Count Invalid 0
Delete Count Valid 0
Find Copy Count 0
Find Count 0
Global Hit Count 0
Global Miss Count 0
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 56
Hash Chain Length 0
Invalidation Count 0
Latch (Share) 0
Result Size Maximum (Blocks) 193
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

3 Block Count Current 32


Block Count Maximum 3872
Block Size (Bytes) 1024
Create Count Failure 0
Create Count Success 2
Delete Count Invalid 0
Delete Count Valid 0
Find Copy Count 0
ble
Find Count 2
fe r a
ans
Global Hit Count 0
n - t r
no
Global Miss Count 0
Hash Chain Length
s ฺa 1
Invalidation Count h a 1
Latch (Share) o m )
u i de 0
Result Size Maximum (Blocks) a ilฺc ent G 193
45 rows selected.
@ gm tud
b d i s S
SYS@orcl_3 SQL> ab
i r t h
h k s e
u 3, we can see that it has been incremented from 1 to
a t undertinstance
o
m
Looking at Find Count
2, indicatingira (result cache
se hit.
b e n
u l Ka lic
s16.anNext, go to the terminal window for instance 1 and query the EMPLOYEES table. Look at the
Ah explain plan. What do you see?
SYS@orcl_1 SQL> set autotrace traceonly

SYS@orcl_1 SQL> select * from hr.employees;

107 rows selected.

Execution Plan
----------------------------------------------------------
Plan hash value: 1445457117

----------------------------------------------------------------------------------------
|Id| Operation | Name |Rows |Bytes|Cost (%CPU)| Time |
----------------------------------------------------------------------------------------
|0| SELECT STATEMENT | | 107 |7383 | 3 (0)| 00:00:01 |
|1| RESULT CACHE | afz18h8bm8pm02td181yj8udn4 | | | | |
|2| TABLE ACCESS FULL| EMPLOYEES | 107 |7383 | 3 (0)| 00:00:01 |
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 57
----------------------------------------------------------------------------------------

Result Cache Information (identified by operation id):


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

1 - column-count=11; dependencies=(HR.EMPLOYEES);
name="select * from hr.employees"

Statistics
----------------------------------------------------------
189 recursive calls
0 db block gets
ble
290 consistent gets
fe r a
12 physical reads
ans
0 redo size
n - t r
10121 bytes sent via SQL*Net to client
a no
628 bytes received via SQL*Net from client
h a s ฺ
9 SQL*Net roundtrips to/from client
o m )
u i de
9 sorts (memory)
a ilฺc ent G
0 sorts (disk)
@ gm tud
107 rows processed
b d i s S
i r h
h k ab se t
SYS@orcl_1 SQL>
a t t o u
m
ir ( we
From the statistics sesee that I/O is being performed and the local result cache entry
can
is built. ab e n
u l K lic
s17.anAgain, query GV$_RESULT_CACHE_STATISTICS from the host01 (instance 3) terminal
Ah session and re-check results cache statistics for all three instances. You can do this by
entering “/” and then pressing Enter. What do you see?
SYS@orcl_3 SQL> /
Hit Any Key to Continue

INST_ID NAME VALUE


---------- ------------------------------ ----------------------
1 Block Count Current 32
Block Count Maximum 3872
Block Size (Bytes) 1024
Create Count Failure 0
Create Count Success 1
Delete Count Invalid 0
Delete Count Valid 0
Find Copy Count 0
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 58
Find Count 0
Global Hit Count 1
Global Miss Count 0
Hash Chain Length 1
Invalidation Count 0
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Latch (Share) 0
Result Size Maximum (Blocks) 193

2 Block Count Current 0


Block Count Maximum 3872
Block Size (Bytes) 1024
Create Count Failure 0
Create Count Success 0
ble
Delete Count Invalid 0
fe r a
ans
Delete Count Valid 0
n - t r
Find Copy Count 0
o
Find Count
s an 0
Global Hit Count
) ha deฺ 0
Global Miss Count
c o m ui 0
Hash Chain Length a il ent G
ฺ 0
Invalidation Count
@ gm tud 0
b d i s S
Latch (Share)
i r h 0
k ab se t
Result Size Maximum (Blocks)
h
193
a t t o u
i m
r ( 3 eBlockse Count Current
a b c n 32

u lK li Block Count Maximum 3872


a n Block Size (Bytes) 1024
Ahs Create Count Failure 0
Create Count Success 2
Delete Count Invalid 0
Delete Count Valid 0
Find Copy Count 0
Find Count 2
Global Hit Count 0
Global Miss Count 0
Hash Chain Length 1
Invalidation Count 1
Latch (Share) 0
Result Size Maximum (Blocks) 193
45 rows selected.

SYS@orcl_3 SQL>

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 59
Looking at the statistics for instance 1, we can see that the Global Hit Count has been
incremented by 1.

18. Now, update the EMPLOYEES table on instance 1 and commit. When the commit is
complete, rerun the EMPLOYEES query. What do you see?
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

SYS@orcl_1 SQL> set autotrace off

SYS@orcl_1 SQL> update hr.employees set salary = salary + 0;

107 rows updated.

SYS@orcl_1 SQL> commit;

ble
Commit complete.
fe r a
ans
SYS@orcl_1 SQL> set autotrace traceonly n - t r
a no
SYS@orcl_1 SQL> select * from hr.employees;
h a s ฺ
o m )
u i de
107 rows selected.
a ilฺc ent G
@ gm tud
Execution Plan b d i s S
i r h
h k ab se t
----------------------------------------------------------
a
Plan hash value: t 1445457117
t o u
i m
r ( ense
b
u KaOperation lic
----------------------------------------------------------------------------------------
l |Id|
a n | Name |Rows|Bytes |Cost (%CPU)| Time |

hs
----------------------------------------------------------------------------------------

A |0 | SELECT STATEMENT |
|1 | RESULT CACHE
|107 |7383 |
| afz18h8bm8pm02td181yj8udn4 | | |
3 (0)| 00:00:01 |
| |
|2 | TABLE ACCESS FULL| EMPLOYEES |107 |7383 | 3 (0)| 00:00:01 |
----------------------------------------------------------------------------------------

Result Cache Information (identified by operation id):


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

1 - column-count=11; dependencies=(HR.EMPLOYEES);
name="select * from hr.employees"

Statistics
----------------------------------------------------------
4 recursive calls
0 db block gets

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 60
15 consistent gets
0 physical reads
0 redo size
10121 bytes sent via SQL*Net to client
628 bytes received via SQL*Net from client
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

9 SQL*Net roundtrips to/from client


0 sorts (memory)
Looking at the statistics, you can see that there are no db block gets or physical reads and
the explain plan shows the local results cache entry for instance 1.

19. Again, query GV$_RESULT_CACHE_STATISTICS from the host01 (instance 3) terminal


session and re-check results cache statistics. You can do this by entering “/” and then
pressing Enter. What do you see?
ble
SYS@orcl_3 SQL> /
fe r a
Hit Any Key to Continue
ans
n - t r
o
INST_ID NAME
s an VALUE
---------- ------------------------------
) ha deฺ ----------------------
1 Block Count Current
c o m ui 32
Block Count Maximum
a il ent G
ฺ 3872
Block Size (Bytes)
@ gm tud 1024
b d
Create Count Failure
i s S 0
i r h
h k ab se t
Create Count Success 2
a t t o u
Delete Count Invalid 0
i m
r ( ense
Delete Count Valid 0
b
l Ka lic
Find Copy Count 0

a n u Find Count 0

Ahs Global Hit Count 1


Global Miss Count 1
Hash Chain Length 1
Invalidation Count 1
Latch (Share) 0
Result Size Maximum (Blocks) 193

2 Block Count Current 0


Block Count Maximum 3872
Block Size (Bytes) 1024
Create Count Failure 0
Create Count Success 0
Delete Count Invalid 0
Delete Count Valid 0
Find Copy Count 0
Find Count 0
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 61
Global Hit Count 0
Global Miss Count 0
Hash Chain Length 0
Invalidation Count 0
Latch (Share) 0
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Result Size Maximum (Blocks) 193

3 Block Count Current 32


Block Count Maximum 3872
Block Size (Bytes) 1024
Create Count Failure 0
Create Count Success 2
Delete Count Invalid 0
ble
Delete Count Valid 0
fe r a
ans
Find Copy Count 0
n - t r
no
Find Count 2
Global Hit Count
s ฺa 0
Global Miss Count h a 0
Hash Chain Length o m )
u i de 1
Invalidation Count a ilฺc ent G 2
Latch (Share)
@ gm tud 0
b d i s S
i r
Result Size Maximum (Blocks)
h 193
k
45 rows selected.
h ab se t
a t t o u
i m
r ( eSQL> se
SYS@orcl_3
b n
l Ka Count
Invalidation
u licand Create Count Success for instance 1 has been incremented.
san
Invalidation Count for instance 3 has also been incremented. There are two instances
Ah caching EMPLOYEES query results.

20. Go to the third instance (orcl_2 in this example) and query the EMPLOYEES table.
SYS@orcl_2 SQL> set autotrace traceonly
SYS@orcl_2 SQL> select * from hr.employees;

107 rows selected.

Execution Plan
----------------------------------------------------------
Plan hash value: 1445457117

----------------------------------------------------------------------------------------
|Id |Operation | Name |Rows |Bytes |Cost (%CPU)| Time |
----------------------------------------------------------------------------------------

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 62
| 0 | SELECT STATEMENT | | 107 | 7383 | 3 (0)| 00:00:01 |
| 1 | RESULT CACHE |afz18h8bm8pm02td181yj8udn4 | | | | |
| 2 | TABLE ACCESS FULL| EMPLOYEES | 107 | 7383 | 3 (0)| 00:00:01 |
----------------------------------------------------------------------------------------

Result Cache Information (identified by operation id):


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

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

1 - column-count=11; dependencies=(HR.EMPLOYEES);
name="select * from hr.employees"

Statistics
----------------------------------------------------------
ble
212 recursive calls
fe r a
0 db block gets
ans
n - t r
315 consistent gets
o
17 physical reads
s an
0 redo size
) ha deฺ
10121 bytes sent via SQL*Net to client
c o m ui
a il ent G

629 bytes received via SQL*Net from client
gm tud
9 SQL*Net roundtrips to/from client
@
b d i s S
9 sorts (memory)
i r h
k ab se t
0 sorts (disk)
h
a t t o
107 rows processed u
i m
r ( ense
b
Ka
l SYS@orcl_2 lic SQL>
u the explain plan we can see that the results cache entry has been created for
a nFrom
Ahs instance 2.
21. Query GV$_RESULT_CACHE_STATISTICS from the host01 (instance 3) terminal session
and re-check results cache statistics. What do you see?
SYS@orcl_3 SQL> /
Hit Any Key to Continue

INST_ID NAME VALUE


---------- ------------------------------ ----------------------
1 Block Count Current 32
Block Count Maximum 3872
Block Size (Bytes) 1024
Create Count Failure 0
Create Count Success 2
Delete Count Invalid 0

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 63
Delete Count Valid 0
Find Copy Count 0
Find Count 0
Global Hit Count 1
Global Miss Count 1
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Hash Chain Length 1


Invalidation Count 1
Latch (Share) 0
Result Size Maximum (Blocks) 193

2 Block Count Current 32


Block Count Maximum 3872
Block Size (Bytes) 1024
ble
Create Count Failure 0
fe r a
Create Count Success 1
ans
Delete Count Invalid 0 n - t r
o
Delete Count Valid
s an 0
Find Copy Count
) ha deฺ 0
Find Count
c o m ui 0
Global Hit Count
a il ent G
ฺ 1
Global Miss Count
@ gm tud 0
b d
Hash Chain Length
i s S 1
i r h
h k ab se t
Invalidation Count 0
a t t o
Latch (Share) u 0

i m
r ( enseResult Size Maximum (Blocks) 193
b
n u l Ka li3c Block Count Current 32
hs a Block Count Maximum 3872
A Block Size (Bytes) 1024
Create Count Failure 0
Create Count Success 2
Delete Count Invalid 0
Delete Count Valid 0
Find Copy Count 0
Find Count 2
Global Hit Count 0
Global Miss Count 0
Hash Chain Length 1
Invalidation Count 2
Latch (Share) 0
Result Size Maximum (Blocks) 193

SYS@orcl_3 SQL>
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 64
Looking at instance 2 statistics we can see that Create Count Success and Global
Hit Count have been incremented from 0 to 1.

22. Rerun the EMPLOYEES query on instance 2. What do you observe?


SYS@orcl_2 SQL> /
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

107 rows selected.

Execution Plan
----------------------------------------------------------
Plan hash value: 1445457117

----------------------------------------------------------------------------------------
ble
| Id | Operation
Time |
| Name | Rows | Bytes | Cost (%CPU)|

fe r a
----------------------------------------------------------------------------------------
ans
|0 |SELECT STATEMENT | | 107 | 7383 | 3
n - t r
(0)| 00:00:01 |
|1 | RESULT CACHE | afz18h8bm8pm02td181yj8udn4 |
|2 | TABLE ACCESS FULL| EMPLOYEES a
|
no
| 107 | 7383 |
|
3 (0)| 00:00:01 |
| |

h a s ฺ
----------------------------------------------------------------------------------------

o m )
u i de
Result Cache Information (identified
a ilฺc ebyntoperation
G id):
gm tud
------------------------------------------------------
@
b i s S
d dependencies=(HR.EMPLOYEES);
i r t h
name="select * kfrom
h ab hr.employees"
1 - column-count=11;
s e
a t t o u
i m
r ( ense
b
Statistics

u Ka lic
l ----------------------------------------------------------
a n
hs
0 recursive calls
A 0 db block gets
0 consistent gets
0 physical reads
0 redo size
10121 bytes sent via SQL*Net to client
629 bytes received via SQL*Net from client
9 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
107 rows processed

SYS@orcl_2 SQL>
The explain plan shows that the instance 2 local result cache entry was used. The statistics
section confirms this.

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 65
23. Query GV$_RESULT_CACHE_STATISTICS from the host01 (instance 3) terminal session
and re-check results cache statistics. What do you see?
SYS@orcl_3 SQL> /
Hit Any Key to Continue
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

INST_ID NAME VALUE


---------- ------------------------------ ----------------------
1 Block Count Current 32
Block Count Maximum 3872
Block Size (Bytes) 1024
Create Count Failure 0
Create Count Success 2
Delete Count Invalid 0
ble
Delete Count Valid 0
fe r a
Find Copy Count 0
ans
Find Count 0 n - t r
o
Global Hit Count
s an 1
Global Miss Count
) ha deฺ 1
Hash Chain Length
c o m ui 1
Invalidation Count
a il ent G
ฺ 1
Latch (Share)
@ gm tud 0
b d i s S
i r
Result Size Maximum (Blocks)
h
193

h k ab se t
2a t Count
Block
t o u Current 32
i m
r ( eBlockse Count Maximum 3872
b n
n u l Ka lic Block Size (Bytes) 1024

hs a Create Count Failure 0

A Create Count Success


Delete Count Invalid
1
0
Delete Count Valid 0
Find Copy Count 0
Find Count 1
Global Hit Count 1
Global Miss Count 0
Hash Chain Length 1
Invalidation Count 0
Latch (Share) 0
Result Size Maximum (Blocks) 193

3 Block Count Current 32


Block Count Maximum 3872
Block Size (Bytes) 1024

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 66
Create Count Failure 0
Create Count Success 2
Delete Count Invalid 0
Delete Count Valid 0
Find Copy Count 0
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Find Count 2
Global Hit Count 0
Global Miss Count 0
Hash Chain Length 1
Invalidation Count 2
Latch (Share) 0
Result Size Maximum (Blocks) 193
45 rows selected.
ble
fe r a
SYS@orcl_3 SQL>
t r a ns
o
Looking at the instance 2 statistics, you can see that the Find Count is nown -
1. Now, all three
instances have results cached for the same table.
s an
) ha deฺ
24. Next, update the EMPLOYEES table from instance 2 and
c o mcommit.ui
SYS@orcl_2 SQL> update hr.employees a ฺ t G = salary + 0;
il setensalary
@ gm tud
107 rows updated. irbd i s S
ab se t h
h k
t commit; u
SYS@orcl_2 a t o
i m SQL>
r ( ense
b
u l Ka complete.
Commit lic
san
Ah SYS@orcl_2 SQL>

25. Next, query the result cache stats again. What do you observe?
SYS@orcl_3 SQL> /
Hit Any Key to Continue

INST_ID NAME VALUE


---------- ------------------------------ ----------------------
1 Block Count Current 32
Block Count Maximum 3872
Block Size (Bytes) 1024
Create Count Failure 0
Create Count Success 2
Delete Count Invalid 0
Delete Count Valid 0
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 67
Find Copy Count 0
Find Count 0
Global Hit Count 1
Global Miss Count 1
Hash Chain Length 1
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Invalidation Count 2
Latch (Share) 0
Result Size Maximum (Blocks) 193

2 Block Count Current 32


Block Count Maximum 3872
Block Size (Bytes) 1024
Create Count Failure 0
ble
Create Count Success 1
fe r a
ans
Delete Count Invalid 0
n - t r
Delete Count Valid 0
o
Find Copy Count
s an 0
Find Count
) ha deฺ 1
Global Hit Count
c o m ui 1
Global Miss Count a il ent G
ฺ 0
Hash Chain Length
@ gm tud 1
b d i s S
i r
Invalidation Count
h 1
k ab se t
Latch (Share)
h
0
a t t o u
Result Size Maximum (Blocks) 193
i m
r ( ense
b
n u l Ka li3c Block Count Current 32

hs a Block Count Maximum 3872


A Block Size (Bytes) 1024
Create Count Failure 0
Create Count Success 2
Delete Count Invalid 0
Delete Count Valid 0
Find Copy Count 0
Find Count 2
Global Hit Count 0
Global Miss Count 0
Hash Chain Length 1
Invalidation Count 2
Latch (Share) 0
Result Size Maximum (Blocks) 193

SYS@orcl_3 SQL>

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 68
Note that Invalidation Count has been incremented by 1 for all instances, demonstrating
global results cache invalidation coordination handled by the result cache background
process, RCBG.

26. To finish, return the EMPLOYEES table result_cache mode back to DEFAULT.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

SYS@orcl_3 SQL> alter table hr.employees result_cache (mode


default);

SYS@orcl_3 SQL>

27. Close all terminals opened for this practice.

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 69
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 7: Global Resource Management Concepts


Chapter 7 - Page 70
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
Practices for h a s ฺ 8: RAC
Lesson
Database o m ) i de and
Monitoring
u
a
Tuningilฺc ent G
@ gm tud
b d Chapter
i s S 8
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 8: RAC Database Monitoring and Tuning


Chapter 8 - Page 1
Practices for Lesson 8: Overview

Practices Overview
This practice is designed to show you how to discover performance problems in your RAC
environment. In this practice, you identify performance issues by using EM Express, and fix
issues in three different steps. At each step, you will generate the same workload to make sure
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

that you are making progress in your resolution.

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 8: RAC Database Monitoring and Tuning


Chapter 8 - Page 2
Practice 8-1: ADDM and RAC Part I

Overview
The goal of this practice is to show you how to manually discover performance issues by using
the EM Express performance pages as well as ADDM. This first part generates a workload that
uses a bad RAC application design.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Note that all the necessary scripts for this practice are located in the
/stage/RAC/labs/less_08 directory.

1. Connect to your first node as the oracle user. Be sure to use the –X option. Set up your
environment variables by using the oraenv script. Determine that the Oracle instance is
running on host01. You will need this information throughout these practices.
[vncuser@classroom_pc ~]$ ssh -X oracle@host01
ble
oracle@host01's password:
fe r a
[oracle@host01 ~]$ . oraenv
ans
ORACLE_SID = [oracle] ? orcl
n - t r
The Oracle base has been set to /u01/app/oracle
a no
[oracle@host01 ~]$ ps -ef|grep ora_smon) h
as eฺ
c o u id grep ora_smon
m 00:00:00
oracle 18660 3459 0 17:25 pts/3 ฺ t G
a? il den00:01:06
oracle 31630 1 0 Jan13
g m t u
ora_smon_orcl_3
[oracle@host01 ~]$
b d @ sS
a b i r
e thi
t
2. Execute the setupseq1.sh
a hk oscript usfrom the/stage/RAC/labs/less_08 directory to set
(m nse
up the necessary t
configuration for this practice.
i r
l K ab lice ~]$ cd /stage/RAC/labs/less_08
[oracle@host01

a n u
s
Ah
[oracle@host01 less_08]$ ./setupseq1.sh

PL/SQL procedure successfully completed.

PL/SQL procedure successfully completed.

drop user jmw cascade


*
ERROR at line 1:
ORA-01918: user 'JMW' does not exist

drop tablespace seq including contents and datafiles


*
ERROR at line 1:
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 8: RAC Database Monitoring and Tuning


Chapter 8 - Page 3
ORA-00959: tablespace 'SEQ' does not exist

Tablespace created.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

User created.

Grant succeeded.

drop sequence s
ble
*
fe r a
ans
ERROR at line 1:
n - t r
ORA-02289: sequence does not exist
o
s an
) ha deฺ
drop table s purge
c o m ui
* a il ent G

ERROR at line 1:
@ gm tud
b S exist
d doesisnot
ORA-00942: table or view
i r h
h k ab se t
a t t o u
m
( tnspurge
drop irtable e
b e
n u l Ka lic *
hs a ERROR at line 1:
A ORA-00942: table or view does not exist

Table created.

Table created.

Index created.

1 row created.

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

Practices for Lesson 8: RAC Database Monitoring and Tuning


Chapter 8 - Page 4
Commit complete.

PL/SQL procedure successfully completed.


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

[oracle@host01 less_08]$

3. From the Oracle window, start a browser and enter the following address:
https://host01:5500/em
Add a security exception, if prompted, and log in to EM Express as sys/sys_password.
Make sure the connection is as SYSDBA.
[oracle@host01 less_08]$ firefox&
ble
[1] 32419
fe r a
[oracle@host01 less_08]$
ans
n - t r
4. Use PL/SQL to create a new AWR snapshot. a no
h a s ฺ
) de
[oracle@host01 less_08]$ ./create_snapshot.sh
o m u i
PL/SQL procedure successfully a ilฺc ent G
completed.

@ gm tud
b d i s S
[oracle@host01 less_08]$
i r h
h k ab se t
5. Open a second m a t to host01
terminal t o u as the oracle user. Change the directory to
b i r ( ense Execute the lockinfo.sh script. This script allows you to
/stage/RAC/labs/less_08.
view K
l a locklicontention
global c issues. Your output should show no transactions for JMW.
u
san [vncuser@classroom_pc ~]$ ssh oracle@host01
Ah oracle@host01's password:

[oracle@host01 ~]$ cd /stage/RAC/labs/less_08

[oracle@host01 less_08]$ ./lockinfo.sh

SQL*Plus: Release 12.1.0.2.0 Production on Mon Sep 16 14:46:21


2014

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

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 -
64bit Production

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

Practices for Lesson 8: RAC Database Monitoring and Tuning


Chapter 8 - Page 5
With the Partitioning, Real Application Clusters, Automatic
Storage Management, OLAP,
Advanced Analytics and Real Application Testing options

SQL>
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Sess Op Sys OBJ NAME or


ID USERNAME User ID TERMINAL TRANS_ID TY Lock Mode Req Mode
---- -------- ------- -------- ------------ -- ----------- -----------
37 SYS oracle Trans-3 PS Share
44 SYS oracle Trans-2 PS Share
73 SYS oracle ORA$BASE AE Share
73 SYS oracle Trans-1 PS Share
73 SYS oracle Trans-2 PS Share
73 SYS oracle Trans-3 PS Share ble
75 SYS oracle pts/1 ORA$BASE AE Share
fe r a
ans
79 SYS oracle pts/0 ORA$BASE AE Share
n - t r
SQL> Disconnected from Oracle Database 12c Enterprise Edition a no
Release 12.1.0.2.0 - 64bit Production
h a s ฺ
m )
With the Partitioning, Real Application Clusters, Automatic
o u i de
Storage Management, OLAP,
a ilฺc ent G
gm tud
Advanced Analytics and Real Application Testing options
@
[oracle@host01 less_08]$
b d i s S
i r h
h k ab se t
6. From the first oracle
a t terminal,
t o u the startseq1.sh script to generate a workload
execute
on host01 and
i r m
( nse
host02. Do not wait; proceed with the next step.

l K ab lice less_08]$ ./startseq1.sh


[oracle@host01

sa nu
Ah
INSTANCE_NAME
----------------
orcl_3

INSTANCE_NAME
----------------
orcl_2

[oracle@host01 less_08]$
PL/SQL procedure successfully completed.

PL/SQL procedure successfully completed.

[oracle@host01 less_08]$

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

Practices for Lesson 8: RAC Database Monitoring and Tuning


Chapter 8 - Page 6
7. From the second terminal, execute the lockinfo.sh script again to view information
regarding possible lock contention. You can also select Blocking Sessions from the Cluster
Database Performance pull-down menu. You may have to refresh several times to see a
lock contention for transactions belonging to JMW.
[oracle@host01 less_08]$ ./lockinfo.sh
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

SQL*Plus: Release 12.1.0.2.0 Production on Mon Sep 16 15:09:45


2014

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

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 -
64bit Production
ble
With the Partitioning, Real Application Clusters, Automatic
fe r a
Storage Management, OLAP,
ans
Advanced Analytics and Real Application Testing options n - t r
a no
SQL>
OBJ NAME or ) h
as eฺ
Sess Op Sys
c o m TY Lock
u id Mode Req Mode
ID USERNAME User ID TERMINAL TRANS_ID
ฺ G
ail dent-- ----------- -----------
m
---- -------- ------- -------- ------------
g ORA$BASE
tu
37 SYS oracle
oracle b d @ s S AE Share
37 SYS
b i r t h iTrans-1 PS Share
37 SYS
t h ka use Trans-3
oracle PS Share
37 SYS
m a t
oracle o Trans-2 PS Share

i
59 JMW
b r ( enoracle se ORA$BASE AE Share

l K a
59 JMW
l i c oracle S TM --Waiting-- Exclusive

nu 66 SYS oracle Trans-3 PS Share


sa
Ah
67 SYS oracle Trans-1 PS Share
75 SYS oracle pts/1 ORA$BASE AE Share
79 SYS oracle pts/0 ORA$BASE AE Share
81 SYS oracle Trans-2 PS Share
84 SYS ORA$BASE AE Share
86 JMW oracle S TM --Waiting-- Exclusive
86 JMW oracle ORA$BASE AE Share

14 rows selected.

SQL> Disconnected from Oracle Database 12c Enterprise Edition


Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic
Storage Management, OLAP,
Advanced Analytics and Real Application Testing options
[oracle@host01 less_08]$

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

Practices for Lesson 8: RAC Database Monitoring and Tuning


Chapter 8 - Page 7
8. While the scripts are still executing, look at the Average Active Sessions graphic. Then, drill
down to the Cluster wait class for the first node. What are your conclusions?
1) Click Performance, and then Performance Hub.
2) From there you can now see the Active Sessions graph in the bottom left corner. Make
sure that Auto Refresh is set to 15 Seconds. After a few seconds, the graphic should
clearly show that the Cluster and Application wait classes are causing most waits.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

3) Click the Workload tab. In the Workload Profile graph, place the cursor over the
Transactions line at the current time on the timeline. Transactions should be around
120-140 per second.
4) Click the RAC tab and scroll down to the Instances summary.
5) Looking at the Active Sessions column, you should see that the number of active
sessions on host01 and host02 are similar. Click the instance running on host01
(orcl_3 in this example). This takes you to the Performance Hub for the orcl_3 page.
6) Click the Activity tab, look under the SQL ID column, and then click the SQL identifier
ble
that uses most of the resources. This takes you to the SQL Details page for the
fe r a
corresponding statement. The SQL text should be LOCK TABLE S IN EXCLUSIVE
ans
MODE, and the user should be JMW. Click the Back button to return to the
Performance Hub for the orcl_3 page. n - t r
a no
Under the User Session column, click the User Session ID with the highest activity. The
h a s ฺ
User Name should be JMW. Beneath the Monitored SQL section, drill down on the
o m ) i de
SQL ID under the ID column. You will see that the script running on the first instance is
u
ilฺc ent G
executing a SELECT/UPDATE statement on table S that causes most of the Cluster
a
gm tud
waits. (Place the cursor over the SQL Text to see the entire SQL statement.)
@
b i s S
By using EM Express, you can quickly identify the top waiting SQL statements and the top
d
i r h
waiting sessions on both instances. Here it appears that a SELECT or UPDATE statement on
k ab se t
table S is causing most of the waits for the Cluster wait class.
h
a t t o u
i m
r ( eClick sePerformance, then Performance Hub, and then click the RAC tab.
9. Using EMbExpress,
ata
n
LookK
u l licCache Blocks Received graph. What are your conclusions?
the Global

san1) The Global Cache Blocks Received graph clearly shows that there are a lot of blocks
Ah transferred per second on the system. You should see cumulative transfer rates (both
CR and current blocks) in excess of 500 blocks per second.

10. After the workload finishes, use PL/SQL to create a new AWR snapshot.
[oracle@host01 less_08]$ ./create_snapshot.sh

PL/SQL procedure successfully completed.

[oracle@host01 less_08]$

11. Using EM Express, review the latest ADDM run. What are your conclusions?
1) Click Performance, then Performance Hub, and then click the ADDM tab.
2) Find the link for the latest ADDM task under ADDM Tasks and click it. This takes you to
the Automatic Database Diagnostic Monitor (ADDM) page.

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

Practices for Lesson 8: RAC Database Monitoring and Tuning


Chapter 8 - Page 8
3) On the Automatic Database Diagnostic Monitor (ADDM) page, the ADDM Tasks
section shows you the consolidation of ADDM reports from all instances running in
your cluster. This is your first entry point before drilling down to specific instances.
From there, investigate the Top SQL Statements, Table Locks, and Global Cache
Messaging findings.
4) Click the Top SQL Statements finding, which affects all instances, revealing LOCK
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

TABLE, SELECT, and UPDATE commands on table JMW.S as possible problems to


investigate. Click the Back button to return to the ADDM report.
5) Click the Table Locks finding, which affects all instances, revealing that you should
investigate your application logic regarding the JMW.S object.
6) Click the Back button to return to the ADDM report. Click the Global Cache Messaging
finding revealing either the UPDATE S or SELECT command as responsible for
significant amount of Cluster waits during the analysis period. Click the Back button.
7) You now have the possibility to drill down to each instance using the links located in
the DB Time Breakdown By Instance table. Click the link corresponding to the most ble
affected instance.
fe r a
8) On the corresponding Automatic Database Diagnostic Monitor page, you should ans
retrieve similar top findings seen previously at the cluster level. n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 8: RAC Database Monitoring and Tuning


Chapter 8 - Page 9
Practice 8-2: ADDM and RAC Part II

Overview
The goal of this practice is to show you how to manually discover performance issues by using
the EM Express performance pages as well as ADDM. In this second part of the practice, you
are going to correct the previously found issue by creating a sequence number instead of by
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

using a table.
Note that all the necessary scripts for this practice are located in the
/stage/RAC/labs/less_08 directory.

1. Execute the setupseq2.sh script to create the necessary objects used for the rest of this
practice.
[oracle@host01 less_08]$ ./setupseq2.sh
ble
fe r a
PL/SQL procedure successfully completed.
ans
n - t r
o
PL/SQL procedure successfully completed. s an
) ha deฺ
c o m ui
a il ent G

gm tud
User dropped.

b d @ s S
i r h i
h k ab se t
Tablespace dropped.
a t t o u
i m
r ( ense
b
Ka
ul Tablespace lic created.
sa n
Ah
User created.

Grant succeeded.

drop table s purge


*
ERROR at line 1:
ORA-00942: table or view does not exist

drop sequence s
*
ERROR at line 1:

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

Practices for Lesson 8: RAC Database Monitoring and Tuning


Chapter 8 - Page 10
ORA-02289: sequence does not exist

drop table t purge


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

ERROR at line 1:
ORA-00942: table or view does not exist

Table created.

ble
Index created.
fe r a
ans
n - t r
Sequence created. a no
h a s ฺ
o m )
u i de
PL/SQL procedure successfully a ilฺc ent G
completed.

@ gm tud
b d i s S
[oracle@host01 less_08]$
i r h
h k ab se t
2. Using EM Express,aand t connected
t o u as the SYS user, navigate to the Performance page of
m
( nse
your ClusterirDatabase.
b ice and then Performance Hub. Make sure 15 Seconds Refresh is
a Performance,
K
1) Click
l l
u selected from the Auto Refresh drop-down list.
s a n
Ah 3. Use PL/SQL to create a new AWR snapshot.
[oracle@host01 less_08]$ ./create_snapshot.sh

PL/SQL procedure successfully completed.

[oracle@host01 less_08]$

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

Practices for Lesson 8: RAC Database Monitoring and Tuning


Chapter 8 - Page 11
4. Execute the startseq2.sh script to generate a workload on the instances running on
host01 and host02. Do not wait; proceed with the next step.
[oracle@host01 less_08]$ ./startseq2.sh

… Do not wait after this point and go to the next step.


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

PL/SQL procedure successfully completed.

PL/SQL procedure successfully completed


[oracle@host01 less_08]$

5. While the scripts are still executing, look at the Active Sessions graphic. View the workload.
What are your conclusions?
ble
1) Click Performance, and then Performance Hub.
fe r a
2) From there you can now see the Average Active Sessions graph. Make sure 15 ans
Seconds Refresh is selected from the Auto Refresh drop-down list. After a few n - t r
o
waits. s an
seconds, the graphic will clearly show that the Cluster wait classes are causing most

3) Click the RAC tab. ) ha deฺ


c o m ui
il ent G

4) On the Instances table, you should see that the number of active sessions is similar on
a
host01 and host02. Click the first instance’s link, orcl_3 in this case (on host01).
gm tud
This takes you to the Performance Hub for the orcl_3 page.
@
b d i s S
i r
5) On the Active Sessions graph, you can see the most significant wait events causing
h
h k ab se t
most of the waits in the Cluster wait class on the first instance. Click the Activity tab,
a t t o u
then click the SQL identifier under the SQL ID column that uses most of the resources.
m
r ( ense
This takes you to the SQL Details page for the corresponding statement. You will see
i
b
that the script running on the first instance is executing an INSERT statement on table

n u l Ka lic
T that causes most of the Cluster waits.

hs a 6) Click Performance, then Performance Hub, and then the Workload tab. Make sure 15
A Seconds Refresh is selected from the Auto Refresh drop-down list. In the Workload
Profile graph, place the cursor over the Transactions line at the current time on the
timeline. Transactions should be in excess of 175 per second.
7) Click Performance, and then Performance Hub. After a while you can see that all
transactions are executed by looking at the Active Sessions graph again. Check the
Oracle terminal window where the workload was started. You should see two “PL/SQL
procedure successfully completed.” messages, indicating the workload has finished.

6. After the workload finishes, use PL/SQL to create a new AWR snapshot.
[oracle@host01 less_08]$ ./create_snapshot.sh

PL/SQL procedure successfully completed.

[oracle@host01 less_08]$

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

Practices for Lesson 8: RAC Database Monitoring and Tuning


Chapter 8 - Page 12
7. Using EM Express, review the latest ADDM run. What are your conclusions?
1) Click Performance, then Performance Hub, and then the ADDM tab.
2) Find the link for the latest ADDM task under ADDM Tasks and click it. This takes you to
the Automatic Database Diagnostic Monitor (ADDM) page.
3) On the Automatic Database Diagnostic Monitor (ADDM) page, the Findings section
shows you the consolidation of ADDM reports from all instances running in your
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

cluster. This is your first entry point before drilling down to specific instances. From
there, investigate the Top SQL Statements, Sequence Usage, and Unusual
“Concurrency” Wait Event findings.
4) The Top SQL Statements should reveal an INSERT INTO T command using
sequence S as a possible problem to investigate. Click the Back button to return to the
ADDM report.
5) Click Sequence Usage. The Sequence Usage finding reveals that you should use a
larger cache size for your hot sequences. Click the Back button to return to the ADDM
ble
report.
fe r a
6) Click Unusual “Concurrency” Wait Event. The Unusual “Concurrency” Wait Event
ans
finding asks you to investigate the cause for high “row cache lock” waits. Refer to the
n - t r
Oracle Database Reference for the description of this wait event. Click the Back button.
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 8: RAC Database Monitoring and Tuning


Chapter 8 - Page 13
Practice 8-3: ADDM and RAC Part III

Overview
The goal of this practice is to show you how to manually discover performance issues by using
the EM Express performance pages as well as ADDM. This last part generates the same
workload as in the previous practice, but uses more cache entries for sequence number S.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Note that all the necessary scripts for this practice are located in the
/stage/RAC/labs/less_08 directory.

1. Execute the setupseq3.sh script to create the necessary objects used for the rest of this
practice.
[oracle@host01 less_08]$ ./setupseq3.sh

ble
PL/SQL procedure successfully completed.
fe r a
ans
n - t r
o
an
PL/SQL procedure successfully completed.
s
ha deฺ
)
m ui
c o
User dropped.
a il ent G

@ gm tud
b d i s S
i r h
Tablespace dropped.
h k ab se t
a t t o u
i m
r ( ecreated.
se
b n
l Ka
Tablespace
u lic
a n
Ahs User created.

Grant succeeded.

drop table s purge


*
ERROR at line 1:
ORA-00942: table or view does not exist

drop sequence s
*
ERROR at line 1:
ORA-02289: sequence does not exist
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 8: RAC Database Monitoring and Tuning


Chapter 8 - Page 14
drop table t purge
*
ERROR at line 1:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ORA-00942: table or view does not exist

Table created.

Index created.
ble
fe r a
ans
n - t r
Sequence created.
o
s an
) ha deฺ
PL/SQL procedure successfully completed.
c o m ui
a il ent G

[oracle@host01 less_08]$ gm
d @ S tud
b i rb this
2. Use PL/SQL to create ak
h a AWRssnapshot.
new e
t
a less_08]$
to u
i r ( m
[oracle@host01
s e ./create_snapshot.sh

a b icen
u l K
PL/SQL l
procedure successfully completed.
san
Ah [oracle@host01 less_08]$

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

Practices for Lesson 8: RAC Database Monitoring and Tuning


Chapter 8 - Page 15
3. Execute the startseq2.sh script to generate the same workload on both instances of
your cluster as for the previous practice. Do not wait, and proceed with the next step.
[oracle@host01 less_08]$ ./startseq2.sh
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

PL/SQL procedure successfully completed.

PL/SQL procedure successfully completed.

[oracle@host01 less_08]$

4. Until the scripts are executed, look at the Active Sessions graphic. What are your
ble
conclusions?
fe r a
1) Click Performance, and then Performance Hub. Make sure 15 Seconds Refresh is
ans
selected from the Auto Refresh drop-down list. After all the scripts have finished their
n - t r
no
execution, the Active Sessions graph will clearly show that there are no significant
a
waits on your cluster.
h a s ฺ
o m )
u de
2) Next, click the Workload tab. In the Workload Profile graph, place the cursor over the
i
Transactions line at the current time on the timeline. After a few moments, transactions
a ilฺc ent G
should be in excess of 1000 per second.

@ gm tud
5. After the workload finishes, userb
PL/SQL s S a new AWR snapshot.
d toicreate
i t h
ab se./create_snapshot.sh
[oracle@host01 kless_08]$
a t h o u
m t
( nse successfully completed.
b
PL/SQLi r procedure
l K a l ice
a n u [oracle@host01 less_08]$
s
Ah
6. Using EM Express, review the latest ADDM run. What are your conclusions?
1) Click Performance, then Performance Hub, and then the ADDM tab.
2) Find the link for the latest ADDM task under ADDM Tasks and click it. This takes you to
the Automatic Database Diagnostic Monitor (ADDM) page.
3) On the Automatic Database Diagnostic Monitor (ADDM) page, the Findings section
shows you the consolidation of ADDM reports from all instances running in your
cluster. In the DB Time Breakdown By Instance section, drill down on the task link for
orcl_3. From there, investigate the Buffer Busy findings. You should no longer see the
Sequence Usage, nor specific instances impacted.

7. Close all terminal windows opened for this practice.

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

Practices for Lesson 8: RAC Database Monitoring and Tuning


Chapter 8 - Page 16
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
Practices for h a s ฺ 9:
Lesson
m ) i e
dAvailability
Managing c o High
G u of
i l
a den ฺ t
Services
m
@ g tu9
d s S
a b irb thi Chapter

t h k u se
( m a to
e
a bir icens
n u lK l
hs a
A

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

Practices for Lesson 9: Managing High Availability of Services


Chapter 9 - Page 1
Practices for Lesson 9: Overview

Practices Overview
In these practices, you will create, manage, and monitor services.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 9: Managing High Availability of Services


Chapter 9 - Page 2
Practice 9-1: Working with Services

Overview
In this practice, you will create a service called prod1. You then observe what happens to your
service when you terminate the instances on which it is running.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

1. Use SRVCTL to create a singleton service called PROD1.


1) Connect to your first node as the oracle user. Be sure to use the –X option. Set up
your environment variables using the oraenv script. Change the directory to
/stage/RAC/labs/less_09.
[vncuser@classroom_pc ~]$ ssh -X oracle@host01
oracle@host01's password:
[oracle@host01 ~]$ . oraenv
ble
ORACLE_SID = [oracle] ? orcl
fe r a
The Oracle base has been set to /u01/app/oracle
ans
n - t r
[oracle@host01 ~]$ cd /stage/RAC/labs/less_09
a no
h a s ฺ
[oracle@host01 less_09]$
o m )
u i de
a ilฺc ent G
gm service
2) Use SRVCTL to create a SINGLETON
@ tud called PROD1 using the orcldb
server pool. d S
is add service -db orcl -service
b i rb srvctl
t h
t h ka orcldb
[oracle@host01 less_09]$
u se-cardinality singleton -policy manual
( m a
PROD1 -serverpool
to
e
a bir icensless_09]$ srvctl status service -db orcl
lK
[oracle@host01
u l
a n Service PROD1 is not running.

Ahs
[oracle@host01 less_09]$

3) Use SRVCTL to start the PROD1 service.


[oracle@host01 less_09]$ srvctl start service -db orcl -service
prod1
[oracle@host01 less_09]$ srvctl status service -db orcl
Service PROD1 is running on nodes: host02
[oracle@host01 less_09]$

4) Add the following entry for the PROD1 service in the tnsnames.ora on all three
hosts.
prod1 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =
cluster01-scan.cluster01.example.com)(PORT =
1521))(LOAD_BALANCE = YES)(CONNECT_DATA = (SERVER =
DEDICATED)(SERVICE_NAME = prod1)))

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

Practices for Lesson 9: Managing High Availability of Services


Chapter 9 - Page 3
Use the add_tns.sh script to add the entries on all three hosts if you like.
[oracle@host01 less_09]$ cat add_tns.sh
cat /stage/RAC/labs/less_09/prod1_tns.txt>>
/u01/app/oracle/product/12.1.0/dbhome_1/network/admin/tnsnames.ora
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ssh host02 "cat /stage/RAC/labs/less_09/prod1_tns.txt>>


/u01/app/oracle/product/12.1.0/dbhome_1/network/admin/tnsnames.ora"

ssh host03 "cat /stage/RAC/labs/less_09/prod1_tns.txt>>


/u01/app/oracle/product/12.1.0/dbhome_1/network/admin/tnsnames.ora"

echo "PROD1 tnsnames.ora entry completed for HOST01"


echo "PROD1 tnsnames.ora entry completed for HOST02"
echo "PROD1 tnsnames.ora entry completed for HOST03" ble
fe r a
ans
[oracle@host01 less_09]$ cat prod1_tns.txt
n - t r
o
prod1 = (DESCRIPTION =
s an
(ADDRESS = (PROTOCOL = TCP)(HOST = cluster01-
) ha deฺ
scan.cluster01.example.com)(PORT = 1521))
c o m ui
a il ent G

(LOAD_BALANCE = YES) (CONNECT_DATA = (SERVER =
DEDICATED)(SERVICE_NAME = prod1)))
@ gm tud
b d i s S
b i r t h
h k a
[oracle@host01 less_09]$
s eZZ
a t
PROD1 tnsnames.ora
t o u completed for HOST01
entry
r m
( nse
PROD1 tnsnames.ora
i entry completed for HOST02

l K ab tnsnames.ora
PROD1
l ice entry completed for HOST03
nu
sa
Ah [oracle@host01 less_09]$

2. Use the srvctl command to check the status of the new service. On which host is your
service running? (It may be different from the example below)
[oracle@host01 less_09]$ srvctl status service -db ORCL -s prod1
Service prod1 is running on nodes: host02
[oracle@host01 ~]$

3. Change the user to grid, set the environment, and check the status of the PROD1 service
using CRSCTL.
[oracle@host01 less_09]$ su - grid
Password:

[grid@host01 ~]$ . oraenv


ORACLE_SID = [grid] ? +ASM1

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

Practices for Lesson 9: Managing High Availability of Services


Chapter 9 - Page 4
The Oracle base has been set to /u01/app/grid

[grid@host01 ~]$ crsctl stat res -t


----------------------------------------------------------------
Name Target State Server State details
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

----------------------------------------------------------------
Local Resources
----------------------------------------------------------------
ora.DATA.dg
ONLINE ONLINE host01 STABLE
ONLINE ONLINE host02 STABLE
ONLINE ONLINE host03 STABLE
ora.FRA.dg
ble
ONLINE ONLINE host01 STABLE
fe r a
ans
ONLINE ONLINE host02 STABLE
n - t r
ONLINE ONLINE host03 STABLE
o
ora.LISTENER.lsnr
s an
ONLINE ONLINE host01
) ha deฺ
STABLE
ONLINE ONLINE host02
c o m ui
STABLE
ONLINE ONLINE a il ent G
host03 ฺ STABLE
ora.net1.network
@ gm tud
b d i s S
i r
ONLINE ONLINE
h host01 STABLE

h k ab se t
ONLINE ONLINE host02 STABLE
a t t o
ONLINE ONLINEu host03 STABLE
i
ora.ons
m
r ( ense
b
n u l Ka lic ONLINE ONLINE host01 STABLE

hs a ONLINE ONLINE host02 STABLE


A ONLINE ONLINE host03 STABLE
----------------------------------------------------------------
Cluster Resources
----------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE host02 STABLE
ora.LISTENER_SCAN2.lsnr
1 ONLINE ONLINE host03 STABLE
ora.LISTENER_SCAN3.lsnr
1 ONLINE ONLINE host01 STABLE
ora.MGMTLSNR
1 ONLINE ONLINE host01
169.254.68.205 192.1
68.1.101
192.168.2.1
01,STABLE
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 9: Managing High Availability of Services


Chapter 9 - Page 5
ora.asm
1 ONLINE ONLINE host01
Started,STABLE
2 ONLINE ONLINE host02
Started,STABLE
3 ONLINE ONLINE host03
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Started,STABLE
ora.cvu
1 OFFLINE OFFLINE STABLE
ora.gns
1 ONLINE ONLINE host01 STABLE
ora.gns.vip
1 ONLINE ONLINE host01 STABLE
ble
ora.host01.vip
fe r a
1 ONLINE ONLINE host01 STABLE
ans
ora.host02.vip
n - t r
o STABLE
an
1 ONLINE ONLINE host02
ora.host03.vip s
ha deฺ
1 ONLINE ONLINE )
host03
m ui STABLE
ฺ c o G
ora.mgmtdb
a il host01n t
1 ONLINE ONLINE
@ gm tude Open,STABLE
ora.oc4j
i r b dONLINEis S host01
1
b
ONLINE
a e th STABLE
ora.orcl.db k
th ONLINE usONLINE
a
(m nsONLINEt o
i
1
r e host02 Open,STABLE

a b ice
2 ONLINE host03 Open,STABLE
u l K 3 l ONLINE ONLINE host01 Open,STABLE
a n
Ahs ora.orcl.prod1.svc
1 ONLINE ONLINE host02 STABLE
ora.scan1.vip
1 ONLINE ONLINE host02 STABLE
ora.scan2.vip
1 ONLINE ONLINE host03 STABLE
ora.scan3.vip
1 ONLINE ONLINE host01 STABLE
----------------------------------------------------------------

[grid@host01 ~]$ exit


logout
[oracle@host01 less_09]$

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

Practices for Lesson 9: Managing High Availability of Services


Chapter 9 - Page 6
4. Connect to the service and query V$INSTANCE and determine what instance you are
connected to. Check the database status to determine the host on which the instance is
running.
[oracle@host01 less_09]$ sqlplus sys/sys_password@prod1 as
sysdba
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

SQL*Plus: Release 12.1.0.2.0 Production on Tue Sep 17 13:37:47


2014

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

Connected to:
ble
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 -
64bit Production fe r a
ans
With the Partitioning, Real Application Clusters, Automatic
Storage Management, OLAP, n - t r
Advanced Analytics and Real Application Testing options a no
h a s ฺ
SQL> select instance_name from v$instance;
o m )
u i de
a ilฺc ent G
INSTANCE_NAME
@ gm tud
b d i s S
----------------
i r h
orcl_1
h k ab se t
a t t o u
i
SQL> exit m
r ( ense
b
Ka lic from Oracle Database 12c Enterprise Edition
l Disconnected Release

anu
12.1.0.2.0 - 64bit Production
s
Ah With the Partitioning, Real Application Clusters, Automatic
Storage Management, OLAP,
Advanced Analytics and Real Application Testing options

[oracle@host01 less_09]$ srvctl status database -db orcl


Instance orcl_1 is running on node host02
Instance orcl_2 is running on node host03
Instance orcl_3 is running on node host01
[oracle@host01 less_09]$

5. From a terminal session on the node hosting the PROD1 service, as the oracle user,
crash the instance on that node. In this example, the service is running on host02. Use
ssh to log in to the host, find the database pmon process and kill the ora_pmon_orcl_n
process. Use the pkill -9 –f ora_pmon_orcl_n command to crash the database
instance. The orcl_1 instance will crash and the Clusterware services will restart it very
quickly. Exit back to host01.

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

Practices for Lesson 9: Managing High Availability of Services


Chapter 9 - Page 7
[oracle@host01 less_09]$ ssh host02
Last login: Tue Sep 17 13:45:52 2014 from host01.example.com
[oracle@host02 ~]$ ps -ef|grep ora_pmon
oracle 4305 1 0 Sep13 ? 00:04:25 ora_pmon_orcl_1
oracle 26772 26746 0 13:47 pts/1 00:00:00 grep ora_pmon
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

[oracle@host02 ~]$ pkill -9 -f ora_pmon_orcl_1

[oracle@host02 ~]$ exit


logout
Connection to host02 closed.
[oracle@host01 less_09]$

bl e
e
6. Use SRVCTL to check the status of the PROD1 service. Where is the service runningfnow?r a
n s
running on the system hosting the service? n - tra
In the example below, the service has been failed over to host03. What instance is

[oracle@host01 less_09]$ srvctl status servicea-db no orcl


Service PROD1 is running on nodes: host03ha
s ฺ
o m )
u i de
[oracle@host01 less_09]$ srvctl a lฺc ndatabase
istatus t G -db orcl
m
Instance orcl_1 is running gon nodeud
e
d @ S t host02
Instance orcl_2 is running
b i r b thonisnode host03
Instance orcl_3 a e on node host01
t h k is running
u s
a less_09]$
[oracle@host01
( m to
ir ens e
a b
7. Make
u l lic to the database using the PROD1 service. What instance are you
Ka connection
san
connected to?
Ah [oracle@host01 less_09]$ sqlplus sys/sys_password@prod1 as
sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Fri Jan 9 11:07:01


2015

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

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

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

Practices for Lesson 9: Managing High Availability of Services


Chapter 9 - Page 8
SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
orcl_2
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release
12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic
Storage Management, OLAP,
Advanced Analytics and Real Application Testing options

ble
[oracle@host01 less_09]$ srvctl status database -db orcl
fe r a
Instance orcl_1 is running on node host02
ans
Instance orcl_2 is running on node host03
n - t r
Instance orcl_3 is running on node host01
a no
h a s ฺ
[oracle@host01 less_09]$
o m )
u i de
a ilฺc ent G
8. Use SRVCTL to relocate the PROD1 service
@ gm backtutodthe original host.
[oracle@host01 less_09]$ b d srvctl
i s Srelocate service -db orcl -
i r h
service PROD1 -c host03
h k ab se t -n host02

a t t o u
m
r ( ense
[oracle@host01
i less_09]$
b
u l Ka lic
san
9. Verify that the PROD1 service has been relocated to the host specified in the previous step.

Ah
[oracle@host01 less_09]$ srvctl status service -db orcl
Service PROD1 is running on nodes: host02

[oracle@host01 less_09]$

10. Close all terminal sessions opened for this practice.

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

Practices for Lesson 9: Managing High Availability of Services


Chapter 9 - Page 9
Practice 9-2: Monitoring Services

Overview
In this practice, you will use EM Express to determine the amount of resources used by
sessions executing under a particular service.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

1. Connect to your first node as the oracle user. Set up your environment variables using
the oraenv script. Change directory to /stage/RAC/labs/less_09. Execute the
createuser.sh script. This script creates a new user called jmw identified by the
password jmw. The default tablespace of this user is USERS, and its temporary tablespace
is TEMP. This new user has the CONNECT, RESOURCE, and DBA roles.
[vncuser@classroom_pc ~]$ ssh oracle@host01
oracle@host01's password:
ble
fe r a
[oracle@host01 ~]$ . oraenv
ans
ORACLE_SID = [oracle] ? orcl
n - t r
The Oracle base has been set to /u01/app/oracle
a no
h a s ฺ
[oracle@host01 ~]cd /stage/RAC/labs/less_09
o m )
u i de
c
[oracle@host01 less_09]$ catm ailฺ dent G
createuser.sh
@ g tu
export HOST=`hostname -s`
d s S
b irb thi
export ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1
a
t h k u se
export ORACLE_SID=`$ORACLE_HOME/bin/srvctl status database -db
a
orcl|grepm$HOST|cut
( nse t o -f2 -d" "`
b i r PATH=$PATH:$ORACLE_HOME/bin
lice
export

n u l Ka
hs a
A /u01/app/oracle/product/12.1.0/dbhome_1/bin/sqlplus -s /NOLOG
<<EOF

connect / as sysdba
drop user jmw cascade;
create user jmw identified by jmw default tablespace users
temporary tablespace temp;
grant connect, resource, dba to jmw;

EOF

[oracle@host01 less_09]$ ./createuser.sh

User dropped.

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

Practices for Lesson 9: Managing High Availability of Services


Chapter 9 - Page 10
User created.

Grant succeeded.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

[oracle@host01 less_09]$

2. Open a second terminal to your first node as the oracle user. Be sure to use the –X
option. Set up your environment variables using the oraenv script. Next, start Firefox and
enter the following address: https://host01:5500/em
Log in to EM Express as sys/sys_password as SYSDBA.
[vncuser@classroom_pc ~]$ ssh -X oracle@host01
ble
oracle@host01's password:
fe r a
ans
[oracle@host01 ~]$ . oraenv n - t r
ORACLE_SID = [oracle] ? orcl a no
The Oracle base has been set to /u01/app/oracle h a s ฺ
o m )
u i de
[oracle@host01 ~]$ firefox&
a ilฺc ent G
@ gm tud
[oracle@host01 ~]$ bd i s S
i r h
h k ab se t
a t session,
3. From the first terminal t o u
connect to prod1 as jmw using SQL*Plus. When
m
r ( enthe
connected, idetermine seinstance on which your session is currently running.
ThenK
b
a thelicfollowing query:
execute
u l
san
select count(*) from dba_objects,dba_objects,dba_objects
Ah Do not wait; instead, proceed with the next step.
[oracle@host01 less_09]$ sqlplus jmw/jmw_password@PROD1
SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
orcl_1

SQL> select count(*) from dba_objects,dba_objects,dba_objects;

4. Check statistics on your service with gv$service_stats from a SQL*Plus session


connected as SYSDBA as shown below.
[oracle@host01 ~]$ sqlplus sys/sys_password@orcl as sysdba

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

Practices for Lesson 9: Managing High Availability of Services


Chapter 9 - Page 11
SQL*Plus: Release 12.1.0.2.0 Production on Tue Sep 17 14:47:31
2014

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


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

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

SQL> select stat_name, sum(value) from gv$service_stats where


service_name = 'PROD1' group by stat_name; ble
fe r a
ans
STAT_NAME SUM(VALUE)
n - t r
----------------------------------------------------- ---------- o
user calls
s an 18
DB CPU ) ha deฺ
790706794
c o m ui
il ent G
redo size 704
db block changes a ฺ 4
DB time
@ gm tud 884881915
b d i s S
user rollbacks i r h 0

h k
gc cr blocks receivedab se t 2
a t t o u
i m
gc cr block receive time
r ( ense
0
b
gc current blocks received 0

n u l Ka lic
opened cursors cumulative 242

hs a workarea executions - multipass 0


A
STAT_NAME SUM(VALUE)
----------------------------------------------------- ----------
session cursor cache hits 190
user I/O wait time 876444
parse count (total) 99
physical reads 29
gc current block receive time 0
workarea executions - optimal 52
concurrency wait time 70511
parse time elapsed 2149526
physical writes 0
workarea executions - onepass 0
execute count 244

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

Practices for Lesson 9: Managing High Availability of Services


Chapter 9 - Page 12
STAT_NAME SUM(VALUE)
----------------------------------------------------- ----------
session logical reads 7219
cluster wait time 875217
application wait time 0
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

logons cumulative 1
sql execute elapsed time 884654643
user commits 0

28 rows selected.

SQL> exit

ble
[oracle@host01 ~]$
fe r a
t r a ns
5. You can also use EM Express to view service activity. Click Performance, o n -
then
Performance Hub, and then the Activity tab. On the activity timelineagraph, n select Session
Identifiers > Service from the pull-down list. s
a eฺ
hIdentifiers
On the bottom-left summary graphic, again choose Session m ) i d > Service from the
o u
pull-down list.
On the bottom-right summary graphic, chooseaSession ilฺc eIdentifiers
n t G > User ID from the pull-
down list. Spend a few moments and monitor
@ gm thetservice ud activity for the PROD1 service.
d S
isissteadily
You should see the PROD1 service
b
Go to the first terminal window. i rIfbtheactivity
t
queryh
increase.
still running, stop it by pressing Ctrl + C.
Returning to EM Express,t h kayou should
u sesee the service activity for PROD1 steadily decrease
until it disappears
( m a the monitored
from to list due to inactivity.
i r s e
a b icen
l
6. Stop
u Kthe PROD1l service and remove it.
san [oracle@host01 ~]$ srvctl stop service -d orcl -s PROD1
Ah
[oracle@host01 ~]$ srvctl remove service -d orcl -s PROD1
[oracle@host01 ~]$

7. Dismiss Firefox and EM Express and close all terminal windows opened for this practice.

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

Practices for Lesson 9: Managing High Availability of Services


Chapter 9 - Page 13
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 9: Managing High Availability of Services


Chapter 9 - Page 14
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
Practices for h a s ฺ 10: High
Lesson
Availability
o m )
for
u i de
Connections
c G
ilฺApplications
t
and a n
@ gm tude
b d Chapter
i s S 10
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 10: High Availability for Connections and Applications
Chapter 10 - Page 1
Practices for Lesson 10: Overview

Practices Overview
In this practice, you will explore Application Continuity.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 10: High Availability for Connections and Applications
Chapter 10 - Page 2
Practice 10-1: Using Application Continuity

Overview
In this practice, you will use Application Continuity in a RAC environment to demonstrate how
Application Continuity helps an application to seamlessly recover after the failure of a RAC
instance.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

1. From your desktop, open a terminal and become the root user and shut down host03.
[vncuser@classroom_pc ~]$ su -
Password:
[root@classroom_pc ~]# xm shutdown host03

[root@classroom_pc ~]#
ble
fe r a
ans
2. Establish a terminal session connected to host01 using the oracle OS user.
n - t r
o
[vncuser@classroom_pc ~]$ ssh oracle@host01
s an
ha deฺ
oracle@host01's password:
[oracle@host01 ~]$ )
m ui
c o
a il ent G

3. Configure the environment by using the g m tscript.
oraenv
ud
d @ S
[oracle@host01 ~]$ . b
b i r ? orcl
oraenv
t h is
a
useset to /u01/app/oracle
ORACLE_SID = [oracle]
The Oracle a thk hasto been
base
i r (m ns~]$
[oracle@host01 e
b e
u l Ka lic
s4.anConfirm that two instances of the RAC database are up and running.
Ah [oracle@host01 ~]$ srvctl status database -db orcl
Instance orcl_1 is running on node host02
Instance orcl_3 is running on node host01

[oracle@host01 ~]$

5. Navigate to the directory that contains the files for this practice.
[oracle@host01 ~]$ cd /stage/RAC/labs/less_10
[oracle@ host01 less_10]$

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

Practices for Lesson 10: High Availability for Connections and Applications
Chapter 10 - Page 3
6. Create a database service on the orcl database. Configure the service for use in
conjunction with Application Continuity.
[oracle@host01 less_10]$ srvctl add service -db orcl -service
actest -serverpool ora.orcldb -cardinality singleton -
failovertype TRANSACTION -commit_outcome TRUE -failoverretry 50
-failoverdelay 5 -retention 86400 -replay_init_time 1800 -
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

notification TRUE
[oracle@host01 less_10]$

7. Start the service.


[oracle@host01 less_10]$ srvctl start service -db orcl -service
actest
[oracle@host01 less_10]$
ble
8. Examine the status of the newly created service. Take note of the node it is runnings fe
on
r a
(host02 in this case), because it may be different in your environment.
tra n
[oracle@host01 less_10]$ srvctl status service -dbo orcl -service n -
actest
s an
Service actest is running on nodes: host02
) ha deฺ
[oracle@host01 less_10]$
c o m ui
a il ent G

@
9. Establish another terminal session connected gm to host02
tud using the oracle OS user. To
d
b primary s S
isession,
session for the rest of the a b r
differentiate this session from iyour
practice. e t h it will be referred to as the ADMIN

a thk to u~]$
[vncuser@classroom_pc
s ssh oracle@host02
i r (m nsepassword:
ab lice
oracle@host02's
l K
u [oracle@host02 ~]$ cd /stage/RAC/labs/less_10
s a n
Ah [oracle@host02 less_10]$

10. Configure the prompt in your ADMIN session as shown below. This will help you to
differentiate between your terminal sessions as you progress through this practice.
[oracle@host02 less_10]$ export PS1='[HOST02 ADMIN] $ '
HOST02 ADMIN $

11. Configure the environment in your ADMIN session by using the oraenv script. Enter orcl
when you are prompted for an ORACLE_SID value.
[HOST02 ADMIN] $ . oraenv
ORACLE_SID = [oracle] ? orcl
The Oracle base has been set to /u01/app/oracle
[HOST02 ADMIN] $

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

Practices for Lesson 10: High Availability for Connections and Applications
Chapter 10 - Page 4
12. Back in your first session, examine the scripts that you will soon use to execute the practice
application. Notice that both scripts execute the same application code (in actest.jar).
The only difference is that each script references a different properties file.
[oracle@host01 less_10]$ cat runnoreplay
java -classpath
./actest.jar:$ORACLE_HOME/ucp/lib/ucp.jar:$ORACLE_HOME/jdbc/lib/
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ojdbc6.jar actest.ACTest actest_noreplay.properties


[oracle@host01 less_10]$

[oracle@host01 less_10]$ cat runreplay


java -classpath
./actest.jar:$ORACLE_HOME/ucp/lib/ucp.jar:$ORACLE_HOME/jdbc/lib/
ojdbc6.jar actest.ACTest actest_replay.properties
[oracle@host01 less_10]$ ble
fe r a
ans
13. Examine the properties files. Notice that the only difference is the datasource
n - t r
specification.
a no
[oracle@host01 less_10]$ cat actest_noreplay.properties
h a s ฺ
username=scott
o m )
u i de
password=tiger
a ilฺc ent G
gm tud
autoCommit=false

b d @ s Sno replay
i r h i
ab se t
# Use standard 12.1 datasource
h k u
datasource=oracle.jdbc.pool.OracleDataSource
t
m a t o
b i r ( ense
url=jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=
a lic
ul K
cluster01-
n
hsa
scan.cluster01.example.com)(PORT=1521))(CONNECT_DATA=(SERVICE_NA
ME=actest)))
A
# UCP setting:
ucp_pool_size=2
ucp_validate_connection_on_borrow=true
ucp_connection_wait_timeout=60

# Think Time taken to process the results from the database.


Time in milliseconds.
# -1 means no sleep.
thread_think_time=20

# Number of concurrent threads running in the application


# UCP is tuned to have MAX and MIN limit set to this
number_of_threads=6

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

Practices for Lesson 10: High Availability for Connections and Applications
Chapter 10 - Page 5
verbose=true

[oracle@host01 less_10]$

[oracle@host01 less_10]$ cat actest_replay.properties


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

username=scott
password=tiger
autoCommit=false

# Use new 12.1 replay datasource


datasource=oracle.jdbc.replay.OracleDataSourceImpl

url=jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=
ble
cluster01-
fe r a
scan.cluster01.example.com)(PORT=1521))(CONNECT_DATA=(SERVICE_NA
ans
ME=actest)))
n - t r
a no
# UCP setting:
h a s ฺ
) de
ucp_pool_size=2
o m u i
ilฺc ent G
ucp_validate_connection_on_borrow=true
ucp_connection_wait_timeout=60 a
@ gm tud
b S results from the database.
dprocessisthe
# Think Time taken ito r h
k
Time in milliseconds.
h ab se t
# -1 means a t sleep.
no
t o u
i m
r ( ense
thread_think_time=20
a b
ul K lic
n
hsa
# Number of concurrent threads running in the application
A # UCP is tuned to have MAX and MIN limit set to this
number_of_threads=6

verbose=true
[oracle@host01 less_10]$

[oracle@host01 less_10]$ diff actest_replay.properties


actest_noreplay.properties
5,6c5,6
< # Use new 12.1 replay datasource
< datasource=oracle.jdbc.replay.OracleDataSourceImpl
---
> # Use standard 12.1 datasource no replay
> datasource=oracle.jdbc.pool.OracleDataSource
[oracle@host01 less_10]$

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

Practices for Lesson 10: High Availability for Connections and Applications
Chapter 10 - Page 6
Next, you will execute the practice Java application twice. Once without the benefit of
Application Continuity, and once with Application Continuity enabled. Notice that you will
execute the same application and the only difference is the JDBC data source that is used
on each occasion. The source files containing the application code are contained in the src
directory. Feel free to examine the application code if you like.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

14. Execute the practice application without the benefit of Application Continuity. Notice that
while the application runs, a periodic status message is displayed.
[oracle@host01 less_10]$ ./runnoreplay
######################################################
Connecting to
jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=clus
ter01-
scan.cluster01.example.com)(PORT=1521))(CONNECT_DATA=(SERVICE_NA
ble
ME=actest)))
fe r a
# of Threads : 6
ans
UCP pool size : 2
n - t r
Thread think time : 20 ms
a no
######################################################
h a s ฺ
o m )
u i de38 ms
2 active connections, avg response
a ilฺc time
time
n t G
from db
2 active connections, avg response
g m tude from db 23 ms

b d @ sS
a b
15. While the application continues r
e thiin the primary window, return to your ADMIN
i to execute
h
session and remind yourself
t k about u swhich node is running the actest service. Then, abort
m on
the database instancea
(Ensure o
thet host running the actest service (host02 in the example
i
shown below). r s e
n you abort the instance on the node running the service and not
that
a bdatabase c e
u l K
the other li node.

san [HOST02 ADMIN] $ srvctl status service -d orcl -s actest


Ah Service actest is running on nodes: host02

[HOST02 ADMIN] $ srvctl status database -db orcl


Instance orcl_1 is running on node host02
Instance orcl_3 is running on node host01

[HOST02 ADMIN] $ pkill -9 -f pmon_orcl_1


[HOST02 ADMIN] $

16. Return to your primary window and you should see a series of errors caused by aborting
the database instance. This is typical of applications that do not use Application Continuity.
Press Ctrl + C to abort the application.
...
at
oracle.ucp.jdbc.oracle.OracleJDBCConnectionPool.borrowConnection
(OracleJDBCConnectionPool.java:1441)
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 10: High Availability for Connections and Applications
Chapter 10 - Page 7
at
oracle.ucp.jdbc.oracle.OracleConnectionConnectionPool.borrowConn
ection(OracleConnectionConnectionPool.java:81)
at
oracle.ucp.jdbc.PoolDataSourceImpl.getConnection(PoolDataSourceI
mpl.java:1027)
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

... 4 more
.Exception occurred while getting connection:
oracle.ucp.UniversalConnectionPoolException: Cannot get
Connection from Datasource: java.sql.SQLRecoverableException:
Listener refused the connection with the following error:
ORA-12514, TNS:listener does not currently know of service
requested in connect descriptor
.
ble
0 active connections, avg response time from db 150418377 ms
fe r a
^C
ans
[oracle@host01 less_10]$
n - t r
a no
17. Confirm both RAC database instances are up and running again.
h a s ฺ
[oracle@host01 less_10]$ srvctl status
o m )database
u i de-d orcl
Instance orcl_1 is running on node
a ilฺc host02
e n t G
Instance orcl_3 is running gon mnodetudhost01
b d @ s S
i r h i
h k ab se t
[oracle@host01 less_10]$

at t o u
18. Reexamine the(m e
status of the service. You should observe that the service is
i r
ba differentn s actest
runningaon
l K
service l ice when
was migrated
node compared to what you observed earlier. This is because the
you aborted the database instance earlier in the practice.
n u
sa [oracle@host01 less_10]$ srvctl status service -d orcl -s actest
Ah Service actest is running on nodes: host01

[oracle@host01 less_10]$

19. Execute the practice application with Application Continuity enabled. You should see the
same period status messages as before while the application is running.
[oracle@host01 less_10]$ ./runreplay
######################################################
Connecting to
jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=clus
ter01-
scan.cluster01.example.com)(PORT=1521))(CONNECT_DATA=(SERVICE_NA
ME=actest)))
# of Threads : 6
UCP pool size : 2
Thread think time : 20 ms
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 10: High Availability for Connections and Applications
Chapter 10 - Page 8
######################################################

2 active connections, avg response time from db 44 ms


2 active connections, avg response time from db 23 ms
2 active connections, avg response time from db 20 ms
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

20. While the application continues to execute in the primary window, return to your ADMIN
session and remind yourself about which node is now running the actest service. Then,
abort the database instance running the actest service (which is now host01 in the
example shown below). Ensure that you abort the instance on the node running the service
and not the other database node.
[HOST02 ADMIN] $ srvctl status service -d orcl -s actest
Service actest is running on nodes: host01
ble
fe r a
[HOST02 ADMIN] $ srvctl status database -d orcl
ans
Instance orcl_1 is running on node host02
n - t r
Instance orcl_3 is running on node host01
a no
[HOST02 ADMIN] $ ssh host01 pkill -9 -f pmon_orcl_3 h a s ฺ
[HOST02 ADMIN] $ o m )
u i de
a ilฺc ent G
21. Return to your primary window and you g
m tuthat
should see d the application continued in spite of
d @ S
b i b should
the aborted database instance.rYou
t h isseewhen
a pause and then a brief spike in the

h k a
response time, which coincides with
s the
e time the database instance was aborted.
a t
Now you have seen how
t o u
Application Continuity masks the effect of database instance loss

i r (m nse
in a RAC database environment. Press Ctrl + C to abort the application.

l ab liconnections,
2 active
K c e avg response time from db 44 ms

a n u 2 active connections, avg response time from db 23 ms


s
Ah
2 active connections, avg response time from db 20 ms
2 active connections, avg response time from db 16 ms
2 active connections, avg response time from db 14 ms
2 active connections, avg response time from db 12 ms
2 active connections, avg response time from db 12 ms
2 active connections, avg response time from db 15 ms
2 active connections, avg response time from db 125 ms
2 active connections, avg response time from db 16 ms
2 active connections, avg response time from db 13 ms
2 active connections, avg response time from db 12 ms
2 active connections, avg response time from db 12 ms
2 active connections, avg response time from db 13 ms
^C
[oracle@host01 less_10]$

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

Practices for Lesson 10: High Availability for Connections and Applications
Chapter 10 - Page 9
22. Confirm that both instances are running and the service migrated to the other node as
expected.
[oracle@host01 less_10]$ srvctl status database -d orcl
Instance orcl_1 is running on node host02
Instance orcl_3 is running on node host01
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

[oracle@host01 less_10]$ srvctl status service -d orcl -s actest


Service actest is running on nodes: host02

[oracle@host01 less_10]$

23. Stop the actest service and remove it.


[oracle@host01 less_10]$ srvctl stop service -d orcl -s actest ble
fe r a
ans
[oracle@host01 less_10]$ srvctl remove service -d orcl -s actest
n - t r
[oracle@host01 less_10]$ o
s an
24. Close all terminal windows opened for this practice. ) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
u l Ka lic
n
Ahsa

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

Practices for Lesson 10: High Availability for Connections and Applications
Chapter 10 - Page 10
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
Practices for h a s ฺ 11:
Lesson
Oracle o m )
RAC One
u i deNode
a ilฺc ent G
@ gm
Chapter 11d
tu
d s S
a b irb thi
t h k u se
( m a to
e
a bir icens
n u lK l
hs a
A

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

Practices for Lesson 11: Oracle RAC One Node


Chapter 11 - Page 1
Practices for Lesson 11: Overview

Practices Overview
In these practices, you will create a RAC One Node Database.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 11: Oracle RAC One Node


Chapter 11 - Page 2
Practice 11-1: RAC One Node

Overview
In this practice, you will create a RAC One Node database. You will perform an online database
relocation. Finally, you will convert the RAC One Database to an Oracle RAC database.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

1. From a terminal session on your classroom PC, execute ssh oracle@host01 to open a
terminal session on host01 as the oracle user. Set the environment and check the status
of the database.
[vncuser@classroom_pc ~]$ ssh oracle@host01
oracle@host01's password:

[oracle@host01 ~]$ . oraenv


ble
ORACLE_SID = [oracle] ? orcl
fe r a
The Oracle base has been set to /u01/app/oracle
ans
n - t r
[oracle@host01 ~]$ srvctl status database -d orcl
a no
Instance orcl_1 is running on node host02ha
s ฺ
Instance orcl_3 is running on node o m )
host01 u i de
a ilฺc ent G
[oracle@host01 ~]$
@ gm tud
b d i s S
i r h
h k ab Verifysethet database status.
2. Stop the instance on host02.
[oracle@host01a u stop instance -f -d orcl -n
t ~]$tosrvctl host02
i m
r ( ense
b
u l Ka lic ~]$ srvctl status database -d orcl
[oracle@host01

san
Instance orcl_3 is running on node host01

Ah Instance orcl_1 is not running on node host02

[oracle@host01 ~]$

3. An active service is needed to convert the RAC database to RACONENODE. Create a


service called SERV1.
[oracle@host01 ~]$ srvctl add service -d orcl -s SERV1 -
serverpool orcldb

[oracle@host01 ~]$

4. Use the srvctl utility to convert the RAC database to RACONENODE.


[oracle@host01 ~]$ srvctl convert database -d orcl -c RACONENODE

[oracle@host01 ~]$

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

Practices for Lesson 11: Oracle RAC One Node


Chapter 11 - Page 3
5. From the oracle terminal session, check your database configuration using the srvctl
utility.
[oracle@host01 ~]$ srvctl config database -db orcl
Database unique name: orcl
Database name: orcl
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Oracle home: /u01/app/oracle/product/12.1.0/dbhome_1


Oracle user: oracle
Spfile: +DATA/ORCL/PARAMETERFILE/spfile.279.868817789
Password file: +DATA/ORCL/PASSWORD/pwdorcl.276.868816925
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
ble
Management policy: AUTOMATIC
fe r a
Server pools: orcldb
ans
Database instances: n - t r
o
Disk Groups: DATA,FRA
s an
Mount point paths:
) ha deฺ
Services: serv1
c o m ui
Type: RACOneNode
a il ent G

Online relocation timeout: 30
@ gm tud
b d i s S
i r
Instance name prefix: orcl
h
Candidate servers:
h k ab se t
a t
OSDBA group: dba
t o u
i m
r ( ense
OSOPER group: oper
b
n u l Ka lic
Database instances:
Database is policy managed
hs a
A [oracle@host01 ~]$

6. Use the srvctl utility to check the status of the orcl database.
[oracle@host01 ~]$ srvctl status database -db orcl
Instance orcl_3 is running on node host01
Online relocation: INACTIVE
[oracle@host01 ~]$

7. Execute srvctl relocate database –help to view command usage.


[oracle@host01 ~]$ srvctl relocate database -help

Initiate online relocation of the RAC One Node database.

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

Practices for Lesson 11: Oracle RAC One Node


Chapter 11 - Page 4
Usage: srvctl relocate database -db <db_unique_name> {[-node
<target>] [-timeout <timeout>] [-stopoption <stop_option>] | -
abort [-revert]} [-verbose]
-db <db_unique_name> Unique name of database to
relocate
-node <target> Target node to which to
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

relocate database
-timeout <timeout> Online relocation timeout in
minutes
-abort Abort failed online
relocation
-revert Remove target node of failed
online relocation request from the candidate server list of
administrator-managed RAC One Node database
ble
-stopoption <stop_option> Override default shutdown
fe r a
option for running instance (only NORMAL allowed)
ans
-verbose Verbose output
n - t r
-help Print usage
a no
[oracle@host01 ~]$
h a s ฺ
o m )
u i de Use srvctl to
8. In this example, the orcl_3 instance was running
a ilฺc toehost02.
perform an online database relocation from host01
initially
n tG
on host01.

Immediately after issuing the command,


@ gmproceed
tudto the next step!
d is S
[oracle@host01 ~]$ isrvctl
b rb trelocate
h database -db orcl -node
host02 -w 15 -vka e
a th to us
i r (m nsego to the next step>>>
ab lice
<<< Immediately
l K
u Configuration updated to two instances
s a n
Ah Instance orcl_1 started
Services relocated
Waiting for up to 15 minutes for instance orcl_3 to stop ...
Instance orcl_3 stopped
Configuration updated to one instance

[oracle@host01 ~]$

9. Open another terminal window as oracle, set the environment and issue the srvctl
status database -db orcl command several times to monitor the migration process
until the relocation command finishes in the first terminal.
[vncuser@classroom_pc ~]$ ssh oracle@host01
oracle@host01's password:

[oracle@host01 ~]$ . oraenv

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

Practices for Lesson 11: Oracle RAC One Node


Chapter 11 - Page 5
ORACLE_SID = [oracle] ? orcl
The Oracle base has been set to /u01/app/oracle

[oracle@host01 ~]$ srvctl status database -db orcl


Instance orcl_3 is running on node host01
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Online relocation: ACTIVE


Source instance: orcl_3 on host01
Destination instance: orcl_1 on host02

[oracle@host01 ~]$ srvctl status database -db orcl


Instance orcl_3 is running on node host01
Online relocation: ACTIVE
Source instance: orcl_3 on host01
ble
Destination instance: orcl_1 on host02
fe r a
t r a ns
[oracle@host01 ~]$ srvctl status database -db orcl n-
Instance orcl_1 is running on node host02 a no
Online relocation: INACTIVE h a s ฺ
[oracle@host01 ~]$ o m )
u i de
a ilฺc ent G
10. Let’s convert the RAC One Node database
@ gmto a RAC
tuddatabase. First, shut down the RAC
d S
One Node database.
b i rb this
[oracle@host01 k~]$
h a srvctl s e stop database -db orcl
[oracle@host01 t
a ~]$to u
i ( m
r ense
b
11. Use
u l Ka to lconvert
srvctl ic the database to RAC and restart the database. Check the database
sanstatus to make sure that both the instances are up.
Ah [oracle@host01 ~]$ srvctl convert database -db orcl -dbtype RAC

[oracle@host01]$ srvctl start database -db orcl

[oracle@host01]$ srvctl status database -d orcl


Instance orcl_1 is running on node host02
Instance orcl_2 is running on node host01

[oracle@host01]$

12. Execute the srvctl status service command to view the services configuration.
Note that the serv1 service is running on all nodes. Stop the service and remove it.
[oracle@host01 ~]$ srvctl status service -d orcl
Service serv1 is running on nodes: host01,host02

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

Practices for Lesson 11: Oracle RAC One Node


Chapter 11 - Page 6
[oracle@host01 ~]$ srvctl stop service -db orcl -service serv1

[oracle@host01 ~]$ srvctl remove service -db orcl -service serv1


[oracle@host01 ~]$
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

13. Execute the srvctl config database command to view the database configuration.
[oracle@host01 ~]$ srvctl config database -d orcl
Database unique name: orcl
Database name: orcl
Oracle home: /u01/app/oracle/product/12.1.0/dbhome_1
Oracle user: oracle
Spfile: +DATA/ORCL/PARAMETERFILE/spfile.279.868817789
ble
Password file: +DATA/ORCL/PASSWORD/pwdorcl.276.868816925
fe r a
Domain:
ans
Start options: open
n - t r
o
an
Stop options: immediate
Database role: PRIMARY s
ha deฺ
Management policy: AUTOMATIC )
m ui
c o
Server pools: orcldb
a il ent G

gm tud
Disk Groups: DATA,FRA
Mount point paths:
b d @ s S
i r h i
ab se t
Services:
Type: RAC
t h k u
m a t o
r ( ense
Start concurrency:
b i
Stop concurrency:

n u l Ka lic
OSDBA group: dba

hs a OSOPER group: oper


A Database instances:
Configured nodes:
Database is policy managed

[oracle@host01 ~]$

14. Exit all terminal windows opened for this practice.

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

Practices for Lesson 11: Oracle RAC One Node


Chapter 11 - Page 7
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 11: Oracle RAC One Node


Chapter 11 - Page 8
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
Practices for h a s ฺ 12:
Lesson
Multitenant o m ) i de
Architecture
u and
i l ฺ c t G
m a Environment
RAC d e n
@ g tu
d s S
b i rb thi Chapter 12

t h ka use
( m a to
e
a bir icens
n u lK l
hs a
A

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

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 1
Practices for Lesson 12: Overview

Overview
In this practice, you will create a new CDB named cdb1 including one PDB named pdb1. The
CDB is hosted in an existing server pool.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Then you will create another PDB named pdb2 and manage the services to affinitize the PDB
services to instances.
At the end of the practice, you drop the pdb2 PDB.

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 2
Practice 12-1: Creating a CDB

Overview
In this practice, you will create a new CDB named cdb1 with DBCA.
Pre CDB Creation Tasks
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

As root, start host03. Then, remove the existing RAC database. From your classroom
PC desktop, execute ssh –X oracle@host01 to open a terminal session on host01 as
the oracle user. Then navigate to
/u01/app/oracle/product/12.1.0/dbhome_1/bin and execute DBCA.
[vncuser@classroom_pc ~]$ su –
Password:

ble
[root@classroom_pc ~]# xm create host03
fe r a
Using config file "/etc/xen/host03".
ans
Started domain host03 (id=108)
n - t r
a no
*** Wait a few moments for host03 to boot completely
h a s ฺ ****

o m )
u i de
ilฺc ent G
[root@classroom_pc ~]# ssh -X oracle@host01
a
gm tud
oracle@host01's password:

b d @ s S
[oraclec@host01 ~]#ircd
h i
k ab se t
/u01/app/oracle/product/12.1.0/dbhome_1/bin
h
a t t o u
i m
r ( ensbin]$
[oracle@host01 e ./dbca
a b
ul K lic
sa n Step Screen/Page Description Choices or Values
Ah a. Database Operation Select Delete Database. Click Next.
b. Delete Database Select orcl and click Next.
c. Management Options Click Next.
d. Summary Click Finish.
e. Database Configuration You are informed that the instances and
Assistant dialog box datafiles will be deleted. Click Yes to proceed.
f. Database Configuration You are informed that database deletion is
Assistant dialog box complete. Click OK.
g. Progress Page Click Close.

Remove the orcldb server pool.


[oracle@host01 bin]$ /u01/app/12.1.0/grid/bin/srvctl remove
srvpool -serverpool orcldb

[oracle@host01 bin]$ /u01/app/12.1.0/grid/bin/srvctl status


srvpool

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

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 3
Server pool name: Free
Active servers count: 3
Server pool name: Generic
Active servers count: 0
[oracle@host01 bin]$
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Tasks
1. Start DBCA and perform the following steps.
[oracle@host01 bin]$ ./dbca

Step Window/Page Description Choices or Values


a. Step 1: Database Operation Select “Create Database.” ble
fe r a
Click Next.
ans
b. Step 2: Creation Mode Select “Advanced Mode.”
n - t r
a
Click Next.no
h a sApplication
ฺ Clusters (RAC)
c. Step 3: Database Template
)Database
Select “Oracle Real
m i d eType.
database”
l ฺ c o for
G u
i t
a “Policy-Managed”
en
g mSelect
Type. ud
t
for Configuration

d @ s S
a b irb thi Select “General Purpose or Transaction
e
thk to us
Processing.”

(m nsea Click Next.


i r
d. b Step 4:eDatabase
l K a l i c
Identification
Enter

a n u Global Database Name: cdb1

Ahs Select “Create As Container Database.”


Select “Create A Container Database with
one or more PDBs.”
Select 1 for Number of PDBs.
Enter pdb1 for PDB Name.
Click Next.
e. Step 5: Database Placement Select “Create New Server pool for this
database”.
Enter “cdb1pool“ for Server pool Name and 3
for Cardinality.
Click Next.
f. Step 6: Management Deselect “Configure Enterprise Manager (EM)
Options Database Express.”
Click Next.

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

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 4
Step Window/Page Description Choices or Values
g. Step 7: Database Select “Use same Administrative password…”
Credentials
Enter:
Password: database_administrative_password
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Confirm password:
database_administrative_password
Click Next.
h. Step 8: Storage Locations Confirm Storage type is “Automatic Storage
Management (ASM).”
Confirm “Use Common Location for All
Database Files.” in +DATA diskgroup.
ble
Deselect “Specify Fast Recovery Area”.
fe r a
Click Next.
ans
i. Step 9: Database Options Click Next. n - t r
j. Step 10: Initialization a no
Set “Memory Size (SGA and PGA)” to 840 MB.
Parameters h a s ฺ
m )
Select “Use Automatic
i e Management”
Memory
d
o u
a ilฺc“Character
Select
n t GSets.”
de Unicode (AL32UTF8).”
gmSelecttu“Use
b d @ s S Next.
i r h i Click
t Select “Create Database.”
k. k ab Option
Step 11: Creation
h s e
a t t o u
i r m
( nse Click Next.
l. b Step 12:
u l Ka Checkslice Pre Requisite Click Next.

a n
Ahs m. Step 13: Summary Click Finish.
n. Step 14: Progress Page On the Database Configuration Assistant page
(for password management), click Exit.
Click Close.

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

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 5
The screenshot below corresponds to step n.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
h a s ฺ
o m )
u i de
a ilฺc ent G
@ gm tud
2. Explore the CDB instances hosteddon the nodes
b i s Sof the server pool. You will also see that
b
the pdb1 PDB can be accessedi r on anyt h
instance of the CDB just like a non-CDB can be
k a e
th intaoRAC
accessed on any instance
a usenvironment.
i r m seserver pool and its cardinality.
a. Check the(cdb1pool
a b icen bin]$ su - grid
u l K l
[oracle@host01

san grid@host01's password:


Ah [grid@host01 ~]$ . oraenv
ORACLE_SID = [grid] ? +ASM1
The Oracle base has been set to /u01/app/grid

[grid@host01 ~]$ srvctl status srvpool


Server pool name: Free
Active servers count: 0
Server pool name: Generic
Active servers count: 0
Server pool name: cdb1pool
Active servers count: 3

[grid@host01 ~]$ srvctl status srvpool -serverpool cdb1pool


Server pool name: cdb1pool
Active servers count: 3

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

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 6
[grid@host01 ~]$ exit
logout

[oracle@host01 ~]$
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

b. Use SRVCTL to know on which nodes the instances of the CDB are running, as you
traditionally do for any non-CDB.
[oracle@host01 ~]$ export
ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1
[oracle@host01 ~]$ cd $ORACLE_HOME/bin

[oracle@host01 bin]$ ./srvctl status database -d cdb1 ble


fe r a
Instance cdb1_1 is running on node host03
ans
Instance cdb1_2 is running on node host02
n - t r
o
an
Instance cdb1_3 is running on node host01
s
ha deฺ
[oracle@host01 bin]$ pgrep -l cdb1_3 )
m ui
c o
il ent G

9770 ora_pmon_cdb1_3
a
gm tud
9772 ora_psp0_cdb1_3
9774 ora_vktm_cdb1_3
b d @ s S
i r h i
ab se t
9778 ora_gen0_cdb1_3
h k
9780 ora_mman_cdb1_3
t u
m a t o
r ( ense
9784 ora_diag_cdb1_3
i
9786bora_dbrm_cdb1_3
Ka ora_ping_cdb1_3
ul 9790 lic
sa n 9792 ora_acms_cdb1_3
Ah 9794 ora_dia0_cdb1_3
9796 ora_lmon_cdb1_3
9798 ora_lmd0_cdb1_3
9800 ora_lms0_cdb1_3
9804 ora_rms0_cdb1_3
9806 ora_lmhb_cdb1_3
9808 ora_lck1_cdb1_3
9810 ora_dbw0_cdb1_3
9812 ora_lgwr_cdb1_3
9814 ora_ckpt_cdb1_3
9816 ora_smon_cdb1_3
9818 ora_reco_cdb1_3
9820 ora_lreg_cdb1_3
9822 ora_rbal_cdb1_3
9824 ora_asmb_cdb1_3
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 7
9826 ora_mmon_cdb1_3
9830 ora_mmnl_cdb1_3
9832 ora_d000_cdb1_3
9834 ora_s000_cdb1_3
9836 ora_mark_cdb1_3
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

9841 ora_gcr0_cdb1_3
9843 ora_lck0_cdb1_3
9857 ora_rsmn_cdb1_3
9906 ora_tmon_cdb1_3
9908 ora_tt00_cdb1_3
9960 ora_smco_cdb1_3
9962 ora_w000_cdb1_3
9968 ora_gtx0_cdb1_3
ble
9970 ora_rcbg_cdb1_3
fe r a
ans
9972 ora_ppa7_cdb1_3
n - t r
9987 ora_aqpc_cdb1_3
o
9989 ora_qm02_cdb1_3
s an
9991 ora_q001_cdb1_3
) ha deฺ
9993 ora_q002_cdb1_3
c o m ui
9995 ora_qm05_cdb1_3 a il ent G

10013 ora_p000_cdb1_3
@ gm tud
b d i s S
10015 ora_p001_cdb1_3
i r h
k
10017 ora_p002_cdb1_3
h ab se t
a t
10019 ora_p003_cdb1_3
t o u
i m
r ( ense
10319 ora_cjq0_cdb1_3
b
n u l Ka lic
11166 ora_w001_cdb1_3

hs a 11995 ora_w002_cdb1_3
A 13641 ora_p004_cdb1_3
13643 ora_p005_cdb1_3
[oracle@host01 bin]$

c. Use LSNRCTL to list the CDB instances on two nodes of the server pool.
1) Check the services on the first node.
[oracle@host01 bin]$ ./lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 02-SEP-


2014 06:54:40

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

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 8
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0
- Production
Start Date 30-AUG-2014 07:22:00
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Uptime 2 days 23 hr. 32 min. 40 sec


Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File
/u01/app/12.1.0/grid/network/admin/listener.ora
Listener Log File
/u01/app/grid/diag/tnslsnr/host01/listener/alert/log.xml
ble
Listening Endpoints Summary...
fe r a
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
t r a ns
o n
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.0.2.247)(PORT=1521
-
)))
s an
) h a eฺ
o m uid
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.0.2.101)(PORT=1521
c
)))
a il ent G

Services Summary...
g m tud
d @
Service "+ASM" has 1 instance(s).
b s S
b i r t h i
k a
Instance "+ASM1", status
s e READY, has 1 handler(s) for this
service...
a th hasto1 uinstance(s).
i r m se
Service ("cdb1"
a
Instance n
b ice"cdb1_3", status READY, has 1 handler(s) for this
u l K l
service...
a n
hs
Service "cdb1XDB" has 1 instance(s).
A Instance "cdb1_3", status READY, has 1 handler(s) for this
service...
Service "pdb1" has 1 instance(s).
Instance "cdb1_3", status READY, has 1 handler(s) for this
service...
The command completed successfully
[oracle@host01 bin]$

2) Check the services on the second node.


[oracle@host01 bin]$ ssh host02
Last login: Mon Sep 2 01:17:02 2014 from 192.0.2.1
[oracle@host02 ~]$ . oraenv
ORACLE_SID = [oracle] ? cdb1_2
ORACLE_HOME = [/home/oracle] ?
/u01/app/oracle/product/12.1.0/dbhome_1

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

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 9
The Oracle base has been set to /u01/app/oracle

[oracle@host02 ~]$ lsnrctl status



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

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.0.2.245)(PORT=1521
)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.0.2.102)(PORT=1521
)))
Services Summary...
Service "+ASM" has 1 instance(s). ble
fe r a
Instance "+ASM3", status READY, has 1 handler(s) for this
ans
service...
n - t r
Service "cdb1" has 1 instance(s).
o
an
Instance "cdb1_2", status READY, has 1 handler(s) for this
s
service...
) ha deฺ
Service "cdb1XDB" has 1 instance(s).
c o m ui
a il ent G

Instance "cdb1_2", status READY, has 1 handler(s) for this
service...
@ gm tud
b d
Service "pdb1" has 1 instance(s).
i s S
i r h
h k ab se t
Instance "cdb1_2", status READY, has 1 handler(s) for this
service...
a t t o u
m
r ( ense
The command completed successfully
i
b
u Ka lic ~]$ exit
l [oracle@host02
a n
Ahs logout
Connection to host02 closed.
[oracle@host01 bin]$

d. Use SRVCTL to stop and restart the CDB as you traditionally would do for any non-
CDB.
[oracle@host01 bin]$ . oraenv
ORACLE_SID = [oracle] ? cdb1_3
ORACLE_HOME = [/home/oracle] ?
/u01/app/oracle/product/12.1.0/dbhome_1
The Oracle base has been set to /u01/app/oracle

[oracle@host01 bin]$ srvctl stop database -d cdb1

[oracle@host01 bin]$ srvctl status database -db cdb1


Instance cdb1_1 is not running on node host03
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 10
Instance cdb1_2 is not running on node host02
Instance cdb1_3 is not running on node host01

[oracle@host01 bin]$ srvctl start database -d cdb1


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

[oracle@host01 bin]$ srvctl status database -db cdb1


Instance cdb1_1 is running on node host03
Instance cdb1_2 is running on node host02
Instance cdb1_3 is running on node host01

[oracle@host01 bin]$ cd
[oracle@host01 ~]$

ble
fe r a
e. Use SQL*Plus to connect to the instances of the cdb1 CDB, check the UNDO
ans
tablespaces and the groups of redo log files, and verify the existence of the pdb1 PDB.
n - t r
1) Check the UNDO tablespaces created in the CDB.
a no
[oracle@host01 ~]$ sqlplus / as sysdba
h a s ฺ
o m )
u i de
Connected to:
a ilฺc ent G
Oracle Database 12c Enterprise
@ gm Editiont u d Release 12.1.0.2.0 -
64bit Production
b d i s S
i r
b OLAP, t h
k a
With the Partitioning, Real
e Application Clusters, Automatic

ApplicationaTesting
us
th to options
Storage Management, Advanced Analytics and Real

i r (m nse
b ice
u Ka SELECT
l SQL> l name, cdb, con_id FROM v$database;
a n
Ahs NAME CDB CON_ID
--------- --- ----------
CDB1 YES 0

SQL> SELECT instance_name, con_id FROM v$instance;

INSTANCE_NAME CON_ID
---------------- ----------
cdb1_3 0

SQL> show con_name

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

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

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 11
SQL> SELECT tablespace_name, con_id
FROM cdb_tablespaces
WHERE contents = 'UNDO';
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

TABLESPACE_NAME CON_ID
------------------------------ ----------
UNDOTBS1 1
UNDOTBS2 1
UNDOTBS3 1

SQL>

ble
2) Check the groups of redo log files created for the three CDB instances. fe r a
ans
SQL> SELECT group#, con_id FROM v$logfile;
n - t r
o
s an
GROUP# CON_ID
) ha deฺ
---------- ----------
c o m ui
2 0
a il ent G

1 0
g m tud
5 0 d
b @ s S
i r h i
6
3 thk
ab 0 se t
0

a t o u
i m
r ( ense
4 0
a b
u l 6Krows lic
a n selected.

Ahs SQL>

3) Check the PDB created in the CDB and its open mode. If the PDB is not
opened, open it.
SQL> COL pdb_name format a10
SQL> SELECT pdb_id, pdb_name, guid, status FROM cdb_pdbs;

PDB_ID PDB_NAME GUID STATUS


---------- ---------- -------------------------------- --------
3 PDB1 E13E44A728D5266BE043650200C0187D NORMAL
2 PDB$SEED E13D83F6E4966F2AE043650200C0058C NORMAL

SQL> SELECT name, open_mode FROM v$pdbs;

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

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 12
NAME OPEN_MODE
------------------------------ ----------
PDB$SEED READ ONLY
PDB1 MOUNTED
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

SQL> ALTER SESSION SET CONTAINER=pdb1;

Session altered.

SQL> show con_name

CON_NAME
------------------------------
ble
PDB1
fe r a
ans
SQL> CONNECT / AS SYSDBA
n - t r
Connected.
a no
h a s ฺ
SQL> SELECT name FROM cdb_services;
o m )
u i de
a ilฺc ent G
gm tud
NAME

b d @ s S
---------------------------------------------------------------
i r h i
ab se t
SYS$BACKGROUND
SYS$USERS
t h k u
cdb1XDB ma t o
cdb1bir
( nse
u l Ka lice
a n
hs
SQL> ALTER PLUGGABLE DATABASE pdb1 OPEN;
A
Pluggable database altered.

SQL> SELECT name, open_mode FROM v$pdbs;

NAME OPEN_MODE
------------------------------ ----------
PDB$SEED READ ONLY
PDB1 READ WRITE

SQL>

4) Check the services.


SQL> SELECT name FROM v$services;

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

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 13
NAME
---------------------------------------------------------------
pdb1
cdb1XDB
cdb1
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

SYS$BACKGROUND
SYS$USERS

SQL> EXIT

f. Switch to the second node to verify the open mode of the PDB in the second instance
of the CDB.
ble
[oracle@host01 ~]$ ssh host02
fe r a
[oracle@host02 ~]$ . oraenv
ans
ORACLE_SID = [oracle] ? cdb1_2
n - t r
ORACLE_HOME = [/home/oracle] ?
a no
/u01/app/oracle/product/12.1.0/dbhome_1
h a s ฺ
The Oracle base has been set to /u01/app/oracle
o m )
u i de
a lฺc nt G
isysdba
gm tude
[oracle@host02 ~]$ sqlplus / as

b d @ s S
Connected to:
b i r h i
t Edition Release 12.1.0.2.0 -
Oracle Databaseka s e
a t h o u
12c Enterprise
64bit Production
m t
b i
With ther ( Partitioning,
e n se Real Application Clusters, Automatic
K a
Storage
l Application c
li Testing optionsAdvanced Analytics and Real
Management, OLAP,

a n u
Ahs
SQL> SELECT name, cdb, con_id FROM v$database;

NAME CDB CON_ID


--------- --- ----------
CDB1 YES 0

SQL> SELECT instance_name, con_id FROM v$instance;

INSTANCE_NAME CON_ID
---------------- ----------
cdb1_2 0

SQL> show con_name

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

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 14
------------------------------
CDB$ROOT

SQL> SELECT name, open_mode FROM v$pdbs;


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

NAME OPEN_MODE
------------------------------ ----------
PDB$SEED READ ONLY
PDB1 MOUNTED

SQL> ALTER SESSION SET CONTAINER=pdb1;

Session altered.
ble
fe r a
SQL> SELECT name FROM v$services; ans
n - t r
o
NAME
s an
ha deฺ
---------------------------------------------------------------
)
pdb1
c o m ui
a il ent G

SQL> exit
@ gm tud
b d i s S
[oracle@host02 ~]$ exit
i r h
logout
h k ab se t
Connection a t host02
to
t o uclosed.
i m
r ( ens~]$
[oracle@host01 e
b
n u l Ka lic
hs a g. Verify that the pdb1 service is accessible from instance cdb1_3 on the first node but
A also from the cdb1_2 instance on the second node and from the cdb1_1 instance on
the third node. First restart the listener.
[oracle@host01 ~]$ su - grid
Password:
Last login: Mon Sep 2 05:16:31 2014 from host01.example.com
[grid@host01 ~]$ . oraenv
ORACLE_SID = [grid] ? +ASM1
The Oracle base has been set to /u01/app/grid

[grid@host01 ~]$ srvctl stop listener -listener LISTENER

[grid@host01 ~]$ srvctl start listener -listener LISTENER

[grid@host01 ~]$ exit


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

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 15
[oracle@host01 ~]$ sqlplus /nolog
SQL*Plus: Release 12.1.0.2.0 Production on Wed Jul 17 00:38:28
2014
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

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

SQL> CONNECT system@"host01:1521/pdb1"


Enter password:
Connected.
SQL> SELECT instance_name, con_id FROM v$instance;

INSTANCE_NAME CON_ID
ble
---------------- ----------
fe r a
ans
cdb1_3 0
n - t r
SQL> show con_name a no
h a s ฺ
CON_NAME o m )
u i de
------------------------------ailฺ
c t G
n
PDB1
@ gm tude
b d i s S
i r h
k ab se t
SQL> CONNECT system@"host02:1521/pdb1"
h
a
Enter password: t t o u
i m
r ( ense
b
ERROR:

u Ka lic
l ORA-01033:ORACLE initialization or shutdown in progress
a n Process ID: 0
Ahs Session ID: 0 Serial Number: 0

Warning: You are no longer connected to ORACLE.


SQL>

Notice that the connection does not complete because pdb1 was opened for instance
cdb1_3 on host01 only. Remember that the clause INSTANCES was not used in the
ALTER PLUGGABLE DATABASE OPEN statement in task 2.e.3).
SQL> CONNECT / AS SYSDBA
Connected.
SQL> ALTER PLUGGABLE DATABASE pdb1 OPEN INSTANCES=('cdb1_2');

Pluggable database altered.

SQL> CONNECT system@"host02:1521/pdb1"


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

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 16
Enter password:
Connected.

SQL> SELECT instance_name, con_id FROM v$instance;


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

INSTANCE_NAME CON_ID
---------------- ----------
cdb1_2 0

SQL> show con_name

CON_NAME
------------------------------
ble
PDB1
fe r a
ans
n - t r
no
SQL> CONNECT system@"host03:1521/pdb1"
Enter password:
s ฺa
ERROR: h a
o m )
u i de
ORA-01033:ORACLE initialization or shutdown in progress
Process ID: 0 a ilฺc ent G
Session ID: 0 Serial Number: 0
@ gm tud
b d i s S
Warning: You areano
i r
b longer h
t connected to ORACLE.
h k u s e
a t t o
i
SQL> EXIT
m
r ( ense
b
Ka
Thel connection
u
ic not complete on host03 because pdb1 was opened for instance
ldoes
sancdb1_3 on host01 and cdb1_2 on host02 only.
Ah

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

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 17
Practice 12-2: Cloning a PDB in the RAC CDB

Overview
In this practice, you will clone the pdb1 PDB into a new PDB named pdb2 in the cdb1 CDB.
This operation requires to close and open PDBs on multiple instances of the CDB.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Tasks
1. Connect to the root of the multitenant container database cdb1 on any of the three
instances.
[oracle@host01 ~]$ . oraenv
ORACLE_SID = [cdb1] ? cdb1_3
ORACLE_HOME = [/home/oracle] ?
/u01/app/oracle/product/12.1.0/dbhome_1
ble
The Oracle base has been set to /u01/app/oracle
fe r a
ans
[oracle@host01 ~]$ sqlplus / as sysdba
n - t r
Connected to: a no
h a s ฺ
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 -
64bit Production
o m )
u i de
a ilฺc ent G
With the Partitioning, OLAP, Advanced Analytics and Real
Application Testing options
@ gm tud
b d i s S
i r h
SQL>
h k ab se t
a t t o u
m
r ( enFiles
2. Use OracleiManaged se to locate the data files of the new pdb2.
b
u l Ka SHOWlicPARAMETER db_create_file_dest
SQL>
san NAME TYPE VALUE
Ah ------------------------------------ ----------- --------------
db_create_file_dest string +DATA

SQL>

3. Create pdb2 from pdb1.


a. Use the CREATE PLUGGABLE DATABASE command to create pdb2.
SQL> CREATE PLUGGABLE DATABASE pdb2 FROM pdb1;

Pluggable database created.

SQL> SELECT name, open_mode FROM v$pdbs;

NAME OPEN_MODE
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 18
------------------------------ ----------
PDB$SEED READ ONLY
PDB1 READ WRITE
PDB2 MOUNTED
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

SQL>

b. Now, open both PDBs in READ WRITE mode on all the CDB instances.
SQL> ALTER PLUGGABLE DATABASE pdb1 CLOSE IMMEDIATE
INSTANCES=ALL;

Pluggable database altered.


ble
fe r a
SQL> ALTER PLUGGABLE DATABASE ALL OPEN READ WRITE INSTANCES=ALL;
ans
n - t r
Pluggable database altered.
a no
h a s ฺ
SQL> SELECT name, open_mode FROM v$pdbs;
o m )
u i de
a ilฺc ent G
NAME
@ gm ----------
tud
OPEN_MODE
d
------------------------------ S
PDB$SEED b i rb this READ ONLY
PDB1
t h ka use READ WRITE
PDB2 a
(m nse t o READ WRITE
i r
b ice
u Ka SELECT
l SQL> l pdb_id, pdb_name, guid, status FROM cdb_pdbs;
a n
Ahs PDB_ID PDB_NAME GUID STATUS
---------- ---------- -------------------------------- --------
3 PDB1 E13E44A728D5266BE043650200C0187D NORMAL
2 PDB$SEED E13D83F6E4966F2AE043650200C0058C NORMAL
4 PDB2 E2B1483E90856557E043650200C01D40 NORMAL

SQL> ALTER SESSION SET CONTAINER=pdb2;

Session altered.

SQL> SELECT name FROM dba_services;

NAME
---------------------------------------------------------------
pdb2

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

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 19
SQL> EXIT

c. Use LSNRCTL to verify that the new pdb2 service associated to the new PDB in the
CDB instance is automatically started after the PDB is opened. Because the PDB is
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

opened in all the CDB instances, the pdb2 PDB service is started in all the CDB
instances.
[oracle@host01 ~]$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 30-JUL-


2014 05:44:45

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


ble
fe r a
ans
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
n - t r
STATUS of the LISTENER
o
------------------------
s an
Alias LISTENER
) ha deฺ
Version o m ui
TNSLSNR for Linux: Version 12.1.0.2.0
c
- Production
a il ent G

Start Date gm tud
16-JUL-2014 05:38:51
@
Uptime b d i s S
14 days 0 hr. 5 min. 55 sec
i r h
Trace Level
h k ab se t
off
Security a t t o u
ON: Local OS Authentication
SNMP
i m
r ( ense OFF
b
n u l Ka lic
Listening Endpoints Summary...

hs a (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
A (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.0.2.101)(PORT=1521
)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.0.2.239)(PORT=1521
)))
Services Summary...

Service "+ASM" has 1 instance(s).


Instance "+ASM1", status READY, has 2 handler(s) for this
service...

Service "cdb1" has 1 instance(s).


Instance "cdb1_3", status READY, has 1 handler(s) for this
service...
Service "cdb1XDB" has 1 instance(s).

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

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 20
Instance "cdb1_3", status READY, has 1 handler(s) for this
service...
Service "pdb1" has 1 instance(s).
Instance "cdb1_3", status READY, has 1 handler(s) for this
service...
Service "pdb2" has 1 instance(s).
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

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


service...
The command completed successfully

[oracle@host01 ~]$

4. Use the net service name to connect to pdb2 as the system user on any of the three
ble
instances of the CDB.
fe r a
[oracle@host01 ~]$ sqlplus /nolog
ans
SQL> CONNECT system@"host01:1521/pdb2" n - t r
o
Enter password:
s an
Connected.
) ha deฺ
c o m ui
SQL> show con_name a il ent G

CON_NAME
@ gm tud
b d i s S
i r
------------------------------
h
PDB2
h k ab se t
a t t o u
i m
r ( ensystem@"host02:1521/pdb2"
SQL> CONNECT se
b
u Ka password:
l Enter lic
a n Connected.
Ahs
SQL> CONNECT system@"host03:1521/pdb2"
Enter password:
Connected.

SQL> EXIT

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

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 21
Practice 12-3: Affinitizing PDB Services to CDB Instances

Overview
In this practice, you will “affinitize” connections to a PDB to one or particular CDB instances.
Because server pools determine which services run together or separately, you can configure
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

and maintain required affinity or isolation.

Tasks
1. Create a dynamic PDB service, mypdb1serv, for the pdb1 PDB in the CDB which will
“affinitize” connections to pdb1 to all the CDB instances.
a. Check the configuration of the server pools.
ble
[oracle@host01 ~]$ srvctl status srvpool
fe r a
Server pool name: Free
ans
Active servers count: 0
n - t r
Server pool name: Generic
a no
Active servers count: 0
h a s ฺ
Server pool name: cdb1pool
o m )
u i de
Active servers count: 3
a ilฺc ent G
[oracle@host01 ~]$
@ gm tud
[oracle@host01 ~]$bisrvctl h is S srvpool -serverpool
rbd tconfig cdb1pool
t
Server pool name:h ka cdb1pool
u se
( m a0, Min:to 0, Max: 3
Importance:
b i r hub e n se
Ka
Category:
u l Candidate licserver names:
a n
Ahs [oracle@host01 ~]$

b. Check the services. You notice that the default services created at PDB creation are
not managed by the clusterware.
[oracle@host01 ~]$ srvctl status service -db cdb1
[oracle@host01 ~]$
[oracle@host01 ~]$ srvctl config service -db cdb1
[oracle@host01 ~]$

c. Create a dynamic PDB service for the pdb1 PDB in the CDB which will “affinitize”
connections to pdb1 to all the CDB instances uniformly.
1) Create the service from the connection on the first node of the server pool.
[oracle@host01 ~]$ srvctl add service -db cdb1 -pdb pdb1 -
service mypdb1serv -policy automatic -serverpool cdb1pool -
cardinality uniform
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 22
[oracle@host01 ~]$ srvctl config service -db cdb1
Service name: mypdb1serv
Service is enabled
Server pool: cdb1pool
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Cardinality: UNIFORM
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Global: false
Commit Outcome: false
ble
Failover type:
fe r a
ans
Failover method:
n - t r
TAF failover retries:
o
TAF failover delay:
s an
Connection Load Balancing Goal: LONG
) ha deฺ
Runtime Load Balancing Goal: NONE
c o m ui
TAF policy specification: NONE a il ent G

Edition:
@ gm tud
b d i s S
i r
Pluggable database name: pdb1
h
k
Maximum lag time: ANY
h ab se t
a t t
SQL Translation Profile:o u
i m
r ( ense
Retention: 86400 seconds
b
n u l Ka lic
Replay Initiation Time: 300 seconds

hs a Session State Consistency:


A Service is enabled on nodes:
Service is disabled on nodes:
[oracle@host01 ~]$

2) Check that the PDB service is also created on the two other nodes of the server
pool.
[oracle@host01 ~]$ ssh host02
[oracle@host02 ~]$
[oracle@host02 ~]$ . oraenv
ORACLE_SID = [oracle] ? cdb1_2
ORACLE_HOME = [/home/oracle] ?
/u01/app/oracle/product/12.1.0/dbhome_1
The Oracle base has been set to /u01/app/oracle

[oracle@host02 ~]$ srvctl config service -db cdb1


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

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 23
Service name: mypdb1serv
Service is enabled
Server pool: cdb1pool
Cardinality: UNIFORM
Disconnect: false
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Service role: PRIMARY


Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Global: false
Commit Outcome: false
Failover type:
Failover method:
ble
TAF failover retries:
fe r a
ans
TAF failover delay:
n - t r
Connection Load Balancing Goal: LONG
o
Runtime Load Balancing Goal: NONE
s an
TAF policy specification: NONE
) ha deฺ
Edition:
c o m ui
Pluggable database name: pdb1 a il ent G

Maximum lag time: ANY
@ gm tud
b d i s S
SQL Translation Profile:
i r h
k ab se t
Retention: 86400 seconds
h
a t t o u
Replay Initiation Time: 300 seconds
i m
r ( ense
Session State Consistency:
b
n u l Ka lic
Service is enabled on nodes:

hs a Service is disabled on nodes:


A [oracle@host02 ~]$ exit
logout
Connection to host02 closed.
[oracle@host01 ~]$

You can reiterate the same verification on the third node of the server pool.
[oracle@host01 ~]$ ssh host03
[oracle@host03 ~]$ . oraenv
ORACLE_SID = [oracle] ? cdb1_1
ORACLE_HOME = [/home/oracle] ?
/u01/app/oracle/product/12.1.0/dbhome_1
The Oracle base has been set to /u01/app/oracle

[oracle@host03 ~]$ srvctl config service -db cdb1


Service name: mypdb1serv
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 24
Service is enabled
Server pool: cdb1pool
Cardinality: UNIFORM
Disconnect: false
Service role: PRIMARY
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Management policy: AUTOMATIC


DTP transaction: false
AQ HA notifications: false
Global: false
Commit Outcome: false
Failover type:
Failover method:
TAF failover retries:
ble
TAF failover delay:
fe r a
Connection Load Balancing Goal: LONG ans
n - t r
Runtime Load Balancing Goal: NONE
o
TAF policy specification: NONE
s an
Edition:
) ha deฺ
Pluggable database name: pdb1
c o m ui
Maximum lag time: ANY a il ent G

SQL Translation Profile:
@ gm tud
b d i s S
Retention: 86400 seconds
i r h
k ab se t
Replay Initiation Time: 300 seconds
h
a t t o
Session State Consistency: u
i m
r ( ense
Service is enabled on nodes:
b
n u l Ka lic
Service is disabled on nodes:

hs a [oracle@host03 ~]$ exit


A Logout
Connection to host03 closed.

[oracle@host01 ~]$

d. Close the PDB. You will verify that restarting the CDB automatically starts the dynamic
PDB service and opens the associated PDB.
[oracle@host01 ~]$ sqlplus / as sysdba

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

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

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 25
SQL> ALTER PLUGGABLE DATABASE pdb1 CLOSE IMMEDIATE
INSTANCES=ALL;
Pluggable database altered.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

SQL> SELECT name, open_mode FROM v$pdbs;

NAME OPEN_MODE
------------------------------ ----------
PDB$SEED READ ONLY
PDB1 MOUNTED
PDB2 READ WRITE

ble
SQL> EXIT
fe r a
ans
n - t r
e. Stop and restart the CDB.
a no
[oracle@host01 ~]$ srvctl stop database -d cdb1
h a s ฺ
[oracle@host01 ~]$
o m )
u i de -eval
[oracle@host01 ~]$ srvctl start database c
ilฺnodes t G
-db cdb1
a n
Database cdb1 will be started
Service mypdb1serv will @
gm tudonenodes host03,host02,host01
on host03,host02,host01

d be started
s S
[oracle@host01 ~]$ irb t h i
h k ab srvctl
s e
[oracle@host01
a t ~]$
o u start database -db cdb1

i r (m nse t
a b ice ~]$ srvctl status database -db cdb1
[oracle@host01
K
ul Instance l cdb1_1 is running on node host03
sa n Instance cdb1_2 is running on node host02
Ah Instance cdb1_3 is running on node host01
[oracle@host01 ~]$

f. Verify that the new dynamic PDB service is started and the PDB opened automatically.
It may take a few moments for the service to be started on all hosts. (If you do not wish
to wait, use SRVCTL to start the service: srvctl start service -d cdb1 -
service mypdb1serv).
[oracle@host01 ~]$ srvctl status service -db cdb1
Service mypdb1serv is running on nodes: host03,host02,host01.

[oracle@host01 ~]$ sqlplus / as sysdba

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 -
64bit Production
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 26
With the Partitioning, Real Application Clusters, Automatic
Storage Management, OLAP,
Advanced Analytics and Real Application Testing options

SQL> SELECT name, open_mode FROM v$pdbs;


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

NAME OPEN_MODE
------------------------------ ----------
PDB$SEED READ ONLY
PDB1 READ WRITE
PDB2 MOUNTED

SQL> SELECT name FROM v$services;


ble
fe r a
NAME
ans
--------------------------------------------------------------- n - t r
o
mypdb1serv
s an
pdb2
) ha deฺ
pdb1
c o m ui
cdb1XDB
a il ent G

cdb1
@ gm tud
SYS$BACKGROUND
b d i s S
i r h
SYS$USERS
h k ab se t
a t t o u
m
( nse
7 rowsr selected.
i
b
u l Ka lice
a n SQL> EXIT

Ahs [oracle@host01 ~]$


Notice that PDBs are automatically opened by clusterware in all the instances in which the
service is started. There is therefore no need to create a trigger AFTER STARTUP ON
DATABASE to open PDBs as it is the case in non-RAC CDBs.

g. You can also stop and restart the service manually.


[oracle@host01 ~]$ srvctl stop service -d cdb1 -service
mypdb1serv

[oracle@host01 ~]$ srvctl status service -d cdb1 -service


mypdb1serv
Service mypdb1serv is not running.

[oracle@host01 ~]$ srvctl start service -d cdb1 -service


mypdb1serv

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

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 27
[oracle@host01 ~]$ srvctl status service -d cdb1 -service
mypdb1serv
Service mypdb1serv is running on nodes: host03,host02,host01

[oracle@host01 ~]$ lsnrctl status


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

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 17-JUL-


2014 06:07:37

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

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
ble
------------------------
fe r a
Alias LISTENER
ans
Version TNSLSNR for Linux: Version 12.1.0.2.0
n - t r
o
an
- Production
Start Date 16-JUL-2014 05:39:02 s
ha deฺ
Uptime )
1 days 0 hr. 28 min. 37 sec
m ui
c o
Trace Level off
a il ent G

Security
gm tud
ON: Local OS Authentication
@
SNMP OFF
b d i s S
i r h
ab se t
Listener Parameter File
h k
/u01/app/12.1.0/grid/network/admin/listener.ora
t u
m a
Listener Log File t o
i r ( ense
/u01/app/grid/diag/tnslsnr/host01/listener/alert/log.xml
b
n u l Ka lic
Listening Endpoints Summary...

hs a (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
A (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.0.2.101)(PORT=1521
)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.0.2.239)(PORT=1521
)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM1", status READY, has 2 handler(s) for this
service...
Service "cdb1" has 1 instance(s).
Instance "cdb1_3", status READY, has 1 handler(s) for this
service...
Service "cdb1XDB" has 1 instance(s).
Instance "cdb1_3", status READY, has 1 handler(s) for this
service...
Service "mypdb1serv" has 1 instance(s).
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 28
Instance "cdb1_3", status READY, has 1 handler(s) for this
service...
Service "pdb1" has 1 instance(s).
Instance "cdb1_3", status READY, has 1 handler(s) for this
service...
Service "pdb2" has 1 instance(s).
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

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


service...
The command completed successfully
[oracle@host01 ~]$

h. Use the service to connect to the PDB on any of the CDB instances.
[oracle@host01 ~]$ sqlplus /nolog
ble
fe r a
ans
SQL> CONNECT system@"host01/mypdb1serv"
n - t r
Enter password: o
Connected.
s an
) ha deฺ
SQL> SELECT name, open_mode FROM v$pdbs;
c o m ui
a il ent G

NAME
@ gm OPEN_MODE
tud
d S
i rb this ----------
------------------------------
b
PDB1
t h ka use READ WRITE

( m a to
s e
ir ensystem@"host02/mypdb1serv"
a b
SQL> CONNECT
c
u l Enter li
K password:
a n Connected.
Ahs
SQL> SELECT name FROM v$services;

NAME
---------------------------------------------------------------
mypdb1serv
pdb1

SQL> CONNECT system@"host03/mypdb1serv"


Enter password:
Connected.

SQL> SELECT name FROM v$services;

NAME

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

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 29
---------------------------------------------------------------
mypdb1serv
pdb1

SQL> EXIT
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

2. You can also “affinitize” connections to pdb2 to a single node by defining the
singpdb2serv service cardinality to SINGLETON.
a. Create and start the service for pdb2.
[oracle@host01 ~]$ srvctl add service -db cdb1 -pdb pdb2 -
service singpdb2serv -policy automatic -serverpool cdb1pool -
cardinality singleton

ble
[oracle@host01 ~]$ srvctl start service -d cdb1 -service
fe r a
singpdb2serv -eval
ans
Service singpdb2serv will be started on node host01
n - t r
a no
[oracle@host01 ~]$ srvctl start service -dacdb1
h s -service
singpdb2serv
m ) i d eฺ
i l ฺ co t Gu
[oracle@host01 ~]$ srvctl status m a serviced e n -d cdb1 -service
@ g tu
singpdb2serv
d s S
Service singpdb2serv
a b irbis running
t hi on nodes: host01
[oracle@host01 k~]$ e
a th to us
i r (m nse
ab that lyou
b. Check
l K i c ecan use the service to connect to pdb2 only on host01 and that the
a n u PDB is opened in the CDB instance on host01 only.
s
Ah [oracle@host01 ~]$ sqlplus /nolog

SQL> CONNECT system@"host01/singpdb2serv"


Enter password:
Connected.

SQL> SELECT name, open_mode FROM v$pdbs;

NAME OPEN_MODE
------------------------------ ----------
PDB2 READ WRITE

SQL> SELECT name FROM v$services;

NAME

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

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 30
---------------------------------------------------------------
singpdb2serv
pdb2

SQL>
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

c. Check that you cannot use the service to connect to pdb2 on host02 nor host03
and that the PDB is closed in the CDB instances on host02 and host03.
SQL> CONNECT system@"host02/singpdb2serv"
Enter password:
ERROR:
ORA-12514: TNS:listener does not currently know of service
ble
requested in connect descriptor
fe r a
ans
Warning: You are no longer connected to ORACLE.
n - t r
a no
SQL> CONNECT system@"host03/singpdb2serv" s
Enter password: ) ha deฺ
c o m ui
ERROR: ฺ
ail currently
n t G
ORA-12514: TNS:listener doesm
g not
t u de know of service
requested in connect descriptor
b d @ sS
a b i r
e t hi
Warning: You are
a thk noto longer
us connected to ORACLE.
i r (m ensystem@"host02/cdb1"
SQL>bCONNECT se
u Ka password:
l Enter lic
a n
hs
Connected.
A
SQL> select name, open_mode from v$pdbs;

NAME OPEN_MODE
------------------------------ ----------
PDB$SEED READ ONLY
PDB1 READ WRITE
PDB2 MOUNTED

SQL> CONNECT system@"host03/cdb1"


Enter password:
Connected.

SQL> select name, open_mode from v$pdbs;

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

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 31
NAME OPEN_MODE
------------------------------ ----------
PDB$SEED READ ONLY
PDB1 READ WRITE
PDB2 MOUNTED
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

SQL> EXIT
[oracle@host01 ~]$

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 32
Practice 12-4: Dropping a PDB

Overview
In this practice, you will drop a PDB in the CDB and verify that the services and data files are
deleted.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Tasks
1. To drop the pdb2, first stop and remove the service from the resources configuration.
[oracle@host01 ~]$ srvctl stop service -d cdb1 -service
singpdb2serv

[oracle@host01 ~]$ srvctl remove service -d cdb1 -service


singpdb2serv
ble
[oracle@host01 ~]$
fe r a
2. Drop the pdb2 PDB. ans
n - t r
[oracle@host01 ~]$ ~]$ sqlplus /nolog
a no
h a s ฺ
SQL> CONNECT system@"host01/pdb2"
o m )
u i de
Enter password:
a ilฺc ent G
Connected.
@ gm tud
b dv$datafile;
i s S
i r h
ab se t
SQL> SELECT name FROM
t h k u
m a t o
NAME
b i r ( ense
Ka
----------------------------------------------------------------
u lic
l ----------------
a n
hs
+DATA/CDB1/DATAFILE/undotbs2.294.825668383
A +DATA/CDB1/C45A345T5F09726D9C25F01AZ04366B8/DATAFILE/system.268.
335670735
+DATA/CDB1/C45A345T5F09726D9C25F01AZ04366B8/DATAFILE/sysaux.273.
335670729
+DATA/CDB1/C45A345T5F09726D9C25F01AZ04366B8/DATAFILE/users.282.3
35671601

SQL> CONNECT / AS SYSDBA


Connected.

SQL> SELECT name FROM v$services;

NAME
---------------------------------------------------------------
mypdb1serv
pdb2
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 33
pdb1
cdb1XDB
cdb1
SYS$BACKGROUND
SYS$USERS
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

7 rows selected.

SQL> DROP PLUGGABLE DATABASE pdb2 INCLUDING DATAFILES;


*
ERROR at line 1:
ORA-65025: Pluggable database PDB2 is not closed on all
instances.
ble
fe r a
SQL> ALTER PLUGGABLE DATABASE pdb2 CLOSE INSTANCES=ALL;
ans
n - t r
Pluggable database altered.
a no
h a s ฺ
SQL> DROP PLUGGABLE DATABASE pdb2 INCLUDING
o m u de
) DATAFILES;
i
a i lฺc nt G
Pluggable database dropped. m
g t u de
b d @ s S
i r h i
SQL>
h k ab se t
a t t o u
i
3. Verify that the
m
r (data efiles e deleted.
sare
b n
u l Ka SELECT
SQL> lic name FROM v$datafile;
san
Ah NAME
---------------------------------------------------------------
-----------------
+DATA/CDB1/DATAFILE/system.285.825666373
+DATA/CDB1/DATAFILE/sysaux.287.825666251
+DATA/CDB1/DATAFILE/undotbs1.283.825666541
+DATA/CDB1/DD7C48AA5A4404A2E04325AAE80A403C/DATAFILE/system.286.
825666707
+DATA/CDB1/DATAFILE/users.271.825666537
+DATA/CDB1/DD7C48AA5A4404A2E04325AAE80A403C/DATAFILE/sysaux.284.
825666703
+DATA/CDB1/DATAFILE/undotbs2.294.825668383
+DATA/CDB1/DATAFILE/undotbs3.279.825668393
+DATA/CDB1/E5F09726D9C25FC4E043660200C075A9/DATAFILE/system.268.
825670735

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

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 34
+DATA/CDB1/E5F09726D9C25FC4E043660200C075A9/DATAFILE/sysaux.273.
825670729
+DATA/CDB1/E5F09726D9C25FC4E043660200C075A9/DATAFILE/users.282.8
25671601

11 rows selected.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

SQL>
Note that all files related to pdb2 are removed. The UNDO datafile is associated with the
instance, and not with any PDB.

4. Verify that the services are deleted. Check in V$SERVICES view and with LSNRCTL.
ble
SQL> SELECT name FROM v$services;
fe r a
ans
NAME
n - t r
o
an
---------------------------------------------------------------
mypdb1serv s
ha deฺ
pdb1 )
m ui
c o
cdb1XDB
a il ent G

cdb1
@ gm tud
SYS$BACKGROUND
b d i s S
i r h
ab se t
SYS$USERS
t h k u
m a t o
r ( ense
6 rows selected.
b i
u Ka EXITlic
l SQL>
a n
Ahs [oracle@host01 ~]$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 17-JUL-


2014 06:07:37

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

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0
- Production
Start Date 16-JUL-2014 05:39:02
Uptime 1 days 0 hr. 28 min. 37 sec
Trace Level off

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

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 35
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File
/u01/app/12.1.0/grid/network/admin/listener.ora
Listener Log File
/u01/app/grid/diag/tnslsnr/host01/listener/alert/log.xml
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

Listening Endpoints Summary...


(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.0.2.101)(PORT=1521
)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.0.2.239)(PORT=1521
)))
ble
Services Summary...
fe r a
Service "+ASM" has 1 instance(s).
ans
Instance "+ASM1", status READY, has 2 handler(s) for this n - t r
o
service...
s an
Service "cdb1" has 1 instance(s).
) ha deฺ
c o m ui
Instance "cdb1_3", status READY, has 1 handler(s) for this
service...
a il ent G

gm tud
Service "cdb1XDB" has 1 instance(s).
@
b d i s S
Instance "cdb1_3", status READY, has 1 handler(s) for this
i r h
ab se t
service...

h k
Service "mypdb1serv" has 1 instance(s).
t u
m a t o
Instance "cdb1_3", status READY, has 1 handler(s) for this
i r ( ense
service...
b
n u l Ka lic
Service "pdb1" has 1 instance(s).

hs a Instance "cdb1_3", status READY, has 1 handler(s) for this


A service...
The command completed successfully
[oracle@host01 ~]$

5. Close all terminal windows opened for this practice.

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

Practices for Lesson 12: Multitenant Architecture and RAC Environment


Chapter 12 - Page 36
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
Practices for h a s ฺ 13:
Lesson
Quality o m
of
) i
Service
u de
a ilฺc ent G
Management
@ gm tud
b d Chapter
i s S 13
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 13: Quality of Service Management


Chapter 13 - Page 1
Practices for Lesson 13

There are no practices for this lesson.


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

ble
fe r a
ans
n - t r
o
s an
) ha deฺ
c o m ui
a il ent G

@ gm tud
b d i s S
i r h
h k ab se t
a t t o u
i m
r ( ense
b
n u l Ka lic
hs a
A

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

Practices for Lesson 13: Quality of Service Management


Chapter 13 - Page 2

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