Sie sind auf Seite 1von 266

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

a ble
fe r
ans
n - t r
a no
Oracle Databaseh a s 12c: Install
m ) ideฺ
and Upgrade
ฺ co t GuWorkshop
o
y aho tuden
o2 @ Activity
s S Guide
d
a se t h i
e v
( x fn to u
l o rez ense
d oF lic
a n
Fern

D77766GC10
Edition 1.0
July 2013
D82687
Copyright © 2013, 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© 2019, 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.
a b le
fe r
Trademark Notice
an s
n - t r
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective
owners.
a no
h a s
Authors
m ) ideฺ
Donna Keesling, Dominique Jeunot, James Spiller
o ฺ co t Gu
Technical Contributors and Reviewers ya
ho den
@ S u
tCarol
d 2
Roy Swonger, Ira Singer, Darryl Balaski, Mark
o tFrenzen s
Fuller,
i Tagliaferri, Harald Van Breederode,
Joel Goodman, Prakash Jashnani,a Gerlinde h
f n ev use
z (x using:
This book was published e toOracle Tutor
F lore licens
n d o
a
Fern
Table of Contents
Practices for Lesson 1: Oracle Database 12c: Overview ..............................................................................1-1
Practices for Lesson 1....................................................................................................................................1-2
Practice 1-1: Listing Existing Instances and Oracle Homes ...........................................................................1-3
Practice 1-2: Determining the Locations of Data Files, Control Files and Redo Log Files .............................1-6
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Practice 1-3: Determining the Character Set of Existing Database(s) ............................................................1-18


Practice 1-4: Determining Existing Listeners ..................................................................................................1-20
Practices for Lesson 2: Oracle Software Installation Basics .......................................................................2-1
Practices for Lesson 2....................................................................................................................................2-2
Practices for Lesson 3: Installing Oracle Grid Infrastructure for a Standalone Server and Upgrading ASM
...........................................................................................................................................................................3-1
Practices for Lesson 3....................................................................................................................................3-2
Practice 3-1: Installing Oracle Grid Infrastructure and Upgrading ASM .........................................................3-4
Practice 3-2: Using the Upgraded ASM Instance ...........................................................................................3-15
a ble
Practice 3-3: Determining Existing Listeners ..................................................................................................3-23 fe r
an s
Practices for Lesson 4: Installing your Oracle Software ..............................................................................4-1
n - t r
a no
Practices for Lesson 4....................................................................................................................................4-2
Practice 4-1: Installing the Oracle Database 12c Software ............................................................................4-3
h a s
) ideฺ
Practices for Lesson 5: Creating an Oracle Database Using DBCA ............................................................5-1
m
o ฺ co t Gu
Practices for Lesson 5....................................................................................................................................5-2
Practice 5-1: Creating a Non-CDB .................................................................................................................5-3
aho tuden
Practice 5-2: Creating a CDB .........................................................................................................................5-21
y
@ sS
Practices for Lesson 6: Using Oracle Restart2...............................................................................................6-1
o
v a d t hi
Practices for Lesson 6....................................................................................................................................6-2
e
n
Practice 6-1: Starting and Stopping
f e OracleuRestart s ........................................................................................6-3
Practice 6-2: Starting and x
( StoppingeComponents
z Configuration t o ..........................................................................................6-6
r e s
lo icen to Upgrading to Oracle Database 12c ..............................................7-1
Practice 6-3: Managing of Components ...................................................................................6-8
Practices forFLesson 7:lIntroduction
n d o for Lesson 7....................................................................................................................................7-2
aPractices

Fern Practice 7-1: Upgrading an Oracle Database 11g Release 2 Database on File System to Oracle Database 12c
.......................................................................................................................................................................7-4
Solution 7-1: Upgrading an Oracle Database 11g Release 2 Database on File System to Oracle Database 12c
.......................................................................................................................................................................7-5
Practice 7-2: Upgrading an Oracle Database 11g Release 2 Database on ASM to Oracle Database 12c ....7-6
Solution 7-2: Upgrading and Oracle Database 11g Release 2 Database on ASM to Oracle Database 12c ..7-7
Practice 7-3: Upgrading an Oracle Database 11g Release 2 Database to Oracle Database 12c on a New OS or
Platform ..........................................................................................................................................................7-8
Solution 7-3: Upgrading an Oracle Database 11g Release 2 Database to Oracle Database 12c on a New OS or
Platform ..........................................................................................................................................................7-9
Practice 7-4: Upgrading an Oracle Database 11g Release 2 Database to Oracle Database 12c with Minimal
Downtime .......................................................................................................................................................7-10
Solution 7-4: Upgrading an Oracle Database 11g Release 2 Database to Oracle Database 12c with Minimal
Downtime .......................................................................................................................................................7-11
Practices for Lesson 8: Preparing a Database for Upgrade .........................................................................8-1
Practices for Lesson 8....................................................................................................................................8-2
Practice 8-1: Executing Preliminary Steps and the Pre-Upgrade Script .........................................................8-3
Practice 8-2: Implementing the Pre-Upgrade Information Tool Recommendations .......................................8-9
Practice 8-3: Completing Prerequisites Steps Before Upgrade ......................................................................8-19

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

Oracle Database 12c: Install and Upgrade Workshop Table of Contents


i
Practice 8-4: Performing a Full Database Backup..........................................................................................8-22
Practice 8-5: Performing a Transportable Tablespace Export ........................................................................8-26
Practices for Lesson 9: Upgrading a Database .............................................................................................9-1
Practices for Lesson 9....................................................................................................................................9-2
Practice 9-1: Upgrading a Database by Using DBUA ....................................................................................9-3
Practice 9-2: Exporting a Non-CDB Application .............................................................................................9-17
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Practice 9-3: Plugging a Non-CDB into a CDB ..............................................................................................9-19


Practices for Lesson 10: Performing Post-Upgrade Tasks ..........................................................................10-1
Practices for Lesson 10..................................................................................................................................10-2
Practice 10-1: Performing Post-Upgrade Actions ...........................................................................................10-3
Practices for Lesson 11: Migrating Data by Using Oracle Data Pump ........................................................11-1
Practices for Lesson 11..................................................................................................................................11-2
Practice 11-1: Performing a Transportable Tablespace Import ......................................................................11-3
Practice 11-2: Importing a Non-CDB Application Into a CDB .........................................................................11-8
a b le
Appendix: Upgrading a Database With Options............................................................................................12-1
fe r
an s
Appendix ........................................................................................................................................................12-2
Practice A-1: Executing Preliminary Steps and the Pre-Upgrade Tool ...........................................................12-3
n - t r
o
an
Practice A-2: Implementing the Pre-Upgrade Information Tool Recommendations .......................................12-9

s
Practice A-3: Completing Prerequisites Steps Before Upgrade .....................................................................12-23
ha eฺ
Practice A-4: Performing a Full Database Backup .........................................................................................12-26
)
ฺ c om Guid
Practice A-5: Upgrading a Database by Using DBUA ....................................................................................12-30

a h oo ent
Practice A-6: Performing Post-Upgrade Operations.......................................................................................12-42

@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Oracle Database 12c: Install and Upgrade Workshop Table of Contents


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

a ble
fe r
ans
n - t r
a no
Practices for a s
m ) ideฺ 1:
h Lesson
Oracle ฺ coDatabase
G u 12c:
o
ho den t
y aOverview
tu1
2 @ s S
v a do thi Chapter

f n e u se
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 1: Oracle Database 12c: Overview


Chapter 1 - Page 1
Practices for Lesson 1
Practices Overview

Background: In the practices of this course, you assume the role of a database administrator
(DBA). The operating system (OS) accounts on your computer are:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

• The oracle user with a password of oracle


• The grid user with a password of oracle
• The root user with a password of oracle

In these practices, you explore the existing installation, namely:

a ble
• List existing instances
fe r
• Determine existing software versions and existing Oracle homes
ans
• Determine locations of data files, control files and redo log files n - t r
o
• Determine the character set of existing database(s)
s an
• Determine existing listeners
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 1: Oracle Database 12c: Overview


Chapter 1 - Page 2
Practice 1-1: Listing Existing Instances and Oracle Homes
1. List the existing instances, whether they are running or not. There are two ways to find
them all.
a. Right-click the desktop and click Open Terminal to open a terminal window. Verify that
you are logged in as the oracle user.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

$ id
uid=54321(oracle) gid=54321(oinstall)
groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),5
4325(dgdba),54326(kmdba),54327(asmdba)
$
b. To list the running instances, you can search for the SMON background process. Any
running instance includes the SMON background process. An instance owns several
mandatory background processes including PMON, LGWR, DBW0, CKPT, LREG,
MMON, and RECO. a ble
fe r
$ ps -ef|grep smon
ans
grid 12992 1 0 13:11 ? - t r
00:00:00 asm_smon_+ASM
n
oracle 13115 1 0 13:30 ?
a no 00:00:00 ora_smon_dbupgrd
oracle 13209 12815 0 13:31 pts/2
h a s 00:00:00 grep smon
$
m ) ideฺ
There are two running instances, dbupgrd and ฺ o Gu
c+ASM.
h o
o eisnoracle t
Notice that the user running the dbupgrd
y a instance
t u d and the user running the
+ASM instance is grid.
2 @
orelated s S
c. There can be instancesa d
and t h i
databases that are not currently running. You can
e v e
root.sh and(x
fn totheusDatabase
view them in the /etc/oratab
updated by
file. This file is used by Oracle utilities. It is created by
Configuration Assistant while creating a
r e z the ASM
s e
F l o icen
database or Configuration Assistant while creating an ASM instance.

d l
o$ cat /etc/oratab
n
na #Backup file is
Fer /u01/app/grid/product/11.2.0/grid/srvm/admin/oratab.bak.edrsr32p
1 line added by Agent
#

# This file is used by ORACLE utilities. It is created by


root.sh
# and updated by either Database Configuration Assistant while
creating
# a database or ASM Configuration Assistant while creating ASM
instance.

# A colon, ':', is used as the field terminator. A new line


terminates
# the entry. Lines beginning with a pound sign, '#', are
comments.
#

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

Practices for Lesson 1: Oracle Database 12c: Overview


Chapter 1 - Page 3
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third filed
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

indicates
# to the dbstart utility that the database should , "Y", or
should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
a ble
+ASM:/u01/app/grid/product/11.2.0/grid:N # line added by Agent
fe r
dbupgrd:/u01/app/oracle/product/11.2.0/dbhome_2:N # line added
ans
by Agent
n - t r
$
a no
Doubled dbupgrd in oratab
h a s
All instances declared in the file are running. m ) ideฺ
Note: The CREATE DATABASE command does o ฺ cnotoupdate
t G u
the /etc/oratab file
2. In the file, notice that the two instances run
y ainhodifferent
tu d e n
Oracle homes.
• The +ASM ASM instance is running 2 @ S
in /u01/app/grid/product/11.2.0/grid,
s
oInfrastructure. the
Oracle home for Oraclea d
Grid t h i
e v s e
• The dbupgrd Oracle
( x fn Database
t o u instance is running in
r e z e 2.
/u01/app/oracle/product/11.2.0/dbhome_2,
s the Oracle home for Oracle
11g
ce n
Flo GridliInfrastructure
Database Release
3. The
n d oOracle includes ASM and Oracle Restart components. Check if the
na Oracle Restart component is started.
Fer $ pgrep -lf ohasd
16152 /bin/sh /etc/init.d/init.ohasd run
16173 /u01/app/grid/product/11.2.0/grid/bin/ohasd.bin reboot
$
It is currently started.
4. Is it automatically started at reboot?
a. To use the CRSCTL utility, you must be connected as the grid user.
$ su - grid
Password:
$ crsctl config has
-bash: crsctl: command not found
$

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

Practices for Lesson 1: Oracle Database 12c: Overview


Chapter 1 - Page 4
b. Use the oraenv utility to set the PATH environment variable to include the Grid home.
The oraenv script uses /etc/oratab to set the ORACLE_SID, ORACLE_BASE,
ORACLE_HOME and PATH environment variables. You will see that the Oracle base
changes from one environment to another.
$ . oraenv
ORACLE_SID = [grid] ? +ASM
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

The Oracle base has been changed from /u01/app/oracle to


/u01/app/grid
$ env | grep ORA
ORACLE_SID=+ASM
ORACLE_BASE=/u01/app/grid
ORACLE_HOME /u01/app/grid/product/11.2.0/grid
$
a ble
$ crsctl config has
fe r
CRS-4622: Oracle High Availability Services autostart is
ans
enabled.
n - t r
o
an
$
s
ha eฺ
)
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 1: Oracle Database 12c: Overview


Chapter 1 - Page 5
Practice 1-2: Determining the Locations of Data Files, Control Files
and Redo Log Files
Overview
In this practice, you will determine the locations of the data files of the dbupgrd.Oracle
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

database.
For each of the running instances, connect to the RDBMS instance either as SYS or SYSTEM,
and to the ASM instance as SYSASM. Then query the V$DATAFILE view.

Tasks
1. Execute the following steps to retrieve information related to the dbupgrd Oracle database
instance.
a. Check that you are connected as the oracle UNIX user.
a ble
$ exit
fe r
logout
ans
$ id
n - t r
uid=54321(oracle) gid=54321(oinstall)
a no
a s
groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),5
h
4325(dgdba),54326(kmdba),54327(asmdba)
m ) ideฺ
$
o ฺ co t Gu
y a ho environment
b. Use the oraenv utility to set the ORACLE_SID
d e n variable to the appropriate
t u
value. The utility automatically sets the ORACLE_HOME appropriately according to the
@ sInSthis case, the ORACLE_HOME is set to
2
ORACLE_SID entered whenoprompted.
v a d
e thi The oraenv utility uses
/etc/oratabxto f e ORACLE_SID,
set theo u s
/u01/app/oracle/product/11.2.0/dbhome_2.
n ORACLE_BASE, ORACLE_HOME and PATH
environment
(
z variables. e t
r e s
$F .lo
oraenv
l i c en
n d oORACLE_SID = [oracle] ? dbupgrd
na
Fer The Oracle base has been set to /u01/app/oracle

$ env | grep ORA


ORACLE_SID=dbupgrd
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_2
$
c. View the database name.
$ sqlplus / as sysdba

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 -
64bit Production

SQL> show parameter instance_type


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

Practices for Lesson 1: Oracle Database 12c: Overview


Chapter 1 - Page 6
NAME TYPE VALUE
------------------------------ ----------- --------------------
instance_type string RDBMS

SQL> select name from v$database;


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

NAME
---------
DBUPGRD

SQL>
d. View the data file names. Note: the suffix numbers for the datafiles can be different on
each database a ble
fe r
SQL> select name from v$datafile;
ans
n - t r
NAME
a no
h a s
---------------------------------------------------------------
+DATA/dbupgrd/datafile/system.260.814012925
m ) ideฺ
+DATA/dbupgrd/datafile/sysaux.261.814012959
o ฺ co t Gu
aho tuden
+DATA/dbupgrd/datafile/undotbs1.262.814012987
y
o 2 @ sS
+DATA/dbupgrd/datafile/users.264.814013023

v a d
e thi
+DATA/dbupgrd/datafile/example.265.814013031

SQL> EXIT xfn


e us
( t o
$
l o rez ense
d o The licfor the data files of the DBUPGRD database is the +DATA disk group.
F location
a n The disk group is managed by an ASM instance.

Fern 2. Execute the following steps to retrieve information related to the +ASM ASM instance.
a. Check that you are connected as the grid UNIX user. Use the su (substitute user)
UNIX command to start a user session as the grid user using the oracle password.
$ id
uid=54321(oracle) gid=54321(oinstall)
groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),5
4325(dgdba),54326(kmdba),54327(asmdba)
$
$ su - grid
Password:
$ id
uid=54322(grid) gid=54321(oinstall)
groups=54321(oinstall),54322(dba),54327(asmdba),54329(asmadmin)
$

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

Practices for Lesson 1: Oracle Database 12c: Overview


Chapter 1 - Page 7
b. Use the oraenv utility to set the ORACLE_SID environment variable to the appropriate
value. The utility automatically sets ORACLE_HOME to
/u01/app/grid/product/11.2.0/grid.
$ . oraenv
ORACLE_SID = [grid] ? +ASM
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

The Oracle base has been changed from /u01/app/oracle to


/u01/app/grid
$ env | grep ORA
ORACLE_SID=+ASM
ORACLE_BASE=/u01/app/grid
ORACLE_HOME=/u01/app/grid/product/11.2.0/grid
$
c. Connect to the instance with the SYSASM privilege.
a ble
$ sqlplus / as sysasm fe r
ans
Connected to: n - t r
a
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 -no
64bit Production
h a s
SQL> m ) ideฺ
d. View the instance type and then the databaseo ฺ co The
name. t G u
unsuccessful query confirms
ahoThere
that an ASM instance is only an instance.
y tu d n database attached to it.
iseno
2 @
SQL> show parameter instance_type
s S
v a do thi
NAME
f n e u se TYPE VALUE
x
z ( se t o
------------------------------ ----------- --------------------
r e
lo licen
instance_type string ASM
o F
n d
na SQL> select name from v$database;
Fer select name from v$database
*
ERROR at line 1:
ORA-01507: database not mounted
SQL>
e. View the instance name.
SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
+ASM

SQL>

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

Practices for Lesson 1: Oracle Database 12c: Overview


Chapter 1 - Page 8
f. List the data file names.
SQL> select name from v$datafile;
select * from v$datafile
*
ERROR at line 1:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

ORA-01507: database not mounted


SQL>
An ASM instance manages disk groups and disks for the files of RDBMS databases
and has no datafiles of its own.
g. List the disk groups managed by the ASM instance. Note that the values in TOTAL_MB
and FREE_MB will vary depending on the classroom machine configuration.
SQL> col name format a4
SQL> select GROUP_NUMBER, NAME, TOTAL_MB, FREE_MB, STATE, TYPE
a ble
fe r
from v$asm_diskgroup;
ans
2
n - t r
GROUP_NUMBER NAME TOTAL_MB FREE_MB STATE TYPE
a no
------------ ---- ---------- ---------- ----------- ------
h a s
1 DATA 25243 23339 MOUNTED ) ideฺ
EXTERN
m
2 FRA 16829 16595 MOUNTED
o ฺ co t Gu
EXTERN

SQL> y aho tuden


o 2 @ sS
Note: The values of TOTAL_MB
the example v a d and
e hi
tFREE_MB may be different from what is shown in

The values (
ne o and
ofxfTOTAL_MB
us FREE_MB always differ because there is some space
t
l o ezthe metadata
takenrfor
n se in each disk group. The EXTERNAL type means that there is
c e
F copy ofliallocation
no units in the disks. If the type was NORMAL or HIGH there would 2
d o or 3 copies of the allocation units on different disks. The MOUNTED state means that
n an
Fer
the disk group is ready to store data for the database files (data files, redo log files,
and control files).
h. List the disks managed by the ASM instance in each disk group.
SQL> col path format a27
SQL> col name format a10
SQL> set pagesize 30
SQL> select GROUP_NUMBER, DISK_NUMBER, PATH, NAME
from v$asm_disk
order by 1, 2;
2 3

GROUP_NUMBER DISK_NUMBER PATH NAME


------------ ----------- --------------------------- ----------
0 0 /dev/oracleasm/disks/DISK14
0 1 /dev/oracleasm/disks/DISK13
0 2 /dev/oracleasm/disks/DISK12
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 1: Oracle Database 12c: Overview


Chapter 1 - Page 9
0 3 /dev/oracleasm/disks/DISK11
1 0 /dev/oracleasm/disks/DISK1 DATA_0000
1 1 /dev/oracleasm/disks/DISK2 DATA_0001
1 2 /dev/oracleasm/disks/DISK3 DATA_0002
1 3 /dev/oracleasm/disks/DISK4 DATA_0003
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

1 4 /dev/oracleasm/disks/DISK5 DATA_0004
1 5 /dev/oracleasm/disks/DISK6 DATA_0005
2 0 /dev/oracleasm/disks/DISK7 FRA_0000
2 1 /dev/oracleasm/disks/DISK8 FRA_0001
2 2 /dev/oracleasm/disks/DISK9 FRA_0002
2 3 /dev/oracleasm/disks/DISK10 FRA_0003

14 rows selected.
a ble
fe r
ans
SQL>
n - t r
a no
There are six disks in the DATA disk group and four disks in the FRA (Fast Recovery
Area reserved for databases backups) disk group. There are also four disks in the 0
h a s
disk group. Note that the 0 disk group contains unassigned disks that are candidate
m ) ideฺ
disks, available to be assigned to a new disk group.
i. o ฺ co t Gu
The disks store files for the RDBMS databases. View the files managed by the ASM
instance in each disk group.
y aho tuden
SQL> col type format a16
o2 @ sS
SQL> set pages 100
v a d
e thi
n e
SQL> select fGROUP_NUMBER, us FILE_NUMBER,TYPE, REDUNDANCY
( x
z v$asm_file t o
e
from
r n s e order by type;
2lo c e
o F l i
na nd GROUP_NUMBER FILE_NUMBER TYPE REDUND

Fer
------------ ----------- ---------------- ------
1 253 ASMPARAMETERFILE UNPROT
1 256 CONTROLFILE UNPROT
2 256 CONTROLFILE UNPROT
1 262 DATAFILE UNPROT
1 265 DATAFILE UNPROT
1 264 DATAFILE UNPROT
1 261 DATAFILE UNPROT
1 260 DATAFILE UNPROT
2 257 ONLINELOG UNPROT
2 258 ONLINELOG UNPROT
2 259 ONLINELOG UNPROT
1 257 ONLINELOG UNPROT
1 259 ONLINELOG UNPROT
1 258 ONLINELOG UNPROT
1 266 PARAMETERFILE UNPROT
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 1: Oracle Database 12c: Overview


Chapter 1 - Page 10
1 263 TEMPFILE UNPROT

16 rows selected.

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

$
You discover that there are three online log files and one control file in the DATA disk
group and three online log files and one control file in the FRA disk group. The disk
group number shows which diskgroup by comparing it with the previous query.
j. Another utility, ASMCMD, provides information contained in the metadata of each disk
group. The advantage of using ASMCMD instead of SQL*Plus is that it can read
information in the disk group headers even if the ASM instance is not up. ASMCMD uses
a Unix-like syntax to view and manage ASM files. Note The '+' is equivalent to the root
directory '/' in Unix or Linux. a ble
fe r
$ asmcmd
ans
ASMCMD> ls
n - t r
DATA/
a no
FRA/
h a s
ASMCMD> ls -l
m ) ideฺ
State Type Rebal Name
o ฺ co t Gu
MOUNTED EXTERN N DATA/
y aho tuden
MOUNTED EXTERN N
o 2 @FRA/
s S
ASMCMD> ls +DATA d
a se t h i
e v
ASM/
( x fn to u
rez ense
DBUPGRD/
l o
F lic
ASMCMD>

n d o The DATA disk group stores data for the DBUPGRD database and the ASM database
rn a instance.
Fe ASMCMD> ls +DATA/DBUPGRD
CONTROLFILE/
DATAFILE/
ONLINELOG/
PARAMETERFILE/
TEMPFILE/
control01.ctl
redo01.log
redo02.log
redo03.log
spfiledbupgrd.ora
ASMCMD> ls -l +DATA/DBUPGRD/DATAFILE
Type Redund Striped Time Sys Name
DATAFILE UNPROT COARSE APR 30 05:00:00 Y
EXAMPLE.265.814013031
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 1: Oracle Database 12c: Overview


Chapter 1 - Page 11
DATAFILE UNPROT COARSE APR 30 05:00:00 Y
SYSAUX.261.814012959
DATAFILE UNPROT COARSE APR 30 05:00:00 Y
SYSTEM.260.814012925
DATAFILE UNPROT COARSE APR 30 05:00:00 Y
UNDOTBS1.262.814012987
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

DATAFILE UNPROT COARSE APR 30 05:00:00 Y


USERS.264.814013023
ASMCMD>
What is the relationship between EXAMPLE.265.814013031 and
+DATA/dbupgrd/datafile/example.265.814013031 listed in step 1.d?
EXAMPLE.265.814013031 is the unique ASM file managed by the ASM instance
and +DATA/dbupgrd/datafile/example.265.814013031 is an alias for the
same file.
a ble
k. List the files maintained in the FRA disk group and particularly the control files. fe r
ans
ASMCMD> ls +FRA/DBUPGRD/CONTROLFILE/*
n - t r
Current.256.814012889
a no
ASMCMD>
h a s
The DBUPGRD database contains two control files which
m e ฺ
) areidmultiplexed in two
distinct disk groups. o
ฺc t G u
ASMCMD> ls +*/DBUPGRD/CONTROLFILE/* o o
h den
y a tu
Current.256.814012887
2 @ s S
Current.256.814012889
v a do thi
ASMCMD>
f n e u se
If there were
z (xmore than
e totwo disk groups, and you needed to know in which disk
F lorethelicontrol
groups
c e nsfiles are stored, you would enter the following command:
n d oASMCMD> ls -l +*/DBUPGRD/CONTROLFILE/
rn a Type Redund Striped Time Sys Name
Fe
+DATA/DBUPGRD/CONTROLFILE/:
CONTROLFILE UNPROT FINE FEB 27 18:00:00 Y
Current.256.814012887

+FRA/DBUPGRD/CONTROLFILE/:
CONTROLFILE UNPROT FINE FEB 27 18:00:00 Y
Current.256.814012889
ASMCMD>
l. List the DBUPGRD database redo log files maintained by the ASM instance.
ASMCMD> ls +*/DBUPGRD/ONLINELOG

+DATA/DBUPGRD/ONLINELOG/:
group_1.257.814012897
group_2.258.814012905
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 1: Oracle Database 12c: Overview


Chapter 1 - Page 12
group_3.259.814012913

+FRA/DBUPGRD/ONLINELOG/:
group_1.257.814012901
group_2.258.814012909
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

group_3.259.814012917
ASMCMD> exit
$
The DBUPGRD database holds three groups of redo log files multiplexed in two
distinct disk groups.
m. In step 2h, the disk group 0 has fours disks assigned to it but are not assigned to any
diskgroup that is displayed in the v$asm_diskgroup view. These are candidate disks,
that are available to be used by ASM. Use another utility, ASMCA, to view the candidate
a ble
disks that do not yet belong to an existing disk group.
fe r
− Launch ASMCA.
ans
n - t r
no
$ asmca

s a
h a
) ideฺ
Step Window/Page Description
m
co t Gu Choices or Values
o ฺ
n. Disk Groups tab page
y aho tudVerify
en the two existing disk groups DATA and
2 @ s S FRA

v a do thi Click Create.


n e us e
( x f t o
l o rez ense
d oF lic
a n
Fern

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

Practices for Lesson 1: Oracle Database 12c: Overview


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

a ble
fe r
ans
n - t r
a no
h a s
m ) ideฺ
Step Window/Page Description
o ฺ co t Gu Choices or Values
o. Create Disk Group page
y aho tudVerify
en the following four ASM disks are listed:
o2 @ s S /dev/oracleasm/disks/DISK11
v a d
e thi /dev/oracleasm/disks/DISK12

f n e u s /dev/oracleasm/disks/DISK13
( x t o /dev/oracleasm/disks/DISK14

l o rez ense These four disks have been formatted with

d oF lic oracleasm to create your ASM disks to


provision any newly created disk group. Note:
a n
Fern any disks that have been made available to
ASM will appear here. The oracleasm utility is
not required.

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

Practices for Lesson 1: Oracle Database 12c: Overview


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

a ble
fe r
ans
n - t r
a no
h a s
m ) ideฺ
o ฺ co t Gu
Step Window/Page Description y aho tuden Choices or Values
p. Create Disk Group page o2 @ s S View all disks managed by the ASM instance.
v a d
e thi Click the Show All radio button.
f n e us
( x t o
l o rez ense
d o F lic
nan
Fer

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

Practices for Lesson 1: Oracle Database 12c: Overview


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

a ble
fe r
ans
n - t r
a no
h a s
m ) ideฺ
o ฺ co t Gu
o en
ainh“Header
Those with a value of PROVISIONED
@ y
S t udStatus” are candidates for new disk
groups. Those with a value oof2
MEMBERis in “Header Status” belong to either the DATA or
FRA disk group and arev a d
assigned at h
Disk Name that you displayed in V$ASM_DISK
e s e
view.
( x fn to u
Step rez Window/Page se Description Choices or Values
l o e n
d oq. F Create lic Disk Group page Click Cancel
a n r. Click Exit
Fern
s. Click Yes to leave ASMCA.

t. There is another way to list all disks available for ASM. Use the ORACLEASM utility and
the listdisks command.
− First exit from the grid session. The exit command ends the session belonging to
the OS user grid and should bring you back into the session owned by oracle.
$ exit
logout
$
− Log in as root.
$ su -
Password:
# oracleasm listdisks
DISK1

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

Practices for Lesson 1: Oracle Database 12c: Overview


Chapter 1 - Page 16
DISK10
DISK11
DISK12
DISK13
DISK14
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

DISK2
DISK3
DISK4
DISK5
DISK6
DISK7
DISK8
DISK9
a ble
# fe r
− Exit from the root session. The exit command ends the session belonging to the ans
OS user root and brings you back into the session owned by oracle. n - t r
o
# exit
s an
logout ) ha eฺ
$
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 1: Oracle Database 12c: Overview


Chapter 1 - Page 17
Practice 1-3: Determining the Character Set of Existing Database(s)
Overview
In this practice, you will determine the character set of the existing Oracle database.

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

1. Verify that your session belongs to the oracle user to set up your environment variables to
point to the /u01/app/oracle/product/11.2.0/dbhome_2 Oracle home for your
RDBMS database installation.
$ whoami
oracle
$
2. Use the oraenv utility to set the ORACLE_SID environment variable to the dbupgrd le
instance. r a b
s fe
$ . oraenv
- t r an
ORACLE_SID = [dbupgrd] ? dbupgrd
on
an
The Oracle base remains unchanged with value /u01/app/oracle
s
$
) ha eฺ
3. View the database character set.
ฺ c om Guid
$ sqlplus / as sysdba
a h oo ent
d
SQL> col VALUE formato2 @y s Stu
thi
A16
v a dNLS_DATABASE_PARAMETERS
SQL> select * from
n e e
s '%CHARACTERSET%';
ulike
where xfparameter o
2 rez
( t
l o e n se
d o F
PARAMETER lic VALUE

na n ------------------------------- ----------------
Fer NLS_CHARACTERSET
NLS_NCHAR_CHARACTERSET
AL32UTF8
AL16UTF16

SQL> EXIT
$
Note that there are two character sets defined.
• The NLS_CHARACTERSET represents the database character set used to identify and
to hold SQL and PL/SQL source code. AL32UTF8 encoding is the 8-bit encoding of
Unicode. It is a variable-width type of encoding and also a strict superset of ASCII. A
strict superset means that each and every character in 7-bit ASCII is available in
AL32UTF8 with the same corresponding code point value. One Unicode character can
be 1, 2, 3, or 4 bytes in this encoding. Characters from the European scripts are
represented in either 1 or 2 bytes; characters from most Asian scripts are represented
in 3 bytes, whereas supplementary characters are represented in 4 bytes.

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

Practices for Lesson 1: Oracle Database 12c: Overview


Chapter 1 - Page 18
• The NLS_NCHAR_CHARACTERSET represents the alternate character set that enables
you to store Unicode character data in a database that does not have a Unicode
database character set. AL16UTF16 encoding is the 16-bit encoding of Unicode. One
Unicode character can be 2 to 4 bytes in this encoding. Characters from both
European (including ASCII) and most Asian scripts are represented in 2 bytes.
Supplementary characters are represented in 4 bytes.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

a ble
fe r
ans
n - t r
o
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 1: Oracle Database 12c: Overview


Chapter 1 - Page 19
Practice 1-4: Determining Existing Listeners
Overview
In this practice, you will determine the existing listeners and the environment in which they run.

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

1. Use the listener control utility (LSNRCTL) to determine whether a listener is running.
$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 04-FEB-


2013 17:53:08

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

a ble
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
fe r
ans
STATUS of the LISTENER
n - t r
------------------------
o
Alias LISTENER
s an
Version ha eฺ
TNSLSNR for Linux: Version 11.2.0.3.0
)
- Production
ฺ c om Guid
Start Date
oo ent
31-JAN-2013 16:19:48
a h
Uptime
@ y ud
4 days 17 hr. 33 min. 22 sec
S t
Trace Level
a d o2 this
off

ev use
Security ON: Local OS Authentication
SNMP f n
(x e to
OFF
z
lore licens
Listener Parameter File
/u01/app/grid/product/11.2.0/grid/network/admin/listener.ora
o F
a n d Listener Log File

Fern /u01/app/grid/diag/tnslsnr/<yourhostserver>/listener/alert/log.x
ml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=<yourhostserver>)(PORT
=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM", status READY, has 1 handler(s) for this
service...
Service "dbupgrd" has 1 instance(s).
Instance "dbupgrd", status READY, has 1 handler(s) for this
service...
The command completed successfully
$

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

Practices for Lesson 1: Oracle Database 12c: Overview


Chapter 1 - Page 20
The listener named LISTENER is running in the
/u01/app/grid/product/11.2.0/grid Oracle home with a configuration defined
in the /u01/app/grid/product/11.2.0/grid/network/admin/listener.ora
configuration file. The LISTENER listener handles requests from both the +ASM and
dbupgrd instances.
2. Explore the
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

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

a ble
LISTENER =
fe r
ans
(DESCRIPTION_LIST =
n - t r
no
(DESCRIPTION =
a
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
s
h a
) ideฺ
(ADDRESS = (PROTOCOL = TCP)(HOST = <yourhostserver>)(PORT
= 1521)) m
co t Gu
) o ฺ
)
y aho tuden
o2 @ sS
v e thi
ADR_BASE_LISTENER a=d/u01/app/grid
f n e us
z ( x t o
r e n s e
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by

o Flo lice
Agent

nd $
n3.a Find the user running the listener LISTENER process. grid is the UNIX user running the
F e r
process in /u01/app/grid/product/11.2.0/grid, the Oracle home of Oracle Grid
Infrastructure.
$ ps -ef | grep tnslsnr
grid 16203 1 0 Mar29 ? 00:00:16
/u01/app/grid/product/11.2.0/grid/bin/tnslsnr LISTENER -inherit
oracle 27661 31746 0 12:42 pts/1 00:00:00 grep tnslsnr
$

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

Practices for Lesson 1: Oracle Database 12c: Overview


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

a ble
fe r
ans
n - t r
o
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 1: Oracle Database 12c: Overview


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

a ble
fe r
ans
n - t r
a no
Practices for a s
m ) ideฺ 2:
h Lesson
Oracle ฺ coSoftware
G u Installation
o
ho den t
y aBasicstu2
2 @ s S
v a do thi Chapter

f n e u se
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 2: Oracle Software Installation Basics


Chapter 2 - Page 1
Practices for Lesson 2
Practices Overview
There is no practice for this lesson.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

a ble
fe r
ans
n - t r
o
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 2: Oracle Software Installation Basics


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

a ble
fe r
ans
n - t r
a no
Practices for a s
m ) ideฺ 3:
h Lesson
Installing
ฺ co Oracle
G u Grid
o
ho den t
y aInfrastructure
t u
for a
o2 @ Standalone
s S Server and
i
ad se thUpgrading ASM
e v
( x fn to u Chapter 3
r e z s e
F lo licen
n d o
rn a
Fe

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

Practices for Lesson 3: Installing Oracle Grid Infrastructure for a Standalone Server and Upgrading ASM
Chapter 3 - Page 1
Practices for Lesson 3
Practices Overview

In the practices of this course, you assume the role of a database administrator (DBA). The
operating system (OS) accounts on your computer are:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

• The oracle user with a password of oracle


• The grid user with a password of oracle
• The root user with a password of oracle

The system administrator has set up the OS so that it is ready for your Oracle software
installation. You are performing two installations.
1. The first installation is the Oracle Grid Infrastructure for a standalone server.
a ble
2. The second installation is the Oracle Database 12c software.
fe r
ans
The installation media is staged at: n - t r
• /stage/shiphomes/RDBMS_LINUX.X64_12C/clusterware for Oracle Grid a no
Infrastructure h a s
m ) ideฺ
• /stage/shiphomes/RDBMS_LINUX.X64_12C/database for Oracle Database 12c
o ฺ co t Gu
Perform most of the following tasks as the grid
y ahOSo user,
tu d e n otherwise indicated.
unless
You are going to work as the oracle o2 @
user for some
s S operations and as the grid user for other
d h i
tas the oracle user and another terminal window
opened as the grid user.fne
va opened
operations. Keep a terminal window
s e
( x t o u
l o r ez nse

o
InF
the oracle
l iceuser terminal window, keep the following environment variables set:
a n d $ id
Fern uid=54321(oracle) gid=54321(oinstall)
groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),5
4325(dgdba),54326(kmdba),54327(asmdba)
$
Set the ORACLE_SID environment variable to any instance other than +ASM, for
example dbupgrd.
$ . oraenv
ORACLE_SID = [dbupgrd] ? dbupgrd
The Oracle base remains unchanged with value /u01/app/oracle
$

• In the grid user terminal window, keep the following environment variables set:
$ su - grid
Password:
$ id

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

Practices for Lesson 3: Installing Oracle Grid Infrastructure for a Standalone Server and Upgrading ASM
Chapter 3 - Page 2
uid=54322(grid) gid=54321(oinstall)
groups=54321(oinstall),54322(dba),54327(asmdba),54329(asmadmin)
$
Set the ORACLE_SID environment variable to +ASM.
$ . oraenv
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

ORACLE_SID = [grid] ? +ASM


The Oracle base has been changed from /u01/app/oracle to
/u01/app/grid
$

Note: Completing this practice is critical for all following practice sessions.

a ble
fe r
ans
n - t r
o
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 3: Installing Oracle Grid Infrastructure for a Standalone Server and Upgrading ASM
Chapter 3 - Page 3
Practice 3-1: Installing Oracle Grid Infrastructure and Upgrading ASM
Overview
In the previous practice, you detected two installed products:
• 11g Oracle Grid Infrastructure with a running ASM instance (+ASM) and Oracle Restart
started
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

• 11g Oracle Database server with a running Oracle RDBMS instance (dbupgrd)

In this practice, you upgrade 11g Oracle Grid Infrastructure to 12c Oracle Grid Infrastructure by
using the Oracle Universal Installer.
The Oracle Universal Installer (OUI) will detect the ASM instance during the Oracle Grid
Infrastructure upgrade and will upgrade the ASM instance from the 11g Release 2 to the 12c
Release 1 version. The ASM instance is managing the storage for the dbupgrd database. The
ASM instance will be shut down and therefore the clients need to be shut down as well. a ble
fe r
You are going to work as the oracle user for some operations and as the grid user for other
ans
operations. Therefore, keep a terminal window opened as the oracle user and another
n - t r
terminal window opened as the grid user.
a no
Tasks h a s
m ) idshut e ฺ
1. Before upgrading Oracle Grid Infrastructure and the ASM o Gu instance, down the dbupgrd

o nt
instance to close all the database files. The dbupgrd
c database is a client of the ASM
instance. h o
a tude
@ y
a. From the oracle user terminal
o 2 window, i s S that you are logged in as the oracle
verify
user.
v d
a se t h
$ id e
fn to u
z ( x
e
uid=54321(oracle)
r n s e gid=54321(oinstall)
o Flo lice
groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),5

a n d$ 4325(dgdba),54326(kmdba),54327(asmdba)
n
Fer b. Set the ORACLE_SID environment variable to dbupgrd.
$ . oraenv
ORACLE_SID = [dbupgrd] ? dbupgrd
The Oracle base remains unchanged with value /u01/app/oracle
$
c. Shut down the dbupgrd instance.
$ sqlplus / as sysdba

SQL> shutdown immediate


Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
$

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

Practices for Lesson 3: Installing Oracle Grid Infrastructure for a Standalone Server and Upgrading ASM
Chapter 3 - Page 4
2. The 11g Oracle Grid Infrastructure includes the Oracle Restart component which is
currently running.
a. If you did not already open the grid user terminal window, right-click the desktop and
click Open Terminal to open another terminal window. Check that you are logged as
the grid UNIX user.
$ whoami
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

oracle
$
This is not the case. Use the su command to switch to the grid user.
$ su - grid
Password:
$ id
uid=54322(grid) gid=54321(oinstall)
a ble
groups=54321(oinstall),54322(dba),54327(asmdba),54329(asmadmin)
fe r
$
ans
b. Set the ORACLE_BASE and ORACLE_HOME environment variables. n - t r
$ . oraenv a no
h a s
ORACLE_SID = [grid] ? +ASM
m ) ideฺ
o ฺ co t Gu
The Oracle base has been changed from /u01/app/oracle to

aho tuden
/u01/app/grid
$
y
@ forstheSOracle Grid Infrastructure. As the grid
3. Start the Oracle Universal Installer o2(OUI)
a d thi
user, navigate to the /stage/shiphomes/RDBMS_LINUX.X64_12C/clusterware
v e
f n e
directory and enter ./runInstaller. us
( x t o
r ez nse
$ cd /stage/shiphomes/RDBMS_LINUX.X64_12C/grid
l o
o
$F
l ice
./runInstaller

a n d
n
Fer

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

Practices for Lesson 3: Installing Oracle Grid Infrastructure for a Standalone Server and Upgrading ASM
Chapter 3 - Page 5
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

a ble
fe r
ans
n - t r
a no
h a s
Oracle Grid Infrastructure 12c OUI is displayed.
m ) ideฺ
Step Window/Page Description o ฺ co t GChoices
u or Values
h o
a is tude n
a. Oracle Grid Infrastructure 12c yOUI
displayed.
o 2 @ s S
d
a Updates t h i
b. Download Software
n e v s e page Select “Skip software updates”.
f
(x e to u Click Next.
z
re Installation
c.
F loSelect c e ns Option page Select “Upgrade Oracle Grid Infrastructure
o l i or Oracle Automatic Storage Management”
n d Note: This option upgrades the existing 11g
na
Fer Oracle Grid Infrastructure and the ASM
instance.
d. Select Product Languages page Select all the available languages with the '>>'
button.
Click Next.
e. Privileged Operating System Groups Verify that role separation is defined for ASM
page operations. You should see three OS groups,
asmadmin, asmdba and asmoper that were
created prior to running the installer. These
groups may also be viewed in the
/etc/group file.
Click Next.
f. Specify Installation Location page Browse the Oracle base
Select /u01/app/grid
Set Software Location to
/u01/app/grid/product/12.1.0/grid
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 3: Installing Oracle Grid Infrastructure for a Standalone Server and Upgrading ASM
Chapter 3 - Page 6
Step Window/Page Description Choices or Values
Click Next
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

a ble
fe r
ans
n - t r
a no
h a s
m ) ideฺ
o ฺ co t Gu
y aho tuden
o 2 @ sS
Step Window/Page v a e thi
dDescription Choices or Values
f n e u s
g. (x execution
Root script
z e to configuration Configure the root scripts to be executed
re ens
lopage manually when required. This will allow you to
o F li c follow the steps more easily. The alternate
a n d configuration is described below.
n
Fer
Click Next.

You could have chosen the “Automatically run configuration scripts” option as shown in
the screenshot below. In this case, the installation would run the required scripts as
root when necessary. To run the scripts as root, OUI must know the root password.
If a root script failed on the server, then you would have to fix the problem manually
and rerun the root script on the server, and continue.

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

Practices for Lesson 3: Installing Oracle Grid Infrastructure for a Standalone Server and Upgrading ASM
Chapter 3 - Page 7
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

a ble
fe r
ans
n - t r
a no
h a s
m ) Choices
d e ฺ
Step Window/Page Description
ฺ c o Gu i or Values
h. Perform Prerequisites Checks page
a h ooOnlyeappears
n t if a check fails.
y d occurs
Aufailure
t
@ S
o2 this Select the failure message - Check incorrectly
a d
f n ev use sized ASM disks

z (x e to Click more details link in the lower pane


i. re ens
loDetails See Message: PRCT-1207 : Failed to set the
o F l i c ORACLE_SID for running asmcmd from CRS
n d home location
na
Fer
/u01/app/grid/product/11.2.0/grid
This is a known bug:
Click Close
j. Perform Prerequisites Checks page Click Ignore All
Click Next
k. OracleGrid Infrastructure Are you sure you want to continue?
Click Yes

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

Practices for Lesson 3: Installing Oracle Grid Infrastructure for a Standalone Server and Upgrading ASM
Chapter 3 - Page 8
Step Window/Page Description Choices or Values
l. Summary page Review the settings and information.
Click Install.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

a ble
fe r
ans
n - t r
a no
h a s
m ) ideฺ
o ฺ co t Gu
y aho tuden
o2 @ sS
v a d
e thi
Step Window/Page
f n e Description
us Choices or Values
( x t o
m.
l o rezProduct
Install
e n e
spage The progress of the Oracle Grid Infrastructure
installation is displayed and the status of the
o F l ic individual tasks being performed.
n d
na The installation can take up to 20 minutes to
Fer get to Step 3t.

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

Practices for Lesson 3: Installing Oracle Grid Infrastructure for a Standalone Server and Upgrading ASM
Chapter 3 - Page 9
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

a ble
fe r
ans
n - t r
a no
h a s
m ) ideฺ
Step Window/Page
o ฺ coChoices
t G uor Values
Description
y aho tuden
n. Execute
2@ isasSthe root user execute
In a terminal
o
Configuration Scripts d/u01/app/grid/product/12.1.0/grid/rootupgrade.sh
page e v a se th
( x fn to u
l o rez ense
d o F lic
nan
Fer

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

Practices for Lesson 3: Installing Oracle Grid Infrastructure for a Standalone Server and Upgrading ASM
Chapter 3 - Page 10
Step Window/Page Choices or Values
Description
o. In a new terminal Check that you are logged as the root UNIX user.
session $ id
uid=54321(oracle) gid=54321(oinstall)
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

groups=54321(oinstall),54322(dba),54323(oper),
54324(backupdba),54325(dgdba),54326(kmdba),
54327(asmdba)
p. Use the su command to switch to the root user. Once logged as
root, you get the # prompt.
$ su –
Password:
#
a ble
q. Execute the script fe r
ans
# /u01/app/grid/product/12.1.0/grid/rootupgrade.sh
n - t r
Enter RETURN to the four questions
See output in code box belowa no
h a s
) ideฺ
Note: This step takes about 12 minutes.
m
o ฺ co t Gu
Keep the root user terminal session opened.

y a ho den
@ S tu
# /u01/app/grid/product/12.1.0/grid/rootupgrade.sh
2 s
dooperation
thi for Oracle 12c
Performing root user
e v a e
( x f n
t o us
r e z
The following
s e
environment variables are set as:

F l i en grid
loORACLE_OWNER=
c
n d o ORACLE_HOME= /u01/app/grid/product/12.1.0/grid
rn a
Fe Enter the full pathname of the local bin directory:
[/usr/local/bin]:
The file "dbhome" already exists in /usr/local/bin. Overwrite
it? (y/n)
[n]:
The file "oraenv" already exists in /usr/local/bin. Overwrite
it? (y/n)
[n]:
The file "coraenv" already exists in /usr/local/bin. Overwrite
it? (y/n)
[n]:

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


Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 3: Installing Oracle Grid Infrastructure for a Standalone Server and Upgrading ASM
Chapter 3 - Page 11
Using configuration parameter file:
/u01/app/grid/product/12.1.0/grid/crs/install/crsconfig_params

ASM Configuration upgraded successfully.


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

Creating OCR keys for user 'grid', privgrp 'oinstall'..


Operation successful.
LOCAL ONLY MODE
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4664: Node <your_hostname> successfully pinned.
2013/02/25 01:32:09 CLSRSC-329: Replacing Clusterware entries in
a ble
file 'oracle-ohasd.conf'
fe r
a n s
2013/02/25 01:35:46 CLSRSC-329: Replacing Clusterware n t r
-entries in
o
file 'oracle-ohasd.conf'
s an
) ha eฺ
ฺ c om Guid
oo ent
<your_hostname> 2013/02/25 01:39:55
h
/u01/app/grid/product/12.1.0/grid/cdata/<your_hostname>/backup_2
a
0130225_013955.olr
@ y
S t ud
a d o2 this
<your_hostname> v
f n u se
e 2013/02/25 04:22:22
(x e to
/u01/app/grid/product/11.2.0/grid/cdata/<your_hostname>/backup_2
z
lore lice01:40:53
ns
0130225_042222.olr
F
2013/02/25 CLSRSC-327: Successfully configured Oracle
oGrid Infrastructure for a Standalone Server
a n d
Fern #
The ASM configuration is updated. This means that the ASM instance has been
upgraded from Oracle Grid Infrastructure 11g to Oracle Grid Infrastructure 12c.
• The upgrade script sets the ORACLE_OWNER environment variable to grid and the
ORACLE_HOME environment variable to the new
/u01/app/grid/product/12.1.0/grid Oracle home.
• The upgrade script upgrades the ASM instance to run in the new
/u01/app/grid/product/12.1.0/grid Oracle home.
• The upgrade script replaces clusterware entries in the
/u01/app/grid/product/12.1.0/grid/crs/install/oracle-ohasd.conf
file to start the OHASD (Oracle High Availability Services Daemon) in the new Oracle
home. The Oracle High Availability Services Daemon is covered in another practice.
• The upgrade script creates a new Oracle Local Registry (OLR) in the new Oracle
home. The OLR includes the current registered resources that are the listener, the
dbupgrd database instance, the ASM instance and the two disk groups. The OLR is
finally backed up at the end of the upgrade as

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

Practices for Lesson 3: Installing Oracle Grid Infrastructure for a Standalone Server and Upgrading ASM
Chapter 3 - Page 12
/u01/app/grid/product/11.2.0/grid/cdata/<localhost>/backup_20130
208_211335.olr.
• It also backs up the 11g OLR in its original Oracle home,
/u01/app/grid/product/11.2.0/grid/cdata/<localhost>/backup_20130
208_211335.olr. Oracle Restart with the OLR is covered in another practice.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Step Window/Page Choices or Values


Description
r. Execute Click OK
Configuration
scripts window
s. Install Product Continues
page
a ble
t. Oracle Grid Message: [INS-20802] Oracle Cluster Verification Utility failed.
fe r
Infrastructure Click Details
ans
n - t r
u. Oracle Grid Note: Log File Location o
Infrastructure an
In the root user terminal window:
s
) ha eฺ
less <log file location>

ฺ c om Guid
Scroll up from bottom of file to find error –

a h oo ent PRVG-2033 : Permissions of file

@ y
S t ud "/u01/app/grid/product/12.1.0/grid/cdata/localhost/<your_hostn

a d o2 this ame>.olr" did not match the expected octal value on node
"edrsr7p1". [Expected = "0600" ; Found = "0660"]
f n ev use in terminal window as root user change the permissions of this
z (x e to file:

F lore licens chmod 600

n d o /u01/app/grid/product/12.1.0/grid/cdata/localh

rn a ost/<your_hostname>.olr

Fe Click OK
v. Install Product Click Retry
page
w. Install Product When all items have completed – indicate by a green check
page Click Next
x. Finish page Click Close
y. Terminal window press [Enter]
as grid The name of the log file of the install is displayed
$ You can find the log of this install session
at:
u01/app/logs/installActions2013-02-25_01-15-
27AM.log
$
z. Terminal window Quit the root user terminal wirndow.
as root # exit
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 3: Installing Oracle Grid Infrastructure for a Standalone Server and Upgrading ASM
Chapter 3 - Page 13
Step Window/Page Choices or Values
Description
logout
$ exit
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

a ble
fe r
ans
n - t r
o
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 3: Installing Oracle Grid Infrastructure for a Standalone Server and Upgrading ASM
Chapter 3 - Page 14
Practice 3-2: Using the Upgraded ASM Instance
Overview
In this practice, you will perform tasks such as resetting the Oracle ASM passwords and
configuring disk groups now that the ASM instance has been upgraded.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Tasks
1. From the grid user session, verify that the ASM instance entry is updated in
/etc/oratab.
$ less /etc/oratab
#Backup file is
/u01/app/grid/product/12.1.0/grid/srvm/admin/oratab.bak.<localho
st> line added by Agent
#
a ble
fe r
# This file is used by ORACLE utilities. It is created by
ans
root.sh
n - t r
# and updated by either Database Configuration Assistant while
o
creating
s an
ha eฺ
# a database or ASM Configuration Assistant while creating ASM
)
instance.
ฺ c om Guid
oo ent
# A colon, ':', is used as the field terminator. A new line
terminates
a h
@ y
S t ud
# the entry. Lines beginning with a pound sign, '#', are
comments.
a d o2 this
#
f n ev use
(x e to
# Entries are of the form:
z
#
F lore licens
$ORACLE_SID:$ORACLE_HOME:<N|Y>:

n d o#

rn a # The first and second fields are the system identifier and home
Fe # directory of the database respectively. The third filed
indicates
# to the dbstart utility that the database should , "Y", or
should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
dbupgrd:/u01/app/oracle/product/11.2.0/dbhome_2:N #
line added by Agent
+ASM:/u01/app/grid/product/12.1.0/grid:N: # line added by
Agent
$
The ORACLE_HOME for the ASM instance is updated to
/u01/app/grid/product/12.1.0/grid.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 3: Installing Oracle Grid Infrastructure for a Standalone Server and Upgrading ASM
Chapter 3 - Page 15
2. Verify that the ASM instance is started.
a. Reset the environment variables so that ORACLE_HOME reflects the new
/u01/app/grid/product/12.1.0/grid directory.
$ . oraenv
ORACLE_SID = [+ASM] ? +ASM
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

The Oracle base remains unchanged with value /u01/app/grid


$ env | grep ORA
ORACLE_SID=+ASM
ORACLE_BASE=/u01/app/grid
ORACLE_HOME=/u01/app/grid/product/12.1.0/grid
$
b. Verify in the banner that the ASM instance now runs in the 12c environment
$ sqlplus / as sysasm
a ble
fe r
ans
Connected to:
n - t r
o
an
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -
s
64bit Production With the Automatic Storage Management option
ha eฺ
) id
SQL> select instance_name, status from
ฺ c omv$instance;
G u
a h oo ent
INSTANCE_NAME STATUS
@ y
S t ud
a d o2 this
---------------- ------------
+ASM
f n evSTARTED
u se
z (x e to
SQL> re
F l o icens
n d c. oShut down lthe ASM instance.
n a SQL> shutdown immediate
Fer ASM diskgroups dismounted
ASM instance shutdown
SQL>
d. Start the instance up.
SQL> startup
ASM instance started

Total System Global Area 1068937216 bytes


Fixed Size 2295952 bytes
Variable Size 1041475440 bytes
ASM Cache 25165824 bytes
ASM diskgroups mounted
SQL>
The disk groups are automatically mounted because there is a parameter file
including the ASM_DISKGROUPS parameter.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 3: Installing Oracle Grid Infrastructure for a Standalone Server and Upgrading ASM
Chapter 3 - Page 16
3. Determine which initialization parameter file in being used. Note : the suffix of the file name
will vary from the example shown below.
SQL> show parameter spfile

NAME TYPE VALUE


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

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


spfile string +DATA/asm/asmparameterfile/reg
istry.253.814078909
SQL> exit
$
a. View the location of the SPFILE in ASMCMD.
$ asmcmd ls +DATA/ASM/ASMPARAMETERFILE/
REGISTRY.253.814078909
a ble
fe r
$
ans
The SPFILE is stored in the DATA disk group.
n - t r
b. no
Create the ASM text parameter file (PFILE) from the ASM server parameter file
(SPFILE). a
h a s
$ sqlplus / as sysasm
m ) ideฺ
o ฺ co t Gu
aho tudenfrom spfile;
SQL> create pfile='?/dbs/bkup+ASM.ora'
y
o2 @ sS
File created.
v a d
e thi
f n e us
SQL> exit ( x t o
l o rez ense
Disconnected

d o$ F lic
a n
Fern c. View the contents of the ASM text parameter file.
$ cd $ORACLE_HOME/dbs
$ ls
ab_+ASM.dat hc_+ASM.dat bkup+ASM.ora init.ora
$ cat bkup+ASM.ora
+ASM.__oracle_base='/u01/app/grid'#ORACLE_BASE set from in
memory value
+ASM.asm_diskgroups='FRA','DATA'#Manual Mount
*.asm_diskstring='/dev/oracleasm/disks'
*.core_dump_dest='/u01/app/grid/diag/asm/+asm/+ASM/cdump'
*.diagnostic_dest='/u01/app/grid'
*.memory_max_target=327155712
*.memory_target=327155712
$
4. Connect to the ASM instance and verify which disk groups are mounted.
$ sqlplus / as sysasm
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 3: Installing Oracle Grid Infrastructure for a Standalone Server and Upgrading ASM
Chapter 3 - Page 17
SQL> select name, state from v$asm_diskgroup;

NAME STATE
------------------------------ -----------
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

FRA MOUNTED
DATA MOUNTED

SQL> exit
$
The DATA disk group must be mounted because the SPFILE is stored there.
5. View the alert log file of the ASM instance. You will find all operations performed in the ASM
instance. For example, the disks attached to the DATA and FRA disk groups are opened
a ble
with external redundancy. Both disk groups are mounted, the DATA disk group first because fe r
the instance uses “parameter settings in server-side spfile ans
+DATA/asm/asmparameterfile/registry.253.814078909”, then the FRA disk n - t r
no
group defined in the ASM_DISKGROUPS parameter. The compatible.asm attribute is still
a
set to 11.2.0.0.0 and not yet 12.1.0.0.0.
h a s
) ideฺ
Use shift-G to move to the bottom of the file then search up until you find the last
m
o ฺ co t Gu
"Starting up:" string. Note: ?Starting up? will search up in vi.
Use :q to exit vi
y aho tuden
2 @ sS
$ cd /u01/app/grid/diag/asm/+asm/+ASM/trace
o
$ vi alert_+ASM.logd
v a e thi
Starting up: ne us
( x f 12cto Enterprise
r e z
Oracle Database
s e Edition Release 12.1.0.1.0 -

F lothe
64bit Production
l i c en
n d oWith Automatic Storage Management option.

rn a ORACLE_HOME = /u01/app/grid/product/12.1.0/grid_1
Fe System name: Linux
Node name: <your_hostname>
Release: 2.6.39-200.24.1.el6uek.x86_64
Version: #1 SMP Sat Jun 23 02:39:07 EDT 2012
Machine: x86_64
Using parameter settings in server-side spfile
+DATA/asm/asmparameterfile/registry.253.814078909
System parameters with non-default values:
memory_target = 1G
memory_max_target = 1G
core_dump_dest =
"/u01/app/grid/diag/asm/+asm/+ASM/cdump"
asm_diskstring = "/dev/oracleasm/disks"
asm_diskgroups = "DATA"
asm_diskgroups = "FRA"

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

Practices for Lesson 3: Installing Oracle Grid Infrastructure for a Standalone Server and Upgrading ASM
Chapter 3 - Page 18
diagnostic_dest = "/u01/app/grid"
NOTE: remote asm mode is local (mode 0x301; from cluster type)

SQL> ALTER DISKGROUP ALL MOUNT /* asm agent call crs *//*
{0:0:2} */
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Diskgroup with spfile:DATA


NOTE: Diskgroups listed in ASM_DISKGROUP are
DATA
(duplicate)
FRA

NOTE: cache registered group DATA 1/0x07957B80


NOTE: cache began mount (first) of group DATA 1/0x07957B80
a ble
NOTE: cache registered group FRA 2/0x07957B81
fe r
NOTE: cache began mount (first) of group FRA 2/0x07957B81 ans
n - t r
NOTE: Loaded library: /opt/oracle/extapi/64/asm/orcl/1/libasm.so
o
NOTE: Assigning number (1,5) to disk
s an
(/dev/oracleasm/disks/DISK6)
) ha eฺ
NOTE: Assigning number (1,4) to disk
ฺ c om Guid
oo ent
(/dev/oracleasm/disks/DISK5)
a h
ud
NOTE: Assigning number (1,3) to disk
@ y
(/dev/oracleasm/disks/DISK4) t
o2 this S
d
NOTE: Assigning number (1,2) to disk
a
f n ev use
(/dev/oracleasm/disks/DISK3)
(x e to
NOTE: Assigning number (1,1) to disk
z
lore licens
(/dev/oracleasm/disks/DISK2)

o F
NOTE: Assigning number (1,0) to disk

a n d (/dev/oracleasm/disks/DISK1)

Fern NOTE: Assigning number (2,3) to disk


(/dev/oracleasm/disks/DISK10)
NOTE: Assigning number (2,2) to disk
(/dev/oracleasm/disks/DISK9)
NOTE: Assigning number (2,1) to disk
(/dev/oracleasm/disks/DISK8)
NOTE: Assigning number (2,0) to disk
(/dev/oracleasm/disks/DISK7)
Using default pga_aggregate_limit of 2048 MB
NOTE: GMON heartbeating for grp 1 (DATA)
GMON querying group 1 at 4 for pid 19, osid 24170
NOTE: cache is mounting group DATA created on 2013/04/04
09:00:31
NOTE: cache opening disk 0 of grp 1: DATA_0000
path:/dev/oracleasm/disks/DISK1
NOTE: 04/04/13 11:13:17 DATA.F1X0 found on disk 0 au 2 fcn 0.0
datfmt 1
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 3: Installing Oracle Grid Infrastructure for a Standalone Server and Upgrading ASM
Chapter 3 - Page 19
NOTE: cache opening disk 1 of grp 1: DATA_0001
path:/dev/oracleasm/disks/DISK2
NOTE: cache opening disk 2 of grp 1: DATA_0002
path:/dev/oracleasm/disks/DISK3
NOTE: cache opening disk 3 of grp 1: DATA_0003
path:/dev/oracleasm/disks/DISK4
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

NOTE: cache opening disk 4 of grp 1: DATA_0004


path:/dev/oracleasm/disks/DISK5
NOTE: cache opening disk 5 of grp 1: DATA_0005
path:/dev/oracleasm/disks/DISK6
NOTE: cache mounting (first) external redundancy group
1/0x07957B80 (DATA)
NOTE: cache recovered group 1 to fcn 0.2484
NOTE: redo buffer size is 256 blocks (1053184 bytes)
a ble
NOTE: LGWR attempting to mount thread 1 for diskgroup 1 (DATA)
fe r
ans
NOTE: LGWR found thread 1 closed at ABA 5.214 lock domain=0
inc#=0 instnum=0 n - t r
o
an
NOTE: LGWR mounted thread 1 for diskgroup 1 (DATA)
s
ha eฺ
NOTE: LGWR opened thread 1 (DATA) at fcn 0.2484 ABA 6.215 lock
)
om Guid
domain=1 inc#=0 instnum=1
ฺ c
oo ent
NOTE: cache mounting group 1/0x07957B80 (DATA) succeeded
a h
ud
NOTE: cache mounting group 1/0x07957B80 (DATA) succeeded
@ y t
o2 this S
NOTE: cache ending mount (success) of group DATA number=1
incarn=0x07957b80
a d
n ev use
NOTE: GMON heartbeating for grp 2 (FRA)
f
z (x e to
GMON querying group 2 at 6 for pid 19, osid 24170
lore licens
NOTE: cache is mounting group FRA created on 2013/04/04 09:00:59
F
n d oNOTE: cache opening disk 0 of grp 2: FRA_0000

rn a path:/dev/oracleasm/disks/DISK7
Fe NOTE: 04/04/13 11:13:17 FRA.F1X0 found on disk 0 au 2 fcn 0.0
datfmt 1
NOTE: cache opening disk 1 of grp 2: FRA_0001
path:/dev/oracleasm/disks/DISK8
NOTE: cache opening disk 2 of grp 2: FRA_0002
path:/dev/oracleasm/disks/DISK9
NOTE: cache opening disk 3 of grp 2: FRA_0003
path:/dev/oracleasm/disks/DISK10
NOTE: cache mounting (first) external redundancy group
2/0x07957B81 (FRA)
NOTE: cache recovered group 2 to fcn 0.969
NOTE: redo buffer size is 256 blocks (1053184 bytes)
NOTE: LGWR attempting to mount thread 1 for diskgroup 2 (FRA)
NOTE: LGWR found thread 1 closed at ABA 5.158 lock domain=0
inc#=0 instnum=0
NOTE: LGWR mounted thread 1 for diskgroup 2 (FRA)

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

Practices for Lesson 3: Installing Oracle Grid Infrastructure for a Standalone Server and Upgrading ASM
Chapter 3 - Page 20
NOTE: LGWR opened thread 1 (FRA) at fcn 0.969 ABA 6.159 lock
domain=2 inc#=0 instnum=1
NOTE: cache mounting group 2/0x07957B81 (FRA) succeeded
NOTE: cache ending mount (success) of group FRA number=2
incarn=0x07957b81
NOTE: cache mounting group 2/0x07957B81 (FRA) succeeded
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

NOTE: cache ending mount (success) of group FRA number=2


incarn=0x07957b81
NOTE: Instance updated compatible.asm to 11.2.0.0.0 for grp 1
SUCCESS: diskgroup DATA was mounted
NOTE: Instance updated compatible.asm to 11.2.0.0.0 for grp 2
SUCCESS: diskgroup FRA was mounted
$
a ble
6. Start the DBUPGRD Oracle Database instance and verify the locations of all the database
fe r
files.
ans
a. From the oracle user terminal window, set the ORACLE_SID environment variable to
n - t r
dbupgrd.
a no
$ . oraenv
h a s
ORACLE_SID = [dbupgrd] ? dbupgrd m ) ideฺ
The Oracle base remains unchanged o ฺ co value
with
t G u /u01/app/oracle
$
y aho tuden
b. Start the dbupgrd instance. 2@ S
d o h i s
e v a Size,seandt Database Buffers may vary from the values
Note: the values of Variable
n oof the
shown below, but fthe
(xthe
sum u two values should be the same. The shared pool will
get memoryzfrom t
buffer
e pool as needed.
l o re /eas n ssysdba
lic
$ sqlplus
o F
an d
n
Fer
Connected to an idle instance.

SQL> STARTUP
ORACLE instance started.

Total System Global Area 626327552 bytes


Fixed Size 2230952 bytes
Variable Size 192939352 bytes
Database Buffers 423624704 bytes
Redo Buffers 7532544 bytes
Database mounted.
Database opened.
SQL>
c. Verify the location of the data files, the control files and the redo log files.
SQL> select name from v$datafile;

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

Practices for Lesson 3: Installing Oracle Grid Infrastructure for a Standalone Server and Upgrading ASM
Chapter 3 - Page 21
NAME
---------------------------------------------------------------
+DATA/dbupgrd/datafile/system.260.814012925
+DATA/dbupgrd/datafile/sysaux.261.814012959
+DATA/dbupgrd/datafile/undotbs1.262.814012987
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

+DATA/dbupgrd/datafile/users.264.814013023
+DATA/dbupgrd/datafile/example.265.814013031

SQL> select name from v$controlfile;

NAME
---------------------------------------------------------------
+DATA/dbupgrd/control01.ctl
a ble
+FRA/dbupgrd/control02.ctl
fe r
ans
SQL> select member from v$logfile;
n - t r
o
MEMBER s an
) ha eฺ
---------------------------------------------------------------
+DATA/dbupgrd/redo01.log
ฺ c om Guid
+FRA/dbupgrd/redo01.log
a h oo ent
+DATA/dbupgrd/redo02.log
@ y
S t ud
+FRA/dbupgrd/redo02.log
a d o2 this
f n ev use
+DATA/dbupgrd/redo03.log
(x e to
+FRA/dbupgrd/redo03.log
z
6F loreselected.
rows li c e ns
n d o
rn a
Fe
SQL> EXIT
$
All files of the dbupgrd database are still stored on ASM disk groups DATA and FRA
which are managed by the upgraded ASM instance.
Note: The file numbers and incarnation numbers may be different in individual instances.
Question: Why do datafiles and controlfiles appear with the suffix file and incarnation
numbers and the redo log files do not?
Answer: the redo log files were created with an alias specification.

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

Practices for Lesson 3: Installing Oracle Grid Infrastructure for a Standalone Server and Upgrading ASM
Chapter 3 - Page 22
Practice 3-3: Determining Existing Listeners
Overview
In this practice, you will determine the existing listeners and in which environment they run now
that the Oracle Grid Infrastructure is installed in a 12c environment. Note: setting the
environment to either dbupgrd or +ASM will allow you to view the status of the default listener
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

named LISTENER.

Tasks
1. From the grid user terminal window, use the listener control utility (LSNRCTL) to
determine whether a listener is running.
$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 27-FEB-


a ble
2013 17:49:18 fe r
a n s
n -t r
Copyright (c) 1991, 2013, Oracle. All rights reserved. o
s an
Connecting to
) ha eฺ
ฺ c om Guid
(DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------ yah
oo ent
@ S t ud
Alias
a d o2 tTNSLSNR
is for Linux: Version 12.1.0.1.0
LISTENER
h
Version
- Productionfne
v se
(x e to u
Start Date
r e z s 27-FEB-2013 13:41:17

Flo Level n
lice
Uptime 0 days 4 hr. 8 min. 1 sec

n d oTrace off
rn a Security ON: Local OS Authentication
Fe SNMP OFF
Listener Parameter File
/u01/app/grid/product/12.1.0/grid/network/admin/listener.ora
Listener Log File
/u01/app/grid/diag/tnslsnr/edrsr32p1/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=edrsr32p1.us.oracle.co
m)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM", status READY, has 1 handler(s) for this
service...
Service "dbupgrd" has 1 instance(s).

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

Practices for Lesson 3: Installing Oracle Grid Infrastructure for a Standalone Server and Upgrading ASM
Chapter 3 - Page 23
Instance "dbupgrd", status READY, has 1 handler(s) for this
service...
The command completed successfully
$
The listener, named LISTENER, is running in the
/u01/app/grid/product/12.1.0/grid Grid home with a configuration defined
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

in the
/u01/app/grid/product/12.1.0/grid/network/admin/listener.ora
configuration file. The listener handles requests from both the +ASM and dbupgrd
instances.
2. Explore the
/u01/app/grid/product/12.1.0/grid/network/admin/listener.ora
configuration file.
$ cat $ORACLE_HOME/network/admin/listener.ora
a ble
# listener.ora Network Configuration File: fe r
/u01/app/grid/product/11.2.0/grid/network/admin/listener.ora ans
n - t r
no
# Generated by Oracle configuration tools.

s a
LISTENER = h a
) ideฺ
(DESCRIPTION_LIST = m
co t Gu
(DESCRIPTION = o
o en ฺ
(ADDRESS = (PROTOCOLy=ah d = EXTPROC1521))
@ S t u
IPC)(KEY

o2 =isTCP)(HOST
(ADDRESS = (PROTOCOL
d
=
v a se t h
<your_hostname>.us.oracle.com)(PORT = 1521))
) e
fn to u
( x
)
l o rez ense
d
F lic
oADR_BASE_LISTENER
a n = /u01/app/grid

Fern
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by
Agent
VALID_NODE_CHECKING_REGISTRATION_LISTENER=SUBNET #
line added by Agent
$
3. Find the user running the LISTENER: process. grid is the UNIX user running the process
in /u01/app/grid/product/12.1.0/grid, the new Grid home of the 12c Oracle Grid
Infrastructure.
$ ps -ef | grep tnslsnr
grid 4340 1 0 13:12 ? 00:00:00
/u01/app/grid/product/12.1.0/grid_1/bin/tnslsnr LISTENER -
no_crs_notify -inherit
grid 8800 32043 0 13:30 pts/3 00:00:00 grep tnslsnr
$

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

Practices for Lesson 3: Installing Oracle Grid Infrastructure for a Standalone Server and Upgrading ASM
Chapter 3 - Page 24
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

a ble
fe r
ans
n - t r
a no
Practices for a s
m ) ideฺ 4:
h Lesson
Installing
ฺ co your
G u Oracle
o
ho den t
y aSoftware
tu4
2 @ s S
v a do thi Chapter

f n e u se
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 4: Installing your Oracle Software


Chapter 4 - Page 1
Practices for Lesson 4
Practices Overview

The installation of the Oracle Grid Infrastructure software is complete. In this practice you install
the Oracle Database 12c software to enable you to create Oracle Database 12c databases.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

The installation media is staged at:


• /stage/shiphomes/RDBMS_LINUX.X64_12C/database for Oracle Database 12c

Perform the following tasks as the oracle OS user from the oracle user terminal window,
unless otherwise indicated.
Note: Completing this practice is critical for all following practice sessions.
a ble
fe r
ans
n - t r
o
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 4: Installing your Oracle Software


Chapter 4 - Page 2
Practice 4-1: Installing the Oracle Database 12c Software
1. From the oracle user terminal window, navigate to the
/stage/shiphomes/RDBMS_LINUX.X64_12C/database directory. Start the Oracle
Universal Installer (OUI) by entering ./runInstaller.
a. Enter the following:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

$ cd /stage/shiphomes/RDBMS_LINUX.X64_12C/database
$ ./runInstaller

a ble
fe r
ans
n - t r
a no
h a s
m ) ideฺ
o ฺ co t Gu
y aho tuden
o 2 @ sS
Notice that Oracle Database
a i
d 12c isthdisplayed instead of the Oracle Grid Infrastructure
12c (check in the n e v
previous s e
practice). The installation lasts 10 to 15 minutes.
x f o u
r e z ( se t
StepFlo Window/Page
l i c en Description Choices or Values
o
n ana.d Configure Security Updates Deselect the option to receive security updates

Fer
from My Oracle Support.
Note: In your real-world environment, you
would enter your email address and My Oracle
Support password; however, because the
classroom is an isolated environment, leave
the email and password fields null.
b. Configure Security Updates Click Next
c. Email Address Not Specified Click Yes
warning
d. Download Software Updates page Verify Skip Software Updates is selected
Click Next.
e. Select Installation Option page Select Install database software only
Click Next
Note: You will create databases by using
DBCA in a later practice. The upgrade of the
dbupgrd database will be performed in later
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 4: Installing your Oracle Software


Chapter 4 - Page 3
Step Window/Page Description Choices or Values
practice.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

a ble
fe r
ans
n - t r
a no
h a s
m ) ideฺ
o ฺ co t Gu
y aho tuden
o 2 @ sS
Step Window/Page e v ad se thi
Description Choices or Values
f n
(x Options u
f. Grid Installation
z e to page Verify Single instance database installation is
F lore licens selected
Click Next
n d o
na Note: In this course you are not working on a Real
Fer Application Cluster system.
g. Select Product Languages Select all the available languages with the '>>' button
page Click Next.
h. Select Database Edition page Verify Enterprise Edition (6.4GB) is selected.
Click Next.
Note: With Enterprise Edition, any existing option can
be installed which is not the case with Standard
Edition. This explains the difference of space used.
i. Specify Installation Location 1. Set Oracle Base to /u01/app/oracle.
page 2. Set Software Location
to/u01/app/oracle/product/12.1.0/dbhome_1.
3. Note:You installed the Oracle Grid Infrastructure
in /u01/app/grid base directory and you install the
Oracle Database in /u01/app/oracle base
directory.

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

Practices for Lesson 4: Installing your Oracle Software


Chapter 4 - Page 4
Step Window/Page Description Choices or Values
4. Click Next.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

a ble
fe r
ans
n - t r
a no
h a s
m ) ideฺ
o ฺ co t Gu
y aho tuden
o 2 @ sS
Step Window/Pagev a e thi
dDescription Choices or Values
e
fn toSystem s
u groups Keep distinct OS groups for separation of
j. (
Privileged xOperating

l o rez ense
page duties.

d o F lic Note: The OS groups, dba, oper,

nan
backupdba, dgdba and kmdba were created

Fer
prior to running the installer. You can view
them in the /etc/group file.
Click Next

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

Practices for Lesson 4: Installing your Oracle Software


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

a ble
fe r
ans
n - t r
a no
h a s
Step Window/Page Description m ) Choicesd e ฺ or Values
ฺ co tif any i
uchecks failed
k. Perform Prerequisites Checks oAppears G
y aho tuden
Note: However, if you want to list2 @ S click the Prerequisite Checks in the
all the checks,
navigator in the left panea
o
ofdthe OUI. tThe
h ischeck for User Existence is oracle. The
e v e
s to the summary page.
( x fn Next
groups are listed. click
t o
toureturn

l o rez ense
d o F lic
nan
Fer

Step Window/Page Description Choices or Values


l. Summary page Click Install

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

Practices for Lesson 4: Installing your Oracle Software


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

a ble
fe r
ans
n - t r
a no
h a s
m ) ideฺ
o ฺ co t GChoices
u
Step Window/Page Description
a h o en or Values
m. Install Product page @ y
S t ud the progress of the installation and
Displays

a d o2 this the status for each individual task being


f n ev use performed

z (x e to
F lore licens
n d o
na
Fer

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

Practices for Lesson 4: Installing your Oracle Software


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

a ble
fe r
ans
n - t r
a no
h a s
m ) ideฺ
o ฺ co t Gu
y aho tuden
o 2 @ sS
v a d
e thi
f n e usscripts window appears, follow the steps listed in the
When the Execute
window. ez
( x Configuration
t o
l o r e n se
StepF
d o lic
Window/Page Description Choices or Values

n ann. Execute Configuration scripts Follow steps in window.


Fer
b. Open a terminal window and log in as root.
i. $ su -
ii. Password:
iii. #
c. Run the script shown in the Execute Configuration scripts window. Accept the default
for the local bin directory and do not overwrite any files (you can just press [Enter]
because the default option is to not overwrite).
# /u01/app/oracle/product/12.1.0/dbhome_1/root.sh

Performing root user operation for Oracle 12c

The following environment variables are set as:


ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/12.1.0/dbhome_1
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 4: Installing your Oracle Software


Chapter 4 - Page 8
Enter the full pathname of the local bin directory:
[/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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

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.
#
a ble
d. Exit from the root session.
fe r
ans
# exit
n - t r
logout
$ exit a no
h a s
m ) ideฺ
Step Window/Page Description o ฺ co t GChoices
u or Values
h o n
o. Execute Configuration ya tClicku deOK
o 2 @ s S Click Close
p. Finish page
d
a se t h i
e v
2. Return to the oracle( x fnuser Unix
t o usession where runInstaller was launched and press
[Enter].
l o rez ense
$F You canlic
n d o find the log of this install session at:

na /u01/app/logs/installActions2013-02-25_02-27-55AM.log
Fer $
The name of the log file of the install is displayed.

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

Practices for Lesson 4: Installing your Oracle Software


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

a ble
fe r
ans
n - t r
o
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 4: Installing your Oracle Software


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

a ble
fe r
ans
n - t r
a no
Practices for a s
m ) ideฺ 5:
h Lesson
Creating
ฺ co an Oracle
G u Database
o
ho dDBCA n t
y aUsing tu5
e
2 @ s S
v a do thi Chapter

f n e u se
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 5: Creating an Oracle Database Using DBCA


Chapter 5 - Page 1
Practices for Lesson 5
Practices Overview

You will create two types Oracle databases in this practice:


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

• A non container database (non-CDB): orcl


• A multitenant container database (CDB): cdb1
You anticipate that several similar non-CDB databases will be needed in the near future.
Therefore, you decide to create your orcl database, as well as a database template and the
database creation scripts. Locate the scripts in the /home/oracle/labs directory (which is
the directory that you use most often throughout this course).
The CDB named cdb1 will contain sample schemas and therefore one pluggable database
named pdb1.
a ble
fe r
ans
n - t r
o
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 5: Creating an Oracle Database Using DBCA


Chapter 5 - Page 2
Practice 5-1: Creating a Non-CDB
In this practice, you create the non-container database named orcl. You use the Database
Configuration Assistant (DBCA) to create the database.
1. From the oracle user terminal window, set your ORACLE_HOME environment variable by
using oraenv. Enter orcl for the SID and then enter
/u01/app/oracle/product/12.1.0/dbhome_1 for the new ORACLE_HOME.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Note: You enter the full ORACLE_HOME path at this time because the orcl database
does not exist yet. The entry is not yet registered in the /etc/oratab file and therefore
the ORACLE_HOME is not known. After the database is created, you will only have to
enter orcl as the SID and it will determine the appropriate ORACLE_HOME from the
/etc/oratab file.
$ . oraenv
ORACLE_SID = [dbupgrd] ? orcl
a ble
ORACLE_HOME = [/home/oracle] ?
fe r
/u01/app/oracle/product/12.1.0/dbhome_1
ans
The Oracle base remains unchanged with value /u01/app/oracle
n - t r
$
a no
The Oracle base remains /u01/app/oracle because you
h a s are creating a database
and therefore still working in the Oracle Databasem ) ideฺ
environment.
2. Start the Database Configuration Assistant (DBCA).o ฺ co t Gu
$ dbca
y aho tuden
o2 @ sS
v a d
e thi
f n e Description
us
Step
z ( x
Window/Page t o Choices or Values
a. re eOperation e
ns page Select Create Database
F loDatabase
l i c
n d o Click Next
na b. Creation Mode page Select Advanced Mode.
Fer Note: This option allows more customization.
Click Next.
c. Database Template page Select the General Purpose or Transaction
Processing template.
Click Show Details
d. Template Details Answer the following questions:

i) Question 1: How many control files are created?

Answer: Two
Note: The location is by default {ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}
for the first control file and
{ORACLE_BASE}/fast_recovery_area/{DB_UNIQUE_NAME} for the second
control file.

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

Practices for Lesson 5: Creating an Oracle Database Using DBCA


Chapter 5 - Page 3
ii) Question 2: How many redo log groups are created?

Answer: Three
Note: The location will change later in this practice when we choose to use
filesystem as our storage technique.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

iii) Question 3: What is the database block size (db_block_size)?

Answer: 8 KB
iv) Question 4: What is the value of Sample Schemas?

Answer: Sample Schemas is set to False.


Note: You will change this setting later in this practice so that the HR sample schema
is included in your database.
a ble
v) Question 5: What is the template default for the Database Character Set? fe r
ans
Answer: WE8MSWIN1252 n - t r
a no
Note: You will change this setting later in this practice to use a Unicode database
character set. h a s
m ) ideฺ
Step Window/Page Description
o ฺ co t GChoices
u or Values
e. Template Details window.
y aho tClick
u d eOKn
f. Database Template page 2 @ s S Click Next
g. a dopage thi Set Global Database Name = orcl.
Database Identification
v
f n e u se
z ( x t o Note: The SID defaults to the database name
r e n s e orcl.

o Flo lice Verify that the Create As Container Database

a n d check box Is NOT checked so that you will


create a non-CDB.
n
Fer Click Next.

Note: it is common to input a fully qualified name for the global database name, for
example: orcl.example.com. The global name often needs to be unique across the
domain which in this case is example.com. Notice the SID excludes the domain name
automatically.
Step Window/Page Description Choices or Values
h. Management Options page Select Configure Enterprise Manager (EM)
Database Express
Note: Enterprise Manager Database Express allows
you to perform DBA tasks through a graphical user
interface
Click Next
i. Database Credentials page Best practice tip: use separate passwords used for
each account to help maintain separation of duties.

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

Practices for Lesson 5: Creating an Oracle Database Using DBCA


Chapter 5 - Page 4
Step Window/Page Description Choices or Values
Note: In this class, you are using the same password
to minimize disruption to the practices due to a
forgotten password.
Select Use the Same Administrative Password for
All Accounts
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Set Password = oracle_4U Set Confirm Password


= oracle_4U
Click Next.
j. Network Configuration page Verify Listener named LISTENER with Port 1521 is
Listener Selection tab selected and is Up, and running from the
/u01/app/grid/product/12.1.0/grid
directory
Click Next a ble
fe r
k. Storage Locations page Set Storage Type = File System
ans
-
Select Use Common Location for All Database
n t r
o
s an Files
Note: All the database files of the orcl non-CDB will
) ha eฺ be created in /u01/app/oracle/oradata/orcl
ฺ c om Guid directory. The RMAN backup files will be stored in

a h oo ent /u01/app/oracle/fast_recovery_area/orcl.

@ y
S t ud The orcl directories are created automatically - the

a d o2 this {ORACLE_BASE}/oradata listed in the Database


File Locations field is sufficient. There is no need to
f n ev use add the orcl directory. The same applies to the Fast
z (x e to Recovery Area field.

F lore licens Click Next.

n d o
rn a
Fe

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

Practices for Lesson 5: Creating an Oracle Database Using DBCA


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

a ble
fe r
ans
n - t r
a no
h a s
m ) ideฺ
Step Window/Page Description o ฺ co t GChoices
u or Values
a h o en
l. Database Options page
@ y
S ud Sample Schemas
Select
t
a d o2 this Note: This will create several sample schemas
f n ev use such as HR, OE, SH and others.

z (x e to Best Practice Tip: Do NOT create Sample

l o re ens Schemas in production databases. Sample


Schemas are for training and testing.
o F l ic
a n d Click Next
n
Fer m. Initialization Parameters page
Memory tab
Set Memory Size = 840 MB
Select Use Automatic Memory Management
n. Initialization Parameters page Select Use Unicode (AL32UTF8).
Character Sets tab
o. Initialization Parameters page Review Settings, Do not change anything
Sizing tab
p. Initialization Parameters page Review Settings, Do not change anything
Connection Mode tab Click Next

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

Practices for Lesson 5: Creating an Oracle Database Using DBCA


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

a ble
fe r
ans
n - t r
o
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

Step Window/Page Description Choices or Values


q. Creation Options page Select Create Database
Select Save as a Database Template option.
• Set Name = orcl as the Name for the
database template
• Set Description to orcl Database
Template
Select Generate Database Creation Scripts
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 5: Creating an Oracle Database Using DBCA


Chapter 5 - Page 7
Step Window/Page Description Choices or Values
Set Destination Directory =
/home/oracle/labs
Note: this directory must exist.
Click Next.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

r. Pre Requisite Checks If there are no failed prerequisites, the DBCA


moves immediately to the next page
s. Summary page Review options, parameters, locations and
settings, specifically the ones in the table
below.

Name Value or Location Value


a ble
Sample true
fe r
Schemas
ans
n - t r
db_name orcl
a no
db_block_s 8KB
h a s
ize
m ) ideฺ
ฺ co t Gu
Data Files {ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/*
o
Control
a ho den
{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/control01.ctl
y
Files
@ S tu
{ORACLE_BASE}/fast_recovery_area/{DB_UNIQUE_NAME}}/co
2
ntrol02.ctldo thi s
e v a se
memory_tar 840MB
f n
(x e to u
get
z
l ore iceAL32UTF8
Database
F ns
d o
Character l
n n
a Set
Fer
Step Window/Page Description Choices or Values
t. Summary page Click Finish
u. Template has been created Click OK
v. Generation of the database scripts Click OK
w. Progress page Displays the progress of the various
installation steps. You can see that the
database is automatically registered with
Oracle Restart. You will learn about Oracle
Restart in a later practice. This step takes
about 15 minutes.

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

Practices for Lesson 5: Creating an Oracle Database Using DBCA


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

a ble
fe r
ans
n - t r
a no
h a s
m ) ideฺ
Step Window/Page Description o ฺ co t GChoices
u or Values
a h o en
x. Database creation complete y
@ S ud essential information about the
Displays
t
a d o2 this database.
Express
Make note Enterprise Manager
URL,because will be used in several
e v s e
( x fn to u of the following practice sessions

l o rezMakeenote
Important: n seof your Enterprise Manager Express URL here:
d o F lic
n an https://_________________________________________:______/em
Fer You will be using this URL many times throughout the remainder of the course.

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

Practices for Lesson 5: Creating an Oracle Database Using DBCA


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

a ble
fe r
ans
n - t r
a no
h a s
Step Window/Page Description
m ) ideฺ or Values
Choices
y. Database creation complete
o ฺ coPassword
Click
t G u Management
Password Management page ah
o Scrolledown
n to find the HR user
z.
y u d
tDeselect
o2 @ s S Lock Account?
d
a se t h i Set New Password: oracle_4U
e v
( x fn to u Confirm Password: oracle_4U

l o rez ense Click OK

d lic creation complete


aa.o F Database Click Exit
n
na bb. Database Creation Assistant Click Close
Fer
3. You have completed the creation of the non-CDB, of the orcl database template, and the
database generation scripts. When you create another database, the orcl template will
appear on the templates page. Check that the orcl.sh shell script exists.
Note: the ls command below has a “one” not “el” as the last character.
$ cd /home/oracle/labs
$ ls -tr -1
init.ora
orcl.sh
tempControl.ctl
initorclTempOMF.ora
rmanRestoreDatafiles.sql
CloneRmanRestore.sql
initorclTemp.ora
cloneDBCreation.sql
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 5: Creating an Oracle Database Using DBCA


Chapter 5 - Page 10
postScripts.sql
lockAccount.sql
orcl.sql
postDBCreation.sql
$
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

4. Verify that the orcl database instance entry is added in /etc/oratab.


$ cat /etc/oratab

+ASM:/u01/app/grid/product/12.1.0/grid:N: # line added by
Agent
dbupgrd:/u01/app/oracle/product/11.2.0/dbhome_2:N: #
line added by
Agent
a ble
orcl:/u01/app/oracle/product/12.1.0/dbhome_1:N: # line fe r
added by Agent
ans
$ n - t r
5. a no
Verify that you can connect as SYSTEM and that the database name is ORCL. Do not mix
up instance and database names. h a s
m ) ideฺ
a. Use views to verify instance and database names. The banner displays “Oracle
ฺ co t Gu
Database 12c Enterprise Edition Release 12.1.0.1.0”.
o
$ sqlplus system/oracle_4Uyah
o en
@ S t ud
a d o2 this
ev12c Enterprise
se
Connected to:
x
Oracle Database
( f n o u Edition Release 12.1.0.1.0 -
t
rez ense
64bit Production
l o
d
F select
oSQL> lic instance_name from v$instance;
a n
Fern
INSTANCE_NAME
----------------
orcl

SQL> select name from v$database;

NAME
---------
ORCL

SQL> EXIT
$
b. View the ORACLE_SID environment variable.
$ echo $ORACLE_SID

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

Practices for Lesson 5: Creating an Oracle Database Using DBCA


Chapter 5 - Page 11
orcl
$
6. Verify the existence of initialization parameter files.
$ ls $ORACLE_HOME/dbs/*orcl*.ora
/u01/app/oracle/product/12.1.0/dbhome_1/dbs/spfileorcl.ora
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

$
Only the server parameter file exists. DBCA removes the parameter file after the
creation of the database is complete. It is a good practice to have a parameter file to
edit it when necessary to modify initialization parameters. But do not create the
parameter file with the default name. A non-default name will prevent accidentally
starting the database instance with a possibly out-of-date parameter file.
a. Re-create the parameter file.
$ sqlplus system/oracle_4U
a ble
fe r
SQL> create pfile='bkuporcl.ora' from spfile; ans
n - t r
no
create pfile from spfile
*
s a
ERROR at line 1: h a
) ideฺ
ORA-01031: insufficient privileges m
co t Gu
o ฺ
SQL> y aho tuden
o2 @ enough
The SYSTEM user is not privileged s Sto create a parameter file. Connect as
d
a se t h i
SYSDBA.
e v
SQL> connect( x fn/ as tsysdba
o u
o rez ense
Connected.
l
d o F create
SQL> lic pfile='bkuporcl.ora' from spfile;
na n
Fer File created.

SQL> exit
$
b. Edit the parameter file using gedit or your preferred editor to set the
db_recovery_file_dest_size to 6G instead of 4800m. Save the changes and
quit gedit.
$ gedit $ORACLE_HOME/dbs/bkuporcl.ora

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

Practices for Lesson 5: Creating an Oracle Database Using DBCA


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

a ble
fe r
ans
n - t r
c. Be aware that if you shut the instance down and restart it without naming the o
an
initialization parameter file, the SPFILE is used by default. If you want the PFILE to be
s
used, use the following steps:
) ha eฺ
i) Shut the instance down.
ฺ c om Guid
$ sqlplus / as sysdba
a h oo ent
@ y
S t ud
SQL> shutdown immediate
a d o2 this
Database closed.
f n ev use
(x e to
Database dismounted.
z
o
ORACLE
l reinstance
e ns shut down.
F
oSQL> li c
a n d
n ii) Start the instance up with the PFILE clause.
Fer SQL> startup pfile=$ORACLE_HOME/dbs/bkuporcl.ora
ORACLE instance started.

Total System Global Area 876859392 bytes


Fixed Size 2294360 bytes
Variable Size 62070488 bytes
Database Buffers 247463936 bytes
Redo Buffers 6340608 bytes
Database mounted.
Database opened.
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------ ----------- ---------------
spfile string
SQL> show parameter db_recovery_file_dest_size
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 5: Creating an Oracle Database Using DBCA


Chapter 5 - Page 13
NAME TYPE VALUE
------------------------------ ----------- ----------------
db_recovery_file_dest_size big integer 6G
SQL>
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

iii) Restart the instance without specifying the initialization file and you find out that the
server parameter file is used.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
a ble
ORACLE instance started.
fe r
ans
Total System Global Area 881037312 bytes
n - t r
Fixed Size 2294408 bytes
a no
h a s
Variable Size 620760440 bytes
251658240 bytesm) d e ฺ
Database Buffers
ฺ co t Gu i
6324224 obytes
aho tuden
Redo Buffers
Database mounted. y
@ sS
Database opened.
o2
dspfilethi
SQL> show parameter
e v a e
sTYPE
NAME
( x f n o u VALUE
t
l o rez ense
---------------------- ----------- ----------------

d
F
spfile
lic string
o/u01/app/oracle/product/12.1.0/dbhome_1/dbs/spfileorcl.ora
a n
Fern
SQL>
SQL> show parameter db_recovery_file_dest_size

NAME TYPE VALUE


------------------------------ ----------- ----------------
db_recovery_file_dest_size big integer 4800M
SQL> EXIT
$
7. View the alert.log file. You can use the Automatic Diagnostic Repository Command
Interface (ADRCI), any text editor, or UNIX command to read the alert.log.
a. Use ADRCI.
$ adrci
ADRCI: Release 12.1.0.1.0 - Production on Wed Feb 27 20:10:48
2013

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

Practices for Lesson 5: Creating an Oracle Database Using DBCA


Chapter 5 - Page 14
Copyright (c) 1982, 2013, Oracle and/or its affiliates. All
rights reserved.

ADR base = "/u01/app/oracle"


adrci> show alert -tail
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

DIA-48449: Tail alert can only apply to single ADR home

adrci> EXIT
$
b. Set the ADR home to the ADR of the orcl database instance. If you do not know it,
you can find it using the V$DIAG_INFO view.
$ sqlplus / as sysdba

a ble
SQL> col value format A54 fe r
ans
SQL> col name format A22
n - t r
SQL> select name, value from v$diag_info;
a no
h a s
NAME VALUE
m ) ideฺ
o ฺ co t Gu
---------------------- -----------------------------------------

aho tuden
Diag Enabled TRUE
ADR Base y
/u01/app/oracle
@ sS
o2
thi
ADR Home /u01/app/oracle/diag/rdbms/orcl/orcl
v a d /u01/app/oracle/diag/rdbms/orcl/orcl/trace
Diag Trace
e e
us/u01/app/oracle/diag/rdbms/orcl/orcl/alert
Diag Alert(xfn t o
r ez nse
Diag Incident
l o
d
F lice
o/u01/app/oracle/diag/rdbms/orcl/orcl/incident
a n Diag Cdump /u01/app/oracle/diag/rdbms/orcl/orcl/cdump

Fern Health Monitor /u01/app/oracle/diag/rdbms/orcl/orcl/hm


Default Trace File
/u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_28
725.trc

Active Problem Count 0


Active Incident Count 0

11 rows selected.

SQL> EXIT
$
c. Set the ADR home to the ADR of the orcl database instance. The text of the alert file
will vary from the example shown below.
$ adrci
adrci> set homepath diag/rdbms/orcl/orcl
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 5: Creating an Oracle Database Using DBCA


Chapter 5 - Page 15
adrci> show alert -tail
2013-02-27 20:09:20.484000 -08:00
No Resource Manager plan active
Starting background process FBDA
FBDA started with pid=7, OS id=28197
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

replication_dependency_tracking turned off (no async multimaster


replication found)
2013-02-27 20:09:23.566000 -08:00
Starting background process AQPC
AQPC started with pid=28, OS id=28204
Starting background process CJQ0
Completed: ALTER DATABASE OPEN
CJQ0 started with pid=36, OS id=28221
a ble
2013-02-27 20:09:24.812000 -08:00
fe r
db_recovery_file_dest_size of 4800 MB is 0.00% used. This is a ans
n - t r
user-specified limit on the amount of space that will be used by
o
this
s an
ha eฺ
database for recovery-related files, and does not reflect the
)
om Guid
amount of
ฺ c
oo ent
space available in the underlying filesystem or ASM diskgroup.
a h
ud
adrci>
@ y t
d. Find any existing error. 2 is S
o"MESSAGE_TEXT
adrci> show alert a-p
v d t h LIKE '%ORA-%'"
e s e
( x fn to u
l o rez ense
d o F lic
na n
Fer

If you need to read all errors, scroll down the temporary file. If you need to keep the
information in a file, enter :w /tmp/mylogfile. This creates a permanent file.

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

Practices for Lesson 5: Creating an Oracle Database Using DBCA


Chapter 5 - Page 16
Enter :q to quit the temporary file.

ADR Home = /u01/app/oracle/diag/rdbms/orcl/orcl:


****************************************************************
Output the results to file: /tmp/alert_29068_1397_orcl_1.ado
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

adrci> EXIT
$
e. Use any text editor or UNIX command to read the alert.log. The text of the alert file will
vary from the example shown below.
Note: the tail command in the example shows the last 30 lines in the file.
$ cd $ORACLE_BASE/diag/rdbms/orcl/orcl/trace
$ tail -30 alert_orcl.log
Current log# 1 seq# 10 mem# 0:
a ble
fe r
/u01/app/oracle/oradata/orcl/redo01.log
ans
Successful open of redo thread 1
n - t r
MTTR advisory is disabled because FAST_START_MTTR_TARGET is not o
set
s an
SMON: enabling cache recovery
) ha eฺ
ฺ c om Guid
[16330] Successfully onlined Undo Tablespace 2.

a h oo ent
Undo initialization finished serial:0 start:55183694

@ y
S t ud
end:55183774 diff:80 ms (0.1 seconds)

encryption..
a d o2 this
Verifying file header compatibility for 11g tablespace

f n ev use
Verifying 11g file header compatibility for tablespace
z (x e to
encryption completed
lore licens
SMON: enabling tx recovery
F
n d oStarting background process SMCO

rn a Mon Feb 25 03:35:25 2013


Fe SMCO started with pid=25, OS id=16336
Database Characterset is AL32UTF8
No Resource Manager plan active
Starting background process FBDA
Mon Feb 25 03:35:25 2013
FBDA started with pid=26, OS id=16338
replication_dependency_tracking turned off (no async multimaster
replication found)
Starting background process AQPC
Mon Feb 25 03:35:26 2013
AQPC started with pid=27, OS id=16340
Starting background process CJQ0
Completed: ALTER DATABASE OPEN
Mon Feb 25 03:35:29 2013
CJQ0 started with pid=37, OS id=16363

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

Practices for Lesson 5: Creating an Oracle Database Using DBCA


Chapter 5 - Page 17
Mon Feb 25 03:35:33 2013
db_recovery_file_dest_size of 4800 MB is 0.00% used. This is a
user-specified limit on the amount of space that will be used by
this
database for recovery-related files, and does not reflect the
amount of
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

space available in the underlying filesystem or ASM diskgroup.


$
8. Verify that you can connect as the HR user, one of the sample schemas.
$ sqlplus hr/oracle_4U

SQL> show user


USER is "HR"
a ble
SQL> select table_name from user_tables; fe r
ans
n - t r
TABLE_NAME o
an
---------------------------------------------------------------
s
COUNTRIES
) ha eฺ
JOB_HISTORY
ฺ c om Guid
EMPLOYEES
a h oo ent
JOBS
@ y
S t ud
REGIONS
a d o2 this
DEPARTMENTS
f n ev use
LOCATIONS
z (x e to
7F loreselected.
rows li c e ns
n d o
rn a
Fe SQL>
9. List all data files, control files and redo log files of the orcl database.
a. List all data files.
SQL> connect system/oracle_4U
Connected.
SQL> select name from v$datafile;

NAME
---------------------------------------------------------------
/u01/app/oracle/oradata/orcl/system01.dbf
/u01/app/oracle/oradata/orcl/example01.dbf
/u01/app/oracle/oradata/orcl/sysaux01.dbf
/u01/app/oracle/oradata/orcl/undotbs01.dbf
/u01/app/oracle/oradata/orcl/users01.dbf

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

Practices for Lesson 5: Creating an Oracle Database Using DBCA


Chapter 5 - Page 18
SQL>
The data files are all stored in the $ORACLE_BASE/oradata/orcl directory.
b. List all control files.
SQL> select name from v$controlfile;
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

NAME
---------------------------------------------------------------
/u01/app/oracle/oradata/orcl/control01.ctl
/u01/app/oracle/fast_recovery_area/orcl/control02.ctl

SQL>
One control file resides in the $ORACLE_BASE/oradata/orcl directory and another
control file resides in the $ORACLE_BASE/fast_recovery_area/orcl directory. a ble
fe r
c. List all redo log files.
ans
SQL> select member from v$logfile;
n - t r
a no
MEMBER
h a s
m ) ideฺ
---------------------------------------------------------------
/u01/app/oracle/oradata/orcl/redo03.log o ฺ co t Gu
y aho tuden
/u01/app/oracle/oradata/orcl/redo02.log
2 @ sS
/u01/app/oracle/oradata/orcl/redo01.log
o
v a d
e thi
SQL> f n e us
( x t o
l o ezthreenredo
There are selog groups. Each redo
r$ORACLE_BASE/oradata/orcl log group owns a single member residing
in the e directory. The default configuration does not
lic redo log groups. Best practice is for each group to have two
F multiplexed
n d o create
rn a members, each on a different disk drive.
Fe d. If you had another disk on /u02, you could multiplex the redo log groups to this disk.
On your server you only have /u01. You use it to multiplex.
SQL> alter database add logfile member
'/u01/app/oracle/oradata/orcl/redo01b.log' to group 1;

Database altered.

SQL> alter database add logfile member


'/u01/app/oracle/oradata/orcl/redo02b.log' to group 2;

Database altered.

SQL> alter database add logfile member


'/u01/app/oracle/oradata/orcl/redo03b.log' to group 3;

Database altered.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 5: Creating an Oracle Database Using DBCA


Chapter 5 - Page 19
SQL> col member format A50
SQL> select group#, member from v$logfile order by 1;

GROUP# MEMBER
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

---------- --------------------------------------------------
1 /u01/app/oracle/oradata/orcl/redo01.log
1 /u01/app/oracle/oradata/orcl/redo01b.log
2 /u01/app/oracle/oradata/orcl/redo02b.log
2 /u01/app/oracle/oradata/orcl/redo02.log
3 /u01/app/oracle/oradata/orcl/redo03b.log
3 /u01/app/oracle/oradata/orcl/redo03.log

a ble
6 rows selected. fe r
ans
n - t r
SQL> exit o
$
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 5: Creating an Oracle Database Using DBCA


Chapter 5 - Page 20
Practice 5-2: Creating a CDB
Overview
In this practice, you create the cdb1 multitenant container database. You use the Database
Configuration Assistant (DBCA) to create the CDB.
1. Still from the oracle user terminal window, set your ORACLE_HOME environment variable
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

by using oraenv. Enter cdb1 for the SID and then enter
/u01/app/oracle/product/12.1.0/dbhome_1 for ORACLE_HOME. The entry is not
yet registered in the /etc/oratab file and therefore the ORACLE_HOME is not known.
$ . oraenv
ORACLE_SID = [orcl] ? cdb1
ORACLE_HOME = [/home/oracle] ?
/u01/app/oracle/product/12.1.0/dbhome_1
a ble
The Oracle base remains unchanged with value /u01/app/oracle
fe r
$
a n s
2. Start the Database Configuration Assistant (DBCA) and perform the following
n t r
-steps:
o
$ dbca
s an
) ha eฺ
Step Window/Page Description om Guid
Choices or Values
ฺ c
a. Step 1: Database
a oo Database”.
Selecth“Create e n t
Operation
@ y Next.tud
Click
o2 i s S
b. Step 2: Creation Mode
v d
a se t h
Select “Advanced Mode”.
e
fn to u Click Next.
( x
c.
l o r zDatabase
Stepe3:
Template e n se Notice that the template orcl created in practice 5-1 is

d o F lic available.
Select “General Purpose or Transaction Processing”.
n a n
Fer
Click Next.
d. Step 4: Database Enter
Identification Global Database Name: cdb1
SID: cdb1
Select “Create As Container Database”
Select “Create a Container Database with one or more
PDBs”
Enter
PDB Name: pdb1
Click Next.
e. Step 5: Management Deselect “Configure Enterprise Manager (EM) Database
Options Express”.
Note: each database using EM Database Express requires a
separate port. The default port of 5500 has already been
assigned so it can be be used again for this database.

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

Practices for Lesson 5: Creating an Oracle Database Using DBCA


Chapter 5 - Page 21
Step Window/Page Description Choices or Values
Click Next.
f. Step 6: Database Notice that a new User Name appears: PDBADMIN, this user
Credentials could be the DBA of the pdb1 PDB.
Select “Use same Administrative password…”
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Enter:
Password: oracle_4U
Confirm password: oracle_4U
Click Next.
g. Step 7: Network Listener Selection: Click Next
Configuration
h. Step 8: Storage Locations Confirm Storage type is “File System”.
a ble
Select “Use Common Location for All Database Files”.
fe r
Click Next. ans
n - t r
i. Step 9: Database Options
a no
Select Sample Schemas. Click Next.
j. Step 10: Initialization Enter
h a s
Parameters Memory Tab Memory Size (SGA
m ) and iPGA):
d e ฺ 844 MB
Check theฺc o Automatic
Use G u Memory Management
o
o enSets” tab
Selecth“Character
t
y a t d
uUnicode
o2 @Select “Use
s S (AL32UTF8)”.

ad seClick i
th Next.
e v
k.
( x fn Options
Step 11: Creation
t o u Select “Create Database”.
r e z s e Click Next.
l.
o 12:icPre
FlStep n
e Requisite Note if there are no warnings or errors, this page automatically
d o Checks
l advances to the next.
n a n
Fer m. Step 13: Summary Review options, parameters, locations and settings
Verify Number of Pluggable Databases is one
Sample Schema PDB is named pdb1
Parameter enable_pluggable_database is true.
Click Finish.
n. Step 14: Progress Page The DBCA displays the progress of the installation steps.
This operation takes about 25 minutes.

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

Practices for Lesson 5: Creating an Oracle Database Using DBCA


Chapter 5 - Page 22
Step 14 is detailed below.
− You can see that the database is automatically registered with Oracle Restart. You
will learn about Oracle Restart in another practice. After the CDB is created, not only
is the CDB is created but also a PDB inside the CDB. There are two PDBs created:
the PDB$SEED PDB, automatically created in any CDB as a PDB template to create
other PDBs, and pdb1.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

a ble
fe r
ans
n - t r
a no
h a s
m ) ideฺ
o ฺ co t Gu
y aho tuden
o 2 @ sS
v a d
e thi
f n e us
( x
z database t o
− When the
r e n s e is created, the DBCA displays essential information about the
F lo lice Password Management button. Scroll down the Password
database. Click the

n d o Management page to find the HR username. You will not find the HR username
rn a because it is created only in the PDB, not in the root container of the CDB. Click
Fe Cancel.

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

Practices for Lesson 5: Creating an Oracle Database Using DBCA


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

a ble
fe r
ans
n - t r
a no
h a
− Click Exit to close the Database Configuration Assistant s
window. Then click Close
to quit DBCA. )
m uide ฺ
c o
h o oฺ inn/etc/oratab.
3. Verify that the cdb1 database instance entry is added
t G
$ cat /etc/oratab
@ ya tude

o2 i s S
v d
a se t h
+ASM:/u01/app/grid/product/12.1.0/grid:N: # line added by
Agent e
fn to u
( x
z by se
dbupgrd:/u01/app/oracle/product/11.2.0/dbhome_2:N: #
r e n
Flo lice
line added

n o
d orcl:/u01/app/oracle/product/12.1.0/dbhome_1:N:
Agent
n a # line
Fer added by Agent
cdb1:/u01/app/oracle/product/12.1.0/dbhome_1:N: # line
added by Agent
$
4. You have completed the creation of the CDB, including a PDB. Verify that you can connect
as SYSTEM and that the database name is CDB1. Use views to verify the instance and
database names. The CON_NAME and CON_ID values allow you to verify in which container
in the CDB you are connected to.
$ sqlplus system/oracle_4U

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -
64bit Production

SQL> show con_name

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

Practices for Lesson 5: Creating an Oracle Database Using DBCA


Chapter 5 - Page 24
CON_NAME
------------------------------
CDB$ROOT
SQL> show con_id
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

CON_ID
------------------------------
1
SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
cdb1
a ble
fe r
ans
SQL> select name from v$database;
n - t r
o
NAME
s an
---------
) ha eฺ
CDB1
ฺ c om Guid
a h oo ent
SQL>
@ y
S t ud
The container ID for the root
a d ois 21. this
v PDB.
5. Display the status of theepdb1
n se
f
(xname, o u
topen_mode
r e z
SQL> select
s e from v$pdbs;

F lo licen
n d oNAME OPEN_MODE
na ------------------------------ ----------
Fer PDB$SEED READ ONLY
PDB1 READ WRITE

SQL>
The PDB$SEED PDB is automatically created in any CDB as a PDB template to create
other PDBs. The seed PBD is always READ ONLY.
The PDB1 PDB has been created and DBCA automatically put the PDB in READ WRITE
mode.
6. Connect to pdb1 as SYSDBA.
SQL> connect sys/oracle_4U@localhost:1521/pdb1 as sysdba
Connected.
SQL> show con_name

CON_NAME
------------------------------
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 5: Creating an Oracle Database Using DBCA


Chapter 5 - Page 25
PDB1
SQL> show con_id

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

3
SQL>
The container ID for pdb1 is 3. The container ID 2 is PDB$SEED PDB.
7. Connect to pdb1 as HR.
a. Use the Easy Connect syntax to connect to pdb1 as HR.
SQL> connect hr/oracle_4U@localhost:1521/pdb1
ERROR:
ORA-28000: the account is locked a ble
fe r
ans
n - t r
no
Warning: You are no longer connected to ORACLE.

s a
SQL>
h a
)HR account.ฺ The HR user is a
b. Connect as the administrator of the PDB to unlock mthe i d e
ฺ cothe administrator
local user only known in its PDB. Therefore,oonly t G u of the PDB can
unlock the user.
y aho tuden
2 @ sS
SQL> connect sys/oracle_4U@localhost:1521/pdb1
o
as sysdba
Connected. ad se th i
e v
SQL> alter user
( x fn hrtoidentified
u by oracle_4U account unlock;

l o rez ense
d o F
User
lic
altered.

na n
Fer
SQL>
c. Reattempt the connection to pdb1 as HR.
SQL> connect hr/oracle_4U@localhost:1521/pdb1
Connected.
SQL>
d. Verify that HR is connected in pdb1.
SQL> show con_name

CON_NAME
------------------------------
PDB1
SQL>
e. List the tables owned by the HR sample schema.
SQL> select table_name from user_tables;

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

Practices for Lesson 5: Creating an Oracle Database Using DBCA


Chapter 5 - Page 26
TABLE_NAME
----------------------------------------------------------------
COUNTRIES
JOB_HISTORY
EMPLOYEES
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

JOBS
REGIONS
DEPARTMENTS
LOCATIONS

7 rows selected.

SQL> exit
a ble
$ fe r
ans
8. Verify the existence of initialization parameter files.
n - t r
$ ls $ORACLE_HOME/dbs/*cdb1*.ora
a no
/u01/app/oracle/product/12.1.0/dbhome_1/dbs/spfilecdb1.ora
h a s
$
m ) ideฺ
Only the SPFILE server parameter file exists. ฺ o removes
cDBCA G u the PFILE parameter
o t
o eItnis always a good habit to have a
parameter file to edit when necessaryy ahtocomplete.
file after the creation of the database is
udinitialization parameters.
modify
t
@
2 an SPFILE. S
Also Notice pdb1 does notohave
a d t h is
9. Re-create the parameterefile
n v with asnon-default
e name. The SYSTEM user is not privileged
enough to create ( ax f
parameter u
tofile. Connect as SYSDBA.
z e
lore lic/eas
$ sqlplus
F nssysdba
n d o
na SQL> create pfile='bkupcdb1.ora' from spfile;
Fer
File created.

SQL> exit
$
$ ls $ORACLE_HOME/dbs/*cdb1*.ora
/u01/app/oracle/product/12.1.0/dbhome_1/dbs/bkupcdb1.ora
/u01/app/oracle/product/12.1.0/dbhome_1/dbs/spfilecdb1.ora
$
10. Be aware that if you shut down the instance and restart it, the PDBs (only one in our case
excluding PDB$SEED which remains in READ ONLY mode) are all closed or MOUNTED by
default.
a. Shut the instance down.
$ sqlplus / as sysdba

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

Practices for Lesson 5: Creating an Oracle Database Using DBCA


Chapter 5 - Page 27
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

b. Start the instance up.


SQL> startup
ORACLE instance started.

Total System Global Area 881037312 bytes


Fixed Size 2294408 bytes
Variable Size 620760440 bytes
Database Buffers 251658240 bytes a ble
fe r
Redo Buffers 6324224 bytes
ans
Database mounted.
n - t r
Database opened.
a no
SQL> select name, open_mode from v$pdbs;
h a s
m ) ideฺ
OPEN_MODE ฺco u
NAME
o t G
------------------------------
y a ho----------
d e n
@ ONLY tu
PDB$SEED
o
READ
2 i s S
PDB1
v d
a se t h
MOUNTED
e
fn to u
( x
reztheePDBs
SQL>
c. l
If you owant n seto be opened when the CDB instance is started and the root
d
F opened,
ocontainer lic create a trigger as follows:
a n
Fern CREATE TRIGGER open_all_PDBs
AFTER STARTUP ON DATABASE
begin
execute immediate 'alter pluggable database all open';
end open_all_PDBs;
/
SQL> CREATE TRIGGER open_all_PDBs
2 after startup on database
3 begin
4 execute immediate 'alter pluggable database all open';
5 end open_all_PDBs;
6 /

Trigger created.

SQL>
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 5: Creating an Oracle Database Using DBCA


Chapter 5 - Page 28
Use the trigger to open all PDBs or only some PDBs.
d. Shut down cdb1.
SQL> shutdown immediate
Database closed.
Database dismounted.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

ORACLE instance shut down.


SQL>
e. Start up cdb1.
SQL> startup
ORACLE instance started.

Total System Global Area 881037312 bytes


a ble
Fixed Size 2294408 bytes
fe r
Variable Size 620760440 bytes
ans
Database Buffers 251658240 bytes
n - t r
Redo Buffers 6324224 bytes
a no
Database mounted.
h a s
Database opened.
m ) ideฺ
SQL>
o ฺ co t Gu
f. Notice that the pdb1 is now in READ a
y ho open
WRITE d e n
mode.
2 @ S tu from v$pdbs;
SQL> select CON_ID, NAME,
do thi s
OPEN_MODE

e v a se
CON_ID NAME
( x f n o u OPEN_MODE
t
l o r2ez PDB$SEED
----------
e n se
------------------------------ ----------

o F l ic READ ONLY

na nd 3 PDB1 READ WRITE

Fer SQL> exit


$
11. View the alert log file to list the operations performed on the cdb1, pdb$seed and pdb1
databases by using ADRCI.
$ adrci
adrci> set homepath diag/rdbms/cdb1/cdb1
adrci> show alert -tail 30
2013-02-27 21:31:42.637000 -08:00
MMNL started with pid=20, OS id=3066
starting up 1 shared server(s) ...
ORACLE_BASE from environment = /u01/app/oracle
ALTER DATABASE MOUNT
2013-02-27 21:31:45.472000 -08:00
Using default pga_aggregate_limit of 2048 MB

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

Practices for Lesson 5: Creating an Oracle Database Using DBCA


Chapter 5 - Page 29
2013-02-27 21:31:47.377000 -08:00
Successful mount of redo thread 1, with mount id 782251263
Database mounted in Exclusive Mode
Lost write protection disabled
Ping without log force is disabled.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Completed: ALTER DATABASE MOUNT


ALTER DATABASE OPEN
Starting background process TMON
TMON started with pid=23, OS id=3092
Thread 1 opened at log sequence 21
Current log# 3 seq# 21 mem# 0:
/u01/app/oracle/oradata/cdb1/redo03.log
Successful open of redo thread 1
a ble
MTTR advisory is disabled because FAST_START_MTTR_TARGET is not
fe r
set
ans
SMON: enabling cache recovery n - t r
o
[3090] Successfully onlined Undo Tablespace 2.
s an
ha eฺ
Undo initialization finished serial:0 start:292530234
)
om Guid
end:292530314 diff:80 ms (0.1 seconds)
ฺ c
oo ent
Verifying file header compatibility for 11g tablespace
encryption..
a h
@ y t ud
Verifying 11g file header compatibility for tablespace
S
encryption completed
a d o2 this
f n ev use
SMON: enabling tx recovery
(x e to
Starting background process SMCO
z
lore licens
SMCO started with pid=24, OS id=3096
F
n d o Database Characterset is AL32UTF8

rn a 2013-02-27 21:31:48.478000 -08:00

Fe No Resource Manager plan active


replication_dependency_tracking turned off (no async multimaster
replication found)
Starting background process AQPC
AQPC started with pid=26, OS id=3105
2013-02-27 21:31:49.861000 -08:00
Due to limited space in shared pool (need 6094848 bytes, have
3981120 bytes), limiting Resource Manager entities from 2048 to
32
Opening pdb PDB$SEED (2) with no Resource Manager plan active
db_recovery_file_dest_size of 4800 MB is 0.00% used. This is a
user-specified limit on the amount of space that will be used by
this
database for recovery-related files, and does not reflect the
amount of
space available in the underlying filesystem or ASM diskgroup.

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

Practices for Lesson 5: Creating an Oracle Database Using DBCA


Chapter 5 - Page 30
2013-02-27 21:31:52.744000 -08:00
alter pluggable database all open
2013-02-27 21:31:53.724000 -08:00
Due to limited space in shared pool (need 6094848 bytes, have
3981120 bytes), limiting Resource Manager entities from 2048 to
32
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Opening pdb PDB1 (3) with no Resource Manager plan active


Pluggable database PDB1 opened read write
Completed: alter pluggable database all open
2013-02-27 21:31:54.782000 -08:00
Starting background process CJQ0
CJQ0 started with pid=27, OS id=3161
Completed: ALTER DATABASE OPEN
a ble
adrci> exit
fe r
$
ans
12. List all data files, control files and redo log files of the cdb1 database. n - t r
a. List all the data files. a no
h a s
$ sqlplus system/oracle_4U
m ) ideฺ
o ฺ co t Gu
aho tuden
SQL> select name from v$datafile;
y
@ sS
o2
thi
NAME
v a d
e e
---------------------------------------------------------------
n us
( x f t o
/u01/app/oracle/oradata/cdb1/system01.dbf

l o rez ense
/u01/app/oracle/oradata/cdb1/sysaux01.dbf

d
F lic
o/u01/app/oracle/oradata/cdb1/undotbs01.dbf
a n /u01/app/oracle/oradata/cdb1/pdbseed/system01.dbf

Fern /u01/app/oracle/oradata/cdb1/users01.dbf
/u01/app/oracle/oradata/cdb1/pdbseed/sysaux01.dbf
/u01/app/oracle/oradata/cdb1/pdb1/system01.dbf
/u01/app/oracle/oradata/cdb1/pdb1/sysaux01.dbf
/u01/app/oracle/oradata/cdb1/pdb1/SAMPLE_SCHEMA_users01.dbf
/u01/app/oracle/oradata/cdb1/pdb1/example01.dbf

10 rows selected.

SQL>
The data files are all stored in the $ORACLE_BASE/oradata/cdb1 directory. There
are:
− Four data files for the root container:
− One for the SYSTEM tablespace
− One for the SYSAUX tablespace
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 5: Creating an Oracle Database Using DBCA


Chapter 5 - Page 31
− One for the UNDO tablespace
− One for the USERS tablespace
− Two data files for the seed container under a subdirectory pdbseed:
− One for the SYSTEM tablespace
− One for the SYSAUX tablespace
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

− Four data files for the pdb1 container under a subdirectory pdb1:
− One for the SYSTEM tablespace
− One for the SYSAUX tablespace
− One for the USERS tablespace
− One for the EXAMPLE tablespace
b. List all the control files.
SQL> select name from v$controlfile;
a ble
fe r
ans
NAME
n - t r
---------------------------------------------------------------
a no
/u01/app/oracle/oradata/cdb1/control01.ctl
h a s
/u01/app/oracle/fast_recovery_area/cdb1/control02.ctl
m ) ideฺ
o ฺ co t Gu
SQL>
y aho tuden
o 2@ is S
One control file resides in the $ORACLE_BASE/oradata/cdb1
control file resides in thed$ORACLE_BASE/fast_recovery_area/cdb1
directory and another
directory.
v a e t h
The control files are
f n e mounted
u at the instance start up. There is only one instance for
sPDBs,
the whole CDB
z ( x including
t othe and therefore the control files are mounted for the
e
lallorthee redo
single instance.
F
c. List c e nsfiles.
log
li
na ndoSQL> select member from v$logfile;
Fer MEMBER
---------------------------------------------------------------
/u01/app/oracle/oradata/cdb1/redo03.log
/u01/app/oracle/oradata/cdb1/redo02.log
/u01/app/oracle/oradata/cdb1/redo01.log

SQL>
There are three redo log groups whose members reside in the
$ORACLE_BASE/oradata/cdb1 directory. The LGWR process works for the redo
stream of the whole CDB including the PDBs. The default configuration does not
create multiplexed redo log groups.
Best Practice Tip: Create two members for each group each on a different disk
drive.If you had another disk on /u02, you could multiplex the redo log groups to this
disk.

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

Practices for Lesson 5: Creating an Oracle Database Using DBCA


Chapter 5 - Page 32
d. On your server you only have /u01. You use it to multiplex.
SQL> alter database add logfile member
'/u01/app/oracle/oradata/cdb1/redo01b.log' to group 1;

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

SQL> alter database add logfile member


'/u01/app/oracle/oradata/cdb1/redo02b.log' to group 2;

Database altered.

SQL> alter database add logfile member


'/u01/app/oracle/oradata/cdb1/redo03b.log' to group 3;
a ble
fe r
Database altered.
ans
n - t r
SQL> col member format A50 a no
h a
SQL> select group#, member from v$logfile order by 1; s
m ) ideฺ
o ฺ co t Gu
aho tuden
GROUP# MEMBER
y
---------- --------------------------------------------------
@ sS
2
1 /u01/app/oracle/oradata/cdb1/redo01.log
o
v a d
e thi
1 /u01/app/oracle/oradata/cdb1/redo01b.log
f n e us
( x
2 /u01/app/oracle/oradata/cdb1/redo02b.log
t o
z 2 /u01/app/oracle/oradata/cdb1/redo02.log
l o r e
e n se
d oF lic3 /u01/app/oracle/oradata/cdb1/redo03.log
3 /u01/app/oracle/oradata/cdb1/redo03b.log

a n
Fern
6 rows selected.

SQL>

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

Practices for Lesson 5: Creating an Oracle Database Using DBCA


Chapter 5 - Page 33
13. You did not configure Enterprise Manager (EM) Database Express while the cdb1
database was created with DBCA. Each database instance requires a separate port for EM
Database Express. You are now going to configure it with the port 5501. 5500 is being used
by the orcl instance.
a. Verify that the DISPATCHERS instance parameter has at least one dispatcher
configured for the XMLDB service with the TCP protocol.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

SQL> show parameter DISPATCHERS

NAME TYPE VALUE


-------------------- ---------- -------------------------------
dispatchers string (PROTOCOL=TCP) (SERVICE=cdb1XDB)
max_dispatchers integer
SQL>
a ble
b. Choose between a secured and an unsecured connection. If you chose, a secured
fe r
connection, use the setHTTPsPort procedure in the DBMS_XDB_CONFIG package to
ans
configure the port 5501 (5500 is used for the orcl EM Database Express), else use
n - t r
the setHTTPPort procedure.
a no
h a s
Note: The https protocol uses Secure Socket Layer (SSL)
SQL> exec DBMS_XDB_CONFIG.setHTTPsPort(5501) m ) ideฺ
o ฺ co t Gu
o en
ahcompleted.
PL/SQL procedure successfully
@ y
S t ud
a d o2 this
ev use
SQL>
c. Verify the port x f n
allocation.
z e to
( dbms_xdb_config.gethttpsport
l o re ens
SQL> SELECT FROM DUAL;

d oF lic
a n GETHTTPSPORT

Fern ------------
5501

SQL> exit
$

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

Practices for Lesson 5: Creating an Oracle Database Using DBCA


Chapter 5 - Page 34
d. In a browser, use the URL: https://localhost:5501/em. This Connection is Untrusted
page appears. You need to add a security exception.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

a ble
fe r
ans
n - t r
− At the end of the alert box, click I Understand the Risks.
− At the bottom of the page, click Add Exception. a no
s
haCertificate.
− In the Add Security Exception pop-up window, click)Get
m d e ฺ
− Confirm that “Permanently store this exception”
ฺ i
co is selected
u in your training
o t G
aho console
environment and click Confirm Security Exception.
n
y
e. The Enterprise Manager Database Express d e
u appears. In the Login page, enter
sys in the User Name field,o2 @ S t
and click Login. a d oracle_4U
t h is in the Password field, select “as sysdba”
f n ev use
z (x e to
F lore licens
n d o
na
Fer
f. Now the Database Home page of the cdb1 instance appears. To avoid the current
issues displaying the “Resources” and “SQL Monitor- Last Hour (20 max)”

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

Practices for Lesson 5: Creating an Oracle Database Using DBCA


Chapter 5 - Page 35
information, collapse the two tabs and switch the Auto Refresh to Off.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

a ble
fe r
ans
n - t r
a no
h a s tab from the top
g. You can view the list of PDBs in the CDB1. Click the Performance
m
menu, then Performance Hub from the options. In the )Summary d e ฺ
tab, click the PDBs tab
from the Active Sessions section. ฺ co t Gu i
o
y aho tuden
o2 @ sS
v a d
e thi
f n e us
( x t o
l o rez ense
d o F lic
na n
Fer

h. Exit EM Database Express. Click Log Out.


i. Close the browser window.

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

Practices for Lesson 5: Creating an Oracle Database Using DBCA


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

a ble
fe r
ans
n - t r
a no
Practices for a s
m ) ideฺ 6: Using
h Lesson
Oracle ฺ coRestart
G u
o
ho 6 den t
y aChapter
tu
2 @ s S
v a do thi
f n e u se
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 6: Using Oracle Restart


Chapter 6 - Page 1
Practices for Lesson 6
Practices Overview

In the previous practices, you upgraded the ASM instance by using OUI and you created two
databases by using DBCA, a non-CDB and a CDB including one PDB.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

You can manage these instances and databases by using:


• SQL*Plus to start up or shut down the ASM and database instances, create and drop
non-CDBs and CDBs, create and drop PDBs, and open and close PDBs
• DBCA to create and delete non-CDBs and CDBs, and add new PDBs in CDBs
• SQL Developer to start up or shut down the instances, and create new PDBs in CDBs
• ASMCA to create and drop ASM disk groups, configure ASM disk group attributes,
manage templates, upgrade the ASM instance
a ble
• ASMCMD to manage ASM disk groups, ASM files, and ASM aliases and templates.
fe r
ans
In this practice, you will manage Oracle Restart by using: n - t r
• CRSCTL to monitor the Oracle Restart daemon a no
• a s
SRVCTL to manage components of the database instances, ASM instance, and
h
listeners m ) ideฺ
o ฺ co t Gu
You are going to work as the oracle user for a
y ho operations
some d e n and as the grid user for other
operations. Keep a terminal window opened
2 @ as theS tu user and another terminal window
oracle
opened as the grid user. do thi s
e v a se
Assumptions f n
(x e to u
z
F l ore was
The orcl non-CDB
i c e ns
successfully created in the previous practice.

n d o CDB waslsuccessfully
The cdb1 created in the previous practice.
na
Fer

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

Practices for Lesson 6: Using Oracle Restart


Chapter 6 - Page 2
Practice 6-1: Starting and Stopping Oracle Restart
Overview
Oracle Grid Infrastructure includes the Oracle Restart component. In this practice, you will
check if Oracle Restart is started. You will also stop and restart Oracle Restart.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Tasks
1. Check if Oracle Restart is started.
a. From the grid user terminal window, check the status of the HAS process (Oracle
High Availability Services daemon), ohasd.
$ pgrep -lf ohasd
3296 /bin/sh /etc/init.d/init.ohasd run
3326 /u01/app/grid/product/12.1.0/grid/bin/ohasd.bin reboot
a ble
$
fe r
It is currently started.
ans
b. Another way to determine if the HAS process is started is to use a CRSCTL command. n - t r
$ crsctl check has a no
h a s
) ideฺ
CRS-4638: Oracle High Availability Services is online
m
$
2. Determine the HAS version. o ฺ co t Gu
y
$ crsctl query has softwareversionaho tuden
o2 @Services
s S version on the local node
Oracle High Availability
d
a se t h i is
[12.1.0.1.0]
e v
$
( x fn to u
l o rez automatically
3. Is Oracle Restart
e n se started at reboot?
o$F c
crsctl liconfig has
n d
na CRS-4622: Oracle High Availability Services autostart is
Fer enabled.
$
4. Stop Oracle Restart.
$ crsctl stop has
CRS-2791: Starting shutdown of Oracle High Availability
Services-managed resources on '<localhost>'
CRS-2673: Attempting to stop 'ora.dbupgrd.db' on
'<your_hostname>'
CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on
'<your_hostname>'
CRS-2673: Attempting to stop 'ora.orcl.db' on '<your_hostname>'
CRS-2673: Attempting to stop 'ora.cdb1.db' on '<your_hostname>'
CRS-2677: Stop of 'ora.LISTENER.lsnr' on '<your_hostname>'
succeeded
CRS-2677: Stop of 'ora.orcl.db' on '<your_hostname>' succeeded
CRS-2677: Stop of 'ora.cdb1.db' on '<your_hostname>' succeeded
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 6: Using Oracle Restart


Chapter 6 - Page 3
CRS-2677: Stop of 'ora.dbupgrd.db' on '<your_hostname>'
succeeded
CRS-2673: Attempting to stop 'ora.DATA.dg' on '<your_hostname>'
CRS-2673: Attempting to stop 'ora.FRA.dg' on '<your_hostname>'
CRS-2677: Stop of 'ora.evmd' on '<your_hostname>' succeeded
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

CRS-2677: Stop of 'ora.FRA.dg' on '<your_hostname>' succeeded


CRS-2677: Stop of 'ora.DATA.dg' on '<your_hostname>' succeeded
CRS-2673: Attempting to stop 'ora.asm' on '<your_hostname>'
CRS-2677: Stop of 'ora.asm' on '<your_hostname>' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on '<your_hostname>'
CRS-2677: Stop of 'ora.cssd' on '<your_hostname>' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed
resources on '<your_hostname>' has completed
a ble
CRS-4133: Oracle High Availability Services has been stopped.
fe r
$
ans
You can view all resources stopped one by one: n - t r
a no
− The dbupgrd, orcl and cdb1 databases are registered as local resources in
the OLR. h a s
− The listener is also registered in the OLR. om
) ideฺ
o c instance
ฺASM G uare also registered in the
− The DATA and FRA disk groups ando the t
OLR. y ah tuden
They are stopped automatically
o2 @by Oracles SRestart in the right sequence, the client
database instances first dthen the t
ASMh i instance. The disk groups are dismounted
e va is shute
before the ASMn
(
These resourcesx
instance
f havetbeen
o usregistered automatically by DBCA for the first three
down.

rezinstances
database
l o e n seand by ASMCA for the disk groups and the ASM instance.
o
5. Check
d lic instances and the ASM instance are shut down.
Fthat all database
nan $ ps -ef | grep smon
Fer grid 17257 8535 0 18:09 pts/3 00:00:00 grep smon
$
6. Restart Oracle Restart. It will take some time to start all resources. However if you want to
see the resources started one after the other, the commands in step 7 should be run as
soon as the current crsctl command has completed.
$ crsctl start has

CRS-4123: Oracle High Availability Services has been started.


$
7. Check that all the database and ASM instances are automatically started up. Oracle Restart
knows that there are some dependencies between the resources. For example, the ASM
instance must be started before the disk groups can be mounted and the client database
instances such as dbupgrd can start up to connect to the ASM instance. If you check with
the following Unix command, you will have to repeat the command to see the resources
started up one after the other.
$ ps -ef | grep smon
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 6: Using Oracle Restart


Chapter 6 - Page 4
oracle 17802 1 0 18:14 ? 00:00:00 ora_smon_cdb1
oracle 17812 1 0 18:14 ? 00:00:00 ora_smon_orcl
grid 18021 8535 0 18:15 pts/3 00:00:00 grep smon
$ ps -ef | grep smon
oracle 17802 1 0 18:14 ? 00:00:00 ora_smon_cdb1
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

oracle 17812 1 0 18:14 ? 00:00:00 ora_smon_orcl


grid 18072 1 0 18:15 ? 00:00:00 asm_smon_+ASM
grid 18150 8535 0 18:15 pts/3 00:00:00 grep smon
$ ps -ef | grep smon
oracle 17802 1 0 18:14 ? 00:00:00 ora_smon_cdb1
oracle 17812 1 0 18:14 ? 00:00:00 ora_smon_orcl
grid 18072 1 0 18:15 ? 00:00:00 asm_smon_+ASM
oracle 18199 1 0 18:15 ? 00:00:00 ora_smon_dbupgrd
a ble
grid 18450 8535 0 18:17 pts/3 00:00:00 grep smon fe r
ans
$
n - t r
o
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 6: Using Oracle Restart


Chapter 6 - Page 5
Practice 6-2: Starting and Stopping Components
Overview
In this practice, you use Oracle Restart to view the status, start and stop the orcl database, the
ASM instance, the disk groups, and the listener.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Tasks
1. Invoke the SRVCTL utility from the Oracle Database home when working with the database
instance. You will check the status of the orcl database instance.
a. From the oracle user terminal window, set the ORACLE_BASE and ORACLE_HOME
environment variables for your orcl database instance.
$ . oraenv
ORACLE_SID = [cdb1] ? orcl
a ble
The Oracle base has been set to /u01/app/oracle
fe r
$
ans
b. Check the status of the orcl instance by using the SRVCTL utility. n - t r
$ srvctl status database -d orcl a no
h a s
Database is running.
m ) ideฺ
$
ฺ o Gu
cprocess,
c. Kill the LGWR process. After you kill the LGWR
h o
o restarted n t the instance is shut down.
a
After a little while, the instance is automatically
y configuration
u d e by Oracle Restart because
the orcl resource is registered 2 @
in the S t file of Oracle Restart. The lwgr
o i s
process may take a a few
e v adseconds
e ttohrestart. Repeat the pgrep command until it has
started.
n o us
(xfora_lgwr_orcl
$ pgrep z -fl
e t
r e s
7955
F l i c en
loora_lgwr_orcl
na ndo$ pkill -SIGKILL -f ora_lgwr_orcl
Fer
$ pgrep -fl ora_lgwr_orcl

$ pgrep -fl ora_lgwr_orcl
8792 ora_lgwr_orcl
$
2. From the grid user terminal window, invoke the SRVCTL utility from the Oracle Grid
Infrastructure home when working with the ASM instance.
a. Check the status of the ASM instance by using the SRVCTL utility.
$ srvctl status asm
ASM is running on <your_hostname>
$
b. Kill the LGWR process. After you kill the LGWR process, the instance is shut down.
After a little while, the instance is automatically restarted by Oracle Restart. notice that
the processes have a new process id when they are restarted.
$ pgrep -lf asm_lgwr
2267 asm_lgwr_+ASM
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 6: Using Oracle Restart


Chapter 6 - Page 6
$ pkill -SIGKILL -f asm_lgwr
$ pgrep -lf asm_lgwr
$ pgrep -lf asm_lgwr
4961 asm_lgwr_+ASM
$
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

3. Invoke the SRVCTL utility from the Oracle Grid Infrastructure home when working with the
disk groups. You will check the status of the DATA disk group.
$ srvctl status diskgroup -g DATA
Disk Group DATA is running on <your_hostname>
$
4. Invoke the SRVCTL utility from the Oracle Grid Infrastructure home when working with the
listener.
a. You will check the status of the listener.
a ble
fe r
$ srvctl status listener
ans
Listener LISTENER is enabled
n - t r
Listener LISTENER is running on node(s): <your_hostname>
a no
$
h a s
b. Kill the listener process. When you kill the listener process,
m e ฺ is shut down.
) theidlistener
Very quickly the listener is automatically restarted
o ฺ coby Oracle
t G uRestart. Notice the
y a ho den
process id will be different after the listener is restarted.
$ pgrep -lf tnslsnr
2 @ S tu
do thi s
1921 /u01/app/grid/product/12.1.0/grid/bin/tnslsnr LISTENER -
v a
e -f tnslsnre
us
no_crs_notify -inherit
( x f n o
$ pkill -SIGKILL
t
$ pgrep
l o rez-lfetnslsnr
n se
d o…F lic
nan
$ pgrep -lf tnslsnr

Fer 8014 /u01/app/grid/product/12.1.0/grid/bin/tnslsnr LISTENER -


no_crs_notify -inherit
$

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

Practices for Lesson 6: Using Oracle Restart


Chapter 6 - Page 7
Practice 6-3: Managing Configuration of Components
In this practice, you use Oracle Restart to view and modify the configuration of the orcl
database and the listener.
1. The component you will manage in this step is the orcl database instance. You have to
use SRVCTL in the ORACLE_HOME of the database instance.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

a. From the oracle user terminal window. set the ORACLE environment variables.
$ . oraenv
ORACLE_SID = [orcl] ? orcl
The Oracle base remains unchanged with value /u01/app/oracle
$
b. List the database instances configured with Oracle Restart.
$ srvctl config
a ble
cdb1
fe r
dbupgrd
ans
orcl
n - t r
$
a no
c. Display the configuration of the orcl database instance.has
m ) ideฺ
$ srvctl config database -d orcl
o ฺ co t Gu
aho tuden
Database unique name: orcl
Database name: orcl y
@ sS
o 2
thi
Oracle home: /u01/app/oracle/product/12.1.0/dbhome_1
v a d
Oracle user: oracle
n e us e
Spfile:
( x f t o
l o rez file:
Password
e n se
d o F
Domain: lic
na n Start options: open
Fer Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Database instance: orcl
Disk Groups:
Services:
$
d. Remove your orcl database instance from the Oracle Restart configuration.
$ srvctl remove database -d orcl
PRKO-3141 : Database orcl could not be removed because it was
running
$

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

Practices for Lesson 6: Using Oracle Restart


Chapter 6 - Page 8
e. Stop the orcl database instance.
$ srvctl stop database -d orcl
$
f. Check that the database instance is shut down.
$ pgrep -lf orcl
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

$
g. Remove your orcl database instance from the Oracle Restart configuration.
$ srvctl remove database -d orcl
Remove the database orcl? (y/[n]) y
$
h. Check that the orcl database is no longer a resource known to Oracle Restart.
$ srvctl config database -d orcl
a ble
PRCD-1120 : The resource for database orcl could not be found.
fe r
PRCR-1001 : Resource ora.orcl.db does not exist
ans
$ n - t r
i. a no
Check that the database instance is no longer automatically started.
h a s
$ pgrep -lf orcl
m ) ideฺ
co t Gu
$ pgrep -lf orcl
o ฺ
aho tuden

$
@ y
j. You can perform manual startup
o2 S operations by using SQL*Plus.
and shutdown
i s
v d
a se t h
e
$ sqlplus / as sysdba
fn to u
( x
l o rez Release
SQL*Plus:
e n se 12.1.0.1.0 Production on Thu Feb 14 02:01:27
F lic
2013

n d o
na
Fer
Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 876859392 bytes


Fixed Size 2294360 bytes
Variable Size 620760488 bytes
Database Buffers 247463936 bytes
Redo Buffers 6340608 bytes
Database mounted.
Database opened.
SQL> exit
$
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 6: Using Oracle Restart


Chapter 6 - Page 9
k. Once again, kill the LGWR process of your orcl database instance. What do you
observe?
The database instance is shut down, but is no longer automatically restarted.
$ pgrep -fl ora_lgwr_orcl
7955 ora_lgwr_orcl
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

$ pkill -SIGKILL -f ora_lgwr_orcl


$ pgrep -fl ora_lgwr_orcl
$ pgrep -fl ora_lgwr_orcl
$
l. Add the orcl database instance and its dependencies back to the Oracle Restart
configuration.
$ srvctl add database -d orcl -o
/u01/app/oracle/product/12.1.0/dbhome_1
a ble
$
fe r
m. The database resource is added back to the Oracle Restart configuration. You can ans
verify by using SRVCTL. n - t r
o
$ srvctl config database -d orcl
s an
Database unique name: orcl
) ha eฺ
Database name:
ฺ c om Guid
a h oo ent
Oracle home: /u01/app/oracle/product/12.1.0/dbhome_1
Oracle user: oracle
@ y
S t ud
Spfile:
a d o2 this
ev use
Password file:
Domain: f n
(x e to
z
lore licens
Start options: open

o F
Stop options: immediate

a n d Database role: PRIMARY

Fern Management policy: AUTOMATIC


Database instance: orcl
Disk Groups:
Services:
$
n. Restart the orcl database instance.
$ srvctl status database -d orcl
Database is not running.
$ srvctl start database -d orcl
$ srvctl status database -d orcl
Database is running.
$

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

Practices for Lesson 6: Using Oracle Restart


Chapter 6 - Page 10
o. Modify the configuration of the orcl database instance to add the following
information: the SPFILE is
/u01/app/oracle/product/12.1.0/dbhome_1/dbs/spfileorcl.ora.
$ srvctl modify database -d orcl -p
/u01/app/oracle/product/12.1.0/dbhome_1/dbs/spfileorcl.ora
$ srvctl config database -d orcl
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Database unique name: orcl


Database name:
Oracle home: /u01/app/oracle/product/12.1.0/dbhome_1
Oracle user: oracle
Spfile:
/u01/app/oracle/product/12.1.0/dbhome_1/dbs/spfileorcl.ora
Password file:
a ble
Domain:
fe r
Start options: open
ans
Stop options: immediate
n - t r
Database role: PRIMARY
a no
Management policy: AUTOMATIC
h a s
Database instance: orcl
m ) ideฺ
Disk Groups:
o ฺ co t Gu
Services:
y aho tuden
$
o 2 @ sS
p. Make sure Oracle Restart
v a e thi properly with your orcl database instance.
dis functioning
Once again kill the
f n e process
LGWR us and verify that it is automatically restarted.
$ pgrep z ( x t o
l o r e
e n se
-fl ora_lgwr_orcl

F lic
10310 ora_lgwr_orcl

n d o$ pkill -SIGKILL -f ora_lgwr_orcl


na
Fer
$ pgrep -fl ora_lgwr_orcl
$ pgrep -fl ora_lgwr_orcl
10787 ora_lgwr_orcl
$
q. Disable Oracle Restart on the orcl database instance. This does not remove the
resource configuration from the registry. It disables it until you decide to reenable it.
$ srvctl disable database -d orcl
$ srvctl status database -d orcl -f
Database is disabled
Database is running.
$
r. Verify that Oracle Restart does not restart the orcl database instance. Again kill the
LGWR process and then verify that the instance is not restarted automatically.
$ pgrep -fl ora_lgwr_orcl
10787 ora_lgwr_orcl

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

Practices for Lesson 6: Using Oracle Restart


Chapter 6 - Page 11
$ pkill -SIGKILL -f ora_lgwr_orcl
$ pgrep -fl ora_lgwr_orcl
$ pgrep -fl ora_lgwr_orcl
$
s. Attempt to start the orcl resource.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

$ srvctl start database -d orcl


PRCR-1079 : Failed to start resource ora.orcl.db
CRS-2501: Resource 'ora.orcl.db' is disabled
$
t. Enable Oracle Restart again on your orcl database instance.
Note: the first status command may show the database is running depending on the
time between the enable command and the status command.
a ble
$ srvctl enable database -d orcl
fe r
$ srvctl status database -d orcl -f
ans
Database is not running.
n - t r
$ pgrep -fl ora_lgwr_orcl
a no
11793 ora_lgwr_orcl
h a s
$ srvctl status database -d orcl -f
m ) ideฺ
Database is running.
o ฺ co t Gu
$
y aho tuden
2. @stepsisSthe listener. You have to use SRVCTL in the
The component you will manage in2this
o
ORACLE_HOME of the listener.d
v a e thi
a. From the grid user
f n eterminaluwindow,
s display the configuration of the listener.
( x t
$ srvctlz config elistener
o
e
lorLISTENER ns
F
Name:
li c e
na ndoHome: /u01/app/grid/product/12.1.0/grid
Fer
End points: TCP:1521
$
b. You can specify a non-default location for the listener's networking files. In our case,
the location is the default, but the procedure is the same. This command sets an
environment variable to used whenever the listener is managed.
$ srvctl setenv listener -l LISTENER -t
TNS_ADMIN=/u01/app/grid/product/12.1.0/grid
$
3. The component you will manage in this step is the cdb1 database. You have to use
SRVCTL in the ORACLE_HOME of the database instance.
a. If you attempt to execute the SRVCTL command in the ORACLE_HOME of the Grid
home, you get the following message.
$ whoami
grid
$ srvctl add service -db cdb1 -service pdb1bis -pdb pdb1
PRCD-1026 : Failed to create service pdb1bis for database cdb1
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 6: Using Oracle Restart


Chapter 6 - Page 12
PRKH-1014 : Current user "grid" is not the oracle owner user
"oracle" of oracle home
"/u01/app/oracle/product/12.1.0/dbhome_1"
$
b. From the oracle user terminal window, set the ORACLE_SID to cdb1.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

$ . oraenv
ORACLE_SID = [orcl] ? cdb1
The Oracle base remains unchanged with value /u01/app/oracle
$
c. Display the configuration of the cdb1 database.
$ srvctl config database -d cdb1
Database unique name: cdb1
Database name: cdb1 a ble
fe r
Oracle home: /u01/app/oracle/product/12.1.0/dbhome_1
ans
Oracle user: oracle
n - t r
o
an
Spfile:
Password file: s
ha eฺ
Domain: )
Start options: open ฺ c om Guid
Stop options: immediate
a h oo ent
Database role: PRIMARY @ y
S t ud
d o2 this
Management policy: AUTOMATIC
a
n ev use
Database instance: cdb1
f
z (x e to
Disk Groups:
lore licens
Services:
F
n d o$

rn a d. Add another pdb1bis service for the pdb1 PDB in the cdb1 CDB.
Fe $ srvctl add service -db cdb1 -service pdb1bis -pdb pdb1
$
e. Display the configuration of the cdb1 database.
$ srvctl config database -d cdb1
Database unique name: cdb1
Database name: cdb1
Oracle home: /u01/app/oracle/product/12.1.0/dbhome_1
Oracle user: oracle
Spfile:
Password file:
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY

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

Practices for Lesson 6: Using Oracle Restart


Chapter 6 - Page 13
Management policy: AUTOMATIC
Database instance: cdb1
Disk Groups:
Services: pdb1bis
$
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

f. Start the service.


$ srvctl start service -db cdb1 -service pdb1bis
$
g. Check the status of the new service.
$ srvctl status service -db cdb1
Service pdb1bis is running
$
a ble
h. Verify that you can connect to the PDB using the new service.
fe r
$ sqlplus sys/oracle_4U@localhost:1521/pdb1bis as sysdba ans
n - t r
SQL> select name, con_id from v$services; a no
h a s
m ) ideฺ
NAME
ฺ c o Gu CON_ID

a h oo ent
----------------------------------------------- ----------------
pdb1bis y t u d 3
o2 @ s S
pdb1
d
a se t h i 3

e v
SQL> exit xfn u
( t o
$
l o rez ense
d
i.
oUse lic to show the new service.
F LSNRCTL
a n $ lsnrctl services
Fern
LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 27-FEB-
2013 23:31:51

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

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM", status READY, has 1 handler(s) for this
service...
Handler(s):
"DEDICATED" established:60 refused:0 state:ready
LOCAL SERVER
Service "cdb1" has 1 instance(s).

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

Practices for Lesson 6: Using Oracle Restart


Chapter 6 - Page 14
Instance "cdb1", status READY, has 1 handler(s) for this
service...
Handler(s):
"DEDICATED" established:1 refused:0 state:ready
LOCAL SERVER
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ


Service "pdb1" has 1 instance(s).
Instance "cdb1", status READY, has 1 handler(s) for this
service...
Handler(s):
"DEDICATED" established:1 refused:0 state:ready
LOCAL SERVER
Service "pdb1bis" has 1 instance(s).
a ble
Instance "cdb1", status READY, has 1 handler(s) for this
fe r
service...
ans
Handler(s):
n - t r
o
an
"DEDICATED" established:1 refused:0 state:ready
s
LOCAL SERVER
) ha eฺ
om Guid
The command completed successfully
ฺ c
oo ent
$
a h
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 6: Using Oracle Restart


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

a ble
fe r
ans
n - t r
o
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 6: Using Oracle Restart


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

a ble
fe r
ans
n - t r
a no
Practices for a s
m ) ideฺ 7:
h Lesson
Introduction
ฺ co t Gtou Upgrading to
o
ho dDatabase
n
y aOracle
t u e 12c
o2 @ Chapter
s S 7
d
a se t h i
e v
( x fn to u
l o rez ense
d oF lic
a n
Fern

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

Practices for Lesson 7: Introduction to Upgrading to Oracle Database 12c


Chapter 7 - Page 1
Practices for Lesson 7
Practices Overview
In these practices, you will consider several upgrade scenarios.
A general checklist for any upgrade scenario is:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

1. For all of these cases the first step is to become familiar with the Oracle Database Upgrade
Guide 12c Release 1 (12.1).
2. Survey your database to determine if the current configuration is compatible with Oracle
Database 12c. Document any issues that you find.
3. What-if: You have discovered that your database is not a supported release.
a. For any patch release before 10.2.0.5, 11.1.0.7, 11.2.0.2, you cannot upgrade directly
to Oracle Database 12c. You must upgrade to a supported patch level (10.2.0.5,
11.1.0.7, 11.2.0.2 or later) and then upgrade to 12c.
b. For database versions older than 10.2.x, you must upgrade to a supported version. For a ble
example, 9.2.0.8 could be upgraded to 11.2.0.2 or 11.2.0.3, and then to 12.1. fe r
ans
c. For other than supported patch releases, and older versions of the Oracle Database
n - t r
a no
software from 10.1.0.1 and up, the database can be migrated using Oracle Data Pump
export/import. See chapter 2 of the Oracle Database Upgrade Guide 12c Release 1
(12.1) for more information about Data Pump use. h a s
m ) ideฺ
d. For versions of the database earlier than 10.1.0.1, you can use the original Export and
Import utilities. o ฺ co t Gu
4. Determine the upgrade/migration method.
y aho tuden
a. Direct upgrade using DBUA
o 2 @ sS
− Requires supported a
v d levelthi
version
n
− Requires thatfsource se ORACLE_HOME directories have compatible
e andutarget
z
permission. (xBoth must
e tobe owned by the same OS user, or by the same OS group.
Log e mustnbesdirected to a directory accessible by both source and target OS
orfiles
lusers.
o F l ice
n d
e r na − Requires that the database be in restricted mode during the upgrade.
F − Time required for the upgrade is dependent on installed components, and number of
objects, not the volume of data.
− Database files remain in place by default.
− Downgrade possible after an upgrade, if COMPATIBLE parameter has NOT been
set to a higher level.
− Note: If the upgrade fails, you must recover the database to the pre-upgrade state.
A tested backup and recovery plan to restore database files is essential.
b. Direct Upgrade using manual method. (same requirements as using DBUA)
− more flexibility
− More opportunities for error
− Requires additional post-upgrade steps
c. Data Pump export/import
− Allows you to move database to different OS, hardware, and version
− Allows network transfer of data ( no dump files created or moved)
− Allows data transfer from any version from 10.1.0.1 and higher to 12.1.0.1
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Introduction to Upgrading to Oracle Database 12c


Chapter 7 - Page 2
− Allows transfer of selected schemas, and objects
− Time to transfer is dependent on amount of data
− Source database must be in restricted mode while exporting the data (no data
updates allowed)
d. Original export/import (same restrictions as Data Pump export with exceptions)
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

− Allows export from older versions of Oracle Database software older than 10.1.0.1
to Oracle Database 12c
− Does not allow network transfer of data, except though custom scripting (e.g. pipes)
For all upgrade methods to 12c:
− Install Oracle Database 12c in a new ORACLE_HOME directory.
− The current ORACLE_HOME directory is not removed. DO NOT attempt to open
the upgraded database with the older software.
Best Practice: Practice whatever upgrade method you decide to use. Create a test
a ble
database instance as similar as possible to the source instance. Use this instance to test
fe r
applications and performance after the upgrade, before upgrading the production
ans
instance.
n - t r
5. Perform pre-upgrade steps, and correct issues. o
6. Perform upgrade using method of choice s an
a. Using DBUA (recommended) ) ha eฺ
b. Using manual upgrade ฺ c om Guid
c. Using Data Pump export/import
a h oo ent
@
d. Using original export/import y
S t ud
7. Perform post-upgrade steps
a d o2 this
f n ev use
a. Consider resetting password to be case sensitive. Note the –ignorecase parameter for
(x e to
orapwd to create the oracle password file is deprecated.
z
F lore licens
b. Add new features. Several new features require setting the COMPATIBLE parameter
to 12.0.0.0.0. Note: If this parameter is changed, a downgrade operation is not
n d o
possible. The source database must be restored from backup to return to the prior
rn a version.
Fe c. Migrate to use Unified Auditing.
8. Test the upgraded database
a. Test for correct application behavior.
b. Test performance.

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

Practices for Lesson 7: Introduction to Upgrading to Oracle Database 12c


Chapter 7 - Page 3
Practice 7-1: Upgrading an Oracle Database 11g Release 2 Database
on File System to Oracle Database 12c
Overview
In this practice, you will outline the steps to upgrade an existing Oracle Database 11g Release 2
database on file system to Oracle Database 12c.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Tasks
Write an outline of the major steps in upgrading an Oracle Database 11g Release 2 database to
Oracle Database 12c.
1. ______________________________________
2. ______________________________________
3. ______________________________________
4. ______________________________________ a ble
fe r
5. ______________________________________
ans
6. ______________________________________
n - t r
o
7. ______________________________________
8. ______________________________________ s an
9. ______________________________________ ) ha eฺ
10. ______________________________________ ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 7: Introduction to Upgrading to Oracle Database 12c


Chapter 7 - Page 4
Solution 7-1: Upgrading an Oracle Database 11g Release 2 Database
on File System to Oracle Database 12c
Suggested Answers
Your answers may vary
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

a. Determine upgrade method


b. Use Database Upgrade Assistant (DBUA)
c. Install Oracle Database 12c
d. Perform preupgrade tasks
e. Upgrade using chosen method
f. Perform post-upgrade tasks
g. Test upgraded instance

a ble
fe r
ans
n - t r
o
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 7: Introduction to Upgrading to Oracle Database 12c


Chapter 7 - Page 5
Practice 7-2: Upgrading an Oracle Database 11g Release 2 Database
on ASM to Oracle Database 12c
Overview
In this practice you develop an outline for upgrading an Oracle Database 11g Release 2
database on standalone ASM to Oracle Database 12c.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Tasks
1. _____________________________________________________________
2. _____________________________________________________________
3. _____________________________________________________________
4. _____________________________________________________________
5. _____________________________________________________________
6. _____________________________________________________________ a ble
fe r
7. _____________________________________________________________
ans
8. _____________________________________________________________
n - t r
o
9.
an
_____________________________________________________________
s
10.
11. ) ha eฺ
_____________________________________________________________
_____________________________________________________________
12. ฺ c om Guid
_____________________________________________________________
13. a h oo ent
_____________________________________________________________
14. @ y
S t ud
_____________________________________________________________
15. a d o2 this
_____________________________________________________________
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 7: Introduction to Upgrading to Oracle Database 12c


Chapter 7 - Page 6
Solution 7-2: Upgrading and Oracle Database 11g Release 2 Database
on ASM to Oracle Database 12c
Suggested Answers
a. Stop the database instances using the 11g ASM instance.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

b. Stop any listener running out of the current ORACLE_HOME for grid (if it exists).
c. Install Oracle Grid Infrastructure 12c for standalone server in a new ORACLE_HOME.
− Upgrade ASM instance
− Create ASM SPFILE
− Adjust ASM parameters
d. Restart listener running out of Grid Infrastructure 12c new ORACLE_HOME (if it exists).
e. Restart Database instances.
f. Install Oracle Database software in new ORACLE_HOME for Oracle 12c Database.
a ble
g. Perform preupgrade tasks. fe r
ans
h. Upgrade using DBUA.
n - t r
i. Perform post-upgrade tasks. o
j. Test upgraded instance. s an
k. ) ha eฺ
Adjust ASM diskgroup parameters, set diskgroup compatible level if necessary.
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 7: Introduction to Upgrading to Oracle Database 12c


Chapter 7 - Page 7
Practice 7-3: Upgrading an Oracle Database 11g Release 2 Database
to Oracle Database 12c on a New OS or Platform
Overview
In this practice you consider the differences in this scenario from the previous scenarios.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Tasks
1. _____________________________________________________________
2. _____________________________________________________________
3. _____________________________________________________________
4. _____________________________________________________________
5. _____________________________________________________________
6. _____________________________________________________________
a ble
7. _____________________________________________________________
fe r
8. _____________________________________________________________
ans
9. _____________________________________________________________ n - t r
o
10. an
_____________________________________________________________
s
11. ha eฺ
_____________________________________________________________
)
12. om Guid
_____________________________________________________________
ฺ c
13.
oo ent
_____________________________________________________________
a h
14.
@ y
S t ud
_____________________________________________________________
15.
o2 this
_____________________________________________________________
a d
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 7: Introduction to Upgrading to Oracle Database 12c


Chapter 7 - Page 8
Solution 7-3: Upgrading an Oracle Database 11g Release 2 Database
to Oracle Database 12c on a New OS or Platform
Suggested Answers
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Determine compatibility of datafiles and OS versions.


− Is endianness the same (check)
− Yes, datafiles can be copied with OS utilities
− No datafiles must be converted to target OS endianness. Note: If the source
platform and the target platform are of different endianness, then you cannot use
the RMAN CONVERT DATABASE command. This process requires both the
source and target platform to be the same endian value. Your available options
are Data Pump replication, Data Pump export/import, or Transportable
Tablespace, with an RMAN CONVERT TABLESPACE. If the platforms are of the a ble
same endianness, then no conversion is necessary and data can be transported fe r
as if on the same platform. ans
n - t r
− Does either the source or target OS support both Oracle database versions
a no
− Yes, consider migrating to new platform and upgrading to new version as
h a s
separate operations. Upgrade as in practice 7-1 or 7-3 then migrate to new
platform or migrate then upgrade. m ) ideฺ
− No, Use Data Pump export/import Note: o ฺ cthiso situation
t G umay also have a Golden
Gate solution. See Practice 7-7a for
o information.
hmore e n
y d
tuthat is one 32 bit and one 64 bit?
2 @
− Is there a difference in bit-width S
of the OS,
s
a
− Follow the notes given
v doin MOSthdocument
i "Can you / How to Upgrade RDBMS
e s e
and Convert
( x fn Using
Intel Platforms
From
t
32-bit
o u to 64-bit Binaries Directly on Linux or Windows based
the Database Upgrade Assistant (DBUA) [ID 757245.1]"
rez the
−loPerform e n se to 64 bit separate from the upgrade, Note: This may
migration
F ic
n do requirel the 32-bit binaries to be installed for a time on the 64-bit OS to perform
the migration in place.
e r na
F

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

Practices for Lesson 7: Introduction to Upgrading to Oracle Database 12c


Chapter 7 - Page 9
Practice 7-4: Upgrading an Oracle Database 11g Release 2 Database
to Oracle Database 12c with Minimal Downtime
Overview
In this practice you consider options to reduce downtime while upgrading from Oracle Database
11g Release 2 to Oracle Database 12c.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Tasks
1. _____________________________________________________________
2. _____________________________________________________________
3. _____________________________________________________________
4. _____________________________________________________________
5. _____________________________________________________________
6. _____________________________________________________________ a ble
fe r
7. _____________________________________________________________
ans
8. _____________________________________________________________
n - t r
o
9.
an
_____________________________________________________________
s
10.
11. ) ha eฺ
_____________________________________________________________
_____________________________________________________________
12. ฺ c om Guid
_____________________________________________________________
13. a h oo ent
_____________________________________________________________
14. @ y
S t ud
_____________________________________________________________
15. a d o2 this
_____________________________________________________________
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 7: Introduction to Upgrading to Oracle Database 12c


Chapter 7 - Page 10
Solution 7-4: Upgrading an Oracle Database 11g Release 2 Database
to Oracle Database 12c with Minimal Downtime

Suggested Answers
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Practice upgrade as many times as needed to automate pre-upgrade and post-upgrade tasks.
Reduce the time for DBUA to run. Remove any unused components from the database before
upgrade. For example Oracle Text, Oracle Spatial.
Script all pre-upgrade tasks.
Perform upgrade with DBUA.
Script all post-upgrade tasks.
Alternates to using DBUA
Create a target database and use Oracle GoldenGate to synchronize the source with the
a ble
target. When the synchronization is complete and applications can be run on the target,
fe r
stop the applications on the source, restart the applications on the target. Shutdown the
ans
source database. The detailed procedures for this operation are beyond the scope of
n - t r
this course. See Oracle Database Global Data Services Concepts and Administration o
Guide 12c Release 1 (12.1) for details.
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 7: Introduction to Upgrading to Oracle Database 12c


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

a ble
fe r
ans
n - t r
o
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 7: Introduction to Upgrading to Oracle Database 12c


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

a ble
fe r
ans
n - t r
a no
Practices for a s
m ) ideฺ 8:
h Lesson
Preparing
ฺ co taGDatabase
u for
o
ho den
y aUpgrade
tu8
2 @ s S
v a do thi Chapter

f n e u se
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 8: Preparing a Database for Upgrade


Chapter 8 - Page 1
Practices for Lesson 8
Practices Overview

In the previous practices, you upgraded the 11g ASM instance to 12c using OUI and you
created two databases in 12c.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

In these practices, you will prepare the dbupgrd database instance currently running in 11g to
upgrade to 12c. The upgrade process will use Database Upgrade Assistant (DBUA). The
upgrade process will be covered in the next practice. In these practices, you will:
• Execute the preupgrd.sql script
• Review the information displayed by the pre-upgrade information tool
• Resolve issues if any
• Perform a full database backup before the upgrade process starts
a ble
fe r
In your upgrade plan, you do not plan to relocate the data files, control files, redo log files and
ans
archive log files in another location.
n - t r
o
s an
You are going to work as the oracle user to perform operations in the 11g environment and as
the oracle user for other operations in the 12c environment. Therefore, keep a terminal
) ha eฺ
window opened as the oracle user in the 11g environment and another terminal window
c
opened as the oracle user in the 12c environment.
ฺ om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 8: Preparing a Database for Upgrade


Chapter 8 - Page 2
Practice 8-1: Executing Preliminary Steps and the Pre-Upgrade Script
Overview
In this practice, you will now prepare your dbupgrd database instance for an upgrade to 12c.
You have already installed the Oracle 12c Database software. You need to check that the
dbupgrd database instance is compatible with an upgrade from 11.2.0.3.0 to 12.1.0.1.0 before
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

upgrading.

Tasks
1. List the options that require a specific treatment before upgrade.
a. From the oracle user terminal window (we will name this window the oracle user
11g terminal window), check if Oracle Label Security or/and Oracle Database Vault are
installed in the 11g dbupgrd database instance.
$ . oraenv
a ble
fe r
ORACLE_SID = [cdb1] ? dbupgrd
ans
The Oracle base remains unchanged with value /u01/app/oracle
n - t r
$ env | grep ORA
a no
ORACLE_SID=dbupgrd
h a s
ORACLE_BASE=/u01/app/oracle
m ) ideฺ
ฺ co t Gu
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_2
o
$ sqlplus / as sysdba
y aho tuden
SQL> col parameter d o 2@A30is S
v
SQL> col value eformat
format
a A10 e th
SQL> select ( x us
f*nfromtov$option
l o rez eparameter
where n se in
d o lic
F ('Oracle Label Security', 'Oracle Database Vault');
na n 2 3
F e r PARAMETER VALUE
---------------------------------------- ----------
Oracle Label Security FALSE
Oracle Database Vault FALSE

SQL>
If one of these two options were enabled, you would have to execute the
$ORACLE_HOME/rdbms/admin/olspreupgrade.sql script copied from the 12c
database ORACLE_HOME environment to the 11g database ORACLE_HOME
environment. The script moves the AUD$ table from the SYSTEM schema to the SYS
schema. You would have to disable Oracle Database Vault if the option is enabled.
b. View the olspreupgrade.sql script. This script is available in the 12c
ORACLE_HOME. Open another oracle user terminal window in which you set the
environment variables to the 12c Oracle database ORACLE_HOME. We will name this
window the oracle user 12c terminal window. Set the ORACLE_SID environment
variable to orcl. (The orcl database instance runs in the 12c database environment)
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 8: Preparing a Database for Upgrade


Chapter 8 - Page 3
$ . oraenv
ORACLE_SID = [oracle] ? orcl
The Oracle base remains unchanged with value /u01/app/oracle
$ env | grep ORA
ORACLE_SID=orcl
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1
$
c. Display the content of the $ORACLE_HOME/rdbms/admin/olspreupgrade.sql
script.
$ less $ORACLE_HOME/rdbms/admin/olspreupgrade.sql
Rem
Rem $Header: rdbms/admin/olspreupgrade.sql /st_rdbms_12.1.0.1/1
a ble
fe r
Rem
ans
Rem olspreupgrade.sql
n - t r
o
an
Rem
s
Rem Copyright (c) 2012, 2013 Oracle and/or its affiliates. All
ha eฺ
rights reserved
)
Rem
ฺ c om Guid
Rem oo ent
NAME olspreupgrade.sql - OLS Pre processing script prior
a h
to upgrade for 12.1
@ y
S t ud
Rem
a d o2 this
Rem
ev use
DESCRIPTION
f n
Rem
z (x e to
This is a mandatory OLS preprocess upgrade script that

lore licens
needs to be run by Label Security and Database Vault customers
when upgrading to 12.1.
o F
a n d Rem

Fern Rem This script is NOT NEEEDED if you DO NOT have Database
Vault or Label Security.

It is clearly stated that this is a mandatory OLS preprocess upgrade script that needs
to be run by Label Security and Database Vault customers when upgrading to
12.1.0.0, but this script is NOT NEEEDED if you DO NOT have Database Vault or
Label Security enabled.
d. It is clearly described in the script to know how to proceed:
Rem STEPS TO RUN THIS SCRIPT
Rem -----------------------------
Rem To run the Oracle Label Security preprocess upgrade
script, copy the $ORACLE_HOME/rdbms/admin/olspreupgrade.sql
script to the old ORACLE_HOME. Run the script as SYSDBA in the
old ORACLE_HOME.
Rem However, if you have Database Vault, the following
steps need to be done after copying the olspreupgrade.sql to the
old ORACLE_HOME:

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

Practices for Lesson 8: Preparing a Database for Upgrade


Chapter 8 - Page 4
Rem To run the OLS preprocess script on a release 11.1.0.7
database before upgrading:
Rem
Rem 1. Start SQL*Plus and connect to the database to be
upgraded as DVOWNER.
Rem 2. Execute the following statement:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Rem SQL>EXEC dbms_macadm.add_auth_to_realm('Database


Vault','SYS',NULL,0);
Rem 3. Run the OLS preprocess script, at
Rem ORACLE_HOME/rdbms/admin/olspreupgrade.sql
Rem 4. After the olspreupgrade.sql has been successfully
run, start
Rem SQL*Plus and connect to the database as DVOWNER.
Rem 5. Execute the following statement:
a ble
fe r
Rem SQL> EXEC
ans
dbms_macadm.delete_auth_from_realm('Database Vault','SYS');
n - t r
Rem o

s an
) ha eฺ
e. Quit the less page browser. ฺ c om Guid
oo eVault?
Question: How would you disable OraclehDatabase
a n t
Answer: @ y
S t ud
d o2 Owner
− Log in as the Oracle Database
a t h is (DV_OWNER) account.
n
sqlplus dvo/password
f ev use
− Execute the
z (xfollowing
e toprocedure:
re ens
execoDVSYS.DBMS_MACADM.DISABLE_DV
l
d o F licinstance
− Restart the

n an connect / as sysdba
Fer shutdown immediate
startup
2. The upgrade will fail if the tablespace that are not schema-based such as SYSAUX,
SYSTEM, XDB, HTMLDB, CTXSYS are set to READ ONLY or OFFLINE. Check that the
tablespaces set to READ ONLY or OFFLINE mode are not any of these tablespaces. In the
rare case where queue tables reside in a tablespace that has been set to READ ONLY for
the upgrade, then that tablespace should be set back to READ WRITE.
In the terminal session that is set to the 11g ORACLE_HOME, run the following statement:
SQL> select tablespace_name, status from dba_tablespaces;

TABLESPACE_NAME STATUS
------------------------------- ---------
SYSTEM ONLINE
SYSAUX ONLINE
UNDOTBS1 ONLINE
TEMP ONLINE
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 8: Preparing a Database for Upgrade


Chapter 8 - Page 5
USERS ONLINE
EXAMPLE ONLINE

6 rows selected.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

SQL>
3. Remove the AUDSYS schema and the AUDIT_ADMIN and AUDIT_VIEWER roles. At this
stage, there should be no AUDSYS schema. These user and roles will be created as
predefined user and roles when the database will have been upgraded to 12c and migrated
to Unified Auditing. Unified auditing is the new auditing capability in Oracle database 12c. It
is covered in another practice after the database upgrade completion.
SQL> DROP USER AUDSYS CASCADE;
DROP USER AUDSYS CASCADE
a ble
*
fe r
ERROR at line 1:
ans
ORA-01918: user 'AUDSYS' does not exist n - t r
o
s an
) h a ฺ
SQL> DROP ROLE AUDIT_ADMIN;
c o m uide
DROP ROLE AUDIT_ADMIN
h o oฺ nt G
*
y a tude
ERROR at line 1:
o2 @ s S
d h i
a se t does not exist
v
ORA-01919: role 'AUDIT_ADMIN'
e
( x fn to u
l o rez ROLE
e n e
sAUDIT_VIEWER;
d oF
SQL> DROP
lic
a n DROP ROLE AUDIT_VIEWER

Fern *
ERROR at line 1:
ORA-01919: role 'AUDIT_VIEWER' does not exist

SQL> exit
$
4. Run the Pre-Upgrade Information Tool using the
$ORACLE_HOME/rdbms/admin/preupgrd.sql script.
a. Copy the $ORACLE_HOME/rdbms/admin/preupgrd.sql and
$ORACLE_HOME/rdbms/admin/utluppkg.sql scripts from the 12c database
ORACLE_HOME environment to the 11g database ORACLE_HOME environment. Run the
following statement:
$ cp
/u01/app/oracle/product/12.1.0/dbhome_1/rdbms/admin/preupgrd.sql
/u01/app/oracle/product/11.2.0/dbhome_2/rdbms/admin/preupgrd.sql

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

Practices for Lesson 8: Preparing a Database for Upgrade


Chapter 8 - Page 6
$ cp
/u01/app/oracle/product/12.1.0/dbhome_1/rdbms/admin/utluppkg.sql
/u01/app/oracle/product/11.2.0/dbhome_2/rdbms/admin/utluppkg.sql
$
b. The execution of the preupgrd.sql script will generate a log file and two SQL scripts
in the /u01/app/oracle/cfgtoollogs/dbupgrd/preupgrade directory. Create
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

the directory.
$ mkdir -p /u01/app/oracle/cfgtoollogs/dbupgrd/preupgrade
$
c. From the oracle user 11g terminal window, run the preupgrd.sql script. This
$ sqlplus / as sysdba
...
SQL>
a ble
@/u01/app/oracle/product/11.2.0/dbhome_2/rdbms/admin/preupgrd.sq
fe r
l
ans
Loading Pre-Upgrade Package...
n - t r
a no
Executing Pre-Upgrade Checks...
h a s
Pre-Upgrade Checks Complete. m ) ideฺ
o ฺ co t Gu
aho tuden
************************************************************
y
o2 @ sS
Results of the checks
v a d are
e hi
tlocated at:

f n e us
/u01/app/oracle/cfgtoollogs/dbupgrd/preupgrade/preupgrade.log
( x t o
l o rez eFixup
Pre-Upgrade n se Script (run in source database environment):
d
F lic
o/u01/app/oracle/cfgtoollogs/dbupgrd/preupgrade/preupgrade_fixups
a n
rn
.sql
Fe
Post-Upgrade Fixup Script (run shortly after upgrade):
/u01/app/oracle/cfgtoollogs/dbupgrd/preupgrade/postupgrade_fixup
s.sql

************************************************************
Fixup scripts must be reviewed prior to being executed.
************************************************************

************************************************************
====>> USER ACTION REQUIRED <<====
************************************************************

The following are *** ERROR LEVEL CONDITIONS *** that must be
addressed prior to attempting your upgrade.
Failure to do so will result in a failed upgrade.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 8: Preparing a Database for Upgrade


Chapter 8 - Page 7
1) Check Tag: PURGE_RECYCLEBIN
Check Summary: Check that recycle bin is empty prior to
upgrade
Fixup Summary:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

"The recycle bin will be purged."

You MUST resolve the above errors prior to upgrade

************************************************************

SQL> exit
$
a ble
fe r
ans
n - t r
o
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 8: Preparing a Database for Upgrade


Chapter 8 - Page 8
Practice 8-2: Implementing the Pre-Upgrade Information Tool
Recommendations
Overview
In this practice, you will examine the Pre-Upgrade Information Tool output log file and
implement the recommended actions. The actions and recommendations resulting from your
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

environment and the one displayed below may differ.


1. Examine the
/u01/app/oracle/cfgtoollogs/dbupgrd/preupgrade/preupgrade.log, output
created from the Pre-Upgrade Information Tool. Generally you will access this from the
environment where you ran the script. From the oracle user 11g terminal window,
execute the following:
$ cat
/u01/app/oracle/cfgtoollogs/dbupgrd/preupgrade/preupgrade.log
a ble
Oracle Database Pre-Upgrade Information Tool 02-14-2013 19:13:10 fe r
ans
Script Version: 12.1.0.1.0 Build: 006
n - t r
*************************************************************** o
Database Name: DBUPGRD
s an
Version: 11.2.0.3.0
) ha eฺ
Compatible: 11.2.0.0.0
ฺ c om Guid
Blocksize: 8192
a h oo ent
y t
Platform: Linux x86 64-bit
@ S ud
Timezone file: V14
a d o2 this
f n ev use
***************************************************************

z (x e to [Renamed Parameters]

lore licens
[No Renamed Parameters in use]

o F
***************************************************************

a n d [Obsolete/Deprecated Parameters]

Fern [No Obsolete or Desupported Parameters in use]


***************************************************************
[Component List]
***************************************************************
--> Oracle Catalog Views [upgrade] VALID
--> Oracle Packages and Types [upgrade] VALID
--> Oracle Workspace Manager [upgrade] VALID
--> Oracle Enterprise Manager Repository [upgrade] VALID
***************************************************************
[Tablespaces]
***************************************************************
--> SYSTEM tablespace is adequate for the upgrade.
minimum required size: 748 MB
--> SYSAUX tablespace is adequate for the upgrade.
minimum required size: 500 MB

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

Practices for Lesson 8: Preparing a Database for Upgrade


Chapter 8 - Page 9
--> UNDOTBS1 tablespace is adequate for the upgrade.
minimum required size: 400 MB
--> TEMP tablespace is adequate for the upgrade.
minimum required size: 60 MB
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

[No adjustments recommended]

***************************************************************
[Pre-Upgrade Checks]
***************************************************************
WARNING: --> Process Count may be too low

Database has a maximum process count of 150 which is lower


a ble
than the default value of 300 for this release.
fe r
You should update your processes value prior to the upgrade ans
n - t r
no
to a value of at least 300.
For example:
s a
h a
) ideฺ
ALTER SYSTEM SET PROCESSES=300 SCOPE=SPFILE
or update your init.ora file. m
co t Gu
o ฺ
WARNING: --> Enterprise Managery ahoDatabase
tu d e n Control repository
found in the database 2@ S
do thi s
v a
eDatabasese12c, Database Control is removed during
In Oraclef n
(x e tTo u
o save time during the Upgrade, this action
thez upgrade.
re beedone
locan ns prior to upgrading using the following steps
F li c
na ndo after copying rdbms/admin/emremove.sql from the new Oracle
Fer
home
- Stop EM Database Control:
$> emctl stop dbconsole

- Connect to the Database using the SYS account AS SYSDBA:

SET ECHO ON;


SET SERVEROUTPUT ON;
@emremove.sql
Without the set echo and serveroutput commands you will not
be able to follow the progress of the script.

INFORMATION: --> Older Timezone in use

Database is using a time zone file older than version 18.


After the upgrade, it is recommended that DBMS_DST package
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 8: Preparing a Database for Upgrade


Chapter 8 - Page 10
be used to upgrade the 11.2.0.3.0 database time zone
version
to the latest version which comes with the new release.
Please refer to My Oracle Support note number 977512.1 for
details.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

ERROR: --> RECYCLE_BIN not empty.


Your recycle bin contains 2 object(s).
It is REQUIRED that the recycle bin is empty prior to
upgrading.
Immediately before performing the upgrade, execute the
following command:
EXECUTE dbms_preup.purge_recyclebin_fixup;
a b le
e r
***************************************************************
a n sf
[Pre-Upgrade Recommendations]
n - tr
no
***************************************************************
a
h a s
m ) ideฺ
*****************************************
Dictionary Statisticsoo
ฺco t Gu
ah tuden
*********
y
@ sS
o2
thi
*****************************************
v a d
n e e
us statistics 24 hours prior to
(
Please gather x f o
dictionary
t
r
upgrading
l o ez thensdatabase.
e
e
n d oToFgatherlicdictionary statistics execute the following command
while connected as SYSDBA:
rn a
Fe
EXECUTE dbms_stats.gather_dictionary_stats;

^^^ MANUAL ACTION SUGGESTED ^^^

***************************************************************
[Post-Upgrade Recommendations]
***************************************************************

*****************************************
Fixed Object Statistics ********
*****************************************

Please create stats on fixed objects two weeks


after the upgrade using the command:
EXECUTE DBMS_STATS.GATHER_FIXED_OBJECTS_STATS;
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 8: Preparing a Database for Upgrade


Chapter 8 - Page 11
^^^ MANUAL ACTION SUGGESTED ^^^

***************************************************************
************ Summary ************
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

1 ERROR exist that must be addressed prior to performing your


upgrade.
2 WARNINGS that Oracle suggests are addressed to improve
database performance.
1 INFORMATIONAL message that should be reviewed prior to your
upgrade.

a ble
After your database is upgraded and open in normal mode you
fe r
must run rdbms/admin/catuppst.sql which executes several
ans
required tasks and completes the upgrade process.
n - t r
a no
You should follow that with the execution of
h a s
m ) ideฺ
rdbms/admin/utlrp.sql, and a comparison of invalid objects
before and after the upgrade using rdbms/admin/utluiobj.sql
o ฺ co t Gu
If needed you may want to upgrade
y aho tudyour en timezone data using the
process described in My @ Oracle S
o 2 i
d*************s
Support note 977512.1

v a e th
$ e
fn to us
2. You have two ways ( x
z to fixsethe warnings and recommendations. You run the
r e
F i c en to resolve issues reported, or you can perform the recommend
lo willlattempt
$ORACLE_BASE/cfgtoollogs/dbupgrd/preupgrade/preupgrade_fixups.sql

n d o manually. Issues that cannot be resolved automatically by the fixup script are
script
actions
which
na
Fer flagged with ** USER ACTION REQUIRED **. You will have to fix them manually one by
one.
3. From the oracle user 11g terminal window, execute the
/u01/app/oracle/cfgtoollogs/dbupgrd/preupgrade/preupgrade_fixups.sq
l script and check if all required actions were fixed..
$ sqlplus / as sysdba

SQL>
@/u01/app/oracle/cfgtoollogs/dbupgrd/preupgrade/preupgrade_fixup
s.sql
Pre-Upgrade Fixup Script Generated on 2013-02-14 19:13:04
Version: 12.1.0.1 Build: 006
Beginning Pre-Upgrade Fixups...

PL/SQL procedure successfully completed.

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

Practices for Lesson 8: Preparing a Database for Upgrade


Chapter 8 - Page 12
PL/SQL procedure successfully completed.

***************************************************************
Check Tag: DEFAULT_PROCESS_COUNT
Check Summary: Verify min process count is not too low
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Fix Summary: Review and increase if needed, your PROCESSES


value.
***************************************************************
Fixup Returned Information:
WARNING: --> Process Count may be too low

Database has a maximum process count of 150 which is lower


than the default value of 300 for this release.
a ble
You should update your processes value prior to the upgrade
fe r
to a value of at least 300.
ans
For example: n - t r
a no
ALTER SYSTEM SET PROCESSES=300 SCOPE=SPFILE
or update your init.ora file.
h a s
m ) ideฺ
***************************************************************
o ฺ co t Gu
o en
ahcompleted.
@ y
PL/SQL procedure successfully
S t ud
a d o2 this
v
***************************************************************
Check Tag: fneEM_PRESENTse
(x Check u
to if Enterprise Manager is present
z e
re ensExecute emremove.sql prior to upgrade.
Check Summary:
Fixlo
d
F lic
Summary:
o***************************************************************
a n
Fern Fixup Returned Information:
WARNING: --> Enterprise Manager Database Control repository
found in the database

In Oracle Database 12c, Database Control is removed during


the upgrade. To save time during the Upgrade, this action
can be done prior to upgrading using the following steps
after copying rdbms/admin/emremove.sql from the new Oracle
home
- Stop EM Database Control:
$> emctl stop dbconsole

- Connect to the Database using the SYS account AS SYSDBA:

SET ECHO ON;


SET SERVEROUTPUT ON;
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 8: Preparing a Database for Upgrade


Chapter 8 - Page 13
@emremove.sql
Without the set echo and serveroutput commands you will not
be able to follow the progress of the script.
***************************************************************
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

PL/SQL procedure successfully completed.

***************************************************************
Check Tag: PURGE_RECYCLEBIN
Check Summary: Check that recycle bin is empty prior to upgrade
Fix Summary: The recycle bin will be purged.
***************************************************************
Fixup Succeeded
a ble
*************************************************************** fe r
ans
n - t r
PL/SQL procedure successfully completed.
a no
h a s
m ) ideฺ
o Gu
cRecommendations]
***************************************************************

h o
o ent
[Pre-Upgrade
y a t ud
***************************************************************
@
o2 this S
a d
PL/SQL procedurevsuccessfully
f n e u se completed.

z (x e to
F lore licens
*****************************************
n d o Dictionary Statistics *********
rn a
Fe *****************************************

Please gather dictionary statistics 24 hours prior to


upgrading the database.
To gather dictionary statistics execute the following command
while connected as SYSDBA:
EXECUTE dbms_stats.gather_dictionary_stats;

^^^ MANUAL ACTION SUGGESTED ^^^

PL/SQL procedure successfully completed.

**************************************************
************* Fixup Summary ************

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

Practices for Lesson 8: Preparing a Database for Upgrade


Chapter 8 - Page 14
1 fixup routine was successful.
2 fixup routines returned INFORMATIONAL text that should be
reviewed.
PL/SQL procedure successfully completed.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

********* Pre-Upgrade Fixup Script Complete ***************

PL/SQL procedure successfully completed.

SQL>
The fixup routine that was succeeded is the recycle bin dump.
Verify that the recycle bin is now empty.
SQL> select * from dba_recyclebin;
a ble
fe r
ans
no rows selected
n - t r
a no
SQL>
h a s
4. Perform the non-fixed issues.
m ) ideฺ
a. First update the PROCESSES value prior to theฺc o toGauvalue of at least 300.
upgrade
SQL> show parameter processesho
o n t
y a ud e
@ S t
NAME
a d o2 this TYPE VALUE
n e v s e
x f o u
------------------------------------ ----------- --------------

r e z ( se t
F lo licen
processes integer 150

n d o
na SQL> ALTER SYSTEM SET PROCESSES=300 SCOPE=SPFILE;
Fer
System altered.

SQL> EXIT
$
b. Perform the second recommended action. In Oracle Database 12c, Enterprise
Manager Database Control is removed during the upgrade. Enterprise Manager
Database Control does not exist anymore with Oracle Database 12c. It is replaced by
Enterprise Manager Database Express. To save time during the Upgrade, this action
can be done prior to upgrading using the following steps:

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

Practices for Lesson 8: Preparing a Database for Upgrade


Chapter 8 - Page 15
i) Copy the $ORACLE_HOME/rdbms/admin/emremove.sql from the new 12c
Oracle home.
$ cp
/u01/app/oracle/product/12.1.0/dbhome_1/rdbms/admin/emremove.sql
/u01/app/oracle/product/11.2.0/dbhome_2/rdbms/admin/emremove.sql
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

$
ii) Stop EM Database Control in case it is running.
$ emctl stop dbconsole
Oracle Enterprise Manager 11g Database Control Release
11.2.0.3.0
Copyright (c) 1996, 2011 Oracle Corporation. All rights
reserved.
https://<your_hostname>:1158/em/console/aboutApplication
a ble
Stopping Oracle Enterprise Manager 11g Database Control ... fe r
ans
... Stopped.
n - t r
$
n o
iii) Execute the removal script. This takes about 6 minutes s a
) h a ฺ
$ sqlplus / as sysdba
c o m uide
h o oฺ nt G
SQL> SET ECHO ON
SQL> SET SERVEROUTPUT ON y
a tude
o 2 @ s S
d h i
SQL> @$ORACLE_HOME/rdbms/admin/emremove.sql
a se t
… e v
( x
Dropping synonymfn :toMGMT$APPLIED_PATCHSETS
u ...
z e
l ore isynonym
Dropping
F c e ns : MGMT$APPLIED_PATCHES ...
n d oDropping l synonym : MGMT$ALERT_NOTIF_LOG ...
n a Dropping synonym : MGMT$ALERT_HISTORY ...
Fer Dropping synonym : MGMT$ALERT_CURRENT ...
Dropping synonym : MGMT$ALERT_ANNOTATIONS ...
Dropping synonym : EMD_MNTR ...
Dropping synonym : ECM_UTIL ...
Finished phase 5
Starting phase 6 : Dropping Oracle Enterprise Manager related
other roles ...
Finished phase 6
The Oracle Enterprise Manager related schemas and objects are
dropped.
Do the manual steps to shutdown the DB Control if not done
before running this
script and then delete the DB Control configuration files

PL/SQL procedure successfully completed.

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

Practices for Lesson 8: Preparing a Database for Upgrade


Chapter 8 - Page 16
SQL>
c. The last recommendation is to gather dictionary statistics 24 hours prior to upgrading
the database.
SQL> exec dbms_stats.gather_dictionary_stats
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

PL/SQL procedure successfully completed.

SQL> exit
$
5. Examine the
$ORACLE_BASE/cfgtoollogs/dbupgrd/preupgrade/postupgrade_fixups.sql
script created to address issues that can be fixed after the database will have been
upgraded.
a ble
$ cat
fe r
$ORACLE_BASE/cfgtoollogs/dbupgrd/preupgrade/postupgrade_fixups.s
ans
ql
n - t r
o
an
REM Post Upgrade Script Generated on: 2013-02-14 19:13:04
s
ha eฺ
REM Generated by Version: 12.1.0.1 Build: 006
)
om Guid
SET ECHO OFF SERVEROUTPUT ON FORMAT WRAPPED TAB OFF LINESIZE
750; ฺ c
BEGIN
a h oo ent
@ y t ud
dbms_output.put_line ('Post Upgrade Fixup Script Generated on
S
a d o2 this
2013-02-14 19:13:04 Version: 12.1.0.1 Build: 006');

f n ev use
dbms_output.put_line ('Beginning Post-Upgrade Fixups...');
END;
z (x e to
/
F lore licens
n d oBEGIN

rn a dbms_preup.clear_run_flag(FALSE);

Fe END;
/
BEGIN
-- ***************** Fixup Details **************************
-- Name: OLD_TIME_ZONES_EXIST
-- Description: Check for use of older timezone data file
-- Severity: Informational
-- Action: ^^^ MANUAL ACTION REQUIRED ^^^
-- Fix Summary:
-- Update the timezone using the DBMS_DST package after
upgrade is complete.

dbms_preup.run_fixup_and_report('OLD_TIME_ZONES_EXIST');
END;
/

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

Practices for Lesson 8: Preparing a Database for Upgrade


Chapter 8 - Page 17
BEGIN
dbms_output.put_line
('***********************************************************');
dbms_output.put_line (' [Post-Upgrade Recommendations]');
dbms_output.put_line
('***********************************************************');
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

dbms_output.put_line ('');
END;
/
BEGIN
dbms_output.put_line ('
**************************************');
dbms_output.put_line (' ******** Fixed Object Statistics
*****');
a ble
fe r
dbms_output.put_line ('
ans
**************************************');
n - t r
dbms_output.put_line (''); o
s an
dbms_output.put_line ('Please create stats on fixed objects two
weeks');
) ha eฺ
ฺ c om Guid
dbms_output.put_line ('after the upgrade using the command:');
dbms_output.put_line ('EXECUTE
a h oo ent
@ y
S t ud
DBMS_STATS.GATHER_FIXED_OBJECTS_STATS;');

a d o2 this
dbms_output.put_line ('');

ev use
dbms_output.put_line ('^^^ MANUAL ACTION SUGGESTED ^^^');
f n
(x e to
dbms_output.put_line ('');
z
lore licens
END;

o F
/

a n d BEGIN dbms_preup.fixup_summary(FALSE); END;

Fern /
BEGIN
dbms_output.put_line ('* Post Upgrade Fixup Script Complete
**');
END;
/
REM Post Upgrade Script Closed At: 2013-02-14 19:13:16
$
Recommendations are suggested for after upgrade such as updating the time zone
using the DBMS_DST package.

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

Practices for Lesson 8: Preparing a Database for Upgrade


Chapter 8 - Page 18
Practice 8-3: Completing Prerequisites Steps Before Upgrade
Overview
In this practice, you perform the last actions and verifications before the upgrade.

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

1. The Pre-Upgrade Information Tool creates and populates the registry$sys_inv_objs


and registry$nonsys_inv_objs tables. If you did not execute the Pre-Upgrade
Information Tool script, you can execute the utluiobj.sql script before and after
upgrading. The script execution outputs the difference between the invalid objects that
existed prior the upgrade and invalid objects that exist after to upgrade. Consider that you
did not execute the Pre-Upgrade Information Tool because you know that DBUA will
automatically execute it. You are still logged in the session with 11g ORACLE_HOME set.
$ sqlplus / as sysdba
a ble
fe r
ans
SQL> @$ORACLE_HOME/rdbms/admin/utluiobj.sql
n - t r
.
o
an
Oracle Database 11.1 Post-Upgrade Invalid Objects Tool 02-14-
s
2013 21:42:13
) ha eฺ
.
ฺ c om Guid
a h oo ent
This tool lists post-upgrade invalid objects that were not

ud
invalid prior to upgrade (it ignores pre-existing pre-upgrade
@ y t
invalid objects).
o2 this S
.
a d
f n
Ownerev use Object Name Object Type
.
z (x e to
F l ore icens
d l
oPL/SQL procedure successfully completed.
a n
Fern SQL> select * from REGISTRY$sys_inv_objs;

no rows selected

SQL> select * from REGISTRY$nonsys_inv_objs;

no rows selected

SQL>
2. Verify that materialized view refreshes have completed. If materialized view refreshes have
not completed, perform the refresh manually using the DBMS_MVIEW package.
SQL> select o.name from sys.obj$ o, sys.user$ u, sys.sum$ s
where o.type# = 42
and bitand(s.mflags, 8) =8;
2 3
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 8: Preparing a Database for Upgrade


Chapter 8 - Page 19
no rows selected

SQL>
3. Ensure that no files need media recovery.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

SQL> select * from v$recover_file;

no rows selected

SQL>
If there are files that need recovery, perform the required recovery using RMAN.
4. Resolve outstanding distributed transactions.
a ble
SQL> select * from dba_2pc_pending;
fe r
ans
no rows selected
n - t r
a no
SQL>
h a s
m
If the query in the previous step returns any rows, then d ฺ statements:
)run theifollowing
e
SELECT local_tran_id FROM dba_2pc_pending; o ฺ co t Gu
y aho tuden
EXECUTE dbms_transaction.purge_lost_db_entry('');
COMMIT;
o 2 @ sS
5. If a standby database exists, v athen
e thi synchronize it with the primary database.
d you must
a. Check if a standby f n e
database s
uexists.
( x t o
l o rez ense
SQL> select

d o F lic
SUBSTR(value,INSTR(value,'=',INSTR(UPPER(value),'SERVICE'))+1)

nan where name like 'log_archive_dest%'


from v$parameter

Fer and UPPER(value) like 'SERVICE%';


2 3 4
no rows selected

SQL>
b. If the query in the previous step returns a row, then synchronize the standby database
with the primary database.
− Make sure all the logs are transported to the standby server after a final log switch
in the primary.
− Start the recovery of the standby database with the NODELAY option.

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

Practices for Lesson 8: Preparing a Database for Upgrade


Chapter 8 - Page 20
6. The upgrade process uses a large amount of archive log files. Increase the
DB_RECOVERY_FILE_DEST_SIZE to 30GB.
SQL> alter system set DB_RECOVERY_FILE_DEST_SIZE=30G scope=BOTH;

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

SQL> exit
$

a ble
fe r
ans
n - t r
o
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 8: Preparing a Database for Upgrade


Chapter 8 - Page 21
Practice 8-4: Performing a Full Database Backup
Overview
In this practice, you will perform a full database backup of the dbupgrd database before you
start the upgrade.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Tasks
1. Verify that the database is in ARCHIVELOG mode.
a. Stay in the oracle user 11g terminal window with the environment set to the
dbupgrd instance. Connect to the database instance as SYSDBA.
$ sqlplus / as sysdba

SQL> select log_mode from v$database;


a ble
fe r
LOG_MODE
ans
------------ n - t r
o
NOARCHIVELOG
s an
) ha eฺ
SQL>
ฺ c om Guid
b. Set the database instance in ARCHIVELOG
a h oomode.ent
i) Shut the database instance down.y
@ S t ud
a
SQL> shutdown immediate d o2 this
f
Database closed. n ev use
(x e to
Databasez dismounted.
loreinstance
ORACLE
F c e ns shut down.
n d oSQL> li
n a
Fer
ii) Start the database instance in MOUNT mode.
SQL> startup mount
ORACLE instance started.

Total System Global Area 663908352 bytes


Fixed Size 2231312 bytes
Variable Size 239076336 bytes
Database Buffers 415236096 bytes
Redo Buffers 7364608 bytes
Database mounted.
SQL>
iii) Alter the database instance in ARCHIVELOG mode and open.
SQL> alter database archivelog;

Database altered.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 8: Preparing a Database for Upgrade


Chapter 8 - Page 22
SQL> alter database open;

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

SQL> exit
$
2. Use RMAN to perform the database full backup.
a. Verify that the configuration includes the automatic control file and SPFILE backup. It
this is not the case, enable the automatic control file and SPFILE backup.
$ rman target /

RMAN> show all;


a ble
fe r
ans
using target database control file instead of recovery catalog
n - t r
o
an
RMAN configuration parameters for database with db_unique_name
DBUPGRD are:
s
ha eฺ
)
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default

ฺ c om Guid
CONFIGURE BACKUP OPTIMIZATION OFF; # default

a h oo ent
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
y t ud
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
@ S

a d o2 this
f n ev use
CONFIGURE SNAPSHOT CONTROLFILE NAME TO

z
# default (x e to
'/u01/app/oracle/product/11.2.0/dbhome_2/dbs/snapcf_dbupgrd.f';

F lore licens
n d oRMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
rn a
Fe new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored

RMAN>
b. Perform the full database backup including all data files, control files, SPFILE and
archive log files.
RMAN> backup database plus archivelog;

Starting backup at 14-FEB-13


current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=147 device type=DISK
channel ORA_DISK_1: starting archived log backup set
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 8: Preparing a Database for Upgrade


Chapter 8 - Page 23
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=12 RECID=1 STAMP=807374917
channel ORA_DISK_1: starting piece 1 at 14-FEB-13
channel ORA_DISK_1: finished piece 1 at 14-FEB-13
piece
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

handle=+FRA/dbupgrd/backupset/2013_02_14/annnf0_tag20130214t1448
38_0.261.807374919 tag=TAG20130214T144838 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 14-FEB-13

Starting backup at 14-FEB-13


using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
a ble
channel ORA_DISK_1: specifying datafile(s) in backup set
fe r
input datafile file number=00001
ans
name=+DATA/dbupgrd/datafile/system.256.807214393
n - t r
o
input datafile file number=00002
s an
name=+DATA/dbupgrd/datafile/sysaux.257.807214393
input datafile file number=00005 ) ha eฺ
c om Guid
name=+DATA/dbupgrd/datafile/example.261.808328869

h oo ent
input datafile file number=00003
a
@ y
S t ud
name=+DATA/dbupgrd/datafile/undotbs1.258.807214395

a d o2 this
input datafile file number=00004

ev use
name=+DATA/dbupgrd/datafile/users.258.808326885
f n
(x e to
channel ORA_DISK_1: starting piece 1 at 14-FEB-13
z
lore licens
channel ORA_DISK_1: finished piece 1 at 14-FEB-13

o F
piece

a n d handle=+FRA/dbupgrd/backupset/2013_02_14/nnndf0_tag20130214t1448

Fern 41_0.262.807374923 tag=TAG20130214T144841 comment=NONE


channel ORA_DISK_1: backup set complete, elapsed time: 00:01:45
Finished backup at 14-FEB-13

Starting backup at 14-FEB-13


current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=13 RECID=2 STAMP=807375027
channel ORA_DISK_1: starting piece 1 at 14-FEB-13
channel ORA_DISK_1: finished piece 1 at 14-FEB-13
piece
handle=+FRA/dbupgrd/backupset/2013_02_14/annnf0_tag20130214t1450
27_0.264.807375029 tag=TAG20130214T145027 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

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

Practices for Lesson 8: Preparing a Database for Upgrade


Chapter 8 - Page 24
Finished backup at 14-FEB-13

Starting Control File and SPFILE Autobackup at 14-FEB-13


piece
handle=+FRA/dbupgrd/autobackup/2013_02_14/s_807375029.265.807375
031 comment=NONE
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Finished Control File and SPFILE Autobackup at 14-FEB-13

RMAN> exit
$
At the end of the full database backup, you have:
• Two backup sets of archived logs: one completed BEFORE the data files backup
and one completed AFTER the data files backup because modifications in the data
files may have been applied by applications. The backup sets are stored in a ble
fe r
+FRA/dbupgrd/backupset/20yy_mm_dd
ans
• One backup set of the five data files stored in
n - t r
+FRA/dbupgrd/backupset/20yy_mm_dd
n o
• One backup set of the control file and SPFILE stored in s a
+FRA/dbupgrd/autobackup/20yy_mm_dd
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 8: Preparing a Database for Upgrade


Chapter 8 - Page 25
Practice 8-5: Performing a Transportable Tablespace Export
Overview
In anticipation of a later practice, you will perform a transportable tablespace export before the
database is upgraded. This export will be used in a later practice to experiment another method
of upgrade using Data Pump export and import.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Tasks
1. Perform a transportable tablespace export of the dbupgrd database. The database
instance still runs in the Oracle Database 11g version. Connect to the dbupgrd database
instance.
$ . oraenv
ORACLE_SID = [dbupgrd] ? dbupgrd
The Oracle base remains unchanged with value /u01/app/oracle
a ble
fe r
ans
$ sqlplus / as sysdba
n - t r
SQL> a no
h
2. Put the user-defined tablespaces in the source database dbupgrda s in read-only mode.
m
a. Find the list of user-defined tablespaces to be putoin
) idmode.
read-only
eฺ
o ฺ c t Gu ORDER BY 1;
aho tuden
SQL> SELECT tablespace_name FROM dba_tablespaces
y
@ sS
o2
thi
TABLESPACE_NAME
v a d
e us
------------------------------
n e
EXAMPLE ( x f t o
SYSAUX
l o rez ense
d o F
SYSTEM lic
nan TEMP
Fer UNDOTBS1
USERS

6 rows selected.

SQL>
b. The list may be different from yours according to the tablespaces created during the
training session. Make all tablespaces except SYSTEM, SYSAUX, TEMP, and UNDOTBS1
read-only.
SQL> ALTER TABLESPACE example READ ONLY;

Tablespace altered.

SQL> ALTER TABLESPACE users READ ONLY;

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

Practices for Lesson 8: Preparing a Database for Upgrade


Chapter 8 - Page 26
Tablespace altered.

SQL>
c. Find the list of data files associated to the read-only tablespaces that need to be
transported.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

SQL> SELECT file_name FROM dba_data_files


WHERE tablespace_name IN ('EXAMPLE','USERS');
2
FILE_NAME
---------------------------------------------------------------
+DATA/dbupgrd/datafile/users.258.808326885
+DATA/dbupgrd/datafile/example.261.808328869

a ble
SQL> exit
fe r
$
ans
3. Export the dbupgrd database in transportable tablespace mode. n - t r
a no
h a s
$ rm /u01/app/oracle/admin/dbupgrd/dpdump/expTTS.dmp
rm: cannot remove
m ) ideฺ
or directory o ฺ co t Gu
`/u01/app/oracle/admin/dbupgrd/dpdump/expTTS.dmp': No such file

y aho tuden
$ expdp system/oracle_4U DUMPFILE=expTTS.dmp

o2 @ sS
TRANSPORT_TABLESPACES=example, users TRANSPORT_FULL_CHECK=YES
LOGFILE=expTTS.log
v a d
e thi
f n e 11.2.0.3.0
us - Production on Wed Feb 20 22:02:47
( x
Export: Release
t o
2013 ez se
l o r e n
d o F lic
na n Copyright (c) 1982, 2011, Oracle and/or its affiliates. All

Fer
rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release


11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data
Mining
and Real Application Testing options
Starting "SYSTEM"."SYS_EXPORT_TRANSPORTABLE_01":
system/******** DUMPFILE=expTTS.dmp
TRANSPORT_TABLESPACES=example, users TRANSPORT_FULL_CHECK=YES
LOGFILE=expTTS.log
Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
Processing object type TRANSPORTABLE_EXPORT/TABLE
Processing object type TRANSPORTABLE_EXPORT/TABLE_STATISTICS
Processing object type
TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
Master table "SYSTEM"."SYS_EXPORT_TRANSPORTABLE_01" successfully
loaded/unloaded
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 8: Preparing a Database for Upgrade


Chapter 8 - Page 27
***************************************************************
Dump file set for SYSTEM.SYS_EXPORT_TRANSPORTABLE_01 is:
/u01/app/oracle/admin/dbupgrd/dpdump/expTTS.dmp
***************************************************************
Datafiles required for transportable tablespace EXAMPLE:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

+DATA/dbupgrd/datafile/example.261.808328869
Datafiles required for transportable tablespace USERS:
+DATA/dbupgrd/datafile/users.258.808326885
Job "SYSTEM"."SYS_EXPORT_TRANSPORTABLE_01" successfully
completed at 22:06:27
$
4. Create a /home/oracle/labs/dbupgrd12 directory to store the dump file.
$ mkdir -p /home/oracle/labs/dbupgrd12
a ble
fe r
$
ans
5. Move the dump file to the /home/oracle/labs/dbupgrd12 directory.
n - t r
$ mv /u01/app/oracle/admin/dbupgrd/dpdump/expTTS.dmp
a no
/home/oracle/labs/dbupgrd12
h a s
$ ls /home/oracle/labs/dbupgrd12
m ) ideฺ
expTTS.dmp
o ฺ co t Gu
$
y aho tuden
6. From the grid user terminal window,
o2 @copy stheSdata files required for transportable
v a d
tablespace import of the 11g dbupgrd
e thi to the FRA disk group.
database
$ asmcmd
f n e us
ASMCMD> z ( x t o
l o r e
e n se
ls +DATA/DBUPGRD/DATAFILE

d o F lic
EXAMPLE.261.808328869

na n SYSAUX.264.808326845

Fer
SYSTEM.263.808326819
UNDOTBS1.269.808326865
USERS.258.808326885
ASMCMD> cd +DATA/DBUPGRD/DATAFILE
ASMCMD> cp USERS.* +FRA/USERS
copying +DATA/DBUPGRD/DATAFILE/USERS.258.808326885 -> +FRA/USERS
ASMCMD>
ASMCMD> cp EXAMPLE.* +FRA/EXAMPLE
copying +DATA/DBUPGRD/DATAFILE/EXAMPLE.261.808328869 ->
+FRA/EXAMPLE
ASMCMD> exit
$

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

Practices for Lesson 8: Preparing a Database for Upgrade


Chapter 8 - Page 28
7. From the oracle user 11g terminal window, put the user-defined tablespaces in the
database dbupgrd back in read-write mode.
$ sqlplus / as sysdba

SQL> ALTER TABLESPACE example READ WRITE;


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

Tablespace altered.

SQL> ALTER TABLESPACE users READ WRITE;

Tablespace altered.

SQL> exit
a ble
$ fe r
ans
n - t r
o
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 8: Preparing a Database for Upgrade


Chapter 8 - Page 29
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

a ble
fe r
ans
n - t r
o
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 8: Preparing a Database for Upgrade


Chapter 8 - Page 30
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

a ble
fe r
ans
n - t r
a no
Practices for a s
m ) ideฺ 9:
h Lesson
Upgrading
ฺ co t aGDatabase
u
o
ho 9 den
y aChapter
tu
2 @ s S
v a do thi
f n e u se
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 9: Upgrading a Database


Chapter 9 - Page 1
Practices for Lesson 9
Practices Overview

In the previous practices, you prepared the dbupgrd database instance currently running in
11g to upgrade to 12c. The upgrade process will use Database Upgrade Assistant (DBUA)
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

which is recommended as the best method for upgrading your database.


In these practices, you will:
• Upgrade the Oracle Database 11g Release 2 dbupgrd database to Oracle Database
12c by using DBUA
• Plug the orcl non-CDB into the cdb1 CDB as a new PDB

In your upgrade plan, you do not plan to relocate the data files, control files, redo log files and
archive log files to another location. a ble
fe r
You are going to work as the oracle user to perform operations in the 12c environment only.
ans
Therefore, keep a terminal window opened as the oracle user in the 12c environment.
n - t r
o
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 9: Upgrading a Database


Chapter 9 - Page 2
Practice 9-1: Upgrading a Database by Using DBUA
Overview
In this practice, you will upgrade your 11g dbupgrd database instance to 12c.

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

• You successfully installed the Oracle 12c Database software in Practice 4-1.
• In Practice 8-1, you checked that the dbupgrd database instance is compatible with
an upgrade from 11.2.0.3.0 to 12.1.0.1.0 before upgrading.
• In Practices 8-2 and 8-3, you performed all necessary actions to get the database
ready for upgrade.
• The full database backup was successfully completed in Practice 8-4.
a ble
Tasks fe r
ans
1. From the oracle user 12c terminal window, release resources by shutting down instances
n - t r
a no
other than the ASM instance and the dbupgrd database instance. Why is the ASM
instance still required? It is required because the dbupgrd database instance is a client
storing its database files in ASM disks. h a s
m ) ideฺ
a. Shut down orcl.
o ฺ co t Gu
aho tuden
$ . oraenv
ORACLE_SID = [dbupgrd] ? orcl
@ y
o2 i s S with value /u01/app/oracle
The Oracle base remains
v d
a se t
unchanged
h
$ sqlplus (/xfas
e
n sysdba u
t o
l o rez ense
d oSQL> lic IMMEDIATE
F SHUTDOWN
na n Database closed.
Fer Database dismounted.
ORACLE instance shut down.
SQL> exit
$
b. Shut down cdb1.
$ . oraenv
ORACLE_SID = [orcl] ? cdb1
The Oracle base remains unchanged with value /u01/app/oracle

$ sqlplus / as sysdba

SQL> SHUTDOWN IMMEDIATE


Database closed.
Database dismounted.
ORACLE instance shut down.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 9: Upgrading a Database


Chapter 9 - Page 3
SQL> exit
$
2. Launch DBUA from the Oracle home where the new database software has been installed.
$ echo $ORACLE_HOME
/u01/app/oracle/product/12.1.0/dbhome_1
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

$ dbua

Step Window/Page Description Choices or Values


a. Select Operation page Verify Upgrade Oracle Database is selected
Click Next

a ble
fe r
ans
n - t r
o
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe
Step Window/Page Description Choices or Values
b. Select Database page Verify:
Target Oracle Home is
/u01/app/oracle/product/12.1.0/dbhome_1.
Set Source Oracle Home choosing
/u01/app/oracle/product/11.2.0/dbhome_2
The dbupgrd entry appears.
Click Next.

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

Practices for Lesson 9: Upgrading a Database


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

a ble
fe r
ans
n - t r
a no
h a s
m ) ideฺ
o ฺ co t Gu
Step Window/Page Description ho n Choices or Values
y a u d e
c. Prerequisite Checks page @
2 S tAutomatic validation starts (using the
d o th i s preupgrd.sql script) and shows
e v a s e progressively the validation result of each
f n
(x e to u prerequisite.
z
F lore licens
n d o
na
Fer

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

Practices for Lesson 9: Upgrading a Database


Chapter 9 - Page 5
Step Window/Page Description Choices or Values
d. Prerequisite Checks page Validation results appear
The prerequisites are all validated because
you already ran the preupgrd.sql script and
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

fixed all prerequisites manually.


Click Next.

a ble
fe r
ans
n - t r
a no
h a s
m ) ideฺ
o ฺ co t Gu
y aho tuden
o2 @ sS
v a d
e thi
f n e us
( x t o
l o ez nse
ryou eprerequisites that were not validated, you would click each Validation
o F entry ltoicget a more detailed list. Below is an example of failed validated
− If had

a n d prerequisites in a database instance with LDAP dependencies. This is only an


Fern example on the procedure you would have to handle if you had to.

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

Practices for Lesson 9: Upgrading a Database


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

a ble
fe r
ans
n - t r
a no
h a s
m ) ideฺ
ฺ o beG
ccould u
o
− One check would result in a warning and
hothat dcould t fixed. You would examine in
nexist. You would select the
detail the DBMS_LDAP dependencies
y a e
“DBMS_LDAP dependencies
2 @ tuand click more details.
exist” entry
S
do thi s
e v a se
f n
(x e to u
z
F lore licens
n d o
rn a
Fe

This means that you have not added the object in the ACL privileged list
recommended in the preupgrade.log file. You would click Close.
− You would click Apply Action to fix the issue.

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

Practices for Lesson 9: Upgrading a Database


Chapter 9 - Page 7
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

a ble
fe r
ans
n - t r
a no
h a s
− In Action, you would choose Revalidate andm
click e ฺ
) ApplyidAction.
o ฺ co t Gu
y aho tuden
o2 @ sS
v a d
e thi
f n e us
( x t o
l o rez ense
d oF lic
a n
Fern

− If the issue persists but would not prevent the upgrade to progress, you could fix
this problem after the upgrade. In Action, you would choose Ignore and click
Next.
Step Window/Page Description Choices or Values
e. Upgrade Options page Verify Upgrade Parallelism is set to the

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

Practices for Lesson 9: Upgrading a Database


Chapter 9 - Page 8
Step Window/Page Description Choices or Values
Upgrade Options tab number of CPUs or 2 if the number of CPUs is
less than 4. You may select a new value from
the Degree of Parallelism drop-down list. this
value determines the number of parallel
processes used to recompile all invalid
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

PL/SQL modules after the upgrade is


complete.
Select Upgrade Timezone Data
Deselect Gather Statistics Before Upgrade.
You already gathered the statistics before the
upgrade.
Click Next.

a ble
fe r
ans
n - t r
o
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

Step Window/Page Description Choices or Values


f. Management Options page Click Next

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

Practices for Lesson 9: Upgrading a Database


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

a ble
fe r
ans
n - t r
a no
h a s
m ) ideฺ
Step Window/Page Description
o ฺ co t GChoicesu or Values
g. Move Database Files page
y aho tInfiles
u
this
d e n
upgrade, do not move the database
to another type of storage such as a file
o2 @ s S system or other disk groups. You do not want
v a d
e thi to set the FRA location on another type of
f n e us storage such as a file system or other disk
z ( x t o groups. These operations can be performed
r e s e
F lo licen after the upgrade.

n d o Click Next
na
Fer

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

Practices for Lesson 9: Upgrading a Database


Chapter 9 - Page 10
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

a ble
fe r
ans
n - t r
a no
h a s
m ) ideฺ
Step Window/Page Description
o ฺ co t GChoices
u or Values
h. Network Configuration page
y aho tSelectd e
u Next
nLISTENER.
2 @ s S Click
i. Recovery Optionsa
v do thi Select Use Existing RMAN Backup
page
f n e u se You backed up the database in the previous
z ( x t o practice
r e n s e
o Flo lice Click Next

a n d
n Read carefully the message in the box at the bottom of Recovery Options page if
Fer there is any. If it says: “You do not have enough disk space for the archive logs and
flashback logs generated during upgrade.” you would click more details. The
Validation Details page would explicitly provide the required disk space for the
archive logs and flashback logs generated during upgrade. In another oracle user
UNIX session, connected to the dbupgrd instance, you would increase the
DB_RECOVERY_FILE_DEST_SIZE to the required size, and click Close.

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

Practices for Lesson 9: Upgrading a Database


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

a ble
fe r
ans
n - t r
a no
h a s
m ) ideฺ
o ฺ co t GChoices
u
Step Window/Page Description
a h o en or Values
j. Summary page
@ y
S t ud Database Upgrade Summary
Review

a d o2 this Check:
f n ev use Source and target Database Releases,
x
z ( se t o Oracle Homes
r e
lo licen Warnings ignored if there had been any (as
o F described in task 3.d),
n d
na Status of the components that will be
Fer upgraded,
Version of the time zone data.
Click Finish. The upgrade may take around 45
minutes. (118 minutes on M82)

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

Practices for Lesson 9: Upgrading a Database


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

a ble
fe r
ans
n - t r
o
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

Note: During the upgrade phase, DBUA runs catctl.pl, which runs the upgrade
processes in parallel instead of serially, optimally taking advantage of CPU capacity
to decrease down time as much as possible.
An error message “OLAPSYS does not exist” would appear if the OLAP option had
been installed, which is not the case for this database. In this case, you would drop
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 9: Upgrading a Database


Chapter 9 - Page 13
the OLAP metadata by deleting the OLAPSYS schema (using a recommended script
defined in the preupgrd.log). You would then click Ignore.
If you had several options or components installed, there would be other
recommendations and actions to take during the pre-upgrade phase. These actions
are described in an appendix.
Step Window/Page Description Choices or Values
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

k. Progress page You can display the details of the upgrade


progress at each step level by expanding each
blue arrow.

a ble
fe r
ans
n - t r
o
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe
Step Window/Page Description Choices or Values
l. Progress page Review the results when the Upgrade
Progress is 100% complete.
Click Upgrade Results

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

Practices for Lesson 9: Upgrading a Database


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

a ble
fe r
ans
n - t r
a no
h a s
m ) ideฺ
o ฺ co t GChoices
u
Step Window/Page Description
a h o en or Values
m. Results page
@ y
S t ud the first message is " The database is
Verify

a d o2 this ready to use.”


f n ev use The dbupgrd database is now running under

z ( x t o version 12.1.0.1.0. All the upgrade steps


r e n s e completed successfully.

o Flo lice Scroll down to find the Timezone information

a n d The time zone version and TIMESTAMP WITH


n
Fer
TIME ZONE data has been successfully
upgraded to version 18.
Find the SPFILE information
The SPFILE is created in the DATA disk group.
Click Close

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

Practices for Lesson 9: Upgrading a Database


Chapter 9 - Page 15
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

a ble
fe r
ans
n - t r
o
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

n. The upgrade process successfully completed. The log files are located in the
/u01/app/oracle/cfgtoollogs/dbua/dbupgrd/upgrade1 directory.
$ dbua
Database upgrade has been completed successfully, and the
database is ready to use.
$
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 9: Upgrading a Database


Chapter 9 - Page 16
Practice 9-2: Exporting a Non-CDB Application
Overview
Before you unplug and plug the orcl non-CDB into the cdb1 CDB and therefore make it
unusable as a stand-alone database, and in anticipation of another practice, you will export the
SH schema from the orcl non-CDB to later import it into the cdb1 CDB in another practice.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Assumptions
The orcl non-CDB was successfully created in Practice 5-1.

Tasks
1. From the oracle user 12c terminal window, export the SH schema from the orcl non-CDB.
$ . oraenv
a ble
ORACLE_SID = [orcl] ? orcl
fe r
The Oracle base remains unchanged with value /u01/app/oracle
ans
$ sqlplus / as sysdba
n - t r
o
s an
Connected to an idle instance.
) ha eฺ
ฺ c om Guid
oo ent
SQL> startup
a h
ud
ORACLE instance started.
@ y t
S
o2 t668082176
is
Total System GlobaldArea h
e v a e
s 2291328 bytes
bytes

(xfn e to u 499124608 bytes


Fixed Size
Variablez Size

F lore liBuffers
Database
c ens 159383552 bytes

na ndoRedo Buffers 7282688 bytes

Fer
Database mounted.
Database opened.

SQL> exit
$

$ rm /u01/app/oracle/admin/orcl/dpdump/expSH.dmp
rm: cannot remove `/u01/app/oracle/admin/orcl/dpdump/expSH.dmp':
No such file or directory
$ expdp system/oracle_4U DUMPFILE=expSH.dmp SCHEMAS=SH
LOGFILE=expSH.log

Export: Release 12.1.0.1.0 - Production on Thu Feb 21 02:38:54


2013

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

Practices for Lesson 9: Upgrading a Database


Chapter 9 - Page 17
Copyright (c) 1982, 2013, Oracle and/or its affiliates. All
rights reserved.

Connected to: Oracle Database 12c Enterprise Edition Release


12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Application Testing options


Starting "SYSTEM"."SYS_EXPORT_SCHEMA_01": system/********
DUMPFILE=expSH.dmp SCHEMAS=SH LOGFILE=expSH.log
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA

. . exported "SH"."CUSTOMERS" 10.27
MB 55500 rows
a ble
. . exported "SH"."COSTS":"COSTS_Q1_1998" 139.6 fe r
ans
KB 4411 rows
n - t r

o
. . exported "SH"."SALES":"SALES_Q4_2001"
s an 2.257
MB 69749 rows
) ha eฺ

ฺ c om Guid
a h oo ent
. . exported "SH"."SALES":"SALES_Q4_2003" 0

ud
KB 0 rows
@ y t
o2 this S
Master table "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully
loaded/unloaded
a d
n ev use
****************************************************************
f
*
z (x e to
lore licens
Dump file set for SYSTEM.SYS_EXPORT_SCHEMA_01 is:
F
n d o /u01/app/oracle/admin/orcl/dpdump/expSH.dmp

rn a Job "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully completed at


Fe Thu Feb 21 02:41:20 2013 elapsed 0 00:02:17

$
2. Copy the /u01/app/oracle/admin/orcl/dpdump/expSH.dmp dump file temporarily
to the /home/oracle/labs directory.
$ cp /u01/app/oracle/admin/orcl/dpdump/expSH.dmp
/home/oracle/labs
$ ls /home/oracle/labs/*SH*
/home/oracle/labs/expSH.dmp
$

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

Practices for Lesson 9: Upgrading a Database


Chapter 9 - Page 18
Practice 9-3: Plugging a Non-CDB into a CDB
Overview
In this practice, you will plug the orcl non-CDB into the cdb1 CDB. You will not use the Data
Pump Export/Import method, but instead use the unplugging / plugging method using the
DBMS_PDB package. This method has the advantages of being fast and easy. When this
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

package is executed in the orcl non-CDB, it generates an XML file describing the tablespaces
and data files of the orcl non-CDB. The XML file is then used to create a new PDB in the cdb1
CDB. In this exercise, because the orcl datafiles are not copied before they are used to plug
into a CDB, the orcl non-CDB is no longer a valid non-CDB.

Assumptions
The cdb1 CDB was successfully created in Practice 5-2.

Tasks a ble
fe r
1. Unplug the orcl non-CDB.
ans
a. Open the database instance in READ ONLY mode. n - t r
o
$ . oraenv
s an
ORACLE_SID = [orcl] ? orcl
) ha eฺ
ฺ c om Guid
The Oracle base remains unchanged with value /u01/app/oracle
$ sqlplus / as sysdba
a h oo ent
@ y
S t ud
SQL> shutdown immediate
Database closed.vad
o2 this
f n e u se
(x eshut
Database dismounted.
z
ORACLEeinstance
to down.
r
lostartup e s
nmount
o F
SQL>
li c
a n d Total System Global Area 668082176 bytes

Fern Fixed Size 2291328 bytes


Variable Size 499124608 bytes
Database Buffers 159383552 bytes
Redo Buffers 7282688 bytes
Database mounted.
SQL> alter database open read only;

Database altered.

SQL>
b. Use the DBMS_PDB.DESCRIBE package to “unplug” the orcl non-CDB.
SQL> exec dbms_pdb.describe
('/u01/app/oracle/oradata/orcl/xmlorcl.xml')

PL/SQL procedure successfully completed.

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

Practices for Lesson 9: Upgrading a Database


Chapter 9 - Page 19
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

SQL> exit
$
2. Create a new PDB, named pdb_orcl to plug the orcl non-CDB into cdb1 CDB using the
XML file generated. The files described in the XML file are used to create the new PDB.
The new PDB will consist of the SYSTEM and SYSAUX tablespaces, and the user-defined
tablespaces of the orcl non-CDB. The NOCOPY clause enables a very fast operation
because the data files of the orcl non-CDB are directly used where they are to create the
new PDB.
You will have to remove the temp files.
a ble
fe r
$ . oraenv
ans
ORACLE_SID = [orcl] ? cdb1
n - t r
o
an
The Oracle base remains unchanged with value /u01/app/oracle
$ sqlplus / as sysdba s
ha eฺ
)
Connected to an idle instance. ฺ c om Guid
a h oo ent
SQL> startup
@ y
S t ud
d
ORACLE instance started.
a o2 this
f n ev use
Total System
z (x Global
e to Area 881037312 bytes
l e
orSize ns
Fixed
F c e
Variable liSize
2293784 bytes

ndo
578818024 bytes

e r na Database Buffers 293601280 bytes


F Redo Buffers 6324224 bytes
Database mounted.
Database opened.
SQL>
SQL> create pluggable database PDB_ORCL using
'/u01/app/oracle/oradata/orcl/xmlorcl.xml' NOCOPY;
create pluggable database PDB_ORCL using
'/u01/app/oracle/oradata/orcl/xmlorcl' NOCOPY
*
ERROR at line 1:
ORA-27038: created file already exists
ORA-01119: error in creating database file
'/u01/app/oracle/oradata/orcl/temp01.dbf'

SQL> !rm /u01/app/oracle/oradata/orcl/temp01.dbf

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

Practices for Lesson 9: Upgrading a Database


Chapter 9 - Page 20
SQL> create pluggable database PDB_ORCL using
'/u01/app/oracle/oradata/orcl/xmlorcl.xml' NOCOPY;

Pluggable database created.


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

SQL> exit
$
3. Create a net service name, PDB_ORCL to connect easily to the new PDB. Use NETMGR to
add the PDB_ORCL net service name for pdb_orcl PDB of cdb1 to the tnsnames.ora
file.
$ $ORACLE_HOME/bin/netmgr

a ble
fe r
a n s
Step Window/Page Description r
-t or Values
nChoices
a. Oracle Network Manager - a no Expand Local.
a s
/u01/app/oracle/product/12.1.0/dbhome_1/network/admin/ Select Service Naming.
h
m ) ideฺ Click Create (green “+”
o ฺ co t Gu icon).
b. y aho tuden
Net Service Name Wizard: Welcome Enter PDB_ORCL as Net
o2 @ s S Service Name.
d
a se t h i Click Next.
e v
c. x
Net Service
( fnNametWizard:
o u page 2 of 5 -Protocol Select TCP/IP (Internet

l o rez ense Protocol).

d d.oF lic Click Next.

a n Net Service Name Wizard: page 3 of 5 –Protocol Settings Enter the following

Fern information:
Host : <Your hostname> or
LOCALHOST
Port: 1521
Click Next.
e. Net Service Name Wizard: page 4 of 5 –Service Enter the following
information:
Service Name: pdb_orcl
Click Next.
f. Net Service Name Wizard: page 5 of 5 –Test Click Finish
g. Oracle Network Manager - From the menu, select File >
/u01/app/oracle/product/12.1.0/dbhome_1/network/admin Save Network.
Configuration.
Select File > Exit.

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

Practices for Lesson 9: Upgrading a Database


Chapter 9 - Page 21
4. To complete the operation, you have to convert the plugged non-CDB to a proper PDB by
deleting unnecessary metadata from the SYSTEM tablespace of the PDB.
For this purpose, you execute the $ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql
script while you are connected to the PDB. The execution may last more than 30 minutes.
a. Now connect to pdb_orcl as SYSDBA using the net service name.
$ sqlplus sys/oracle_4U@pdb_orcl as sysdba
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

SQL> SELECT con_id, name, open_mode FROM v$pdbs;

CON_ID NAME OPEN_MODE


---------- ------------------------------- ----------
4 PDB_ORCL MOUNTED

a ble
SQL>
fe r
b. List the tablespaces and data files of the new PDB. ans
n - t r
SQL> select name from dba_tablespaces;
select name from dba_tablespaces a no
h a s
*
m ) ideฺ
ERROR at line 1:
o ฺ co t Gu
aho tuden
ORA-01219: database or pluggable database not open: queries
allowed on fixed y
@ sS
tables or views only
o 2
v a d
e thi
f n e us
SQL>
( x t o
The PDB
l o rezis notenyetseopened.
c. F executelicthe $ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql script. It will
oFirst
a n d take approximately 30 minutes to complete.

Fern While the conversion is taking place, proceed with the next practice to perform the
post-upgrade actions on the dbupgrd database instance.
SQL> @$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql

SQL> DOC
DOC>############################################################
#
DOC> The following statement will cause an "ORA-01722: invalid
number"
DOC> error if we're not in a PDB.
DOC>##########################################################
SQL>
SQL> VARIABLE pdbname VARCHAR2(128)
SQL> BEGIN
2 SELECT sys_context('USERENV', 'CON_NAME')
3 INTO :pdbname

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

Practices for Lesson 9: Upgrading a Database


Chapter 9 - Page 22
4 FROM dual
5 WHERE sys_context('USERENV', 'CON_NAME') <> 'CDB$ROOT';
6 END;
7 /
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

PL/SQL procedure successfully completed.



SQL>
================================================================
SQL> Rem Run component validation procedure
SQL> Rem
================================================================

a ble
SQL> alter session set container="&pdbname";
fe r
ans
Session altered.
n - t r
a no
SQL> s
hawas
-- leave the PDB in the same state )it
SQL>
m d e ฺ we started
when
SQL>
BEGIN
ฺ co t Gu i
o
ho d&restricted_state';
n
2 execute immediate '&open_sql
y a e
3EXCEPTION
2 @ S tu
4
do thi
WHEN OTHERS THEN s
5 BEGIN eva se
f n
(x(sqlcode u
6
z IF
e to <> -900) THEN
F lore liEND
7
c ns
eRAISE;
n do 8 IF;

e r na 9 END;
F 10 END;
11 /

PL/SQL procedure successfully completed.

SQL>
SQL> WHENEVER SQLERROR CONTINUE;
SQL>
SQL>
d. When the conversion is completed, open the PDB and quit the session.
SQL> alter pluggable database pdb_orcl open;

Pluggable database altered.

SQL> EXIT
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 9: Upgrading a Database


Chapter 9 - Page 23
$
5. Connect to PDB_ORCL.
$ sqlplus sys/oracle_4U@PDB_ORCL as SYSDBA

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

6. Verify that all application data is in the pdb_orcl PDB.


SQL> select tablespace_name from dba_tablespaces;

TABLESPACE_NAME
------------------------------
SYSTEM
SYSAUX
a ble
TEMP
fe r
USERS
ans
EXAMPLE n - t r
a no
SQL> select name from v$datafile;
h a s
m ) ideฺ
NAME o ฺ co t Gu
y aho tuden
----------------------------------------------------------------
2 @ sS
/u01/app/oracle/oradata/cdb1/undotbs01.dbf
o
v a d thi
/u01/app/oracle/oradata/orcl/system01.dbf
e
f n e us
( x
/u01/app/oracle/oradata/orcl/sysaux01.dbf
t o
l o rez ense
/u01/app/oracle/oradata/orcl/users01.dbf

d oF lic
/u01/app/oracle/oradata/orcl/example01.dbf

a n
Fern SQL> select count(empno) from scott.emp;

COUNT(EMPNO)
------------
14

SQL> select count(*) from hr.employees;

COUNT(*)
----------
107

SQL> EXIT
$

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

Practices for Lesson 9: Upgrading a Database


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

a ble
fe r
ans
n - t r
a no
Practices for a s
m ) ideฺ 10:
h Lesson
Performing
ฺ Post-Upgrade
co t G u
o
ho den
y aTasks tu10
2 @ s S
v a do thi Chapter

f n e u se
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 10: Performing Post-Upgrade Tasks


Chapter 10 - Page 1
Practices for Lesson 10
Practices Overview

In the previous practice, you upgraded the Oracle Database 11g dbupgrd instance to Oracle
Database12c by using DBUA.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

In these practices, you will complete the upgrade process of the dbupgrd database instance
currently running in 12c by:
• Performing post-upgrade actions
• Enabling and using Unified Auditing

You are going to work as the oracle user for some operations and as the grid user for other
operations. Therefore, keep a terminal window opened as the oracle user and another
a ble
terminal window opened as the grid user.
fe r
ans
n - t r
o
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 10: Performing Post-Upgrade Tasks


Chapter 10 - Page 2
Practice 10-1: Performing Post-Upgrade Actions
Overview
In this practice, you will:
• Verify that the /etc/oratab file sets the value of ORACLE_HOME to point to the new
Oracle home that is created for the new Oracle Database 12c release.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

• Show the current state of the Oracle data dictionary


• Check that there are no invalid objects
• Check that the password file exists
• Verify that the SPFILE is created and create the PFILE
• View the contents of the alert.log file
• Launch Enterprise Manager Database Express
• Unlock the application users, if any are locked a ble
fe r
• Upgrade optimizer statistics
ans
• Perform a FULL database backup
n - t r
Tasks a no
h a s
1. From the oracle user 12c terminal window, view the /etc/oratab
m ) idefile. ฺ
$ cat /etc/oratab|grep dbupgrd
o ฺ co t Gu
line added by Agent y aho tuden
dbupgrd:/u01/app/oracle/product/12.1.0/dbhome_1:N: #

o 2 @ sS
$
v a d
e t hi
2. Show the current state of
f n ethe Oracle
u s data dictionary. The status of all components must be
VALID. x
z ( se t o
r e
$ .o
F l oraenv
l i c e= n[cdb1] ? dbupgrd
n d oORACLE_SID
na The Oracle base remains unchanged with value /u01/app/oracle
Fer
$ sqlplus / as sysdba

SQL> set lines 80 pages 100


SQL> col comp_id format A12
SQL> col comp_name format A30
SQL> col version format A10
SQL> col status format A6
SQL> select substr(comp_id,1,15) comp_id, substr(comp_name,1,30)
comp_name, substr(version,1,10) version, status
from dba_registry order by modified;

COMP_ID COMP_NAME VERSION STATUS


-------- ------------------------------ ---------- ------
CATALOG Oracle Database Catalog Views 12.1.0.1.0 VALID

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

Practices for Lesson 10: Performing Post-Upgrade Tasks


Chapter 10 - Page 3
CATPROC Oracle Database Packages and T 12.1.0.1.0 VALID
OWM Oracle Workspace Manager 12.1.0.1.0 VALID
XDB Oracle XML Database 12.1.0.1.0 VALID

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

3. Check that there are no invalid objects.


SQL> @$ORACLE_HOME/rdbms/admin/utluiobj.sql
.
Oracle Database 12.1 Post-Upgrade Invalid Objects Tool 02-17-
2013 20:44:52
.
This tool lists post-upgrade invalid objects that were not
invalid prior to upgrade (it ignores pre-existing pre-upgrade
a ble
invalid objects).
fe r
.
a n s
Owner Object Name n
Object
r
-t Type
o
.
s an
) h a ฺ
PL/SQL procedure successfully completed.
c o m uide
h o oฺ nt G
ya tude
SQL> select * from REGISTRY$sys_inv_objs;
@
o2 i s S
no rows selected a
v d t h
e s e
( x fn to u
e z * sfrom
SQL> select
r e REGISTRY$nonsys_inv_objs;
Flo lice n
o
nd no rows selected
na
Fer SQL>
4. Check that the password file exists.
a. Check the existence of a traditional password file in the $ORACLE_HOME/dbs
directory.
SQL> !ls $ORACLE_HOME/dbs/orapwdbupgrd
/u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwdbupgrd

SQL>
b. Check that the password file is used during an authentication.
SQL> connect sys/oracle_4U@localhost:1521/dbupgrd as sysdba
Connected.
SQL> connect sys/oracle@localhost:1521/dbupgrd as sysdba
ERROR:
ORA-01017: invalid username/password; logon denied

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

Practices for Lesson 10: Performing Post-Upgrade Tasks


Chapter 10 - Page 4
Warning: You are no longer connected to ORACLE.
SQL>
c. Check that after you remove the password file, the only possible authentication is the
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

OS authentication.
− Remove the file system password file.
SQL> !rm $ORACLE_HOME/dbs/orapwdbupgrd

SQL> !ls $ORACLE_HOME/dbs/orapwdbupgrd


ls: cannot access
/u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwdbupgrd: No
such file or directory
a ble
fe r
SQL>
ans
− Even if you use the password that you used in task b., the authentication cannot be n - t r
performed.
a no
SQL> connect sys/oracle_4U@localhost:1521/dbupgrd
h a s as sysdba
m ) ideฺ
co logon
ERROR:
o ฺ G udenied
t
aho tuden
ORA-01017: invalid username/password;
y
@ sS
SQL> connect / as sysdba
o2
Connected.
v a d
e thi
f n e us
SQL>
( x t o
d. If your r
l o ez solution
storage
n se is ASM, you can create the password file in the DATA disk
F It is lonly
group. e
ic possible if you advance the COMPATIBLE.ASM disk group attribute to
d o12.1. Be aware that this is not mandatory but any file stored in a file system can be
nan easily deleted with proper access permissions. Enter oracle_4U when prompted for
Fer the password.
1) Update disk group compatibility attributes first.
a) The COMPATIBLE.ASM, COMPATIBLE.RDBMS and COMPATIBLE.ADVM disk
group attributes determine compatibility. The COMPATIBLE.ASM and
COMPATIBLE.RDBMS attribute settings determine the minimum Oracle
Database software version numbers that a system can use for Oracle ASM
and the database instance types respectively. For example, if the Oracle ASM
compatibility setting is 11.2, and RDBMS compatibility is set to 11.1, then the
Oracle ASM software version must be at least 11.2, and the Oracle Database
client software version must be at least 11.1.
The disk group compatibility settings determine whether your environment can
use the latest Oracle ASM features.
The COMPATIBLE.ASM attribute must be advanced before advancing other
disk group compatibility attributes and its value must be greater than or equal
to the value of other disk group compatibility attributes. This setting also
affects the format of the data structures for the Oracle ASM metadata on the
disk.

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

Practices for Lesson 10: Performing Post-Upgrade Tasks


Chapter 10 - Page 5
From the grid user terminal window session, use SQL*Plus to advance
the COMPATIBLE.ASM attribute of the DATA disk group to 12.1.
$ sqlplus / as sysasm

SQL> ALTER DISKGROUP data SET ATTRIBUTE 'compatible.asm'='12.1';


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

Diskgroup altered.

SQL> col compatibility format A16


SQL> select name, compatibility from v$asm_diskgroup;

NAME COMPATIBILITY
------------------------------ ----------------
a ble
FRA 11.2.0.0.0 fe r
ans
DATA 12.1.0.0.0
n - t r
SQL> exit a no
h a s
$
m ) ideฺ
co t Gattribute
b) Use ASMCA to advance the COMPATIBLE.ASM
o ฺ u of the FRA disk
aho tuden
group to 12.1.
$ asmca y
@ sS
o2
v a d
e thi
f n e us
Step ( x
Window/Page t o
r e z
n s e Description Choices or Values

o Flo1 Configure
l ice ASM: Disk Groups Right-click the Disk Group Name FRA

n and Click the Edit Attributes

Fer

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

Practices for Lesson 10: Performing Post-Upgrade Tasks


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

a ble
fe r
ans
n - t r
a no
h a s
m ) ideฺ
o ฺ co t Gu
Window/Page Description yah
o Choices
e n or Values
Step
tu d
2 @
o thi
2 Edit Attributes for Disk Group: s
FRA S Set the ASM Compatibility = 12.1.0.0.0.
a d
ev usesection
Disk Group Compatibility
f n
Click OK

z (x e to
F lore licens
n d o
na
Fer

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

Practices for Lesson 10: Performing Post-Upgrade Tasks


Chapter 10 - Page 7
Step Window/Page Description Choices or Values
3 Configure ASM: Disk Groups Click Exit
4 Configure ASM: Disk Groups Confirm that you want to quit the ASMCA
application
Click Yes
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

c) Verify the setting by using the V$ASM_DISKGROUP view.


$ sqlplus / as sysasm

SQL> col compatibility format A16


SQL> select name, compatibility from v$asm_diskgroup;

NAME COMPATIBILITY
a ble
------------------------------ ----------------
fe r
ans
FRA 12.1.0.0.0
n - t r
no
DATA 12.1.0.0.0

s a
SQL> EXIT h a
) ideฺ
m
ฺco session,
u
$
2) From the oracle 12c user terminalowindow o n t G create the DBUPGRD
a h e
@ y
password file in the DATA disk group.
S t ud
SQL> select DB_UNIQUE_NAME
a d o2 thfrom is v$database;
f n ev use
(x e to
DB_UNIQUE_NAME
z
o re ens
------------------------------
l
dbupgrd lic
F
n d o
na
Fer SQL> EXIT
$
$ orapwd file='+data/DBUPGRD/orapwdb' dbuniquename='dbupgrd'

Enter password for SYS:

$ sqlplus sys/oracle_4U@localhost:1521/dbupgrd as sysdba


Connected.
SQL> connect sys/oracle@localhost:1521/dbupgrd as sysdba
ERROR:
ORA-01017: invalid username/password; logon denied

Warning: You are no longer connected to ORACLE.


SQL> EXIT

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

Practices for Lesson 10: Performing Post-Upgrade Tasks


Chapter 10 - Page 8
$
3) From the grid user terminal window, verify that the password file is created in the
DATA disk group.
$ asmcmd
ASMCMD> ls +DATA/DBUPGRD/PASSWORD
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

pwddbupgrd.269.814286779
ASMCMD>
5. Verify that the SPFILE is created.
ASMCMD> ls +DATA/DBUPGRD/spfile*
spfiledbupgrd.ora
spfiledbupgrd.ora_1361856137518
ASMCMD>
a ble
ASMCMD> ls -l +DATA/DBUPGRD/spfile*
fe r
Type Redund Striped Time Sys Name
ans
PARAMETERFILE UNPROT COARSE FEB 25 20:00:00 N
n - t r
spfiledbupgrd.ora =>
a no
+DATA/DBUPGRD/PARAMETERFILE/spfile.260.808327751
h a s
PARAMETERFILE UNPROT COARSE FEB 25 22:00:00 N
m ) ideฺ
spfiledbupgrd.ora_1361856137518 =>
o ฺ co t Gu
aho tuden
+DATA/DBUPGRD/PARAMETERFILE/spfile.267.808348937
ASMCMD> exit
y
@ sS
$
o2
6. From the oracle user 12c v a
terminal e thi create the PFILE if it does not exist.
d window,
f n e us
( x t o
$ ls $ORACLE_HOME/dbs/initdbupgrd.ora

o rez ense
/u01/app/oracle/product/12.1.0/dbhome_1/dbs/initdbupgrd.ora
l
d o$F lic
na n $ cat $ORACLE_HOME/dbs/initdbupgrd.ora
Fer SPFILE='+DATA/dbupgrd/spfiledbupgrd.ora_1361856137518'
$
It already exists. The parameter file references the most recent SPFILE file stored in the
DATA disk group.
7. View the contents of the alert log file
$ cd $ORACLE_BASE/diag/rdbms/dbupgrd/dbupgrd/trace
$ ls a*
alert_dbupgrd.log
$ gedit alert_dbupgrd.log

Control file expanded from 594 to 614 blocks for upgrade.


Successful mount of redo thread 1, with mount id 2071604359
Database mounted in Exclusive Mode

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

Practices for Lesson 10: Performing Post-Upgrade Tasks


Chapter 10 - Page 9
Lost write protection disabled
Ping without log force is disabled.
Completed: ALTER DATABASE MOUNT
Fri Feb 15 00:55:36 2013
ALTER DATABASE OPEN MIGRATE
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ


Completed: ALTER DATABASE OPEN MIGRATE

$
From now on, if you encounter any disconnection from the database, reconnect
and continue with your administrative operations.
8. Launch Enterprise Manager Database Express.
a. Configure the port number.
a ble
fe r
$ sqlplus / as sysdba
ans
n - t r
SQL> select DBMS_XDB_CONFIG.getHTTPPort from dual;
a no
h a s
GETHTTPPORT
m ) ideฺ
-----------
o ฺ co t Gu
aho tuden
0
y
@ sS
d o2 i
a t h
SQL> select DBMS_XDB_CONFIG.getHTTPsPort from dual;

f n ev use
GETHTTPSPORT
z (x e to
F lore5500
------------
li c e ns
na ndo
Fer SQL>
− The port number is already being used by the CDB1 instance.
b. Verify which port is being used by the CDB1 instance. Switch to the oracle user
terminal window where the PDB_ORCL plugging is taking place. Wait until it is
completed.
$ . oraenv
ORACLE_SID = [oracle] ? cdb1
The oracle base has been set to /u01/app/oracle
$
Connect to the pdb_orcl PDB to retrieve the port number used.
$ sqlplus sys/oracle_4U@localhost:1521/pdb_orcl as sysdba

SQL> select DBMS_XDB_CONFIG.getHTTPPort from dual;

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

Practices for Lesson 10: Performing Post-Upgrade Tasks


Chapter 10 - Page 10
-----------
0

SQL> select DBMS_XDB_CONFIG.getHTTPsPort from dual;


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

GETHTTPSPORT
------------
5500

SQL> exit
$
c. Configure the port number 5502 for Enterprise Manager Database Express for the
dbupgrd instance. Switch back the dbupgrd session.
a b le
e r
1) Check the value of the DISPATCHERS instance parameter in the dbupgrd instance.
a n sthef
There must be at least one dispatcher configured for the XMLDB service
TCP protocol. n - trwith

Session 1 a no
h a s
SQL> show parameter dispatchers
m ) ideฺ
o ฺ co t Gu
NAME
y a ho deTYPE n VALUE
@
------------------------------------
2 S tu ----------- ---------------
-
do thi s
dispatchers e v a s e string
f n
(x e to
max_dispatchers u integer
SQL> re z
F lo licens
n d o Set the DISPATCHERS instance parameter.
2)
n a
Fer SQL> alter system set
dispatchers='(protocol=tcp)(service=dbupgrdXDB)' scope=both;

System altered.

SQL>
3) Set the port number to 5502 for EM Database Express.
SQL> exec DBMS_XDB_CONFIG.setHTTPsPort(5502)

PL/SQL procedure successfully completed.

SQL> select DBMS_XDB_CONFIG.getHTTPsPort from dual;

GETHTTPSPORT
------------

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

Practices for Lesson 10: Performing Post-Upgrade Tasks


Chapter 10 - Page 11
5502

SQL>
4) Restart the instance to register the XMLDB service.
SQL> shutdown immediate
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 663908352 bytes


a ble
Fixed Size 2291280 bytes
fe r
Variable Size 285215152 bytes
ans
Database Buffers 369098752 bytes n - t r
Redo Buffers 7303168 bytes
a no
Database mounted.
h a s
m ) ideฺ
co t Gu
Database opened.
SQL> exit o ฺ
$
y aho tuden
d. Click the Firefox icon on the top
o 2 @ S region) above the desktop to open a
panel (toolbar
s
d
a se t
browser to access the Enterprise h i
Manager Database Express console.
e v
nEnterprise
e. Enter the URL for
( x f t o uManager Database Express:
z e
https://<hostname>:5502/em. In the current setup, use
r e
lo lice n s
https://localhost:5502/em.
o−
FMost likely, a security exception (untrusted connection) is noticed.
na nd − Enter sys in the User Name field and oracle_4U in the Password field. Select as
Fer SYSDBA. Then click Login.

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

Practices for Lesson 10: Performing Post-Upgrade Tasks


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

a ble
fe r
ans
n - t r
a no
h a s
m ) ideฺ
o ฺ co t Gu
o en
ahverify
y
9. From the oracle user 12c terminal window, t d the SH and HR application users are
uthat
unlocked. @
o2 this S
v a d
e
$ sqlplus / as sysdba
n u s e
… f
(x e to
z
re pages
SQL> set
F locol c e ns100format a30
d
SQL> li
oSQL> selectusername

na n username , account_status from dba_users order by 1;

Fer USERNAME ACCOUNT_STATUS


------------------------------- --------------------------------
ANONYMOUS EXPIRED & LOCKED
APPQOSSYS EXPIRED & LOCKED
AUDSYS EXPIRED & LOCKED
DBSNMP OPEN
DIP EXPIRED & LOCKED
GSMADMIN_INTERNAL EXPIRED & LOCKED
GSMCATUSER EXPIRED & LOCKED
GSMUSER EXPIRED & LOCKED
HR OPEN
ORACLE_OCM EXPIRED & LOCKED
OUTLN EXPIRED & LOCKED
SH OPEN

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

Practices for Lesson 10: Performing Post-Upgrade Tasks


Chapter 10 - Page 13
SYS OPEN
SYSBACKUP EXPIRED & LOCKED
SYSDG EXPIRED & LOCKED
SYSKM EXPIRED & LOCKED
SYSTEM OPEN
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

WMSYS EXPIRED & LOCKED


XDB EXPIRED & LOCKED
XS$NULL EXPIRED & LOCKED

20 rows selected.

SQL>
10. Upgrade optimizer statistics. In Practice 8-2, the last suggestion in
a ble
/u01/app/oracle/cfgtoollogs/dbupgrd/preupgrade/preupgrade.log was to fe r
create statistics on fixed objects two weeks after the upgrade. You can do it now or leave it ans
until the end of the course. In the normal course of database performance management, n - t r
o
s an
you will repeat the procedure periodically as well as the gather_dictionary_stats
procedure to update statistics on data dictionary objects. This procedure takes some time to
execute. You can skip it if you are short of time. ) ha eฺ
ฺ c
SQL> exec dbms_stats.gather_fixed_objects_statsom Guid
a h oo ent
PL/SQL procedure successfully @ S ud
y completed.
t
a d o2 this
SQL> EXIT
f n ev use
$
z (x e to
lore perform
11. After upgrade,
F c
li /e nsa FULL database backup using RMAN.
n d o$ rman target
na
Fer RMAN> show all;

using target database control file instead of recovery catalog


RMAN configuration parameters for database with db_unique_name
DBUPGRD are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;

RMAN> backup database plus archivelog delete all input;

Starting backup at 26-FEB-13


current log archived
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 10: Performing Post-Upgrade Tasks


Chapter 10 - Page 14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=263 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=35 RECID=1 STAMP=808345285
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ


Finished backup at 26-FEB-13

Starting Control File and SPFILE Autobackup at 26-FEB-13


piece
handle=+FRA/DBUPGRD/AUTOBACKUP/2013_02_26/s_808370053.315.808370
057 comment=NONE
Finished Control File and SPFILE Autobackup at 26-FEB-13
a ble
fe r
RMAN> EXIT
ans
$ n - t r
a no
12. Now that you set the COMPATIBLE.ASM disk group attribute to12.1 for the disk group
a s
DATA, you can create the ASM password file in the disk group if it is not already created.
h
Enter oracle_4U when the password is prompted. m ) ideฺ
ฺ o if aGpassword
ccheck u
a. From the grid user terminal window session,
h o o n t file exists.
$ ls $ORACLE_HOME/dbs
@ ya tude
ab_+ASM.dat bkup+ASM.ora
o i S
2 hc_+ASM.dat
s init.ora
$ v d
a se t h
e
fnpassword u in the DATA disk group.
b. Create the same( x t o file
$ orapwd
l o rez file='+data/ASM/orapwdasm'
e n se asm=y
F li
oEnter passwordc
n d
na for SYS:

Fer $ asmcmd
ASMCMD> ls -l +DATA/ASM
Type Redund Striped Time Sys Name
Y
ASMPARAMETERFILE/
Y PASSWORD/
PASSWORD UNPROT COARSE FEB 17 19:00:00 N orapwdasm =>
+DATA/ASM/PASSWORD/pwdasm.268.808291301
ASMCMD> exit
$

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

Practices for Lesson 10: Performing Post-Upgrade Tasks


Chapter 10 - Page 15
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

a ble
fe r
ans
n - t r
o
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 10: Performing Post-Upgrade Tasks


Chapter 10 - Page 16
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

a ble
fe r
ans
n - t r
a no
Practices for a s
m ) ideฺ 11:
h Lesson
Migrating
ฺ co DataG u by Using
o
ho dData t
n Pump
y aOracletu11
e
2 @ s S
v a do thi Chapter

f n e u se
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 11: Migrating Data by Using Oracle Data Pump
Chapter 11 - Page 1
Practices for Lesson 11
Practices Overview

In these practices, you will use another method for migrating data from an Oracle Database 11g
database to an Oracle Database 12c database. Using Oracle Data Pump:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

• Perform a transportable tablespace import from the Oracle Database 11g dbupgrd
database into another Oracle Database 12c database
• Import the SH schema from the orcl non-CDB into the pdb_sh PDB of the cdb1 CDB

You are going to work as the oracle user to perform operations in the 12c environment only.
Therefore, keep a terminal window opened as the oracle user in the 12c environment.

a ble
fe r
ans
n - t r
o
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Practices for Lesson 11: Migrating Data by Using Oracle Data Pump
Chapter 11 - Page 2
Practice 11-1: Performing a Transportable Tablespace Import
Overview
In this practice, you will perform a transportable tablespace import from the Oracle Database
11g dbupgrd database into another Oracle Database 12c database. In order to avoid the
creation of another database, you will use the existing Oracle Database 12c dbupgrd
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

database.

Assumptions

• You successfully installed the Oracle 12c Database software in Practice 5-1.
• In Practice 8-5, the transportable tablespace export from the dbupgrd database before
the database was upgraded successfully completed, exporting the EXAMPLE and
USERS tablespaces.
a ble
fe r
Tasks
a n s
1. From the oracle user 12c terminal window, configure the target dbupgrdn -t r
database as if it
were a brand new empty database to be the recipient for the migrated n
o
data from the source
s
Oracle 11g Database. If you encounter any disconnection fromathe
adatabase, reconnect
and continue with your administrative operations.
m ) h ideฺ
o ฺ co t Gu
a. Set your environment to the target database dbupgrd.
$ . oraenv
y aho tuden
ORACLE_SID = [dbupgrd] ?@ S
d o 2 dbupgrd
i s
The Oracle base remains
v a se t h
unchanged with value /u01/app/oracle
$ sqlplus / as e
fn to u
sysdba
( x
SQL>l o rez ense
F lic
b.doDrop the application schemas and tablespaces.
nan
Fer
SQL> SELECT tablespace_name FROM dba_tablespaces;

TABLESPACE_NAME
------------------------------
SYSTEM
SYSAUX
UNDOTBS1
TEMP
USERS
EXAMPLE

6 rows selected.

SQL> drop user hr cascade;

User dropped.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 11: Migrating Data by Using Oracle Data Pump
Chapter 11 - Page 3
SQL> drop user sh cascade;

User dropped.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

SQL> drop tablespace EXAMPLE including contents and datafiles;

Tablespace dropped.

SQL> drop tablespace USERS including contents and datafiles;

drop tablespace USERS including contents and datafiles


*
a ble
ERROR at line 1: fe r
ans
ORA-12919: Can not drop the default permanent tablespace
n - t r
a no
h a s
SQL> alter database default tablespace system;

m ) ideฺ
Database altered.
o ฺ co t Gu
aho tudecontents
SQL> drop tablespace USERSyincluding
n
and datafiles;
@
o2 this S
a d
f n ev use
Tablespace dropped.

z (x e to
re etablespace_name
SQL> SELECT
l o n s FROM dba_tablespaces ORDER BY 1;

d o F lic
na n TABLESPACE_NAME
Fer ------------------------------
SYSAUX
SYSTEM
TEMP
UNDOTBS1

SQL>
c. Create the schemas in the target database instance before importing data.
SQL> create user HR identified by oracle_4U account unlock;

User created.

SQL> create user SH identified by oracle_4U account unlock;

User created.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 11: Migrating Data by Using Oracle Data Pump
Chapter 11 - Page 4
SQL> grant create session, create table, create materialized
view, unlimited tablespace to HR, SH;

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

SQL> EXIT
$
2. At the end of the Practice 8-5, you moved the dump file to the
/home/oracle/labs/dbupgrd12 directory and copied the data files of the 11g
dbupgrd database to the /u01/app/grid/exp_files directory.
$ ls /home/oracle/labs/dbupgrd12
expTTS.dmp
a ble
$
fe r
3. Move the dump file to the default directory for Data Pump in the dbupgrd database ans
instance. n - t r
a no
$ mv /home/oracle/labs/dbupgrd12/expTTS.dmp
h a s
/u01/app/oracle/admin/dbupgrd/dpdump
m ) ideฺ
$
o ฺ cofiles from
t G u
4. From the grid user terminal window, move the
a h o en
data the FRA disk group back to
the DATA disk group as stipulated at they d Pump export (Practice 8-5).
end of theuData
t
$ asmcmd
@
o2 this S
v a d
e s e
ASMCMD> ls +DATA/DBUPGRD/DATAFILE
n u
f
(x e to
SYSAUX.261.814012959
z
lore licens
SYSTEM.260.814012925
F
n d oASMCMD> cp +FRA/EXAMPLE +DATA/DBUPGRD/DATAFILE/example01.dbf
UNDOTBS1.262.814012987

na
Fer copying
ASMCMD>
+FRA/EXAMPLE -> +DATA/DBUPGRD/DATAFILE/example01.dbf
cp +FRA/USERS +DATA/DBUPGRD/DATAFILE/users01.dbf
copying +FRA/USERS -> +DATA/DBUPGRD/DATAFILE/users01.dbf
ASMCMD> exit
$
5. From the oracle user terminal window, use the dump file and data files to import the
transportable tablespaces from the dbupgrd database into the target database. To make
the import quicker, you will import only the HR and SH schemas.
Note: Remove the named log files, if they exist the import will fail.
$ rm /u01/app/oracle/admin/dbupgrd/dpdump/import.log
rm: cannot remove
`/u01/app/oracle/admin/dbupgrd/dpdump/import.log': No such file
or directory
$ impdp system/oracle_4U dumpfile=expTTS.dmp
TRANSPORT_DATAFILES='+DATA/DBUPGRD/DATAFILE/users01.dbf',
'+DATA/DBUPGRD/DATAFILE/example01.dbf' logfile=import.log
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 11: Migrating Data by Using Oracle Data Pump
Chapter 11 - Page 5
Import: Release 12.1.0.1.0 - Production on Thu Feb 21 17:37:21
2013

Master table "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" successfully
loaded/unloaded
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Source TSTZ version is 14 and target TSTZ version is 18.


Starting "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01":
system/******** dumpfile=expTTS.dmp
TRANSPORT_DATAFILES=+DATA/DBUPGRD/DATAFILE/users01.dbf,
+DATA/DBUPGRD/DATAFILE/example01.dbf logfile=import.log
Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
Processing object type TRANSPORTABLE_EXPORT/TABLE
Processing object type
a ble
TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
fe r
ans
Job "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" successfully
completed at Tue Feb 26 18:30:40 2013 elapsed 0 00:00:21 n - t r
$
a no
h a s have been
6. Check in the target database that the EXAMPLE and USERS tablespaces
m ) table
plugged, and that the HR.EMPLOYEES table and the SH.SALES d e ฺ
contain the rows as in
ฺ co t Gu i
the source dbupgrd database. o
$ sqlplus / as sysdba y aho tuden
o2 @ sS
a d i dba_tablespaces;
thFROM
v
SQL> SELECT tablespace_name
e e
( x f n
t o us
l o rez ense
TABLESPACE_NAME

d o F lic
------------------------------

nan
SYSTEM

Fer
SYSAUX
UNDOTBS1
TEMP
USERS
EXAMPLE

6 rows selected.

SQL> SELECT name FROM v$datafile;

NAME
----------------------------------------------------------------
-
+DATA/dbupgrd/datafile/system.263.808326819
+DATA/dbupgrd/datafile/sysaux.264.808326845
+DATA/dbupgrd/datafile/undotbs1.269.808326865
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 11: Migrating Data by Using Oracle Data Pump
Chapter 11 - Page 6
+DATA/DBUPGRD/DATAFILE/example01.dbf
+DATA/DBUPGRD/DATAFILE/users01.dbf

SQL> SELECT count(*) FROM HR.employees;

COUNT(*)
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

----------
7

SQL> SELECT count(*) FROM SH.sales;

COUNT(*)
----------
a ble
5
fe r
ans
SQL>
n - t r
7. Set the EXAMPLE and USERS tablespaces to READ WRITE. o
SQL> alter tablespace example read write; as
an
m ) h ideฺ
Tablespace altered.
o ฺ co t Gu
y aho tuden
SQL> alter tablespace users
o2 @ read s S write;
a d th i
e v e
( x fn to us
Tablespace altered.

SQL>l o rez ense


8. d o
Reset
F lic
the default permanent tablespace to the USERS tablespace.
na n
Fer
SQL> alter database default tablespace users;

Database altered.

SQL>
9. Shut down the instance to release resources for the next practice.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
$

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

Practices for Lesson 11: Migrating Data by Using Oracle Data Pump
Chapter 11 - Page 7
Practice 11-2: Importing a Non-CDB Application Into a CDB
Overview
In this practice, you will use the export dump file created in Practice 9-2 from the orcl non-CDB
to import the SH schema application in the cdb1 CDB into a new pdb_sh PDB.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Assumption
The export of the SH schema performed from the orcl non-CDB was successfully completed in
Practice 9-2.
The cdb1 CDB was successfully created in Practice 5-2.

Tasks
1. Still from the oracle user 12c terminal window, create a new pdb_sh in cdb1 that will be
the container/recipient for the SH schema exported from non-CDB orcl. a b le
e r
a. Create a directory for the new data files of pdb_sh of cdb1. A recommended pattern
a n sf
n - tr are inthe
is that the pdb datafiles reside in a separate folder below the CDB. For example,
CDB datafiles are in $ORACLE_BASE/oradata/cdb1 and the pdb datafiles
$ORACLE_BASE/oradata/cdb1/pdb_sh. a no
h a s
$ . oraenv
m ) ideฺ
ORACLE_SID = [dbupgrd] ? cdb1
o ฺ co value
t G u
The Oracle base remains unchanged
a h o en with /u01/app/oracle

@ y
S t ud
a d o2 this
$ mkdir –p $ORACLE_BASE/oradata/cdb1/pdb_sh
$
f n ev use
b. Connect to the
z (xrootecontainer
to of cdb1 with a user with CREATE PLUGGABLE
F lore lprivilege.
DATABASE
i c e ns Note:
datafiles will
The FILE_NAME_CONVERT replaces strings, so all the
be renamed to pdb_sh/* when they are copied for the
d opdb_seed/*

nan
pdb_sh PDB.

Fer $ sqlplus / as sysdba

SQL> CREATE PLUGGABLE DATABASE pdb_sh ADMIN USER sh_admin


IDENTIFIED BY oracle_4U ROLES=(CONNECT)
FILE_NAME_CONVERT=('/u01/app/oracle/oradata/cdb1/pdbseed'
,'/u01/app/oracle/oradata/cdb1/pdb_sh');
2 3 4

Pluggable database created.

SQL>
c. Check the open mode of pdb_sh. The other pdbs are open read write because you
created a trigger to open all of them on startup. pdb_sh is NOT open because it was
created after the trigger fired.
SQL> col con_id format 999

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

Practices for Lesson 11: Migrating Data by Using Oracle Data Pump
Chapter 11 - Page 8
SQL> col name format A10
SQL> select con_id, NAME, OPEN_MODE, DBID, CON_UID from V$PDBS;

CON_ID NAME OPEN_MODE DBID CON_UID


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

2 PDB$SEED READ ONLY 4056847030 4056847030


3 PDB1 READ WRITE 3321976125 3321976125
4 PDB_ORCL READ WRITE 1341873063 1341873063
5 PDB_SH MOUNTED 1752541684 1752541684
SQL>
d. Open pdb_sh.
SQL> alter pluggable database pdb_sh open;
a ble
fe r
Pluggable database altered.
ans
n - t r
o
an
SQL> select con_id, NAME, OPEN_MODE, DBID, CON_UID from V$PDBS;
s
a ฺ
DBID ) hCON_UID
CON_ID NAME OPEN_MODE
c o u i de
m ----------
oฺ nt4056847030
------ ---------- ---------- ----------
READ ONLY h o G
2 PDB$SEED
ya3321976125de 3321976125
4056847030
t u
3 PDB1 @
READ WRITE
o S
2WRITEis1341873063
4 PDB_ORCL
v a d
READ
t h 1341873063
e
5 PDB_SH e READ sWRITE 1752541684 1752541684
( x fn to u
SQL>l o rez ense
exit

d o$ F lic
a n
Fern
Note: A service name for a pdb is created and registered with the listener when the
pdb is created, and EZCONNECT may be used to connect to the PBD without
creating the net service name in this step. Net services names are often much more
convenient.
2. Use NETCA to add the PDB_SH net service name for pdb_sh pluggable database of cdb1
to the tnsnames.ora file.
$ $ORACLE_HOME/bin/netmgr
Use netca as you did in Practice 9-3 Task 3 with the following values:
Service Name: pdb_sh
Protocol: TCP
Hostname: <yourservername>, or localhost
Port Number: 1521
3. Test the connection. Connect to pdb_sh AS SYSDBA.
$ sqlplus sys/oracle_4U@pdb_sh AS SYSDBA

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

Practices for Lesson 11: Migrating Data by Using Oracle Data Pump
Chapter 11 - Page 9
SQL> show con_name

CON_NAME
------------------------------
PDB_SH
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

SQL> exit
4. Connect to the target pdb_sh PDB as the SYSTEM user.
$ sqlplus system/oracle_4U@pdb_sh

SQL> SELECT name FROM v$pdbs;

NAME
a ble
------------------------------
fe r
PDB_SH
ans
n - t r
SQL>
a no
5. Create a Data Pump directory for the dump files stored for anya
h s Pump operations in
Data
pdb_sh PDB.
m ) ideฺ
a. Create the OS directory.
o ฺ co t Gu
aho tuden
SQL> ! mkdir -p /u01/app/oracle/admin/cdb1/pdb_sh/dpdump
y
o2 @ sS
SQL>
v a d
e thi
f
b. Create the directoryn ein the PDB.
us
( x t o
l o rez edirectory
SQL> create
n se dp_pdb_sh as
F lic
'/u01/app/oracle/admin/cdb1/pdb_sh/dpdump';
d o
nan Directory created.
Fer
SQL>
6. Create the EXAMPLE tablespace in the PDB.
SQL> create tablespace EXAMPLE datafile
'/u01/app/oracle/oradata/cdb1/pdb_sh/example01.dbf' size 500m;

Tablespace created.

SQL>
7. Create the users before the import operation.
SQL> create user SH identified by oracle_4U account unlock
default tablespace EXAMPLE;
2
User created.

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

Practices for Lesson 11: Migrating Data by Using Oracle Data Pump
Chapter 11 - Page 10
SQL> grant create session, create table, create materialized
view, unlimited tablespace to SH;

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

8. At the end of the Practice 9-2, you moved the


/u01/app/oracle/admin/orcl/dpdump/expSH.dmp export dump file containing the
SH schema of the orcl database to the /home/oracle/labs directory. Move the dump
file to the directory of the PDB.
$ mv /home/oracle/labs/expSH.dmp
/u01/app/oracle/admin/cdb1/pdb_sh/dpdump
$
a ble
9. Import the SH schema of the orcl database into the pdb_sh PDB. Note that the IMPDP
fe r
command includes the net service_name in the userid clause.
a n s
$ rm /u01/app/oracle/admin/cdb1/pdb_sh/dpdump/impSH.log n -t r
n o
rm: cannot remove
s a
`/u01/app/oracle/admin/cdb1/pdb_sh/dpdump/impSH.log':
file or directory ) ha eฺ No such

$ ฺ c om Guid
$ impdp system/oracle_4U@pdb_sh
a h oo
FULL=Y e n t
dumpfile=expSH.dmp
y
directory=dp_pdb_sh logfile=impSH.log
@ S t ud
a d o2 this
Import: Releaseev se - Production on Thu Feb 21 18:29:00
12.1.0.1.0
2013 f n
(x e to u
z
loretable s
n"SYSTEM"."SYS_IMPORT_FULL_01"

F
Master li c e successfully
n d oloaded/unloaded
rn a
Fe
Starting "SYSTEM"."SYS_IMPORT_FULL_01": system/********@pdb_sh
FULL=Y dumpfile=expSH.dmp directory=dp_pdb_sh logfile=impSH.log
Processing object type SCHEMA_EXPORT/USER
ORA-31684: Object type USER:"SH" already exists
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT

. . imported "SH"."CUSTOMERS" 10.27
MB 55500 rows
. . imported "SH"."COSTS":"COSTS_Q1_1998" 139.6
KB 4411 rows

. . imported "SH"."SALES":"SALES_Q1_1998" 1.413
MB 43687 rows

. . imported "SH"."SALES":"SALES_Q4_2003" 0
KB 0 rows

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

Practices for Lesson 11: Migrating Data by Using Oracle Data Pump
Chapter 11 - Page 11
Processing object type SCHEMA_EXPORT/DIMENSION
Job "SYSTEM"."SYS_IMPORT_FULL_01" completed with 12 error(s) at
Tue Feb 26 18:50:38 2013 elapsed 0 00:01:13

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

There are some errors due to missing users in the target PDB. The intention of this
practice is to show how to handle the process of exporting and importing a non-CDB
schema such as SH into a PDB.
10. Connect as SH to the PDB and check that the SH schema exists and the SH.SALES table
is created in the pdb_sh PDB.
$ sqlplus sh/oracle_4U@pdb_sh

SQL> SELECT count(*) FROM sh.sales;


a ble
fe r
COUNT(*)
ans
---------- n - t r
918843 a no
h a s
m ) ideฺ
SQL>
o Gu
ฺcthe
If you connect to the root container of the o
h o
CDB, SHt application data is not known. It
n
belongs only to the PDB. y a ud e
@ S t
SQL> connect / as sysdba
a d o2 this
Connected.
n ev uFROM
SQL> SELECTxfcount(*)
se sh.sales;
z ( e to
F lorecount(*)
SELECT li c e ns FROM sh.sales
n d o
n a *

Fer ERROR at line 1:


ORA-00942: table or view does not exist

SQL> exit
$

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

Practices for Lesson 11: Migrating Data by Using Oracle Data Pump
Chapter 11 - Page 12
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

a ble
fe r
ans
n - t r
a no
has eฺ a
Appendix:)Upgrading
Database c omWith
u d
iOptions

oo 12 ent G
a h
@ y Chapter
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Appendix: Upgrading a Database With Options


Chapter 12 - Page 1
Appendix
Overview

In the class setup, most of the options were removed from the dbupgrd database instance so
that the upgrade process could complete within a reasonable time. In these practices, we will
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

consider that many options are enabled in the dbupgrd database instance. Therefore you
would prepare a dbupgrd database instance currently running in 11g to upgrade to 12c, then
upgrade the database and finally perform post-upgrade actions. In these practices, you would:
• Execute the preupgrd.sql script
• Review the information displayed by the pre-upgrade information tool
• Resolve issues if any
Perform a full database backup before the upgrade process starts

a ble
• Upgrade the Oracle Database 11g Release 2 dbupgrd database to Oracle Database
fe r
12c by using DBUA
ans
• Perform post-upgrade actions n - t r
a no
a sfiles, redo log files and
In the upgrade plan, it is not planned to relocate the data files, control
h
archive log files in another location. m ) ideฺ
You are going to work as the oracle user to perform o ฺ co t G
operations in u
the 11g environment and as
the oracle user for other operations in the 12c h o n
window opened as the oracle user in the y
11g t u de and
environment.
aenvironment Therefore, keep a terminal
another terminal window
2 @ s S
o environment.
opened as the oracle user in thed
v a 12c
e thi
f n e us
( x t o
l o rez ense
d o F lic
r n an
Fe

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

Appendix: Upgrading a Database With Options


Chapter 12 - Page 2
Practice A-1: Executing Preliminary Steps and the Pre-Upgrade Tool
Overview
In this practice, you will prepare your dbupgrd database instance for an upgrade to 12c.
You have already installed the Oracle 12c Database software. You need to check that the
dbupgrd database instance is compatible with an upgrade from 11.2.0.3.0 to 12.1.0.1.0 before
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

upgrading.

Tasks
1. List the options that require a specific treatment before upgrade.
a. Logged in to a Unix session as the oracle user, check if Oracle Label Security or/and
Oracle Database Vault are installed in the dbupgrd database instance.
$ . oraenv
a ble
ORACLE_SID = [dbupgrd] ? dbupgrd
fe r
The Oracle base remains unchanged with value /u01/app/oracle
ans
$ env | grep ORA
n - t r
ORACLE_SID=dbupgrd
a no
ORACLE_BASE=/u01/app/oracle
h a s
m ) ideฺ
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_2
$ sqlplus / as sysdba
o ฺ co t Gu
y a ho den
SQL> col parameter format @ A30 Stu
d 2
o A10 this
a
SQL> col value format
ev v$option
SQL> select *nfrom se
f
(xparameter u
to in
z
2 where
e e
F3lor ('Oracle
c e ns Label Security', 'Oracle Database Vault');
li
na ndo
Fer
PARAMETER VALUE
---------------------------------------- ----------
Oracle Label Security FALSE
Oracle Database Vault FALSE

SQL>
If one of these two options were enabled, you would have to execute the
$ORACLE_HOME/rdbms/admin/olspreupgrade.sql script copied from the 12c
database ORACLE_HOME environment to the 11g database ORACLE_HOME
environment. The script moves the AUD$ table from the SYSTEM schema to the SYS
schema. You would have to disable Oracle Database Vault if the option is enabled.

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

Appendix: Upgrading a Database With Options


Chapter 12 - Page 3
b. Switch to the Oracle Database 12c session. Open an oracle user terminal window
and set the environments variables to the 12c Oracle database ORACLE_HOME.
$ id
uid=54329(oracle) gid=54330(oinstall)
groups=54330(oinstall),54323(oper),54324(backupdba),54325(dgdba)
,54326(kmdba),54327(asmdba),54331(dba)
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
$
c. Set the ORACLE_SID environment variable to orcl. (You know that the orcl
database instance runs in the 12c database environment)
$ . oraenv
ORACLE_SID = [oracle] ? orcl
The Oracle base remains unchanged with value /u01/app/oracle
a ble
$ env | grep ORA
fe r
ORACLE_SID=orcl
ans
ORACLE_BASE=/u01/app/oracle
n - t r
ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1
a no
$
h a s
m ) ideฺ
d. Display the contents of the $ORACLE_HOME/rdbms/admin/olspreupgrade.sql
script. o ฺ co t Gu
y aho tuden
$ vi $ORACLE_HOME/rdbms/admin/olspreupgrade.sql

o 2 @ sS
Rem
v a d
e thi
Rem $Header:fn e us
( x rdbms/admin/olspreupgrade.sql
11:27:27z aramappa t o /main/3 2012/09/06
e s e Exp $
Remlor n
o l ice
F olspreupgrade.sql
a n d Rem
n
Fer
Rem
Rem Copyright (c) 2012, Oracle and/or its affiliates. All rights
reserved.
Rem
Rem NAME olspreupgrade.sql - OLS Pre processing script prior
to upgrade for 12.1
Rem
Rem DESCRIPTION
Rem This is a mandatory OLS preprocess upgrade script that
needs to be run by Label Security and Database Vault customers
when upgrading to 12.1.
Rem
Rem This script is NOT NEEEDED if you DO NOT have Database
Vault or Label Security.

It is clearly stated that this is a mandatory OLS preprocess upgrade script that needs
to be run by Label Security and Database Vault customers when upgrading to
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Appendix: Upgrading a Database With Options


Chapter 12 - Page 4
12.1.0.0, but this script is NOT NEEEDED if you DO NOT have Database Vault or
Label Security.
e. The script describes how you should proceed:
Rem STEPS TO RUN THIS SCRIPT
Rem -----------------------------
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Rem To run the Oracle Label Security preprocess upgrade


script, copy the $ORACLE_HOME/rdbms/admin/olspreupgrade.sql
script to the old ORACLE_HOME. Run the script as SYSDBA in the
old ORACLE_HOME.
Rem


a ble
Rem However, if you have Database Vault, the following
fe r
steps need to be done after copying the olspreupgrade.sql to the
ans
old ORACLE_HOME:
n - t r
o
an

Rem s
To run the OLS preprocess script on a release 10.2.0.5
ha eฺ
or 11.2 database before upgrading:
)
Rem
ฺ c om Guid
Rem oo ent
1. Start SQL*Plus and connect to the database to be
a h
upgraded as DVOWNER.
@ y
S t ud
Rem
o2 this
2. Execute the following statement:
a d
ev use
Rem SQL> GRANT DV_PATCH_ADMIN to SYS;
Rem f n
(x e to
3. Run the OLS preprocess script, at
z
lore licens
Rem ORACLE_HOME/rdbms/admin/olspreupgrade.sql

o F
Rem 4. After the olspreupgrade.sql has been successfully

a n d run, start SQL*Plus and connect to the database as DVOWNER.

Fern Rem 5. Execute the following statement:


Rem SQL> REVOKE DV_PATCH_ADMIN from SYS;
Rem

f. Quit the vi editor.


g. How would you disable Oracle Database Vault?
− Log in as the Oracle Database Owner (DV_OWNER) account.
sqlplus dvo/password
− Execute the following procedure:
exec DVSYS.DBMS_MACADM.DISABLE_DV
− Restart the instance
connect / as sysdba
shutdown immediate
startup

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

Appendix: Upgrading a Database With Options


Chapter 12 - Page 5
2. Check that the tablespaces set to READ ONLY or OFFLINE mode are not schema-based
tablespaces such as SYSAUX, SYSTEM, XDB, HTMLDB, or CTXSYS. Otherwise the upgrade
will fail. In the rare case where queue tables reside in a tablespace that has been set to
READ ONLY for the upgrade, then that tablespace should be set back to READ WRITE.
Return to your Unix 11g session and run the following statement:
SQL> select tablespace_name, status from dba_tablespaces;
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

TABLESPACE_NAME STATUS
------------------------------- ---------
SYSTEM ONLINE
SYSAUX ONLINE
UNDOTBS1 ONLINE
TEMP ONLINE
USERS ONLINE
a ble
fe r
EXAMPLE ONLINE
ans
6 rows selected. n - t r
a no
SQL>
h a s
3. Remove the AUDSYS schema, and the AUDIT_ADMIN and m )AUDIT_VIEWER
d e ฺ roles. At this
ฺ coand troles i
uwill be created as a
stage, there should be no AUDSYS schema. This user
o G
predefined user and roles when the database
y a hois upgraded
d e n to 12c and migrated to Unified
2 @ S tu in Oracle Database 12c.
Auditing. Unified auditing is the new auditing capability
SQL> DROP USER AUDSYS do CASCADE;
t hi s
v a
e CASCADE e
DROP USER AUDSYS
(
* x f n
t o us
l o ez linens1:e
rat
iceuser 'AUDSYS' does not exist
ERROR
o F
ORA-01918: l
a n d
n
Fer SQL> DROP ROLE AUDIT_ADMIN;
DROP ROLE AUDIT_ADMIN
*
ERROR at line 1:
ORA-01919: role 'AUDIT_ADMIN' does not exist

SQL> DROP ROLE AUDIT_VIEWER;


DROP ROLE AUDIT_VIEWER
*
ERROR at line 1:
ORA-01919: role 'AUDIT_VIEWER' does not exist

SQL>

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

Appendix: Upgrading a Database With Options


Chapter 12 - Page 6
4. Run the Pre-Upgrade Information Tool by using the
$ORACLE_HOME/rdbms/admin/preupgrd.sql script.
a. Copy the $ORACLE_HOME/rdbms/admin/preupgrd.sql and
$ORACLE_HOME/rdbms/admin/utluppkg.sql scripts from the 12c database
ORACLE_HOME environment to the 11g database ORACLE_HOME environment. In the
Unix 12c session, run the following statement:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

$ cp
/u01/app/oracle/product/12.1.0/dbhome_1/rdbms/admin/preupgrd.sql
/u01/app/oracle/product/11.2.0/dbhome_2/rdbms/admin/preupgrd.sql
$ cp
/u01/app/oracle/product/12.1.0/dbhome_1/rdbms/admin/utluppkg.sql
/u01/app/oracle/product/11.2.0/dbhome_2/rdbms/admin/utluppkg.sql
$
b. The execution of the preupgrd.sql script will generate a log file and two SQL scripts
a ble
in the /u01/app/oracle/cfgtoollogs/dbupgrd/preupgrade directory. Create
fe r
the directory.
ans
n - t r
no
$ mkdir /u01/app/oracle/cfgtoollogs/dbupgrd
$ mkdir /u01/app/oracle/cfgtoollogs/dbupgrd/preupgrade
s a
$ h a
) ideฺ
c. m
In the Unix 11g session, run the preupgrd.sqloscript:
c t Gu
o ฺ
SQL>
y aho tuden
@/u01/app/oracle/product/11.2.0/dbhome_2/rdbms/admin/preupgrd.sq
l
o2 @ sS
Loading Pre-Upgrade v a e thi
dPackage...
f n e us
( x t o
Executing
l o rez Pre-Upgrade
e n se Checks...

d oF
Pre-Upgrade
lic Checks Complete.

a n
Fern ************************************************************

Results of the checks are located at:


/u01/app/oracle/cfgtoollogs/dbupgrd/preupgrade/preupgrade.log

Pre-Upgrade Fixup Script (run in source database environment):


/u01/app/oracle/cfgtoollogs/dbupgrd/preupgrade/preupgrade_fixups
.sql

Post-Upgrade Fixup Script (run shortly after upgrade):


/u01/app/oracle/cfgtoollogs/dbupgrd/preupgrade/postupgrade_fixup
s.sql

************************************************************
Fixup scripts must be reviewed prior to being executed.

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

Appendix: Upgrading a Database With Options


Chapter 12 - Page 7
************************************************************
====>> USER ACTION REQUIRED <<====

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

The following are *** ERROR LEVEL CONDITIONS *** that must be
addressed prior to attempting your upgrade.
Failure to do so will result in a failed upgrade.

You MUST resolve the above errors prior to upgrade

************************************************************
a ble
fe r
SQL> exit
ans
$
n - t r
o
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Appendix: Upgrading a Database With Options


Chapter 12 - Page 8
Practice A-2: Implementing the Pre-Upgrade Information Tool
Recommendations
Overview
In this practice, you will examine the Pre-Upgrade Information Tool output log file and
implement the recommended actions.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

1. Examine the
/u01/app/oracle/cfgtoollogs/dbupgrd/preupgrade/preupgrade.log, output
created from the Pre-Upgrade Information Tool.
$ cat
/u01/app/oracle/cfgtoollogs/dbupgrd/preupgrade/preupgrade.log
Oracle Database Pre-Upgrade Information Tool 02-14-2013 19:13:10
Script Version: 12.1.0.1.0 Build: 006
a ble
****************************************************************
fe r
*
ans
Database Name: DBUPGRD
n - t r
o
an
Version: 11.2.0.3.0
Compatible: 11.2.0.0.0 s
ha eฺ
Blocksize: 8192 )
Platform: Linux x86 64-bit
ฺ c om Guid
Timezone file: V14
a h oo ent
@ y t ud
****************************************************************
S
*
a d o2 this
f n ev use [Renamed Parameters]

z (x e to [No Renamed Parameters in use]

*F lore licens
****************************************************************

n d o****************************************************************
rn a *
Fe [Obsolete/Deprecated Parameters]
[No Obsolete or Desupported Parameters in use]
****************************************************************
*
[Component List]
****************************************************************
*
--> Oracle Catalog Views [upgrade] VALID
--> Oracle Packages and Types [upgrade] VALID
--> JServer JAVA Virtual Machine [upgrade] VALID
--> Oracle XDK for Java [upgrade] VALID
--> Oracle Workspace Manager [upgrade] VALID
--> OLAP Analytic Workspace [upgrade] VALID
--> Oracle Enterprise Manager Repository [upgrade] VALID
--> Oracle Text [upgrade] VALID

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

Appendix: Upgrading a Database With Options


Chapter 12 - Page 9
--> Oracle XML Database [upgrade] VALID
--> Oracle Java Packages [upgrade] VALID
--> Oracle Multimedia [upgrade] VALID
--> Oracle Spatial [upgrade] VALID
--> Expression Filter [upgrade] VALID
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

--> Rule Manager [upgrade] VALID


--> Oracle Application Express [upgrade] VALID
--> Oracle OLAP API [upgrade] VALID
****************************************************************
*
[Tablespaces]
****************************************************************
*
a ble
--> SYSTEM tablespace is adequate for the upgrade.
fe r
minimum required size: 1226 MB
ans
--> SYSAUX tablespace is adequate for the upgrade. n - t r
minimum required size: 1487 MB
a no
h a
--> UNDOTBS1 tablespace is adequate for the upgrade.s
minimum required size: 400 MB m ) ideฺ
o ฺ co t Gu
--> TEMP tablespace is adequate for the upgrade.
minimum required size: 60 MB
y aho tuden
2 @ sS
--> EXAMPLE tablespace is adequate for the upgrade.
o
v a d thi
minimum required size: 310 MB
e
f n e us
z ( x t o
r e n s e [No adjustments recommended]
Flo lice
o****************************************************************
a n d
Fern *
****************************************************************
*
[Pre-Upgrade Checks]
****************************************************************
*
WARNING: --> Process Count may be too low

Database has a maximum process count of 150 which is lower


than the default value of 300 for this release.
You should update your processes value prior to the upgrade
to a value of at least 300.
For example:
ALTER SYSTEM SET PROCESSES=300 SCOPE=SPFILE
or update your init.ora file.

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

Appendix: Upgrading a Database With Options


Chapter 12 - Page 10
WARNING: --> Enterprise Manager Database Control repository
found in the database

In Oracle Database 12c, Database Control is removed during


the upgrade. To save time during the Upgrade, this action
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

can be done prior to upgrading using the following steps


after copying rdbms/admin/emremove.sql from the new Oracle
home
- Stop EM Database Control:
$> emctl stop dbconsole

- Connect to the Database using the SYS account AS SYSDBA:

a ble
SET ECHO ON;
fe r
SET SERVEROUTPUT ON; ans
n - t r
no
@emremove.sql
a
Without the set echo and serveroutput commands you will not
s
h a
) ideฺ
be able to follow the progress of the script.
m
co t Gobjects
u
WARNING: --> Existing DBMS_LDAP o ฺ
aho tuden
dependent
y
@ sS
Database contains2schemas
DBMS_LDAP package. d o
a se t h i with objects dependent on

e v
(xfn e to u
Refer to the Upgrade Guide for instructions to configure
Network z
ACLs.
re APEX_030200
loUSER e ns has dependent objects.
o F l i c
a n d
Fern INFORMATION: --> OLAP Catalog(AMD) exists in database

Starting with Oracle Database 12c, OLAP is desupported.


If you are not using the OLAP Catalog component and want
to remove it, then execute the
ORACLE_HOME/oraolap/admin/catnoamd.sql script before or
after the upgrade.

INFORMATION: --> Older Timezone in use

Database is using a time zone file older than version 18.


After the upgrade, it is recommended that DBMS_DST package
be used to upgrade the 11.2.0.3.0 database time zone
version
to the latest version which comes with the new release.

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

Appendix: Upgrading a Database With Options


Chapter 12 - Page 11
Please refer to My Oracle Support note number 977512.1 for
details.

****************************************************************
*
[Pre-Upgrade Recommendations]
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

****************************************************************
*

*****************************************
********* Dictionary Statistics
*********

*****************************************
a ble
fe r
ans
Please gather dictionary statistics 24 hours prior to
n - t r
no
upgrading the database.
a
To gather dictionary statistics execute the following command
s
while connected as SYSDBA: h a
) ideฺ
m
co t Gu
EXECUTE dbms_stats.gather_dictionary_stats;
o ฺ
y ho den
a^^^
^^^ MANUAL ACTION SUGGESTED
2 @ S tu
do thi s
v a se
****************************************************************
e
* f n u
(x e to [Post-Upgrade Recommendations]
z
F lore licens
****************************************************************
n d o*
rn a
Fe *****************************************
******** Fixed Object Statistics
********

*****************************************

Please create stats on fixed objects two weeks


after the upgrade using the command:
EXECUTE DBMS_STATS.GATHER_FIXED_OBJECTS_STATS;

^^^ MANUAL ACTION SUGGESTED ^^^

****************************************************************
*
************ Summary ************

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

Appendix: Upgrading a Database With Options


Chapter 12 - Page 12
0 ERRORS exist in your database.
3 WARNINGS that Oracle suggests are addressed to improve
database performance.
2 INFORMATIONAL messages that should be reviewed prior to your
upgrade.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

After your database is upgraded and open in normal mode you


must run rdbms/admin/catuppst.sql which executes several
required tasks and completes the upgrade process.

You should follow that with the execution of


rdbms/admin/utlrp.sql, and a comparison of invalid objects
before and after the upgrade using rdbms/admin/utluiobj.sql

a ble
If needed you may want to upgrade your timezone data using the
fe r
process described in My Oracle Support note 977512.1
ans
************* n - t r
$
a no
2. You have two ways to address the warnings and recommendations. h a s You can run the
m ) ideฺ
$ORACLE_BASE/cfgtoollogs/dbupgrd/preupgrade/preupgrade_fixups.sql
script which will attempt to resolve issues reported.ฺc o that
Issues G ucannot be resolved
automatically by the fixup script are flagged h
with
o
o ** USER t
nACTION REQUIRED **. You will
have to fix them manually one by one. ya d e
2 @ S tu
3. You first execute the
do thi s
v a se
/u01/app/oracle/cfgtoollogs/dbupgrd/preupgrade/preupgrade_fixups.sq
e
l script. f n
(/xas sysdba u
z e to
lore licens
$ sqlplus
F
oSQL>
n d
na @/u01/app/oracle/cfgtoollogs/dbupgrd/preupgrade/preupgrade_fixup
Fer s.sql
Pre-Upgrade Fixup Script Generated on 2013-02-14 19:13:04
Version: 12.1.0.1 Build: 006
Beginning Pre-Upgrade Fixups...

PL/SQL procedure successfully completed.

PL/SQL procedure successfully completed.

****************************************************************
*
Check Tag: DEFAULT_PROCESS_COUNT
Check Summary: Verify min process count is not too low
Fix Summary: Review and increase if needed, your PROCESSES
value.

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

Appendix: Upgrading a Database With Options


Chapter 12 - Page 13
****************************************************************
*
Fixup Returned Information:
WARNING: --> Process Count may be too low
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Database has a maximum process count of 150 which is lower


than the
default value of 300 for this release.
You should update your processes value prior to the upgrade
to a value of at least 300.
For example:
ALTER SYSTEM SET PROCESSES=300 SCOPE=SPFILE
or update your init.ora file.
a ble
****************************************************************
fe r
*
ans
n - t r
PL/SQL procedure successfully completed.
a no
h a s
m ) ideฺ
****************************************************************
*
o ฺ co t Gu
Check Tag: EM_PRESENT
y a ho den
@
Check Summary: Check if Enterprise
2 S tuManager is present
Fix Summary: Execute
t s
do emremove.sql
hi prior to upgrade.
e v a e
* ( x n
t o us
****************************************************************
f
ez nsInformation:
Fixup rReturned
l o
e
F li-->e
c Enterprise Manager Database Control repository
n d oWARNING:
found in the database
rn a
Fe In Oracle Database 12c, Database Control is removed during
the upgrade. To save time during the Upgrade, this action
can be done prior to upgrading using the following steps
after copying rdbms/admin/emremove.sql from the new Oracle
home
- Stop EM Database Control:
$> emctl stop dbconsole

- Connect to the Database using the SYS account AS SYSDBA:

SET ECHO ON;


SET SERVEROUTPUT ON;
@emremove.sql
Without the set echo and serveroutput commands you will not

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

Appendix: Upgrading a Database With Options


Chapter 12 - Page 14
be able to follow the progress of the script.
****************************************************************
*

PL/SQL procedure successfully completed.


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

****************************************************************
*
Check Tag: DBMS_LDAP_DEPENDENCIES_EXIST
Check Summary: Check for dependency on DBMS_LDAP package
Fix Summary: Network Objects must be reviewed manually.
****************************************************************
*
a ble
Fixup Returned Information:
fe r
WARNING: --> Existing DBMS_LDAP dependent objects
ans
n - t r
Database contains schemas with objects dependent on
a no
DBMS_LDAP package.
h a s
) ideฺ
Refer to the Upgrade Guide for instructions to configure
m
Network ACLs.
o ฺ co t Gu
aho tuden
USER APEX_030200 has dependent objects.
y
****************************************************************
@ sS
o2
thi
*
v a d
n us e
e successfully
PL/SQL procedure
( x f t o completed.

l o r ez nse
o F l i ce
****************************************************************

na nd *
Fer
Check Tag: AMD_EXISTS
Check Summary: Check to see if AMD is present in the database
Fix Summary: Manually execute
ORACLE_HOME/oraolap/admin/catnoamd.sql script to remove OLAP.
****************************************************************
*
Fixup Returned Information:
INFORMATION: --> OLAP Catalog(AMD) exists in database

Starting with Oracle Database 12c, OLAP is desupported.


If you are not using the OLAP Catalog component and want
to remove it, then execute the
ORACLE_HOME/oraolap/admin/catnoamd.sql script before or
after the upgrade.
****************************************************************
*

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

Appendix: Upgrading a Database With Options


Chapter 12 - Page 15
PL/SQL procedure successfully completed.

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

[Pre-Upgrade Recommendations]
****************************************************************
*

PL/SQL procedure successfully completed.

*****************************************
a ble
********* Dictionary Statistics
fe r
*********
ans
n - t r
*****************************************
a no
h a sprior to
Please gather dictionary statistics 24 hours
m ) ideฺ
upgrading the database.
To gather dictionary statisticsoo
ฺco tthe
G u
a h execute
e n following command
while connected as SYSDBA:y
@ S t ud
a d o2 this
EXECUTE dbms_stats.gather_dictionary_stats;

n e v s e
^^^ MANUAL(x f o u
ACTION tSUGGESTED ^^^
z e
F loreprocedure
li c e ns successfully completed.
n d oPL/SQL

rn a
Fe **************************************************
************* Fixup Summary ************

4 fixup routines generated INFORMATIONAL messages that should


be reviewed.

PL/SQL procedure successfully completed.

**************** Pre-Upgrade Fixup Script Complete


*********************

PL/SQL procedure successfully completed.

SQL>
4. The fixup routines did not fix the issues. Perform the actions to address the issues that
were not fixed.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Appendix: Upgrading a Database With Options


Chapter 12 - Page 16
a. First update the PROCESSES value prior to the upgrade to a value of at least 300.
SQL> show parameter processes

NAME TYPE VALUE


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

-

processes integer 150

SQL> ALTER SYSTEM SET PROCESSES=300 SCOPE=SPFILE;

System altered.

a ble
SQL> exit
fe r
ans
$
n - t r
b.
no
Perform the second recommended action. In Oracle Database 12c, Enterprise
a
Manager Database Control is removed during the upgrade. Enterprise Manager
a s
Database Control does not exist in Oracle Database 12c. It is replaced by Enterprise
h
) ideฺ
Manager Database Express. To save time during the upgrade, this action can be done
m
prior to upgrading using the following steps:
o ฺ co t Gu
a ho den
i) Copy the $ORACLE_HOME/rdbms/admin/emremove.sql
y from the new 12c
Oracle home. @ sS t u
o2
$ cp
v a d
e thi
f n e us
/u01/app/oracle/product/12.1.0/dbhome_1/rdbms/admin/emremove.sql
z ( x t o
/u01/app/oracle/product/11.2.0/dbhome_2/rdbms/admin/emremove.sql
$ lore
e n se
d o
ii)
F lic
Stop EM Database Control in case it is running.
n an
Fer $ emctl stop dbconsole
Oracle Enterprise Manager 11g Database Control Release
11.2.0.3.0
Copyright (c) 1996, 2011 Oracle Corporation. All rights
reserved.
https://edrsr32p1.us.oracle.com:1158/em/console/aboutApplication
Stopping Oracle Enterprise Manager 11g Database Control ...
... Stopped.
$
iii) Execute the removal script.
$ sqlplus / as sysdba

SQL> SET ECHO ON


SQL> SET SERVEROUTPUT ON
SQL> @$ORACLE_HOME/rdbms/admin/emremove.sql

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

Appendix: Upgrading a Database With Options


Chapter 12 - Page 17

Dropping synonym : MGMT$APPLIED_PATCHSETS ...
Dropping synonym : MGMT$APPLIED_PATCHES ...
Dropping synonym : MGMT$ALERT_NOTIF_LOG ...
Dropping synonym : MGMT$ALERT_HISTORY ...
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Dropping synonym : MGMT$ALERT_CURRENT ...


Dropping synonym : MGMT$ALERT_ANNOTATIONS ...
Dropping synonym : EMD_MNTR ...
Dropping synonym : ECM_UTIL ...
Finished phase 5
Starting phase 6 : Dropping Oracle Enterprise Manager related
other roles ...
Finished phase 6
a ble
The Oracle Enterprise Manager related schemas and objects are
fe r
dropped.
ans
Do the manual steps to studown the DB Control if not done before n - t r
running this
a no
a s
script and then delete the DB Control configuration files
h
m ) ideฺ
o
PL/SQL procedure successfully completed. ฺ co t Gu
y a ho den
SQL>
2 @ S tu
do action
c. Perform the third recommendation
s
thi about network objects.
e v a e
( x f n
i) Query the DBA_DEPENDENCIES
t o us view to obtain more information about the
l o rez ense
dependencies.

oSQL> c
F col lireferenced_name format a16
d
an SQL> col owner format a16
n
Fer SQL>
SQL>
col name format a28
select owner, name, referenced_name from dba_dependencies
2 where referenced_name in
3 ('UTL_TCP','UTL_SMTP','UTL_MAIL','UTL_HTTP',
4 'UTL_INADDR','DBMS_LDAP')
5 and owner NOT IN ('SYS','PUBLIC','ORDPLUGINS');

OWNER NAME REFERENCED_NAME


---------------- ---------------------------- ----------------
ORACLE_OCM MGMT_DB_LL_METRICS UTL_INADDR
MDSYS SDO_OLS UTL_HTTP
APEX_030200 WWV_FLOW_HELP UTL_HTTP
APEX_030200 WWV_FLOW_MAIL UTL_SMTP
APEX_030200 WWV_FLOW_PRINT_UTIL UTL_HTTP
APEX_030200 WWV_FLOW_LDAP DBMS_LDAP

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

Appendix: Upgrading a Database With Options


Chapter 12 - Page 18
APEX_030200 WWV_FLOW_LDAP DBMS_LDAP
APEX_030200 WWV_FLOW_WEB_SERVICES UTL_HTTP
APEX_030200 UTL_HTTP UTL_HTTP
APEX_030200 UTL_SMTP UTL_SMTP
APEX_030200 WWV_FLOW_CUSTOM_AUTH_LDAP DBMS_LDAP
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

APEX_030200 WWV_FLOW_DISP_PAGE_PLUGS UTL_HTTP

12 rows selected.

SQL> exit
$

ii) Add the new access controls. Replace <your_host_name> by your own host name.
Use any editor to write the following text and save it in /home/oracle/labs as
a ble
fe r
acl.sql.
ans
SQL> DECLARE
n - t r
o
acl_path VARCHAR2(4000);
s an
BEGIN
) ha eฺ
om Guid
SELECT acl INTO acl_path FROM dba_network_acls
ฺ c
oo ent
WHERE host = '<your_host_name>' AND lower_port IS NULL
a h
ud
AND upper_port IS NULL;
@ y t
o2 this S
a d
IF DBMS_NETWORK_ACL_ADMIN.CHECK_PRIVILEGE
(acl_path,
f n ev'APEX_030200','connect')
u se IS NULL
THEN z ( x t o
r e s e
F l i en
loDBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE
c
n d o (acl_path, 'APEX_030200', TRUE, 'connect');
rn a END IF;
Fe IF DBMS_NETWORK_ACL_ADMIN.CHECK_PRIVILEGE
(acl_path, 'ORACLE_OCM','connect') IS NULL
THEN
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE
(acl_path, 'ORACLE_OCM', TRUE, 'connect');
END IF;
IF DBMS_NETWORK_ACL_ADMIN.CHECK_PRIVILEGE
(acl_path, 'MDSYS','connect') IS NULL
THEN
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE
(acl_path, 'MDSYS', TRUE, 'connect');
END IF;

EXCEPTION
WHEN no_data_found THEN
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Appendix: Upgrading a Database With Options


Chapter 12 - Page 19
DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('ACL_12c.xml',
'ACL init after upgrade','APEX_030200',TRUE,'connect');
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE
('ACL_12c.xml', 'ORACLE_OCM', TRUE, 'connect');
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

('ACL_12c.xml', 'MDSYS', TRUE, 'connect');


DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL
('ACL_12c.xml', '<your_host_name>');
END;
/

PL/SQL procedure successfully completed.

a ble
SQL> COMMIT; fe r
ans
n - t r
Commit complete.
a no
h a s
eฺCatalog component
SQL>
d. Perform the fourth recommendation. You are noto m ) the OLAP
using i d
o ฺ G u schema.
c the OLAPSYS
and want to remove OLAP metadata by deleting t
SQL> y aho tuden
o2 @ sS
@/u01/app/oracle/product/11.2.0/dbhome_2/olap/admin/catnoamd.sql
… v a d
e thi
f n e us
x
SQL> @@factvdrp.sql
( t o
l o rez public
SQL> drop
e n se synonym OlapFactView;
d o F lic
nan
Synonym dropped.

Fer SQL> @@dimvwdrp.sql


SQL> drop public synonym OlapDimView;

Synonym dropped.

SQL> @@olapodrp.sql
SQL> drop public synonym DBMS_ODM;

Synonym dropped.

SQL>
SQL> rem
SQL> rem drop olapsys user
SQL> rem
SQL> drop user olapsys cascade
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Appendix: Upgrading a Database With Options


Chapter 12 - Page 20
2 /
SQL>
SQL> rem
SQL> rem drop OLAP_DBA role
SQL> rem
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

SQL> drop role OLAP_DBA


2 /

Role dropped.

SQL>
e. The last recommendation is to gather dictionary statistics for 24 hours prior to
upgrading the database.
a ble
fe r
SQL> exec dbms_stats.gather_dictionary_stats
ans
n - t r
PL/SQL procedure successfully completed.
a no
h a s
SQL> exit
m ) ideฺ
$
o ฺ co t Gu
5. Examine the
y aho tuden
$ORACLE_BASE/cfgtoollogs/dbupgrd/preupgrade/postupgrade_fixups.sql
script created to address issueso 2
that@ S after the database has been upgraded.
can besfixed
d
a se t h i
$ cat
e v
x fn to u
$ORACLE_BASE/cfgtoollogs/dbupgrd/preupgrade/postupgrade_fixups.s
(
rez ense Script Generated on: 2013-02-14 19:13:04
ql
REMlo
d o F lic
Post Upgrade

nan SET ECHO OFF SERVEROUTPUT ON FORMAT WRAPPED TAB OFF LINESIZE
REM Generated by Version: 12.1.0.1 Build: 006

Fer 750;
BEGIN
dbms_output.put_line ('Post Upgrade Fixup Script Generated on
2013-02-14 19:13:04 Version: 12.1.0.1 Build: 006');
dbms_output.put_line ('Beginning Post-Upgrade Fixups...');
END;
/
BEGIN
dbms_preup.clear_run_flag(FALSE);
END;
/
BEGIN
-- ************ Fixup Details ***********************
-- Name: OLD_TIME_ZONES_EXIST
-- Description: Check for use of older timezone data file

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

Appendix: Upgrading a Database With Options


Chapter 12 - Page 21
-- Severity: Informational
-- Action: ^^^ MANUAL ACTION REQUIRED ^^^
-- Fix Summary:
-- Update the timezone using the DBMS_DST package after
upgrade is complete.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

dbms_preup.run_fixup_and_report('OLD_TIME_ZONES_EXIST');
END;
/
BEGIN
dbms_output.put_line ('*******************************');
dbms_output.put_line (' [Post-Upgrade Recommendations]');
dbms_output.put_line ('*******************************');
a ble
dbms_output.put_line ('');
fe r
END; ans
n - t r
/
o
BEGIN
s an
ha eฺ
dbms_output.put_line ('***********************************');
)
ฺ c om Guid
dbms_output.put_line ('**** Fixed Object Statistics ******');

a h oo ent
dbms_output.put_line ('***********************************');
dbms_output.put_line ('');
@ y
S t ud
a d o2 this
dbms_output.put_line ('Please create stats on fixed objects two

ev use
weeks');
f n
dbms_output.put_line ('after the upgrade using the command:');
(x e to
z
lore licens
dbms_output.put_line (' EXECUTE
DBMS_STATS.GATHER_FIXED_OBJECTS_STATS;');
o F
a n d dbms_output.put_line ('');

Fern dbms_output.put_line ('^^^ MANUAL ACTION SUGGESTED ^^^');


dbms_output.put_line ('');
END;
/
BEGIN dbms_preup.fixup_summary(FALSE); END;
/
BEGIN
dbms_output.put_line ('** Post Upgrade Fixup Script Complete
*');
END;
/
REM Post Upgrade Script Closed At: 2013-02-14 19:13:16
$
Recommendations are suggested for after upgrade such as updating the time zone
using the DBMS_DST package.

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

Appendix: Upgrading a Database With Options


Chapter 12 - Page 22
Practice A-3: Completing Prerequisites Steps Before Upgrade
Overview
In this practice, you perform the last actions and verifications before the upgrade.

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

1. The Pre-Upgrade Information Tool creates and populates the registry$sys_inv_objs


and registry$nonsys_inv_objs tables. If you did not execute the Pre-Upgrade
Information Tool script, you can execute the utluiobj.sql script before and after
upgrading. The script execution outputs the difference between the invalid objects that
existed prior to the upgrade and invalid objects that exist after the upgrade. Consider that
you did not execute the Pre-Upgrade Information Tool because you know that DBUA will
automatically execute it. You are still logged in the Unix 11g session.
$ sqlplus / as sysdba
a ble
fe r
SQL> @$ORACLE_HOME/rdbms/admin/utluiobj.sql ans
n - t r
.
o
an
Oracle Database 11.1 Post-Upgrade Invalid Objects Tool 02-14-
s
2013 21:42:13
) ha eฺ
.
ฺ c om Guid
a h oo ent
This tool lists post-upgrade invalid objects that were not

ud
invalid prior to upgrade (it ignores pre-existing pre-upgrade
invalid objects).
@ y t
o2 this S
.
a d
f n
Owner ev useObject Name Object Type
.
z (x e to
F l ore icens
d l
oPL/SQL procedure successfully completed.
a n
Fern SQL> select * from REGISTRY$sys_inv_objs;

no rows selected

SQL> select * from REGISTRY$nonsys_inv_objs;

no rows selected

SQL>
2. Verify that materialized view refreshes have completed. If materialized view refreshes have
not completed, perform the refresh manually using the DBMS_MVIEW package.
SQL> select o.name from sys.obj$ o, sys.user$ u, sys.sum$ s
where o.type# = 42
and bitand(s.mflags, 8) =8;
2 3
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Appendix: Upgrading a Database With Options


Chapter 12 - Page 23
no rows selected

SQL>
3. Ensure that no files need media recovery.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

SQL> select * from v$recover_file;

no rows selected

SQL>
If there are files that need recovery, perform the required recovery using RMAN.
4. Resolve outstanding distributed transactions.
a ble
SQL> select * from dba_2pc_pending;
fe r
ans
no rows selected
n - t r
a no
SQL>
h a s
m
If the query in the previous step returns any rows, then d ฺ statements:
)run theifollowing
e
SELECT local_tran_id FROM dba_2pc_pending; o ฺ co t Gu
y aho tuden
EXECUTE dbms_transaction.purge_lost_db_entry('');
COMMIT;
o2 @ sS
5. Purge the database recycle v a d
bin.
e thi
SQL> purge x f n e us
( o
DBA_RECYCLEBIN;
t
l o r ez nse
oDBAF Recyclebin
l ice purged.
a n d
n
Fer 6. SQL>
If a standby database exists, then you must synchronize it with the primary database.
a. Check if a standby database exists.
SQL> select
SUBSTR(value,INSTR(value,'=',INSTR(UPPER(value),'SERVICE'))+1)
from v$parameter
where name like 'log_archive_dest%'
and UPPER(value) like 'SERVICE%';

no rows selected

SQL>
b. If the query in the previous step returns a row, then synchronize the standby database
with the primary database.
− Make sure all the logs are transported to the standby server after a final log switch
in the primary.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Appendix: Upgrading a Database With Options


Chapter 12 - Page 24
− Start the recovery of the standby database with the NODELAY option.
7. The upgrade process uses a large number of archived redo log files. Increase the
DB_RECOVERY_FILE_DEST_SIZE to 15GB.
SQL> alter system set DB_RECOVERY_FILE_DEST_SIZE=15G scope=BOTH;
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

System altered.

SQL> exit
$

a ble
fe r
ans
n - t r
o
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Appendix: Upgrading a Database With Options


Chapter 12 - Page 25
Practice A-4: Performing a Full Database Backup
Overview
In this practice, you will perform a full database backup of the dbupgrd database before you
start the upgrade.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Tasks
1. Verify that the database is in ARCHIVELOG mode.
a. Stay in the oracle user terminal window. Connect to the database instance as
SYSDBA.
$ sqlplus / as sysdba

SQL> select log_mode from v$database;


a ble
fe r
LOG_MODE
ans
------------ n - t r
o
NOARCHIVELOG
s an
) ha eฺ
SQL>
ฺ c om Guid
b. Set the database instance in ARCHIVELOG
a h oomode.ent
i) Shut down the database instance.y
@ S t ud
a
SQL> shutdown immediate d o2 this
f
Database closed. n ev use
(x e to
Databasez dismounted.
loreinstance
ORACLE
F c e ns shut down.
n d oSQL> li
n a
Fer
ii) Start the database instance in MOUNT mode.
SQL> startup mount
ORACLE instance started.

Total System Global Area 501059584 bytes


Fixed Size 2229744 bytes
Variable Size 171969040 bytes
Database Buffers 318767104 bytes
Redo Buffers 8093696 bytes
Database mounted.
SQL>
iii) Alter the database instance to ARCHIVELOG mode and open the database.
SQL> alter database archivelog;

Database altered.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Appendix: Upgrading a Database With Options


Chapter 12 - Page 26
SQL> alter database open;

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

SQL> exit
$
2. Use RMAN to perform the full database backup.
a. Verify that the configuration includes the automatic control file and SPFILE backup. It
this is not the case, enable the automatic control file and SPFILE backup.
$ rman target /

RMAN> show all;


a ble
fe r
ans
using target database control file instead of recovery catalog
n - t r
o
an
RMAN configuration parameters for database with db_unique_name
DBUPGRD are:
s
ha eฺ
)
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default

ฺ c om Guid
CONFIGURE BACKUP OPTIMIZATION OFF; # default

a h oo ent
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
y t ud
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
@ S

a d o2 this
f n ev use
CONFIGURE SNAPSHOT CONTROLFILE NAME TO

z
# default (x e to
'/u01/app/oracle/product/11.2.0/dbhome_2/dbs/snapcf_dbupgrd.f';

F lore licens
n d oRMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
rn a
Fe new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored

RMAN>
b. Perform the full database backup including all data files, control files, SPFILE and
archive log files.
RMAN> backup database plus archivelog;

Starting backup at 14-FEB-13


current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=147 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Appendix: Upgrading a Database With Options


Chapter 12 - Page 27
input archived log thread=1 sequence=12 RECID=1 STAMP=807374917
channel ORA_DISK_1: starting piece 1 at 14-FEB-13
channel ORA_DISK_1: finished piece 1 at 14-FEB-13
piece
handle=+FRA/dbupgrd/backupset/2013_02_14/annnf0_tag20130214t1448
38_0.261.807374919 tag=TAG20130214T144838 comment=NONE
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03


Finished backup at 14-FEB-13

Starting backup at 14-FEB-13


using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
a ble
input datafile file number=00001
fe r
name=+DATA/dbupgrd/datafile/system.256.807214393
ans
input datafile file number=00002
n - t r
o
an
name=+DATA/dbupgrd/datafile/sysaux.257.807214393
input datafile file number=00005 s
ha eฺ
)
name=+DATA/dbupgrd/datafile/example.265.807214591
input datafile file number=00003
ฺ c om Guid
a h oo ent
name=+DATA/dbupgrd/datafile/undotbs1.258.807214395

@ y
input datafile file number=00004
S t ud
a d o2 this
name=+DATA/dbupgrd/datafile/users.259.807214395

ev use
channel ORA_DISK_1: starting piece 1 at 14-FEB-13
f n
(x e to
channel ORA_DISK_1: finished piece 1 at 14-FEB-13
z
lore licens
piece
handle=+FRA/dbupgrd/backupset/2013_02_14/nnndf0_tag20130214t1448
o F
a n d 41_0.262.807374923 tag=TAG20130214T144841 comment=NONE

Fern channel ORA_DISK_1: backup set complete, elapsed time: 00:01:45


Finished backup at 14-FEB-13

Starting backup at 14-FEB-13


current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=13 RECID=2 STAMP=807375027
channel ORA_DISK_1: starting piece 1 at 14-FEB-13
channel ORA_DISK_1: finished piece 1 at 14-FEB-13
piece
handle=+FRA/dbupgrd/backupset/2013_02_14/annnf0_tag20130214t1450
27_0.264.807375029 tag=TAG20130214T145027 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 14-FEB-13

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

Appendix: Upgrading a Database With Options


Chapter 12 - Page 28
Starting Control File and SPFILE Autobackup at 14-FEB-13
piece
handle=+FRA/dbupgrd/autobackup/2013_02_14/s_807375029.265.807375
031 comment=NONE
Finished Control File and SPFILE Autobackup at 14-FEB-13
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

RMAN> exit
$
At the end of the full database backup, you have:
• Two backup sets of archived logs: one completed BEFORE the data files backup
and one completed AFTER the data files backup because modifications in the data
files may have been applied by applications. The backup sets are stored in
+FRA/dbupgrd/backupset/20yy_mm_dd
a ble
fe r
• One backup set of the five data files stored in
ans
+FRA/dbupgrd/backupset/20yy_mm_dd
n - t r
• One backup set of the control file and SPFILE stored in o
+FRA/dbupgrd/autobackup/20yy_mm_dd
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Appendix: Upgrading a Database With Options


Chapter 12 - Page 29
Practice A-5: Upgrading a Database by Using DBUA
Overview
In this practice, you will now upgrade your 11g dbupgrd database instance to 12c.

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

1. Check that you are logged in as the oracle UNIX user.


$ id
uid=54329(oracle) gid=54330(oinstall)
groups=54330(oinstall),54323(oper),54324(backupdba),54325(dgdba)
,54326(kmdba),54327(asmdba),54331(dba)
context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
$
2. Release resources by shutting down instances other than the ASM instance and the a ble
dbupgrd database instance. fe r
ans
a. Shut down orcl.
n - t r
o
$ . oraenv
s an
ORACLE_SID = [dbupgrd] ? orcl
) ha eฺ
om Guid
The Oracle base remains unchanged with value /u01/app/oracle
ฺ c
a h oo ent
ud
$ sqlplus / as sysdba
@ y t
o2 this S
a
SQL> SHUTDOWN IMMEDIATEd
f
Database closed. n ev use
(x e to
Databasez dismounted.
loreinstance
ORACLE
F li c e ns shut down.
na ndoSQL> exit
Fer
$
b. Shut down cdb1.
$ . oraenv
ORACLE_SID = [orcl] ? cdb1
The Oracle base remains unchanged with value /u01/app/oracle

$ sqlplus / as sysdba

SQL> SHUTDOWN IMMEDIATE


Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
$

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

Appendix: Upgrading a Database With Options


Chapter 12 - Page 30
3. Launch DBUA from the Oracle home where the new database software has been installed.
$ echo $ORACLE_HOME
/u01/app/oracle/product/12.1.0/dbhome_1
$ dbua
a. In the Select Operation page, keep the preselected value Upgrade Oracle Database
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

and click Next.

a ble
fe r
ans
n - t r
a no
h a s
m ) ideฺ
o ฺ co t Gu
y aho tuden
o2 @ sS
v a d
e thi
x fne tpage,
b. In the Select(Database o usverify that the Target Oracle Home is
o rez ense
/u01/app/oracle/product/12.1.0/dbhome_1
l for the new Oracle Database 12c.
o F
From li c
the Source Oracle Home drop-down list, choose the

a n d /u01/app/oracle/product/11.2.0/dbhome_2 for the old Oracle Database 11g.


n
Fer
The dbupgrd entry appears. Click Next.

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

Appendix: Upgrading a Database With Options


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

a ble
fe r
ans
n - t r
a no
h a s
m ) startsd e ฺ
c. In the Prerequisite Checks page, the automatic validation
ฺ c o Click u i and shows
o o nt
progressively the validation result of each prerequisite. G each of the Validation
entries to get a more detailed list. h
ya tude
o 2 @ s S
d
a se t h i
e v
( x fn to u
l o rez ense
d o F lic
na n
Fer

− One check results in a warning and can be fixed. Examine in detail the
DBMS_LDAP dependencies that exist. Select the “DBMS_LDAP dependencies
exist” entry. Click more details.

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

Appendix: Upgrading a Database With Options


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

In the previous practice, you did not add this object in the ACL privileged list. Click
Close.
a ble
− Click Apply Action to fix the issue.
fe r
ans
n - t r
o
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

− In Action, choose Revalidate. Click Apply Action.

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

Appendix: Upgrading a Database With Options


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

a ble
fe r
ans
n - t r
a no
h a s
m ) ideฺ
− The issue persists but does not prevent ฺthe
o coupgrade
t G ufrom progressing. You can
fix this issue after the upgrade. Inh
a o choose
Action,
e n Ignore. Click Next.
y
d. In the Upgrade Options, by default, the Upgrade d
tu4. You
Parallelism is set to the number of
CPUs or 2 if the number of CPUs 2 @ is s
less S
selecting a new valuevfrom a o Degree
dthe t h i of Parallelism can
than adjust this default value by
drop-down list. DBUA will
recompile all invalid f n se after the upgrade is complete.
ePL/SQLumodules
Select Upgrade z (x Timezone
e to Data. This is an operation recommended to be executed
after o
l thereupgradee ninsthe Pre-Upgrade Information Tool output log file. You can choose
F
otostatistics
update the c
li Time zone data file version during the upgrade. You already gathered the
n d before the upgrade. Click Next.
na
Fer

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

Appendix: Upgrading a Database With Options


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

a ble
fe r
ans
n - t r
o
s an
) ha eฺ
e. In the Management Options page, click Next. om
ฺ c u id
oo ent G
a h
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
na
Fer

f. In the Move Database Files page, click Next because you do not want to move the
database files to another type of storage such as a file system or other disk groups.
You do not want to set the FRA location to another type of storage such as a file

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

Appendix: Upgrading a Database With Options


Chapter 12 - Page 35
system or other disk groups. These operations can be performed after the upgrade.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

a ble
fe r
ans
n - t r
a no
h a s
m )the LISTENER
d e ฺ with port 1521.
g. In the Network Configuration page, select the entry

of
co t Gu i
Click Next. o
aho tRMAN
h. In the Recovery Options, select Use Existing
y u d e nBackup. You already backed up
@
the database in the previous practice.
2 S
Click
s Next.

v a do thi
f n e u se
z (x e to
F lore licens
na ndo
Fer

Read carefully the message in the box at the bottom of Recovery Options page. If it
says: “You do not have enough disk space for the archive logs and flashback logs
generated during upgrade.” you would click more details. The Validation Details
page would explicitly provide the disk space required for the archive logs and
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Appendix: Upgrading a Database With Options


Chapter 12 - Page 36
flashback logs generated during upgrade. In another oracle user UNIX session,
connected to the dbupgrd instance, you would increase the
DB_RECOVERY_FILE_DEST_SIZE to the required size, and click Close. Click Next.
i. In the Summary page, you can view the source and target Database Releases, Oracle
Homes, the warnings ignored, the status of the components that will be upgraded, and
the version of the time zone data.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

a ble
fe r
ans
n - t r
o
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
e
lortypes ns
F
Other
li c e
of information are displayed.
n d o
rn a
Fe

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

Appendix: Upgrading a Database With Options


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

a ble
fe r
ans
n - t r
a no
h a s
m )phase,idDBUA
e ฺ
ฺ c o Gu
Click Finish. It can take 2 hours. During the upgrade runs catctl.pl,
which runs the upgrade processes in parallel
h o instead
odown n tof serially, optimally taking
advantage of CPU capacity to decrease
y a u d e
time as much as possible.
j. @
The error message “OLAPSYS2does not exist” t
S appears. In the previous, you dropped
the OLAP metadata by a d o OLAPSYS
deleting h i s
t schema because you were not using the
e v e
OLAP Catalog component.
(xfnwhen t o us
Click Ignore.
k. Review thezresults the Upgrade Progress is 100% complete. Click Upgrade
Results.
l o re ense
d oF lic
a n
Fern

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

Appendix: Upgrading a Database With Options


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

a ble
fe r
ans
n - t r
a no
h a s
l. m
In the Results page, the first message is: “The database) is readyd e ฺ
to use.” The
ฺ co12.1.0.1.0.
u i
dbupgrd database is now running under versiono
o the t G
nwarning related to schemas with
The Upgrade Results mentions that youhignored e
objects dependent on DBMS_LDAP y a
package.tThe
d
u operations required to fix this issue
require some knowledge about 2 @
o thi s
and
Sare beyond the scope of this course.
a d LDAP

f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

All the upgrade steps completed successfully.

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

Appendix: Upgrading a Database With Options


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

a ble
fe r
ans
n - t r
a no
The time zone version and TIMESTAMP WITH TIME) h as dataฺ has been
m uide
ZONE
successfully upgraded to version 18.
ฺ c o G
The SGA_TARGET has been increased and
h o oEnterprise
n t Manager Database Express is
configured. y a ud e
@ S t
a d o2 this
f n ev use
z (x e to
F lore licens
n do
e r na
F

Click Close.

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

Appendix: Upgrading a Database With Options


Chapter 12 - Page 40
m. The upgrade process successfully completed. The log files are located in the
/u01/app/oracle/cfgtoollogs/dbua/dbupgrd/upgrade1 directory.
$ dbua
Database upgrade has been completed successfully, and the
database is ready to use.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

a ble
fe r
ans
n - t r
o
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Appendix: Upgrading a Database With Options


Chapter 12 - Page 41
Practice A-6: Performing Post-Upgrade Operations
Overview
In this practice, you will:
• Verify that the /etc/oratab file sets the value of ORACLE_HOME to point to the new
Oracle home that is created for the new Oracle Database 12c release.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

• Show the current state of the Oracle data dictionary


• Check that there are no invalid objects
• Check that the password file exists
• Verify that the SPFILE is created and create the PFILE
• View the content of the alert.log file
• Launch Enterprise Manager Database Express
• Unlock the application users if any are locked a ble
fe r
• Upgrade optimizer statistics
ans
• Enable the new extended data type capability
n - t r
• Enable Database Vault
a no
• Perform a FULL database backup
h a s
Tasks m ) ideฺ
o ฺ co t Gu
1. Switch to the oracle user Unix session. View the /etc/oratab file.
$ cat /etc/oratab|grep dbupgrd y aho tuden
o 2 @ sS
line added by Agent d
a se t h i
dbupgrd:/u01/app/oracle/product/12.1.0/dbhome_1:N: #

e v
$
( x fn to u
VALID. lo
rez state
2. Show the current
e n sethe Oracle data dictionary. The status of all components must be
of

d o F lic
nan
$ . oraenv

Fer
ORACLE_SID = [cdb1] ? dbupgrd
The Oracle base remains unchanged with value /u01/app/oracle

$ sqlplus / as sysdba

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

SQL> set lines 80 pages 100


SQL> col comp_id format A12
SQL> col comp_name format A30
SQL> col version format A10
SQL> col status format A6
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Appendix: Upgrading a Database With Options


Chapter 12 - Page 42
SQL> select substr(comp_id,1,15) comp_id, substr(comp_name,1,30)
comp_name, substr(version,1,10) version, status
from dba_registry order by modified;

COMP_ID COMP_NAME VERSION STATUS


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

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


CATALOG Oracle Database Catalog Views 12.1.0.1.0 VALID
CATPROC Oracle Database Packages and T 12.1.0.1.0 VALID
OWM Oracle Workspace Manager 12.1.0.1.0 VALID
JAVAVM JServer JAVA Virtual Machine 12.1.0.1.0 VALID
XML Oracle XDK 12.1.0.1.0 VALID
CATJAVA Oracle Database Java Packages 12.1.0.1.0 VALID
CONTEXT Oracle Text 12.1.0.1.0 VALID
a ble
XDB Oracle XML Database 12.1.0.1.0 VALID fe r
ans
ORDIM Oracle Multimedia 12.1.0.1.0 VALID
n - t r
XOQ Oracle OLAP API 12.1.0.1.0 VALID o
APS OLAP Analytic Workspace
s an
12.1.0.1.0 VALID
SDO Spatial
) ha eฺ
12.1.0.1.0 VALID
APEX
c
Oracle Application Express
ฺ om Guid
4.2.0.00.2 VALID
OWB OWB
a h oo ent 11.2.0.3.0 VALID

@ y
S t ud
14 rows selected.
a d o2 this
n e v s e
SQL> f
(x e to u
z
e are no
3. Check that
F l orthere c e nsinvalid objects
d li
oSQL> @$ORACLE_HOME/rdbms/admin/utluiobj.sql
n
na .
Fer Oracle Database 12.1 Post-Upgrade Invalid Objects Tool 02-17-
2013 20:44:52
.
This tool lists post-upgrade invalid objects that were not
invalid
prior to upgrade (it ignores pre-existing pre-upgrade invalid
objects).
.
Owner Object Name Object Type
.

PL/SQL procedure successfully completed.

SQL> select * from REGISTRY$sys_inv_objs;

no rows selected
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Appendix: Upgrading a Database With Options


Chapter 12 - Page 43
SQL> select * from REGISTRY$nonsys_inv_objs;

no rows selected
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

SQL>
4. Check that the password file exists.
a. Check the existence of a traditional password file in the $ORACLE_HOME/dbs
directory.
SQL> !ls $ORACLE_HOME/dbs/orapwdbupgrd
/u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwdbupgrd

SQL>
a ble
fe r
b. Check that the password file is used during an authentication.
ans
SQL> connect sys/oracle_4U@localhost:1521/dbupgrd as sysdba
n - t r
Connected.
a no
SQL> connect sys/oracle@localhost:1521/dbupgrd as sysdba
h a s
ERROR:
m ) ideฺ
o ฺ co t Gu
ORA-01017: invalid username/password; logon denied

y aho tuden
o 2 @ sS
Warning: You are nodlongerth
a i
connected to ORACLE.
e v e
SQL>
( x fn to us
c. Check thatzafter you eremove the password file, the only possible authentication is the
r e
lo ice
OS authentication.n s
n d o− FRemovelthe file system password file.
rn a SQL> !rm $ORACLE_HOME/dbs/orapwdbupgrd
Fe
SQL> !ls $ORACLE_HOME/dbs/orapwdbupgrd
ls: cannot access
/u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwdbupgrd: No
such file or directory

SQL>
− Even if you use the password used in task b., the authentication can no longer be
performed.
SQL> connect sys/oracle_4U@localhost:1521/dbupgrd as sysdba
ERROR:
ORA-01017: invalid username/password; logon denied

SQL> connect / as sysdba


Connected.
SQL>
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Appendix: Upgrading a Database With Options


Chapter 12 - Page 44
d. If your storage solution is ASM, you can create the password file in the DATA disk
group. It is possible because you advanced the COMPATIBLE.ASM disk group attribute
to 12.1. Be aware that this is not mandatory. Any file stored in a file system can be
easily deleted with proper access permissions. Enter oracle_4U when prompted for
the password.
SQL> select DB_UNIQUE_NAME from v$database;
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

DB_UNIQUE_NAME
------------------------------
dbupgrd

SQL> !orapwd file='+data/DBUPGRD/orapwdb' dbuniquename='dbupgrd'

a ble
Enter password for SYS:
fe r
a n s
SQL> connect sys/oracle_4U@localhost:1521/dbupgrd as sysdba
n -t r
o
Connected.
s aasnsysdba
SQL> connect sys/oracle@localhost:1521/dbupgrd
) ha eฺ
ERROR:
ฺ c omlogon u id
ORA-01017: invalid username/password;
oo ent G denied
a h
@ y
S t ud
Warning: You are no a d o2 thconnected
longer is to ORACLE.
e v e
SQL> exit (x
fn to us
$
l o rez ense
F licpassword file is created in the DATA disk group. Switch to the grid user
e.doVerify that the
nan terminal window.
Fer $ id
uid=54322(grid) gid=54330(oinstall)
groups=54330(oinstall),54327(asmdba),54329(asmadmin),54331(dba)
context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
$ . oraenv
ORACLE_SID = [grid] ? +ASM
The Oracle base has been changed from /u01/app/oracle to
/u01/app/grid
$ asmcmd
ASMCMD> ls +DATA/DBUPGRD/PASSWORD
pwddbupgrd.267.807938175
ASMCMD>
5. Verify that the SPFILE is created.
ASMCMD> ls +DATA/DBUPGRD/spfile*
spfiledbupgrd.ora

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

Appendix: Upgrading a Database With Options


Chapter 12 - Page 45
spfiledbupgrd.ora_1361440808370
ASMCMD>
ASMCMD> ls -l +DATA/DBUPGRD/spfile*
Type Redund Striped Time Sys
NamePARAMETERFILE UNPROT COARSE FEB 25 20:00:00 N
spfiledbupgrd.ora =>
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

+DATA/DBUPGRD/PARAMETERFILE/spfile.260.808327751
PARAMETERFILE UNPROT COARSE FEB 25 22:00:00 N
spfiledbupgrd.ora_1361440808370 =>
+DATA/DBUPGRD/PARAMETERFILE/spfile.267.808348937
ASMCMD> exit
$
6. Create the PFILE if it does not exist. Return to the oracle user Unix session.
a ble
$ ls $ORACLE_HOME/dbs/initdbupgrd.ora
fe r
/u01/app/oracle/product/12.1.0/dbhome_1/dbs/initdbupgrd.ora
ans
$
n - t r
the SPFILE stored in the DATA disk group. a no
It already exists. The most current of the parameter file and server parameter file is

h a s
7. View the contents of the alert log file
m ) ideฺ
ฺ co t Gu
$ cd $ORACLE_BASE/diag/rdbms/dbupgrd/dbupgrd/trace
o
$ ls -l a*
y a ho den
-rw-rw----. 1 oracle asmadmin
2 @ S tu Feb 17 18:01
31009984
alert_dbupgrd.log
do thi s
e v
$ vi alert_dbupgrd.log a se
… f n
(x e to u
z
re ens
l o
d
F lic expanded from 594 to 614 blocks for upgrade.
oControl file
a n Successful mount of redo thread 1, with mount id 2071604359
Fern Database mounted in Exclusive Mode
Lost write protection disabled
Ping without log force is disabled.
Completed: ALTER DATABASE MOUNT
Fri Feb 15 00:55:36 2013
ALTER DATABASE OPEN MIGRATE

Completed: ALTER DATABASE OPEN MIGRATE

$
8. Launch Enterprise Manager Database Express.
a. Retrieve the port number.
$ sqlplus / as sysdba

SQL> select DBMS_XDB_CONFIG.getHTTPPort from dual;


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

Appendix: Upgrading a Database With Options


Chapter 12 - Page 46
GETHTTPPORT
-----------
0
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

SQL> select DBMS_XDB_CONFIG.getHTTPsPort from dual;

GETHTTPSPORT
------------
5500

SQL>
− The port number was already used by the ORCL database plugged in CDB1 as
a ble
PDB_ORCL. Verify. Open another terminal logged in as the oracle UNIX user. fe r
ans
$ . oraenv
n - t r
ORACLE_SID = [oracle] ? cdb1
a no
h a s
The Oracle base remains unchanged with value /u01/app/oracle
$
m ) ideฺ
o ฺ co t Gu
− Connect to the pdb_orcl PDB to retrieve the port number used.

y aho tuden
$ sqlplus sys/oracle_4U@localhost:1521/pdb_orcl as sysdba

SQL> show con_name do2


@ sS
v a e thi
f n e us
CON_NAME ( x t o
l o rez ense
------------------------------

d
F
oPDB_ORCL lic
a n
Fern SQL> select DBMS_XDB_CONFIG.getHTTPPort from dual;

GETHTTPPORT
-----------
0

SQL> select DBMS_XDB_CONFIG.getHTTPsPort from dual;

GETHTTPSPORT
------------
5500

SQL> exit
$
b. Configure the port 5502 for EM Database Express.

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

Appendix: Upgrading a Database With Options


Chapter 12 - Page 47
− Check the value of DISPATCHERS parameter in the dbupgrd instance. There must
be at least one dispatcher configured for the XMLDB service with the TCP protocol.
SQL> show parameter dispatchers

NAME TYPE VALUE


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

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


-
dispatchers string
max_dispatchers integer
SQL>
− Set the DISPATCHERS parameter.
SQL> alter system set
dispatchers='(protocol=tcp)(service=dbupgrdXDB)' scope=both;
a ble
fe r
System altered.
ans
n - t r
SQL> a no
− Set the port to 5502 for EM Database Express.
h a s
m ) ideฺ
o ฺ co t Gu
SQL> exec DBMS_XDB_CONFIG.setHTTPsPort(5502)
o en
ahcompleted.
ud
PL/SQL procedure successfully
@ y t
o2 this S
a d
SQL> select DBMS_XDB_CONFIG.getHTTPsPort
v from dual;
e
n o us e
( x f t
r e z
GETHTTPSPORT
s e
lo licen
------------
F
n d o 5502
rn a
Fe SQL>
− Restart the instance to register the XMLDB service.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 663908352 bytes


Fixed Size 2291280 bytes
Variable Size 285215152 bytes
Database Buffers 369098752 bytes
Redo Buffers 7303168 bytes
Database mounted.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Appendix: Upgrading a Database With Options


Chapter 12 - Page 48
Database opened.
SQL> exit
$
c. Check with the listener if the service is registered.
$ lsnrctl services
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ


Service "dbupgrd" has 1 instance(s).
Instance "dbupgrd", status READY, has 1 handler(s) for this
service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
LOCAL SERVER

a ble
fe r
Service "dbupgrdXDB" has 1 instance(s).
ans
Instance "dbupgrd", status READY, has 1 handler(s) for this
n - t r
no
service...
Handler(s):
s a
h a
) ideฺ
"D000" established:0 refused:0 current:0 max:1022
state:ready m
co t Gu
o ฺ
aho tuden
DISPATCHER <machine: <your_hostname>, pid: 7436>
(ADDRESS=(PROTOCOL=tcp)(HOST=<your_hostname>)(PORT=59529))
y
@ sS
2
The command completed successfully
o
$
v a d
e thi
n e on theutops panel (toolbar region) above the desktop to open a
d. Click the Firefoxficon
x to Manager Database Express console.
( Enterprise
browser tozaccess e
reURL efornEnterprise
s
e. Enter
F lothe l i c Manager Database Express:

n d ohttps://<hostname>:5502/em. In the current setup, use https://localhost:5502/em.


na − Most likely, you receive a Secure Connection Failed message and you need to add
Fer a security exception. Click Or you can add an exception.
− At the end of the alert box, click I Understand the Risks.
− At the bottom of the page, click Add Exception.
− In the Add Security Exception pop-up window, click Get Certificate.
− Confirm that “Permanently store this exception” is selected in your training
environment and click Confirm Security Exception.
f. Enter sys in the User Name field and oracle_4U in the Password field. Select “as
SYSDBA.” Then click Login.

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

Appendix: Upgrading a Database With Options


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

a ble
fe r
ans
n - t r
a no
h a s
m ) ideฺ
o ฺ co t Gu
9. aho tuden
Unlock the application users if any are locked.
y
o 2 @ sS
thi
SQL> set pages 100
v a d
SQL> col username
n e
SQL> selectxfusername
format
ea30
u, saccount_status from dba_users
( t o order by 1;

l o rez ense
d o F lic
na n USERNAME ACCOUNT_STATUS

Fer
------------------------------- --------------------------------
ANONYMOUS EXPIRED & LOCKED
APEX_030200 EXPIRED & LOCKED
APEX_040200 EXPIRED & LOCKED
APEX_PUBLIC_USER EXPIRED & LOCKED
APPQOSSYS EXPIRED & LOCKED
AUDSYS EXPIRED & LOCKED
BI OPEN
CTXSYS EXPIRED & LOCKED
DBSNMP EXPIRED & LOCKED
DIP EXPIRED & LOCKED
FLOWS_FILES EXPIRED & LOCKED
GSMADMIN_INTERNAL EXPIRED & LOCKED
GSMCATUSER EXPIRED & LOCKED
GSMUSER EXPIRED & LOCKED
HR OPEN
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Appendix: Upgrading a Database With Options


Chapter 12 - Page 50
IX OPEN
MDDATA EXPIRED & LOCKED
MDSYS EXPIRED & LOCKED
OE OPEN
OJVMSYS EXPIRED & LOCKED
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

ORACLE_OCM EXPIRED & LOCKED


ORDDATA EXPIRED & LOCKED
ORDPLUGINS EXPIRED & LOCKED
ORDSYS EXPIRED & LOCKED
OUTLN EXPIRED & LOCKED
OWBSYS EXPIRED & LOCKED
OWBSYS_AUDIT EXPIRED & LOCKED
PM OPEN
a ble
SCOTT EXPIRED & LOCKED fe r
ans
SH OPEN
n - t r
SI_INFORMTN_SCHEMA OPEN o
SPATIAL_CSW_ADMIN_USR
s an EXPIRED & LOCKED
SPATIAL_WFS_ADMIN_USR
) ha eฺ EXPIRED & LOCKED
SYS
ฺ c om Guid OPEN
SYSBACKUP
a h oo ent& LOCKED EXPIRED
SYSDG
@ y
S t ud & LOCKED EXPIRED
SYSKM
a d o2 this & LOCKED EXPIRED
SYSTEM
f n ev use OPEN
WMSYS
z (x e to & LOCKED EXPIRED

lore licens
XDB & LOCKED EXPIRED

o F
XS$NULL & LOCKED EXPIRED
a n d
Fern 41 rows selected.

SQL>
10. Upgrade optimizer statistics. When you examined the
/u01/app/oracle/cfgtoollogs/dbupgrd/preupgrade/preupgrade.log, the last
suggestion was to create statistics on fixed objects two weeks after the upgrade. You can
do it now or leave it until the end of the course. You will repeat the procedure regularly as
well as the gather_dictionary_stats procedure to update statistics on data dictionary
objects. This procedure takes some time.
SQL> exec dbms_stats.gather_fixed_objects_stats

PL/SQL procedure successfully completed.

SQL>

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

Appendix: Upgrading a Database With Options


Chapter 12 - Page 51
11. Enable the new extended data type capability. Control the maximum size of VARCHAR2,
NVARCHAR2, and RAW data types in SQL. Setting MAX_STRING_SIZE = EXTENDED
enables the 32767 byte limit introduced in Oracle Database 12c.
SQL> show parameter max_string_size
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

NAME TYPE VALUE


------------------------------------ ----------- ---------------
max_string_size string STANDARD
SQL>
a. Attempt to create a table named LONG_VARCHAR with a column defined as
VARCHAR2(32767).
SQL> CREATE TABLE long_varchar(id NUMBER,vc VARCHAR2(32767));
CREATE TABLE long_varchar(id NUMBER,vc VARCHAR2(32767))
a ble
* fe r
ans
ERROR at line 1:
n - t r
no
ORA-00910: specified length too long for its datatype
a
h a s
SQL>
m ) ideฺ
o ฺ co t Gu
b. Set the MAX_STRING_SIZE parameter to EXTENDED.

a ho den
SQL> alter system set MAX_STRING_SIZE
y
=EXTENDED;
@
alter system set MAX_STRING_SIZE
S u
t=EXTENDED
*
2
do thi s
e v a se
ERROR at line 1:
ORA-02097:(x
f n u
z parameter
e to cannot be modified because specified value
o re ens
is invalid
l
d o F
ORA-14694: lic database must in UPGRADE mode to begin
nan
MAX_STRING_SIZE migration

Fer SQL>
c. Enabling this new capability requires setting the COMPATIBLE instance parameter to
12.0.0.0.0. Even if the database instance was upgraded, it was not required to set the
COMPATIBLE instance parameter to 12.0.0.0.0. This allows us to downgrade the
database instance if it had been necessary. When the COMPATIBLE instance
parameter is set to 12.0.0.0.0, it will become impossible to downgrade the database
instance.
SQL> alter system set COMPATIBLE=12.0.0.0.0 scope=both;

System altered.

SQL>
d. Restart the database instance in UPGRADE mode.
SQL> shutdown immediate
Database closed.
Database dismounted.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Appendix: Upgrading a Database With Options


Chapter 12 - Page 52
ORACLE instance shut down.
SQL>
.
SQL> startup upgrade
ORACLE instance started.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Total System Global Area 622149632 bytes


Fixed Size 2290800 bytes
Variable Size 276827024 bytes
Database Buffers 335544320 bytes
Redo Buffers 7487488 bytes
Database mounted.
Database opened.
a ble
SQL> fe r
ans
e. Set the MAX_STRING_SIZE parameter to EXTENDED.
n - t r
SQL> ALTER SYSTEM SET MAX_STRING_SIZE = EXTENDED;
a no
h a s
System altered.
m ) ideฺ
o ฺ co t Gu
SQL>
y aho tuden
f.
o @ sS
Execute the $ORACLE_HOME/rdbms/admin/utl32k.sql
2around script as SYSDBA. Be
aware that the script may d
a take t h i
one hour to execute. Although, at the very last
step when the function
n v
e is being e
sdropped and the script seems stuck, you can start
another session x f
as o uand
(a VARCHAR2(32767)
t
SYSDBA perform task 5 to check if the creation of the table is
possible z
re ens
with e data type column.
l o
d oSQL> lic
F @$ORACLE_HOME/rdbms/admin/utl32k.sql
a n
Fern Session altered.

DOC>############################################################
DOC> The following statement will cause an "ORA-01722: invalid
number" error if the database has not been opened for UPGRADE.
DOC> Perform a "SHUTDOWN ABORT" and restart using UPGRADE.
DOC>############################################################
#

TIMESTAMP
----------------------------------------------------------------
COMP_TIMESTAMP UTLRP_BGN 2013-02-17 22:30:04


ERRORS DURING RECOMPILATION
---------------------------
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Appendix: Upgrading a Database With Options


Chapter 12 - Page 53
3

SQL>
g. Find the invalid objects.
SQL> @$ORACLE_HOME/rdbms/admin/utluiobj.sql
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

.
Oracle Database 12.1 Post-Upgrade Invalid Objects Tool 02-17-
2013 22:43:48
.
This tool lists post-upgrade invalid objects that were not
invalid
prior to upgrade (it ignores pre-existing pre-upgrade invalid
objects).
a ble
.
fe r
Owner Object Name Object Type
ans
. n - t r
o
SYS DBMS_INTERNAL_LOGSTDBY
s an PACKAGE
BODY
) ha eฺ
om Guid
SYS DBMS_SQLTUNE_INTERNAL PACKAGE BODY
ฺ c
oo ent
SYS PRVT_ADVISOR PACKAGE BODY
a h
@ S t ud
y completed.
o2 this
PL/SQL procedure successfully
a d
SQL>
f n ev use
(x e tbodies
h. Recompilezthe package
o and the view.
re epackage
loalter ns DBMS_INTERNAL_LOGSTDBY compile;
F
SQL>
li c
na ndo
Fer
Package altered.

SQL> alter package DBMS_SQLTUNE_INTERNAL compile;

Package altered.

SQL> alter package PRVT_ADVISOR compile;

Package altered.

SQL>
i. Restart the database in normal mode.
SQL> shutdown immediate
Database closed.
Database dismounted.

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

Appendix: Upgrading a Database With Options


Chapter 12 - Page 54
ORACLE instance shut down.

SQL> startup
ORACLE instance started.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

Total System Global Area 622149632 bytes


Fixed Size 2290800 bytes
Variable Size 360713104 bytes
Database Buffers 251658240 bytes
Redo Buffers 7487488 bytes
Database mounted.
Database opened.
SQL>
a ble
j. Verify that MAX_STRING_SIZE is set to EXTENDED. fe r
ans
SQL> show parameter MAX_STRING_SIZE
n - t r
a no
NAME TYPE
h a s VALUE
------------------------------------ -----------
m ) ideฺ--------------
max_string_size
o ฺ costring
t G u EXTENDED
SQL>
y aho tuden
k. Create a table with an extended@
data typeScolumn of 32767 bytes.
d o 2 i s
v e th
SQL> CREATE TABLE along_varchar(id NUMBER,vc VARCHAR2(32767));
e
fn to us
( x
l o rez ense
Table created.
F DESClic long_varchar
oSQL>
a n d
Fern Name Null? Type
------------------------------- -------- --------------------
ID NUMBER
VC VARCHAR2(32767)

SQL> DROP TABLE long_varchar PURGE;

Table dropped.

SQL> exit
$
12. How would you reenable Oracle Database Vault if you were using Oracle Database Vault?
You would have been instructed to disable it before upgrading your database. You would
have to reenable Database Vault using the DVSYS.DBMS_MACADM.ENABLE_DV procedure.
a. Log in as the Oracle Database Owner (DV_OWNER) account.
sqlplus dvo/password
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Appendix: Upgrading a Database With Options


Chapter 12 - Page 55
b. Execute the following procedure:
exec DVSYS.DBMS_MACADM.ENABLE_DV
c. Check if Oracle Label Security is enabled.
SELECT VALUE FROM V$OPTION WHERE PARAMETER = 'Oracle Label
Security';
d. Oracle Label security must be enabled before you can use Database Vault. If it is not
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

enabled, then this query returns FALSE. Then enable it.


CONNECT / AS SYSDBA
exec LBACSYS.CONFIGURE_OLS
exec LBACSYS.OLS_ENFORCEMENT.ENABLE_OLS
e. Restart the instance.
connect / as sysdba
shutdown immediate
a ble
startup
fe r
13. Perform a FULL database backup using RMAN.
ans
$ rman target / n - t r
a no
RMAN> show all; h a s
m ) ideฺ
ฺ o Gof
cinstead u recovery catalog
using target database control file o
o database t
n with db_unique_name
RMAN configuration parameters y ahfortu d e
DBUPGRD are:
2 @ s S
o thTOi REDUNDANCY 1; # default
CONFIGURE RETENTION
v a dPOLICY
CONFIGURE BACKUPf n u se
e OPTIMIZATION OFF; # default
( x
z DEFAULT t o
CONFIGURE
r e n s e DEVICE TYPE TO DISK; # default
lo licCONTROLFILE
e
o… F
CONFIGURE AUTOBACKUP ON;

a n d
Fern
RMAN> backup database plus archivelog delete all input;

Starting backup at 18-FEB-13


current log archived
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=267 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=13 RECID=2 STAMP=807375027

Finished backup at 18-FEB-13

Starting Control File and SPFILE Autobackup at 18-FEB-13

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

Appendix: Upgrading a Database With Options


Chapter 12 - Page 56
piece
handle=+FRA/DBUPGRD/AUTOBACKUP/2013_02_18/s_807675362.412.807675
365 comment=NONE
Finished Control File and SPFILE Autobackup at 18-FEB-13

RMAN> exit
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2019, Oracle and/or its affiliatesฺ

a ble
fe r
ans
n - t r
o
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Appendix: Upgrading a Database With Options


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

a ble
fe r
ans
n - t r
o
s an
) ha eฺ
ฺ c om Guid
a h oo ent
@ y
S t ud
a d o2 this
f n ev use
z (x e to
F lore licens
n d o
rn a
Fe

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

Appendix: Upgrading a Database With Options


Chapter 12 - Page 58

Das könnte Ihnen auch gefallen