Anda di halaman 1dari 409

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

s a
) h a
ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sOracle
f er Database 12c R2:
a
S -tra n
non Administration Workshop

Student Guide – Volume I


D78846GC30
Edition 3.0 | March 2017 | D99461

Learn more from Oracle University at education.oracle.com


Copyright © 2017, 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. The information contained in
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

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.

Trademark Notice
s a
) h a
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

Authors
ฺ c o m
i d eฺ
i n fo t Gu
c a na den
Jody Glover, Jeff Ferreira, Dominique Jeunot, Donna K. Keesling, Mark Fuller

Technical Contributors and Reviewers


@ ar s Stu
h aq e thi
James L. Spiller, Jean-Francois Verrier, Hans Forbrich, Jim Spiller, Randy Urbano, Bert Rich, Sarika Surampudi, Kathy Rich, Mike Fitch
l
Editors
a dฺu to us
Raj Kumar, Smita Kommini
( s am nse
H aq e lice
Graphic Designers
U l abl
ad sfer
Maheshwari Krishnamurthy, Seema Bopaiah
m
Sa -tran
Publishers

non
Jobi Varghese, Sumesh Koshy
Table of Contents
1. Lesson 0 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.1 Course Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.2 Course Agenda - Day 1 and 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.3 Course Agenda - Day 3 and 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.4 Course Agenda - Day 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.5 Lab Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2. Lesson 1 Exploring Oracle Database Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

2.1 Objectives for Lesson 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15


2.2 Introducing Oracle Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.2.1 Oracle Database 12c Editions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.2.2 Oracle Database Standard Edition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.3 Relational Database Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.4 Oracle SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
2.5 Oracle Database Server Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
2.5.1 Database Instance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.5.2 Multitenant Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
2.5.3 Logical Storage Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
2.5.4 Database Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
2.5.5 Example - User Issuing a SQL Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
2.6 Connecting to Oracle Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
2.7 Oracle Database Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

s a
2.7.1 SQLPlus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

) h a
2.7.2 SQLcl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.7.3 Oracle SQL Developer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
42
43
m eฺ
2.7.4 Database Configuration Assistant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

ฺ c o i d
2.7.5 Oracle Enterprise Manager Database Express . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

i n fo t Gu
2.7.6 Oracle Enterprise Manager Cloud Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

na den
2.8 Oracle-Supplied User Accounts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

c a
2.9 Querying the Oracle Data Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

ar s Stu
2.10 Summary for Lesson 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
2.11 Practice 1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
@
aq e thi
2.11.1 Practice 1-1 Exploring a CDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

l h
2.11.2 Practice 1-2 Exploring a PDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

a dฺu to us
2.11.3 Practice 1-3 Exploring a CDB and PDB with EM Express . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.11.4 Practice 1-4 Getting Started with SQLcl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
71
77

( s am nse
3. Lesson 2 Managing Database Instances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.1 Objectives for Lesson 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
82
83

H aq e lice
3.2 Working with Initialization Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.2.1 Initialization Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
84
86
U l abl
3.2.2 Modifying Initialization Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88

m ad sfer
3.2.3 Viewing Initialization Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.3 Starting Up Oracle Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
91
93

Sa -tran
3.4 Shutting Down Oracle Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94

non
3.5 Opening and Closing PDBs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
3.6 Working with the Automatic Diagnostic Repository . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
3.6.1 Viewing the Alert Log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
3.6.2 Using Trace Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
3.6.3 Administering the DDL Log File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
3.7 Querying Dynamic Performance Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
3.7.1 Considerations for Dynamic Performance Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
3.8 Summary for Lesson 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
3.9 Practice 2 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
3.9.1 Practice 2-1 Creating a PFILE from an SPFILE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
3.9.2 Practice 2-2 Viewing Initialization Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
3.9.3 Practice 2-3 Modifying Initialization Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
3.9.4 Practice 2-4 Modifying an Initialization Parameter with EM Express . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
3.9.5 Practice 2-5 Shutting Down and Starting Up the Oracle Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
3.9.6 Practice 2-6 Viewing Diagnostic Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
4. Lesson 3 Creating PDBs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
4.1 Objectives for Lesson 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
4.2 Methods and Tools to Create PDBs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
4.3 Creating PDBs from Seed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
4.4 Cloning PDBs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
4.5 Unplugging and Plugging In PDBs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
4.6 Dropping PDBs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
4.7 Summary for Lesson 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
4.8 Practice 3 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
4.8.1 Practice 3-1 Creating a PDB from Seed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
4.8.2 Practice 3-2 Hot Cloning a PDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
4.8.3 Practice 3-3 Unplugging and Plugging a PDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
4.8.4 Practice 3-4 Dropping a PDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
5. Lesson 4 Configuring the Oracle Network Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
5.1 Objectives for Lesson 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
5.2 Oracle Net Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
5.3 How Listeners Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
5.3.1 The Default Listener . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
5.3.2 Tools to Configure Listeners . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
5.4 Configuring Dynamic Service Registration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
5.5 Configuring Static Service Registration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
5.6 Configuring Local Naming for Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
5.6.1 Advanced Connection Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
5.7 Testing Oracle Net Connectivity with tnsping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
5.8 Configuring Communication Between Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

5.9 Dedicated Versus Shared Server Configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219


5.10 Summary for Lesson 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
5.11 Practice 4 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
5.11.1 Practice 4-1 Exploring the Default Listener . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
5.11.2 Practice 4-2 Creating a Dynamic Listener . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
5.11.3 Practice 4-3 Creating a Static Listener for a PDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
5.11.4 Practice 4-4 Creating a Net Service Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
5.11.5 Practice 4-5 Creating a Database Link to an External Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
6. Lesson 5 Administering User Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
6.1 Objectives for Lesson 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
6.2 Creating Users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
6.2.1 User Accounts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
6.2.2 Oracle-Supplied Administrator Accounts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279

s a
6.3 Granting Privileges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.3.1 System Privileges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
280
282
h a
6.3.2 Object Privileges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
)
285

m eฺ
6.4 Creating and Granting Roles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286

c o d
6.4.1 Granting Roles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ฺ i
288

i n fo t Gu
6.4.2 Oracle-Supplied Roles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.4.3 Making Roles More Secure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
289
290

c a na den
6.5 Revoking Privileges and Roles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292

ar s Stu
6.5.1 Revoking System Privileges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
6.5.2 Revoking Object Privileges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
@
aq e thi
6.5.3 Revoking Roles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295

l h
6.6 Creating and Assigning Profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296

dฺu to us
6.6.1 Assigning Profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298

a
6.6.2 Password Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299

am nse
6.6.3 Resource Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301

( s
6.6.4 Oracle-Supplied Password Verification Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303

aq e lice
6.7 Authenticating Users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305

H
6.7.1 Password Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
l abl
307

U
6.7.2 Password File Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308

ad sfer
6.7.3 OS Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
6.8 Assigning Quotas to Users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
m 312

Sa -tran
6.9 Applying the Principal of Least Privilege . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.10 Summary for Lesson 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
313
315

non
6.11 Practice 5 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
6.11.1 Practice 5-1 Creating Common and Local Users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
6.11.2 Practice 5-2 Creating a Local User for an Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
6.11.3 Practice 5-3 Granting the DBA Role to PDBADMIN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
6.11.4 Practice 5-4 Creating a Local Profile in EM Express and Locking Accounts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
6.11.5 Practice 5-5 Creating Local Roles in EM Express . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338
6.11.6 Practice 5-6 Creating Local Users in EM Express . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
6.11.7 Practice 5-7 Configuring a Default Role for a User . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
6.11.8 Practice 5-8 Auditing User Activity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
6.11.9 Practice 5-9 Exploring OS and Password File Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
7. Lesson 6 Creating and Managing Tablespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
7.1 Objectives for Lesson 6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372
7.2 How Table Data Is Stored . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373
7.2.1 Database Block Content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374
7.3 Creating Tablespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375
7.4 Altering and Dropping Tablespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378
7.5 Viewing Tablespace Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380
7.6 Implementing Oracle Managed Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381
7.7 Moving or Renaming Online Data Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383
7.7.1 Examples of Moving and Renaming Online Data Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
7.8 Summary for Lesson 6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386
7.9 Practice 6 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387
7.9.1 Practice 6-1 Viewing Tablespace Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388
7.9.2 Practice 6-2 Creating a Tablespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396
8. Lesson 7 Managing Storage Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410
8.1 Objectives for Lesson 7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411
8.2 Space Management Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412
8.3 Block Space Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413
8.4 Row Chaining and Migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414
8.5 Free Space Management Within Segments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416
8.6 Types of Segments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417
8.7 Allocating Extents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418
8.8 Deferred Segment Creation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419
8.8.1 Controlling Deferred Segment Creation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420
8.8.2 Restrictions and Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
8.9 Space-Saving Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422
8.10 Table Compression Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
8.10.1 Compression for Direct-Path Insert Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424
8.10.2 Advanced Row Compression for DML Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

8.10.3 Specifying Table Compression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426


8.10.4 Using the Compression Advisor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427
8.11 Resolving Space Usage Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428
8.12 Monitoring Tablespace Space Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429
8.13 Reclaiming Space by Shrinking Segments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430
8.13.1 Shrinking Segments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431
8.13.2 Results of a Shrink Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 432
8.14 Managing Resumable Space Allocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433
8.14.1 Using Resumable Space Allocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434
8.14.2 Resuming Suspended Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436
8.15 Summary for Lesson 7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438
8.16 Practice 7 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439
8.16.1 Practice 7-1 Managing Tablespace Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440
8.16.2 Practice 7-2 Using Compression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
s
8.16.3 Practice 7-3 Handling Resumable Space Allocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . a 450
457
h a
9. Lesson 8 Managing UNDO Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
)
464

m eฺ
9.1 Objectives for Lesson 8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465

c o d
9.2 Undo Data Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ฺ i
466

i n fo t Gu
9.3 Transactions and Undo Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.4 Storing Undo Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
468
469

c a na den
9.5 Comparing Undo Data and Redo Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470

ar s Stu
9.6 Managing Undo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471
9.7 Local Undo Mode Versus Shared Undo Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472
@
aq e thi
9.8 Configuring Undo Retention . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473

l h
9.9 Categories of Undo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474

dฺu to us
9.10 Guaranteeing Undo Retention . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475

a
9.11 Changing an Undo Tablespace to a Fixed Size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476

am nse
9.12 Temporary Undo Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477

( s
9.13 Temporary Undo Benefits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 478

aq e lice
9.14 Enabling Temporary Undo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479

H
9.15 Monitoring Temporary Undo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
l abl
480

U
9.16 Viewing Undo Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481

ad sfer
9.17 Viewing Undo Activity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482
9.18 Practice 8 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
m 483

Sa -tran
9.18.1 Practice 8-1 Managing UNDO Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.18.2 Practice 8-2 Using Local UNDO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
484
490

non
10. Lesson 9 Moving Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498
10.1 Objectives for Lesson 9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499
10.2 Moving Data - General Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500
10.3 Oracle Data Pump Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501
10.4 Oracle Data Pump Benefits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 502
10.5 Data Pump Export and Import Clients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 504
10.6 Data Pump Interfaces and Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505
10.7 Data Pump Import Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 507
10.8 SQL Loader Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 508
10.9 Loading Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 510
10.10 Express Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511
10.11 External Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513
10.12 External Table Benefits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514
10.13 Summary for Lesson 9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515
10.14 Practice 9 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 516
10.14.1 Practice 9-1 Moving Data From One PDB to Another . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517
10.14.2 Practice 9-2 Loading Data into a PDB from an External File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531
10.14.3 Practice 9-3 Querying External Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545
10.14.4 Practice 9-4 Unloading External Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553
11. Lesson 10 Backup and Recovery Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557
11.1 Objectives for Lesson 10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 558
11.2 DBA Responsibilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559
11.3 Categories of Failure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 560
11.3.1 Statement Failure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 561
11.3.2 User Process Failure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 562
11.3.3 Network Failure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 563
11.3.4 User Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 564
11.3.5 Instance Failure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565
11.3.6 Media Failure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566
11.4 Understanding Instance Recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 567
11.4.1 The Checkpoint Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568
11.4.2 Redo Log Files and Log Writer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569
11.4.3 Automatic Instance or Crash Recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 570
11.4.4 Phases of Instance Recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 571
11.4.5 Tuning Instance Recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 572
11.4.6 Using the MTTR Advisor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573
11.5 Understanding Types of Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 574
11.5.1 Backup Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 575
11.5.2 Types of Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 576
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

11.5.3 RMAN Backup Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 577


11.6 Comparing Complete and Incomplete Recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 579
11.6.1 Complete Recovery Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 580
11.6.2 Point-in-Time Recovery Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581
11.7 Oracle Data Protection Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 583
11.8 Flashback Technology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584
11.9 Summary for Lesson 10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585
11.10 Practice 10 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 586
11.10.1 Practice 10-1 Configuring Your Database for Recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 587
11.10.2 Practice 10-2 Backing up the Control File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 601
11.10.3 Practice 10-3 Configuring Automatic Backups of the Control File and SPFILE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 606
11.10.4 Practice 10-4 Creating a Whole Database Backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 610
11.10.5 Practice 10-5 Creating a Partial Database Backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 627
11.10.6 Practice 10-6 Recovering From an Essential Data File Loss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
s
11.10.7 Practice 10-7 Recovering From an Application Data File Loss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . a 633
647
h a
12. Lesson 11 Monitoring and Tuning Database Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
)
661

m eฺ
12.1 Objectives for Lesson 11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 662

c o d
12.2 Performance Management Activities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ฺ i
663

i n fo t Gu
12.3 Performance Planning Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.4 Database Maintenance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
664
666

c a na den
12.5 Automatic Workload Repository . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 667

ar s Stu
12.6 Automatic Database Diagnostic Monitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 668
12.7 Performance Monitoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 669
@
aq e thi
12.7.1 Monitoring Sessions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 670

l h
12.7.2 Monitoring Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 671

dฺu to us
12.7.3 Monitoring Wait Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 672

a
12.7.4 Viewing Instance Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 673

am nse
12.8 Performance Tuning Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 675

( s
12.9 Database Server Statistics and Metrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676

aq e lice
12.10 Managing Memory Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 677

H
12.10.1 Automatic Memory Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
l abl
679

U
12.10.2 Automatic Shared Memory Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 681

ad sfer
12.10.3 Managing the SGA for PDBs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 683
12.10.4 Managing the Program Global Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
m 684

Sa -tran
12.10.5 Managing the PGA for a PDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.11 Summary for Lesson 11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
686
687

non
12.12 Practice 11 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 688
12.12.1 Practice 11-1 Managing Performance in EM Express . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 689
12.12.2 Practice 11-2 Resolving Lock Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 696
13. Lesson 12 Tuning SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 702
13.1 Objectives for Lesson 12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 703
13.2 SQL Tuning Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 704
13.3 Oracle Optimizer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 705
13.4 Optimizer Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 706
13.4.1 Optimizer Statistics Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 707
13.4.2 Setting Optimizer Statistics Preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 709
13.4.3 Optimizer Statistics Advisor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 711
13.5 SQL Plan Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 713
13.6 Adaptive Execution Plans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 714
13.7 SQL Tuning Advisor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 716
13.8 SQL Access Advisor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 718
13.9 SQL Performance Analyzer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 719
13.10 Summary for Lesson 12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 721
13.11 Practice 12 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 722
13.11.1 Practice 12-1 Using SQL Tuning Advisor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 723
13.11.2 Practice 12-2 Using Optimizer Statistics Advisor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 733
14. Lesson 13 Oracle Database Resource Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 743
14.1 Objectives for Lesson 13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 744
14.2 Oracle Database Resource Manager Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 745
14.3 Resource Manager Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 746
14.4 Using Resource Manager to Allocate Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 747
14.5 Creating a Simple Resource Plan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 749
14.6 Creating a Complex Resource Plan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 750
14.7 Using the Active Session Pool Feature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 752
14.8 Limiting CPU Utilization at the Database Level . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 753
14.9 Limiting CPU Utilization at the Server Level . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 754
14.10 Viewing Resource Manager Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 756
14.11 Limiting PGA Memory Allocated to Each Session . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 757
14.12 Creating Directives for PDB Performance Profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 758
14.13 Summary for Lesson 13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 759
14.14 Practice 13 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 760
14.14.1 Practice 13-1 Dispatching Resources Amongst PDBs by Using Resource Manager . . . . . . . . . . . . . . . . . . . . . . . . . . 761
14.14.2 Practice 13-2 Avoiding Excessive PGA Memory Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 768
15. Lesson 14 Enterprise Manager Cloud Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 773
15.1 Objectives for Lesson 14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 774
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

15.2 Controlling the Enterprise Manager Cloud Control Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 775


15.3 Starting the Enterprise Manager Cloud Control Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 776
15.4 Stopping the Enterprise Manager Cloud Control Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 778
15.5 Summary for Lesson 14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 779
15.6 Practice 14 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 780
15.6.1 Practice 14-1 Registering a Database with Enterprise Manager Cloud Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 781
15.6.2 Practice 14-2 Using ADDM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 791
16. Appendices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 796
16.1 Appendix - Product-Specific Credentials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 797
16.2 Appendix - Abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 799
16.3 Appendix - Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 800
16.4 Appendix - SGA Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 807

s a
) h a
ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non
Lesson 0 Getting Started
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Getting Started a s a
) h
ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 8 of 812
Course Objectives

After completing this course, you should be able to:


Describe Oracle Database architecture
Configure the database to support your applications
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Manage database security and implement auditing


Implement basic backup and recovery procedures
Move data between databases and files
Employ basic monitoring procedures and manage performance
Manage resources and automate tasks
Create database deployments in Database Cloud Service
(DBCS)
Manage database deployments in DBCS
s a
) h a
ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 9 of 812
Course Agenda - Day 1 and 2

Day 1
Lesson 1 Exploring Oracle Database Architecture
Lesson 1C Introduction to Oracle Database Cloud Service
Lesson 2C Creating DBCS Database Deployments
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Lesson 2 Managing Database Instances


Day 2
Lesson 3 Creating PDBs
Lesson 6C Creating Master Encryption Keys for PDBs
Lesson 4 Configuring the Oracle Network Environment
Lesson 3C Managing DBCS Database Deployments

s a
)h ฺ a
m
f o ฺco uide
n a in nt G
a rca Stude
a q @ his
ฺ u lh se t
m ad to u
( s a nse
H aitsq lesson
A lesson that includes a "C" beside l i ce applies to Database as a Service (DBaaS). All other lessons
number
apply to both on-premises U l Database
Oracle
a b le and DBaaS.
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 10 of 812
Course Agenda - Day 3 and 4

Day 3
Lesson 5C Patching DBCS Database Deployments
Lesson 5 Administering User Security
Lesson 6 Creating and Managing Tablespaces
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Lesson 7C Tablespace Encryption by Default


Lesson 7 Managing Storage Space
Day 4
Lesson 8 Managing UNDO Data
Lesson 9 Moving Data
Lesson 10 Backup and Recovery Concepts
Lesson 4C Backing Up and Restoring DBCS Database Deployments
s a
) h a
ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 11 of 812
Course Agenda - Day 5

Day 5
Lesson 11 Monitoring and Tuning Database Performance
Lesson 12 Tuning SQL
Lesson 13 Oracle Database Resource Manager
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Lesson 14 Enterprise Manager Cloud Control

s a
) h a
ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 12 of 812
Lab Environment
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

s a
)h ฺ a
m
f o ฺco uide
n a in nt G
a rca Stude
a q @ his
ฺ u lh se t
m ad to u
( s a nse
H a q l i ce
VM1 and VM2
U l able
m
d machines
Each student has twoavirtual
s f er (VM1 and VM2) to use during class, as shown in the diagram above:
Sa -tDatabase
r an 12.2 is installed with one container database named ORCL and one pluggable
on PDB1. This container database (CDB) has been set up for you in advance so that you can
On VM1, Oracle
databasennamed
explore an existing configuration. The host name for VM1 is 12cr2db.
On VM2, Oracle Database 12.1 (non-container database) and Enterprise Manager 13c are installed. Oracle
Database 12.1 is required for Enterprise Manager 13c. You'll use this virtual machine to practice
managing Oracle Database 12.2 with Oracle Enterprise Manager Cloud Control. The host name for VM2 is
em13c.

See Appendix - Product-Specific Credentials for a list of credentials used in the practices for this course.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 13 of 812
Lesson 1 Exploring Oracle Database Architecture
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

1
Exploring Oracle Database a s a
) h
Architecture ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 14 of 812
Objectives for Lesson 1

After completing this lesson, you should be able to:


Describe Oracle Database and its editions
Explain the general structure of a relational database model
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Describe SQL and PL/SQL


Describe the architecture of a multitenant Oracle Database
Connect to an Oracle Database by using OS authentication and Easy Connect
Syntax
Describe the main Oracle Database tools
Describe the Oracle-supplied user accounts for
Oracle Database
Query the data dictionary in an Oracle Database
s a
) h a
ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 15 of 812
Introducing Oracle Database

Oracle provides cloud and on-premises database offerings.


The purpose of an Oracle Database is to store, organize, and retrieve data for
your applications.
You can run Oracle Database in your environment (on-premises) or use Oracle
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Database in Oracle's environment (cloud).


Your applications are the user interfaces to the database.
Users can retrieve data in the database to create reports.
Users can update data in the database.

s a
)h ฺa
m
f o ฺco uide
n a in nt G
a rca Stude
a q @ his
ฺ u lh se t
m ad to u
( s a nse
ais qa relational
l i e
cdatabase
An on-premises Oracle Database
l H l e management system (RDBMS) software that is installed in
your own environment. In the
d U raforb you. An Oracle Database
cloud, Oracle hosts the Oracle Database and all its components (for example,
networking and storage
m aFor example,f e
components)
s enables you to store, organize, and retrieve data
Sa on the
for your applications.
t r a n a Human Resources department has a custom software application that uses
Oracle Database
o n - back end to store its data about employees. The application is the front end and provides a
n
user-friendly interface where users can update data in the database and retrieve data to create reports.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 16 of 812
Oracle Database 12c Editions

Oracle Database is available in the following editions, each suitable for different
development and deployment scenarios.
Oracle Database PE
Oracle Database SE2
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Oracle Database EE
Oracle Database XE

s a
)h ฺ a
m
f o ฺco uide
n a in nt G
a rca Stude
a q @ his
ฺ u lh se t
m ad to u
( s a nse
H a q l i ce
Oracle Database Personal
U l Edition
a b le
ad Edition f r
esupports
compatibility S m
Oracle Database Personal
n s
a OracletrDatabase
with a Standard
single-user development and deployment environments that require full
Edition One, Oracle Database Standard Edition, and Oracle Database
Enterprise Edition. n-
no
Personal Edition includes all of the components that are included with Enterprise Edition, as well as all of the options
that are available with Enterprise Edition. Personal Edition is available on Windows platforms only. The Management
Packs are not included in Personal Edition.

Note: You cannot use the Oracle Real Application Clusters option with Personal Edition.

Oracle Database Standard Edition2


Before SE2, there is SE (Standard Edition) and SE1 (Standard Edition1).

Oracle Database Standard Edition delivers the unprecedented ease of use, power, and performance of
Standard Edition One, with support for larger machines and clustering of services with Oracle Real Application
Clusters (Oracle RAC). Oracle RAC is not included in the Standard Edition of releases before Oracle Database
10g, nor is it an available option with those earlier releases.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 17 of 812
Oracle Database Standard Edition One delivers unprecedented ease of use, power, and performance for
workgroup, department-level, and Web applications. From single-server environments for small business to
highly distributed branch environments, Oracle Database Standard Edition One includes all the facilities
necessary to build business-critical applications.

SE2 starts with Oracle Database 12c Release 1 (12.1.0.2).

SE2 supports Oracle RAC.


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

Oracle Database Enterprise Edition


Oracle Database Enterprise Edition provides the performance, availability, scalability, and security required for
mission-critical applications such as high-volume online transaction processing (OLTP) applications, query-intensive
data warehouses, and demanding Internet applications. Oracle Database Enterprise Edition contains all of the
components of Oracle Database, and can be further enhanced with the purchase of the options and packs.

Oracle Database Options


All the Oracle Database options can be purchased with Oracle Database Enterprise Edition.
You may not use the options, packs, or products without separately purchased licenses. The fact that
these options, packs, or products may be included in product CDs or downloads or described in
s a
documentation that you receive, does not authorize you to use them without purchasing appropriate
licenses.
)h ฺa
m
Oracle Management Packs
o ฺco uide
The management packs can be purchased only with Enterprise Edition.
f
n a in nt G
The features in these packs are accessible through Oracle Enterprise Manager Database Control,

rca Stude
Oracle Enterprise Manager Grid Control, and APIs provided with Oracle Database software.
a
@ his
Oracle Database Express Edition
a q t
Oracle Database Express Edition (Oracle Database ฺXE) u lhis an entry-level
s e
a dto develop,
o u edition of Oracle Database that is quick to
t and complex migrations.
s a m
download, simple to install and manage, and is free
s e deploy, and distribute. Oracle Database XE makes it

q (
easy to upgrade to the other editions of Oracle
c e n
without costly Oracle Database XE can be

H a
installed on any size machine with any number
l i of CPUs, stores up to 4 GB of user data, using up to 1 GB of memory,
and using only one CPU on the
U b le An online forum provides the support.
l hostamachine.
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 18 of 812
Oracle Database Standard Edition

From Oracle Database 12c Release 1 (12.1.0.2), SE2 replaces SE and SE1.
SE2 supports Oracle RAC.
SE2 (and SE, SE1) has the same main kernel.
It supports single tenant but lacks the following features, options and tools:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

No parallel execution
No Data Guard
No Cloud Control
No management packs

s a
)h ฺ a
m
f o ฺco uide
n a in nt G
a rca Stude
a q @ his
ฺ u lh se t
m ad to u
( s a nse
H aq ebutliwith
SE2 supports the Multitenant architecture ceone PDB only.
U l abl
adfeatures
SE2 lacks the following :er
f
m s
an(and all other Flashback features), Tablespace point-in-time recovery, Online table
SaDatabase- t r
Flashback
n n Results Cache, Database Resource Manager
oQuery
redefinition,
Options such as In-Memory Database Cache, Oracle Partitioning, and Oracle Database Vault
All management packs such as Oracle Tuning Pack

SE2 does not use Oracle Enterprise Manager Cloud Control.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 19 of 812
Relational Database Models
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

s a
a
)h ฺ
m
f o ฺco uide
n a in nt G
a rca Stude
a q @ his
ฺ u lh se t
m ad to u
( s a nse
H a q l i ce
About Relational Database
U l Models a b le
ada relational
f r
edatabase
Oracle Database uses
m
structures, suchaas tablesa n s model, which organizes and presents the physical data as logical
S -oftrlogical structures that are owned by a database user, and can include tables, views,
(with columns and rows). These logical structures make the data understandable. A
n
schema is a collection
noprocedures,
sequences, stored synonyms, indexes, clusters, and database links. In general, schemas include
everything that your application creates in the database.

HR Schema
The HR schema, which is shown above and is used throughout this course, groups seven related tables and was
created by the HR user. A primary key (identified by PK above) is a unique identifier for a row in a table. A foreign key
(identified by FK above) references a primary key. It uses the same value as the primary key. Together, primary keys
and foreign keys are used to ensure data integrity. For example, in the JOBS table above, each row uniquely identifies
a job. Each job is given a job ID, and this ID is the primary key. Likewise, the EMPLOYEES table uniquely identifies
each employee with an employee ID. The employee ID is also a primary key. The EMPLOYEES table contains a
foreign key named JOB_ID, which references the JOB_ID primary key in the JOBS table. Solid lines in the diagram
represent mandatory foreign key constraints and dashed lines represent optional foreign key constraints.

The following are some principal business rules implemented in the HR schema:

Each department may be the employer of one or more employees. Each employee may be assigned to only
one department.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 20 of 812
Each job must be a job for one or more employees. Each employee must be currently assigned to only one job.
When an employee changes his or her department or job, a record in the JOB_HISTORY table records the start
and end dates of the past assignments.
The JOB_HISTORY table records are identified by a composite primary key: the EMPLOYEE_ID and the
START_DATE columns.
The EMPLOYEES table also has a foreign key constraint with itself. This is an implementation of the business
rule: each employee may be reporting directly to only one manager. The foreign key is optional because the top
employee does not report to another employee.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

s a
) h a
ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 21 of 812
Oracle SQL

Oracle SQL is the language you use to perform operations on the data in an
Oracle Database. For example, selecting data from a database:
SQL> SELECT employee_id, first_name, last_name FROM employees
WHERE employee_id=216 ORDER BY 1;
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

SELECT lists the database columns for which you want to view data.
FROM lists the tables that contain those database columns.
WHERE specifies column limits and table joins (this part essentially filters the
rows of data).
ORDER BY specifies the columns by which the results are sorted.
PL/SQL is a procedural extension to Oracle SQL.
a write
It enables you to control the flow of a SQL program, use variables,s and
error-handling procedures. )h a
ฺ c om ideฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H a q l i ce
Oracle SQL, DDL, andl DML ble
a d Uyoufuse e rato perform operations on the data in an Oracle Database. It's an implementation
am language
Oracle SQL is the language
s
anyoucalled
S
of the ANSI standard
- t r Structure Query Language (SQL), and provides features that extend beyond

ofo
can be thought n
n
standard SQL. For example, use SQL to create tables, query tables, and modify data in tables. A SQL statement
as a very simple, but powerful, computer program or instruction. Users specify the result that they
want (for example, the names of employees), not how to derive it. A SQL statement is a string of SQL text such as the
following:

SELECT first_name, last_name FROM employees;

Data definition language (DDL) includes statements that define or change a data structure; for example, CREATE
TABLE and ALTER INDEX statements.

Data manipulation language (DML) includes statements such as SELECT, INSERT, UPDATE, and DELETE.

PL/SQL
PL/SQL is a procedural extension to Oracle SQL. PL/SQL is integrated with Oracle Database, enabling you to use all
of the Oracle Database SQL statements, functions, and data types. You can use PL/SQL to control the flow of a SQL
program, use variables, and write error-handling procedures.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 22 of 812
Oracle Database can also store program units written in Java. A Java stored procedure is a Java method published to
SQL and stored in the database for general use. You can call existing PL/SQL programs from Java and Java
programs from PL/SQL.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

s a
) h a
ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 23 of 812
Oracle Database Server Architecture
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

s a
)h ฺ a
m
f o ฺco uide
n a in nt G
a rca Stude
a q @ his
ฺ u lh se t
m ad to u
( s a nse
H a q l i ce
Configuration Options l
U a b le
An Oracle Database a d offateleast r one database instance to handle memory and processes and one database,
m consists
n s
Sa physical
which consists of
- t r afiles.
on Database has the following configuration options, as illustrated in the diagram above.
An on-premisesnOracle

A single-instance database (A): This architecture consists of one database instance and one database. A
one-to-one relationship exists between the database and a database instance. You will work with this
architecture during this course.
Multiple single-instance databases on the same server machine (B): You can install multiple single-instance
databases on the same server machine, where there will still be a separate database instance for each
database. This configuration is useful for running different versions of Oracle Database on the same machine.
Oracle Real Application Clusters (Oracle RAC) database (C): This architecture has multiple instances usually
running on separate server machines, all sharing the same database. The cluster of server machines appear
as if they are one server to end users and applications.This configuration is designed for high availability,
scalability, and high-end performance.

Whether in a single-instance or Oracle RAC configuration, a database instance is associated with only one database
at a time.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 24 of 812
View:

View the following figures in the Oracle Database Net Services Administrator's Guide. In Figure 2-1, each
database instance (sales and finance) is associated with its own service name (sales.us.example.com
and finance.us.example.com, respectively). Figure 2-2 is an advanced scenario involving Oracle Real
Application Clusters (RAC) Database where two database instances are associated with the same database
service. Both database instances run on different computers and share a single physical database.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Figure 2-1 and Figure 2-2 (Click the second Understanding Database Instances link.)

s a
) h a
ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 25 of 812
Database Instance
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

s a
a
)h ฺ
m
f o ฺco uide
n a in nt G
a rca Stude
a q @ his
ฺ u lh se t
m ad to u
( s a nse
q is laicseteof memory structures and processes that access and process data
A database instance, as illustratedaabove,
from the database files. A U
H
l a
database b le exists only in memory.
instance
r
ad insfaedatabase
m
Sa -tran
The main memory structures instance are the following:

n on Area (SGA): The SGA is a group of shared memory structures that contain data and control
System Global
information for one database instance. All server and background processes share the SGA. SGA components
include a shared pool, database buffer cache, redo log buffer, large pool, java pool, streams pool, and fixed
SGA. The In-Memory Area is an optional SGA component that contains the In-Memory Column Store (IM
column store). See Appendix - SGA Components for descriptions of these items.
Program Global Area (PGA): The PGA is a nonshared memory region that contains data and control
information exclusively for use by server and background processes. One PGA gets created for each server or
background process that starts. The Oracle Database creates server processes to handle the connections to
the database on behalf of client programs. A PGA is deallocated when the associated server or background
process using it is terminated.

The main process structures in a database instance are the following:

Background processes: These processes manage memory structures, asynchronously perform I/O to write
data to a file on a disk, and perform general maintenance tasks. The background processes that are present
depend on the features that are being used in the database. When you start a database instance, mandatory
background processes automatically start. You can start optional background processes later as required. The
following are some common background processes. For descriptions of individual background process, see

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 26 of 812
Appendix - Processes. For a complete list of background processes, see Table F-1 in Oracle Database
Reference.
Database Writer process (DBWn)
Checkpoint process (CKPT)
Log Writer process (LGWR)
System monitor process (SMON)
Listener registration process (LREG)
Process monitor process (PMON)
Recoverer process (RECO)
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Archiver processes (ARCn) - optional


Server processes: Oracle Database creates server processes to handle the connections to the database on
behalf of client programs, and to perform the work for the client programs; for example, parsing and running
SQL statements, and retrieving and returning results to the client program.

s a
) h a
ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 27 of 812
Multitenant Database
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

s a
)h ฺa
m
f o ฺco uide
n a in nt G
a rca Stude
a q @ his
ฺ u lh se t
m ad to u
( s a nse
H
A database is a set of physical filesathat ce data and metadata. The metadata consists of structural,
q storeliuser
U l aabout
configuration, and control information b le the database server.
d
madatabase s f eber a multitenant container database (CDB). A CDB, as illustrated above, is made up
You can designa your
S -one t r n
aseedto
n PDBs). Topluggable
of one root container,
(simply referredntooas
database (seed PDB), and one or more user-created pluggable databases
a user or application, PDBs appear logically as separate databases. You can still
configure the database the old way using the non-container database (non-CDB) architecture, if needed.

The root container, named CDB$ROOT, contains multiple data files. The data files store Oracle-supplied
metadata and common users (users that are known in every container). This information is shared with all
PDBs.
The seed PDB, named PDB$SEED, is a system-supplied PDB template containing multiple data files that you
can use to create new PDBs.
The user-created PDB contains multiple data files that contain the data and code required to support an
application; for example, a Human Resources application. Users interact only with the PDBs, and not the seed
PDB or root container; for example, in the diagram above there are two PDBs - one for the sales organization
(named SALES) and another for the Human Resources department (named HR). You can create multiple PDBs
in a CDB. One of the goals of the multitenant architecture is that each PDB has a one-to-one relationship with
an application.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 28 of 812
Application Containers
Oracle Database 12c Release 2 introduces the concept of an application container, which is a collection of PDBs
within a CDB, storing data for an application. You create application containers to have a single master application
definition. An application container, as shown below, consists of an application root container, an optional application
seed PDB, and application PDBs.

Note: Application containers are covered briefly here so that you are aware of them. However, it is an advanced
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

concept and is not practiced in this course.

s a
) h a
ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 29 of 812
Logical Storage Structures
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

s a
)h ฺa
m
f o ฺco uide
n a in nt G
a rca Stude
a q @ his
ฺ u lh se t
m ad to u
( s a nse
H a q l i ce
Tablespaces, Segments,
U l Blocks,
a b leand Extents
r units called tablespaces, which collectively store all the database data.
d logicalfestorage
A database is dividedainto
m s
anone orstorage
Sarepresents
Each tablespace
- t r more data files, which can be stored in the following systems: storage area
n
network (SAN), network attached
noManagement.
Automatic Storage
(NAS), network file system (NFS), Exadata system, file system, or Oracle
Each tablespace contains extents that store the data for logical objects, such as
tables and indexes. These extents are collectively known as segments.

At the finest level of granularity, an Oracle database’s data is stored in data blocks. One data block corresponds to a
specific number of bytes of physical space on the disk. An extent is a specific number of contiguous Oracle data
blocks (obtained in a single allocation) that are used to store a specific type of information. The diagram above
illustrates the different levels of logical storage structures. You will learn more about these structures in Lesson 6
Creating and Managing Tablespaces.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 30 of 812
Default Tablespaces
The following table describes the tablespaces that get created for CDBs and PDBs by default. In short, the root
container and PDBs each contain all the tablespaces listed below, with the exception that it is optional for a PDB to
have an UNDO tablespace. A seed PDB has a SYSTEM, SYSAUX, and TEMP tablespace.

Tablespace Description
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

SYSTEM The SYSTEM tablespace is used for core functionality.


It stores the data dictionary (metadata that describes the objects in the database) and tables that
contain administrative information about the database. All this information is contained in the SYS
schema and can be accessed only by the SYS user or other administrative users with the required
privilege. In the root container, it stores Oracle-supplied metadata, whereas in a PDB, it stores user
metadata. Pointers from the PDBs to the Oracle-supplied objects allow the “system” objects to be
accessed without duplicating them in the PDBs.

SYSAUX The SYSAUX tablespace is an auxiliary tablespace to the SYSTEM tablespace and helps to reduce
the load on the SYSTEM tablespace. Some components and products that have used the SYSTEM
tablespace or their own tablespaces in earlier releases of Oracle Database now use the SYSAUX
s a
tablespace. The SYSAUX tablespace exists in the root container and in each PDB.
) h a
o m Objectseinฺ temporary
TEMP The TEMP tablespace contains schema objects only for a session's duration.
tablespaces are stored in temp files. Your temporary tablespace isfo ฺ c
used when u idexecute a SQL
you
statement that requires the creation of temporary segments (such n
afori storing
as a n G
t sort or the creation of
large
a n e
an index). Just as each user is assigned a default tablespace
user is assigned a temporary tablespace. a rc Stud created data objects, each

q @temporaryis tablespace named TEMP that every


l h a
By default, the root container has a single default
e thTEMP
PDB uses; however, if needed, you can
d ฺ u create
u s
separate tablespaces in PDBs .

m a to to roll back, or undo, changes to the database. In a


UNDO The UNDO tablespace stores a e
nstablespace exists in the root container. It is optional to have a
the data needed
(sactiveceUNDO
single-instance CDB, q one
li
Ha binlaePDB.
local UNDO tablespace
l
a d Utablespacef e ra stores user objects and data. If no default tablespace is specified when a
USERS The USERS
m is created, s
athenSYSthen
Sauser.
user
- t r the USERS tablespace is the default tablespace for all objects created by that
on and each PDBSYSTEM
For
ncontainer
and users, the default permanent tablespace is SYSTEM. The root
has its own USERS tablespace.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 31 of 812
Database Files

The following files do not belong to a container, but are used during the operation
of the database:
Control file
Online redo log files
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Initialization parameter file (pfile) or server parameter file (spfile)


Password file
Backup files
Archived redo log files
Alert log file
Trace files
Data files, redo log files, and control files cannot be rebuilt unless they are
a
recovered from database backups.
)h ฺ as
m
f o ฺco uide
n a in nt G
a rca Stude
a q @ his
ฺ u lh se t
m ad to u
( s a nse
q
toaa container l i e data files do, but are used during the operation of the database:
clike
The following files do not belong H
l able
U
Control file: This
m
dfile stores
aThis s f ermetadata about the data files and online redo log files (for example, their names
a trthat
and statuses).
a n
information is required by the database instance to open the database. Control files also
containSmetadata -
n
make severalo ncopies
must
of the
be accessible
control file in
when the database is not open. It is highly recommended that you
your database server for high availability.
Online redo log files: These files store changes to the database as they occur and are used for data recovery.
Initialization parameter file (pfile) or server parameter file (spfile): This file defines how the database
instance is configured when it starts up.
Password file: This file enables users using the SYSDBA, SYSOPER, SYSBACKUP, SYSDG, SYSKM, SYSRAC,
and SYSASM roles to connect remotely to the database instance and perform administrative tasks.
Backup files: These files are used for database recovery. You typically restore a backup file when a media
failure or user error has damaged or deleted the original file.
Archived redo log files: These files contain an ongoing history of the data changes that are generated by the
database instance. Using these files and a backup of the database, you can recover a lost data file. That is,
archive logs enable the recovery of restored data files.
Alert log file: These are special trace entries. The alert log of a database is a chronological log of messages
and errors. Oracle recommends that you review the alert log periodically.
Trace files: Each server process and background process can write to an associated trace file. When a
process detects an internal error, the process dumps information about the error to its trace file. Some of the
information written to a trace file is intended for the database administrator, whereas other information is for
Oracle Support Services.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 32 of 812
Note: Data files reside in containers.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

s a
) h a
ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 33 of 812
Example - User Issuing a SQL Statement
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

s a
)h ฺa
m
f o ฺco uide
n a in nt G
a rca Stude
a q @ his
ฺ u lh se t
m ad to u
( s a nse
H
The following steps describe a basic aqOracle l i ce operation using memory, processes, and storage.
database
U l able
1. An instance has
m
on earopened
adstartedissalso
f node where Oracle Database is installed, often called the host or database

S a tran
server. The database after the instance has started.
an-application spawning a user process. The application attempts to establish a connection to the
2. A user starts n
noconnection can be local, client/server, or a three-tier connection from a middle tier.
server. The
3. The server runs a listener that has the appropriate Oracle Net Services handler. The listener detects the
connection request from the application and creates a dedicated server process on behalf of the user process.
It is in dedicated server mode that a user process first communicates with a listener process.
4. The user runs a DML-type SQL statement and commits the transaction. For example, the user changes the
address of a customer in a table and commits the change.
5. The server process receives the statement and checks the shared pool (an SGA component) for any shared
SQL area that contains an identical SQL statement. If a shared SQL area is found, the server process checks
the user’s access privileges to the requested data, and the existing shared SQL area is used to process the
statement. If a shared SQL area is not found, a new shared SQL area is allocated for the statement so that it
can be parsed and processed.
6. The server process retrieves any necessary data values, either from the actual data file (table whose segment
is stored on a data file) or from values already stored in the database buffer cache (an SGA component)
because someone else had previously requested the same data.
7. The server process modifies data in the SGA. Because the transaction is committed, the Log Writer process
(background process) immediately records the transaction in the online redo log file. The Database Writer
process (another background process) writes modified blocks permanently to disk when it is efficient to do so.

8.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 34 of 812
8. If the transaction is successful, the server process sends a message across the network to the application. If it
is not successful, an error message is transmitted.

Throughout this entire procedure, the other background processes run, watching for conditions that require
intervention. In addition, the database server manages other users’ transactions and prevents contention between
transactions that request the same data.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

s a
) h a
ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 35 of 812
Connecting to Oracle Databases

You connect client applications to an Oracle Database by connecting to its


database instance, not its database.
The database instance accesses the CDB and PDBs for you.
A user session is a logical entity that represents the state of the current user login
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

to the database instance.


Examples of connecting to Oracle Database:
By using operating system authentication
$ sqlplus / as sysdba

By using Easy Connect Syntax


SQL> CONNECT hr/hr@host1.example.com:1521/db.example.com

s a
)h ฺ a
m
f o ฺco uide
n a in nt G
a rca Stude
a q @ his
ฺ u lh se t
m ad to u
( s a nse
H a q l i ce
Connections Versus Sessions
U l able
r
ad sftoedatabase
a m
You connect client applications
n
instances (not databases), which access the CDB and PDBs for you.
S is-the
A connectionn traphysical communication pathway between a client process and a database instance.
no is a logical entity that represents the state of the current user login to the database instance. A
A user session
session lasts from the time the user is authenticated by the database instance until the time the user
disconnects or exits the client application.

Connecting to CDBs by Using Operating System Authentication


As a database administrator, you can quickly start SQL*Plus and connect to a root container without a password by
using the following command. This command enables you to connect to the database as the SYS user with the
SYSDBA privilege. There are some rules: You must be on the same machine as the database instance and the current
operating system user must be a member of the privileged OSDBA group.

$ sqlplus / as sysdba

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 36 of 812
Connecting to PDBs by Using the Easy Connect Syntax
There are many ways to connect to a PDB, however, using the Easy Connect syntax in SQL*Plus is the easiest
because it's already enabled on the database server by default and it doesn't require any client-side configuration.
This syntax supports TCP protocol only (no SSL). It offers no support for advanced connection options such as
connect-time failover, source routing, and load balancing.

Easy Connect connection strings take the following form:


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

SQL> CONNECT <username>/<password>@<listener hostname>:<listener port>/<service name>

For example, the SYSTEM user requests a connection to the database service named db.example.com. The listener
is located on a machine named host01.example.com and listens on port 1521.

SQL> CONNECT hr/hr@host1.example.com:1521/db.example.com

If you're starting from a command prompt, then you can start sqlplus and log in at the same time:

s a
$ sqlplus hr/hr@host1.example.com:1521/db.example.com
)h ฺ a
m
o
default port of 1521 is being used. If the service name is not provided, Oracle Net fassumes u idedatabase
ฺcoNetthatassumes
The listener port and service name are optional. If the listener port is not provided, Oracle that the

a i n ntthatGthe listener usesservice


the
name and host name provided in the connect string are identical. For example,
to listen on port 1521, the connection string above can be shortened. rca
n de assuming TCP

@ a s Stu
For example, a connection string like this:
l h aq e thi
a d ฺu us
t o
( s am nse
SQL> CONNECT hr/hr@db.example.com:1521/db.example.com

...can be shortened like this:


H aq e lice
U l abl
m ad sfer
SQL> CONNECT hr/hr@db.example.com
Sa -tran
Disconnecting n the Database Instance
nofrom
Use the EXIT command to exit SQL*Plus, disconnect from the database instance, and end all sessions in the
database instance memory.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 37 of 812
Oracle Database Tools

Oracle Database tools each have their own purpose, and some operations you
can perform in more than one tool.
Finding the right tool for the job often comes down to preference, for example,
whether you prefer to work with code or use a graphical user interface.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Tools include:
SQL*Plus
SQL Command Line (SQLcl)
SQL Developer
Database Configuration Assistant (DBCA)
Oracle Enterprise Manager Database Express (EM Express)
Oracle Enterprise Manager Cloud Control
a
Others (netca, netmgr, adcri, ...)
)h ฺ as
m
f o ฺco uide
n a in nt G
a rca Stude
a q @ his
ฺ u lh se t
m ad to u
( s a nse
H aq tools:
Oracle Database includes the following l i ce
U l able
SQL*Plus: Use
m s f er tool to access a database.
d command-line
athis
S a tran
SQL Command Line (SQLcl): Use this tool to access a database. It has both a GUI and a command line.

Database on- Use this Assistant


SQL Developer:
nConfiguration
graphical user interface (GUI) tool to access a database and perform DBA actions.
(DBCA): Use this GUI tool to create databases. To use DBCA, you must
be on the server to launch the tool from the operating system that houses the CDB.
Oracle Enterprise Manager Database Express (EM Express): Use this GUI tool to perform database
administration tasks on one database instance at a time.
Oracle Enterprise Manager Cloud Control (EM Cloud Control): Use this GUI tool to perform database
administration tasks on several targets (database instances, listeners, and so on) at the same time.
Others: Many specialized utilities are used to assist with database administration. The ones used in this course
may include tnslsnr, netca, netmgr, adcri, sqlldr, impdp, and expdp. This list does not cover all utilities
available.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 38 of 812
The following table shows you at a glance which tool can perform which tasks.

SQL*Plus SQLcl SQL DBCA EM


Developer Database EM Oracle
Express Cloud Universal
Control Installer

Create a CDB or PDB Yes Yes Yes (PDB Yes Yes (PDB Yes (PDB Yes
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

only) only) only)

Explore CDB Yes Yes Yes No Yes Yes No


instance,
architecture, and
PDBs

s a
) h a
ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 39 of 812
SQLPlus

Example 1: From a command line, you can start SQL*Plus, log in, and show the
user that you're logged in as:
$ sqlplus / as sysdba
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

...
Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 -
64bit Production
SQL> show user
USER is "SYS"

Example 2: Call a SQL script from the command line:


$ sqlplus hr/hr@HRPDB @script.sql

s a
)h ฺ a
m
f o ฺco uide
n a in nt G
a rca Stude
a q @ his
ฺ u lh se t
m ad to u
( s a nse
H a q l i ce
About SQL*Plus
U l able
m ad program
SQL*Plus is a command-line
s f er that you use to submit SQL and PL/SQL statements to an Oracle database.
SQL*Plus is S a with
installed
t r n Database and is located in the $ORACLE_HOME/bin directory. You can start
aOracle
-
nonSQL*Plus, SQL, and PL/SQL commands to perform the following:
SQL*Plus from the command line, or from the Start menu on a Windows client. Use the SQL*Plus command-line
interface to execute

Enter, edit, run, store, retrieve, and save SQL commands and PL/SQL blocks
Format, calculate, store, and print query results
List column definitions for any table
Send messages to and accept responses from an end user
Perform database administration

Calling a SQL Script from SQL*Plus


When calling a SQL script file from within SQL*Plus, you have the following options:

Option 1: Call the script from the command line when you first invoke SQL*Plus:

$ sqlplus hr/hr@HRPDB @script.sql

Option 2: Call the script from inside a SQL*Plus session simply by using the “@” operator:

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 40 of 812
SQL> @script.sql

When a script is saved from SQL*Plus by using the SAVE command, the .sql extension is automatically supplied.
You can then execute the script without supplying the extension at execution time, for example:

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

Calling SQL*Plus from a Shell Script


You can call SQL*Plus from a shell script or BAT file by invoking sqlplus and using the operating system scripting
syntax for passing parameters. For example, suppose you have the following shell script:

# Name of this file: batch_sqlplus.sh


# Count employees and give raise.
sqlplus hr/hr <<EOF
select count(*) from employees;
update employees set salary = salary*1.10;
s a
commit;
quit ) h a
EOF
ฺ c o m
i d eฺ
i n fo t Gu
You can call that shell script from the command line :
c a na den
@ ar s Stu
aq e thi
$ ./batch_sqlplus.sh
l h
For More Information a dฺu to us
( s am n sein SQL*Plus Users Guide and Reference.
To learn how to start SQL*Plus, see Starting
aq e lic e
SQL Plus
H
l abl
U
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 41 of 812
SQLcl

SQLcl
Is a tool that can access Oracle Databases
Is a cross between SQL*Plus and SQL Developer
Incorporates Linux-like and IDE features, and color
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Example query with formatting to fit the screen:


SQL> SELECT first_name, last_name, salary, hire_date FROM hr.employees;

FIRST_NAME LAST_NAME SALARY HIRE_DATE


Steven King 24000 17-JUN-03
Neena Kochhar 17000 21-SEP-05
...

s a
)h ฺ a
m
f o ฺco uide
n a in nt G
a rca Stude
a q @ his
ฺ u lh se t
m ad to u
( s a nse
SQL Command Line (SQLcl) isH aq tool
another l i
thatceyou can use to access an Oracle Database. SQLcl is a cross
between SQL Developer and U lSQL*Plus.
a b lItecan do everything that SQL*Plus can do, plus more. It has improvements
in command-line interaction,
m s er Linux-like and IDE features, and it includes color.
ad incorporating
f
n
Sato run-tonraWindows
Note: For SQLcl
n o n
version 1.7 or higher.
or Linux operating systems, you need a Java Runtime Environment (JRE) of

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 42 of 812
Oracle SQL Developer
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

s a
)h ฺa
m
f o ฺco uide
n a in nt G
a rca Stude
a q @ his
ฺ u lh se t
m ad to u
( s a nse
H
Oracle SQL Developer (SQL Developer) ice tool for database developers and DBAs, and gets installed with
aq isea lgraphical
Oracle Database. You canU l toadisplay
choose b l several different panes in the SQL Developer interface, such as a
Connections and DBA adpane (as f r in the image below). You use the former to define connections to databases
eoperations.
shown
mto perform s
a troraatn least privileges forYoutheshould
and use the latter DBA add connections only for which the associated database
Sprivileges-
user has DBA
n o n desired DBA navigator operations on the specified database.

Some DBA-type operations that you can perform with SQL Developer include:

Start and shut down PDBs


Configure databases, for example, configure initialization parameters
View the status of databases
Export databases using Data Pump and import jobs
Back up and recover data using Oracle Recovery Manager (RMAN)
Configure Oracle Database Resource Manager (the Resource Manager), which enables you to manage
multiple workloads within a database that are contending for system and database resources
Schedule jobs, for example, loading data
Configure security using audit settings, profiles, roles, and users
Configure storage for archive logs, control files, data files, redo log groups, tablespaces, and temporary
tablespace groups
Run any number of provided reports, as well as create new ones

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 43 of 812
Some developer-type operations that you can perform with SQL Developer include:

Develop scripts in both the SQL and PL/SQL languages


Browse database objects
Run SQL statements and SQL scripts
Edit and debug PL/SQL statements
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

s a
) h a
ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 44 of 812
Database Configuration Assistant
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

s a
) h a
ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
Database Configuration Assistant a
e tool that you can use to do the following:
q is laicgraphical
H (DBCA)
l able
U
ma databases
Create databases
s er non-CDBs)
d(CDBsfand
Configureaexisting
DeleteS - t r an
on
databases
Manage n templates
Manage pluggable databases
Manage Oracle RAC database instances

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 45 of 812
Oracle Enterprise Manager Database Express
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

s a
)h ฺ a
m
f o ฺco uide
n a in nt G
a rca Stude
a q @ his
ฺ u lh se t
m ad to u
( s a nse
H a q l i ce
About Oracle Enterprise
U l Manager
a b le Database Express
ad Database
Oracle Enterprise Manager
m s f er Express (EM Express) is a lightweight tool that you can use to manage a CDB
and all its PDBsa(except thenseed PDB). It provides an out-of-box browser-based management solution performance
S -tramanagement,
non
monitoring, configuration administration, diagnostics, and tuning.

Architecture
EM Express uses a web-based console, communicating with the built-in web server available in XML DB.

As requests from the console are processed, the EM Express servlet handles the requests, including authentication,
session management, compression, and caching. The servlet passes requests for reports to the Common Reporting
Framework and actions requiring shell files to the File Manager. This architecture is illustrated in the diagram above.

EM Express is available only when the database is open. This means that Enterprise Manager Database Express
cannot be used to start up the database. Other operations that require that the database change state, such as
enable or disable ARCHIVELOG mode, are also not available in EM Express.

EM Express is configurable with a single click in Database Configuration Assistant (DBCA).

EM Express is a servlet built on top of Oracle XML DB. The Oracle XML DB default wallet has a self-signed
certificate, and some existing browsers consider self-signed certificates as untrusted because they are not signed by

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 46 of 812
a trusted CA (certificate authority). However, the self-signed certificate is still secure, as it ensures that the traffic is
encrypted between the Oracle XML DB server and the client (browser). Therefore, enter a security exception for the
EM Express URL in your web browser.

Requirements
The following are required for EM Express:

XMLDB components must be installed on the Oracle Database server. All Oracle Databases of version 12.1.0
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

or higher have XMLDB installed.


The web browser must have the Flash plug-in installed because EM Express uses Shockwave Flash (SWF)
files.

Starting EM Express for CDBs and PDBs


EM Express uses a global HTTPS port to connect to and manage non-CDBs, CDBs, and PDBs. Usually this port is
provided by DBCA when it configures your non-CDB or CDB. By default, the HTTPS port that DBCA configures for a
CDB can also be used for the PDBs in that CDB. You will, however, need to enable the global port before connecting
to a PDB.

For more information, see:


s a
) h a
Starting EM Express
Configuring the HTTPS Port for EM Express ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 47 of 812
Oracle Enterprise Manager Cloud Control
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

s a
)h ฺa
m
f o ฺco uide
n a in nt G
a rca Stude
a q @ his
ฺ u lh se t
m ad to u
( s a nse
H a q l i ce
About Oracle Enterprise
U l Manager
a b le Cloud Control
ad Cloud f r (EM Cloud Control) is Oracle’s on-premises management platform,
eControl
Oracle Enterprise Manager
m s
afornintegration
Sa location
providing a single
- t r managing all your Oracle deployments, whether they be in your data centers or in the

nonfor Oracle applications, databases, middleware, hardware, and engineered systems.


Oracle Cloud. Through deep with Oracle’s product stack, EM Cloud Control provides management and
automation support

Architecture
Oracle Enterprise Manager Cloud Control is composed of four main components, as illustrated in the diagram above:

Oracle Management Repository (OMR)


Oracle Management Service (OMS)
Oracle Management Agent (OMA or agent) with target-specific plug-ins
Cloud Control Console

The Oracle Management Agent runs on hosts, gathering metric data about those host environments as well as using
plug-ins to monitor availability, configuration, and performance and to manage targets running on the host. The
agents communicate with the Oracle Management Service to upload metric data collected by them and their plug-ins.
In turn, the OMS stores the data it collects in the Oracle Management Repository where it can be accessed by the
OMS for automated and manual reporting and monitoring. The OMS also communicates with the agents to

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 48 of 812
orchestrate the management of their monitored targets. As well as coordinating the agents, the OMS runs the Cloud
Control Console web pages that are used by administrators and users to report on, monitor, and manage the
computing environment that is visible to Cloud Control via the agents and their plug-ins.

Targets
Targets are the entities that EM Cloud Control manages. The following are supported targets:

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

Oracle Database Listeners


Oracle Fusion Middleware products
Oracle Application Servers
Oracle WebLogic Servers
Oracle applications, including E-Business Suite, SOA, Siebel, and PeopleSoft
Exadata and Exalogic
Cloud Control Components: Oracle Management Repository (OMR) and Oracle Management Service (OMS)
Third-party products

Cloud Control Console


The Enterprise Summary page in the Cloud Control Console includes the following:
s a
) h a
Information displayed in graphs and tables
Summary information with drilldown capability to relevant details ฺ c o m
i d eฺ
User-selected home page from a predefined set or based on any page in n
i foconsole
the G u
Menu-driven navigation na den t
c a
Global target search
@ ar s Stu
thi
History and favorites
Customizable target home pages (per-user basis) haq
l e
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 49 of 812
Oracle-Supplied User Accounts

User types for Oracle Database include:


Database administrators
Security officers
Network administrators
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Application administrators
Database users
Oracle supplies the following user accounts:
Administrative user accounts (SYS, SYSTEM, SYSBACKUP, SYSDG, SYSKM,
SYSRAC, SYSMAN, and DBSNMP)
Sample schema user accounts (HR)
Internal user accounts
s a
Users are common versus local: a
)h ฺ
CDB common user m
Application common user f o ฺco uide
n a in nt G
rc Stud
Local user a e
a
@ his
a q
ฺ u lh se t
m ad to u
( s a nse
H a q l i ce
Oracle Database Userl Types ble
a dtheirUrolesfeand
ra responsibilities depend on the database site. A small site can have one
am twho
The types of users and
s
nadministers the database for application developers and users. A very large site can find
aduties
S
database administrator
- r
specialization. no
n
it necessary to divide the of a database administrator among several people and among several areas of

Database Administrators: Each database requires at least one database administrator (DBA). An Oracle
Database system can be large and can have many users. Therefore, database administration is sometimes not
a one-person job, but a job for a group of DBAs who share responsibility.
Security Officers: In some cases, a site assigns one or more security officers to a database. A security officer
enrolls users, controls and monitors user access to the database, and maintains system security.
Network Administrators: Some sites have one or more network administrators. A network administrator, for
example, administers Oracle networking products, such as Oracle Net Services.
Application Administrators: An Oracle Database site can assign one or more application administrators to
administer a particular application. Each application can have its own administrator.
Database Users: Database users interact with the database through applications or utilities.

Oracle-Supplied User Accounts


Oracle supplies several predefined user accounts in an Oracle Database:

Administrative user accounts are created so that you can administer the database: SYS, SYSTEM, SYSBACKUP,

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 50 of 812
SYSDG, SYSKM, SYSRAC, SYSMAN, and DBSNMP. The SYSMAN account gets created if you register the database
to Cloud Control during installation, and is used to perform Cloud Control administration tasks. The
management agent of Cloud Control uses the DBSNMP account to monitor and manage the database. You must
not delete these accounts.
Sample schema user accounts are used for examples in Oracle Database documentation and instructional
materials, for example, the HR account. You must unlock this type of account and reset its password before
using it.
Internal user accounts are created specifically for Oracle Database features and components. You must not
delete internal accounts, and you must not attempt to log in with them.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Common Versus Local Users


In a CDB, a user account is either common or local:

A CDB common user is a database account that is created in the root container and is inherited by all PDBs in
the CDB, including future PDBs and all application containers. A common user cannot have the same name as
any local user across all of the PDBs. All Oracle-supplied administrative user accounts, such as SYS and
SYSTEM , are common users. Other than Oracle-supplied administrative accounts, all common user account
names start with a user-defined prefix, such as C##; for example, C##JODY.
An application common user is a database account that is created in an application root and is inherited by all
s a
common user is not inherited in the root container. ) h a
the application PDBs associated to the application root (including future application PDBs). An application

ฺ c o m
i d eฺ
A local user is a database user that is created in a specific PDB. You can create the same account and
password in more than one PDB.
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 51 of 812
Querying the Oracle Data Dictionary
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

s a
)h ฺa
m
f o ฺco uide
n a in nt G
a rca Stude
a q @ his
ฺ u lh se t
m ad to u
( s a nse
H aq eoflithe
The Oracle data dictionary is the metadata cedatabase and contains the names and attributes of all objects in the
database. The creation or U l abofl any object causes an update to the data dictionary that reflects those
modification

m adusing
changes. This information f erin theviews
is stored
s base tables that are maintained by the Oracle Database server, but you
Sa -tran
access these tables by predefined rather than reading the tables directly.

non
The data dictionary:

Is used by the Oracle Database server to find information about users, objects, constraints, and storage
Is maintained by the Oracle Database server as object structures or definitions are modified
Is available for use by users to query information about the database
Is owned by the SYS user
Should never be modified directly using SQL

CDB_, DBA_, ALL_, and USER_ Views


The view prefixes, as shown in the diagram above, indicate the data (and how much of that data) a given user can
see.

CDB_ views contain metadata for all objects in a CDB across all PDBs.
DBA_ views contain metadata for all objects in a container or PDB.
ALL_views contain metadata for objects that the current user is privileged to see, whether the user owns them
or not. For example, if USER_A has been granted access to a table owned by USER_B, then USER_A sees that
table listed in any ALL_ view dealing with table names.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 52 of 812
USER_ views contain metadata for all objects owned by the current user; that is, objects that are present in the
user's own schema.

Only USER_ and ALL_ views are available to any user. The CDB_ and DBA_ views are restricted to DBA accounts.

Generally, each view set is a subset of the higher-privileged view set, row-wise and column-wise. Not all views in a
given view set have a corresponding view in the other view sets. It depends on the nature of the information in the
view. For example, there is a DBA_LOCK view, but no ALL_LOCK view, because only a DBA would have interest in
data about locks. Be sure to choose the appropriate view set to meet the need that you have. If you have the privilege
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

to access the DBA views, you still may want to query only the USER_ version of the view because the results show
information on objects that you own and you may not want other objects to be added to your result set.

The CDB_ and DBA_ views can be queried only by users with the SYSDBA or SELECT ANY DICTIONARY privilege,
or SELECT_CATALOG_ROLE role, or by users with direct privileges granted to them. Many applications require grants
to one or more individual dictionary views.

s a
) h a
ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 53 of 812
Summary for Lesson 1

In this lesson, you should have learned how to:


Describe Oracle Database and its editions
Explain the general structure of a relational database model
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Describe SQL and PL/SQL


Describe the architecture of a multitenant Oracle Database
Connect to an Oracle Database by using OS authentication and Easy Connect
Syntax
Describe the main Oracle Database tools
Describe the Oracle-supplied user accounts for Oracle Database
Query the data dictionary in an Oracle Database

s a
) h a
ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 54 of 812
Practice 1 Overview

1-1: Exploring a CDB with SQL*Plus


1-2: Exploring a PDB with SQL*Plus
1-3: Exploring a CDB and PDB with EM Express
1-4: Getting Started with SQLcl
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

s a
) h a
ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 55 of 812
Practice 1-1 Exploring a CDB

Overview
In this practice, you learn how to do the following things:

Set the Oracle environment variables


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

Get connected to the root container by using SQL*Plus


Query the data dictionary to view information about the containers, data files, users, instance, and services in a
CDB
List the services created automatically for each container

Tip:

Some things to remember when you want to query the data dictionary for multiple PDBs or the whole CDB:

a
Log in to the root container as a common user. A CDB common user is a database account that is
s
created in the root container and is inherited by all PDBs in the CDB.
Query container data objects, such as views whose names begin with V$ and CDB_.
a
)h ฺ
m
f o ide:
ฺco uGuide
n a in nt G
For more information, refer to the following sections in Oracle Database Administrator's

r a CDB
About Viewing Information When the Current Container iscthe
t u de
Root
Viewing Information About the Containers in a CDB a S
q @ h i s
ฺ u
In some of the steps below, you will format columnslhaby using
s e t
the COLUMN command. For example, applying
a
the format A55 specifies an alphabetic format o u wide. Format 999 is an example of a numeric
d of 55tcharacters
s
format. See COLUMN in SQL*Plus User's m
a Guide e Reference.
sand
(
q in uppercasee n
H aare e l ic and variables are in lower case. Any commands that you need
l ab
Commands in the practices
to enter are bolded,U
l
er
for example:
a d f
a m s
an FROM hr.departments;
SQL>SSELECTtrregions
-
non

Assumptions
You are logged in to VM1 as the oracle user. VM1 is one of your two virtual machines that you will use throughout
this course to complete the practices. Its host name is 12cr2db.

Tasks
Complete the following steps on VM1.

1. Set the Oracle environment variables. You need to set these each time you open a new terminal window.
a. In a new terminal window, list the search path that holds the oraenv script.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 56 of 812
$ which oraenv

/usr/local/bin/oraenv
$

b. Source the oraenv script. The dot in the command means to do a source operation. Oraenv sets the
required environment variables needed for you to connect to your database instance. For example, it
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

sets the ORACLE_SID and ORACLE_HOME environment variables and includes the
$ORACLE_HOME/bin directory in the PATH environment variable setting. Environment variables that
this script sets will persist in the terminal window until you close it. Don't forget to put a space after the
dot. For the ORACLE_SID value, enter ORCL.

$ . oraenv
ORACLE_SID = [oracle] ? ORCL

The Oracle base has been set to /u01/app/oracle


$

s a
c. View the environment variables set by the oraenv command that you just ran.
)h ฺ a
m
$ set | grep ORACLE
f o ฺco uide
n a in nt G
rca Stude
OLD_ORACLE_BASE=
ORACLE_BASE=/u01/app/oracle a
@ his
q
ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1
a
ORACLE_SID=ORCL
ฺ u lh se t
$
m ad to u
s
Therefore, remember, that(each
a time from
e n sethis point on, when you open a terminal window, you will need
q to set
to source the oraenvascript l icthe environment variables for your CDB.
H
l ab l e
dU
2. Connect to thearoot
f erby using SQL*Plus.
container
m s
a tranand log in to the root container of your CDB as the SYS user with the SYSDBA privilege.
a. S
In n
the n-
Start SQL*Plus
ocommand below, you must use lowercase letters for sqlplus.
You can connect to a database without a password when you have a local connection (on the same
machine) and the current operating system user is a member of the privileged OSDBA group. On VM1,
the OSDBA group is named dba, and the user oracle is a member of that group. Because you are
currently connected to the operating system as the oracle user, you can connect to the database as
the SYS user without a password. Including as sysdba in the command enables you to perform all
administrative tasks in the database. For example, you can create, drop, open, mount, start up, and shut
down a database.

$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Thu Jul 14 19:42:08 2016


Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 -
64bit Production
SQL>

b. Verify that you are logged in to the root container as the SYS user by using the SHOW user command.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 57 of 812
b.
The SHOW command is a tool-specific command, and is supported in SQL*Plus, SQL*Developer, and
SQLcl. It is not SQL language, does not appear in any SQL Language reference manuals, and is not
available to any tool or utility that relies on the SQL Language like Toad or within PL/SQL programs or
Java programs. For this example and others that follow, you could use SQL instead of the SHOW
command, if desired.

SQL> SHOW user


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

USER is "SYS"
SQL>

3. View information about the containers in your CDB.

a. Show the current container name. Because you're currently connected to the root container, the name
should be CDB$ROOT.

SQL> SHOW con_name

s a
CON_NAME
------------------- )h ฺ a
m
ฺco uide
CDB$ROOT
SQL>
f o
in nt G
n a e
b. Show the current container id.
a rcthea id S
Because you're currently connected to the root container, tudbe 1.
should
a q @ his
ฺ u lh se t
ad to u
SQL> SHOW con_id

s m
a nse
CON_ID
q ( c e
------------------
H a l i
1
SQL> d U
l able
m a s f er
c. S a thattyou
Verify
- r ando indeed have a container database, as opposed to a non-container database by
noinnthetheCDB
querying
listed
V$DATABASE view. The name ORCL should be listed in the NAME column, YES should be
column, and the ID should be 0 (zero). A value of zero is used for rows containing data
that pertain to the entire CDB. This value is also used for rows in non-CDBs.

SQL> SELECT name, cdb, con_id FROM v$database;

NAME CDB CON_ID


--------- --- ----------
ORCL YES 0
SQL>

d. Show the version of your Oracle Database by querying the V$VERSION view. This view displays version
numbers of core library components in the Oracle Database. The results should indicate that your
database is version 12.2.0.1.0.
Tip: If you're ever confused about whether you're connected to VM1 or VM2 in the classroom, VM1 has
a 12.2 database installed, whereas VM2 has a 12.1 database.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 58 of 812
SQL> SELECT banner FROM v$version;

BANNER
------------------------------------------------------------------
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0
- 64bit Production
PL/SQL Release 12.2.0.1.0 - Production
CORE 12.2.0.1.0 Production
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

TNS for Linux: Version 12.2.0.1.0 - Production


NLSRTL Version 12.2.0.1.0 - Production
SQL>

e. List all the containers in your CDB by querying the V$CONTAINERS view. The results should list three
containers - the root container (CDB$ROOT), the seed PDB (PDB$SEED), and PDB1.

SQL> COLUMN name FORMAT A8


SQL> SELECT name, con_id FROM v$containers ORDER BY con_id;

s a
NAME CON_ID
-------- ---------- )h ฺ a
m
CDB$ROOT 1
f o ฺco uide
PDB$SEED
PDB1
2
3
n a in nt G
SQL>
a rca Stude
a q @ Thehiquery
s should list two PDBs - the seed PDB (
f. List the PDBs in the CDB by using the SHOW command.
l h e t
PDB$SEED) and PDB1.
Note: You can also list PDBs by querying a dฺuthetV$PDBS
o us view.
s m seabout the open mode of each PDB and whether the PDB is
ainformation
The SHOW command includes
(
q for a lPDB c n
edetermines
H a
restricted. The open mode
e i what type of activities a PDB will allow at that time, for
example, queries
U l and data
b l
changes. See About the Open Mode of a PDB in Oracle Database

a d Guide
Administrator's
f e rforadefinitions of each open mode. PDB$SEED is in READ ONLY mode and PDB1 is
am
in READ WRITE s
mode.
an column indicates whether only users possessing the RESTRICTED SESSION
S
The
- t r
RESTRICTED

non can connect to the PDB.


privilege

SQL> SHOW pdbs;

CON_ID CON_NAME OPEN MODE RESTRICTED


------ --------------------- ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 READ WRITE NO
SQL>

g. View the status of all PDBs in the CDB by querying the CDB_PDBS view.
The status of a PDB describes the state of the PDB; for example, if the PDB is new, but never opened (
NEW), or if it is available and ready for use (NORMAL). See DBA_PDBS in the Oracle Database Reference
Guide for definitions of each status.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 59 of 812
SQL> COLUMN pdb_name FORMAT A8
SQL> SELECT pdb_name, status FROM cdb_pdbs ORDER BY 1;

PDB_NAME STATUS
---------- ------
PDB$SEED NORMAL
PDB1 NORMAL
SQL>
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

4. View information about the data files in your CDB.

a. List all the data files in the CDB (for the root container and all PDBs) by querying the CDB_DATA_FILES
view. The order of your results may vary.
A data file is a physical storage structure, and each data file is associated with only one tablespace.
Multiple data files might constitute a single tablespace.

SQL> COLUMN file_name FORMAT A50


SQL> COLUMN tablespace_name FORMAT A10
s a
SQL> SELECT file_name, tablespace_name FROM cdb_data_files;
) h a
FILE_NAME
c o m
TABLESPACE
ฺ i d eฺ
--------------------------------------------------fo
i n G
----------u
a USERS n t
/u01/app/oracle/oradata/ORCL/users01.dbf can d e
/u01/app/oracle/oradata/ORCL/undotbs01.dbf
@ ar s Stu UNDOTBS1
/u01/app/oracle/oradata/ORCL/system01.dbf
l h aq e thi SYSTEM

/u01/app/oracle/oradata/ORCL/sysaux01.dbf
d u u s SYSAUX
a t
/u01/app/oracle/oradata/ORCL/PDB1/undotbs01.dbf
m o UNDOTBS1
s a nse
/u01/app/oracle/oradata/ORCL/PDB1/sysaux01.dbf
(
SYSAUX

a q l i c e
/u01/app/oracle/oradata/ORCL/PDB1/system01.dbf SYSTEM
l H ble
/u01/app/oracle/oradata/ORCL/PDB1/users01.dbf USERS
SQL>
a d U fera
S
b. List
r ns in the CDB (for both the root container and all the PDBs) by querying the
aallmthettablespaces
a
- and V$TABLESPACE views. In the SQL statement below, the FROM clause includes short
nonfor the table names. For example, the alias for V$DATAFILE is d. When you query multiple
V$DATAFILE
aliases
tables, you must identify the table for each column by prefixing the columns with either the full table
name or the short alias name. In this example, notice that aliases are used in the SELECT and WHERE
clauses.
A tablespace is a logical storage structure that consists of one or more data files. The V$TABLESPACE
and V$DATAFILE views both contain tablespace information from the control file.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 60 of 812
SQL> COL name FORMAT A12
SQL> SELECT d.file#, ts.name, ts.ts#, ts.con_id
FROM v$datafile d, v$tablespace ts
WHERE d.ts#=ts.ts# AND d.con_id=ts.con_id
ORDER BY 4;

FILE# NAME TS# CON_ID


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

3 SYSAUX 1 1
1 SYSTEM 0 1
4 UNDOTBS1 2 1
7 USERS 4 1
5 SYSTEM 0 2
6 SYSAUX 1 2
8 UNDOTBS1 2 2
9 SYSTEM 0 3
10 SYSAUX 1 3
11 UNDOTBS1 2 3
12 USERS 4 3
s a
11 rows selected.
SQL>
a
)h ฺ
m
f o ฺco uide
inquerying
c. List all temp files in the CDB (for the root container and all PDBs) by
a n t G CDB_TEMP_FILES
the
view. n de Oracle Database uses
ca ttablespace.
a rtemporary
A temp file is a special data file that is associated witha u
S tasks that are best not done in
q
temporary tablespaces to store global temporary tables@ h s
and ito perform
lha sa ecomplex
memory like sorting a large result set or performing
ฺ u
t query join.
m ad to u FROM cdb_temp_files;
SQL> SELECT file_name,
( s a nse
tablespace_name

H aq e lice
FILE_NAME
U l abl TABLESPACE

a d f e r
-------------------------------------------------- ----------

am trans
S/u01/app/oracle/oradata/ORCL/temp01.dbf TEMP
-
non
/u01/app/oracle/oradata/ORCL/PDB1/temp01.dbf TEMP
SQL>

d. List all the redo log files in the CDB (for the root container and all PDBs) by querying the V$LOGFILE
view.

The redo log for a database consists of two or more redo log files. The database requires a minimum of
two files to guarantee that one is always available for writing while the other is being archived (if the
database is in ARCHIVELOG mode). The Log Writer process (LGWR) writes to redo log files in a circular
fashion. When the current redo log file fills, LGWR begins writing to the next available redo log file. When
the last available redo log file is filled, LGWR returns to the first redo log file and writes to it, starting the
cycle again.
The CON_ID values in the query below are equal to zero below because the redo log files exist for the
whole instance and not for particular containers.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 61 of 812
SQL> COLUMN member FORMAT A42
SQL> SELECT group#, member, con_id FROM v$logfile;

GROUP# MEMBER CON_ID


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

3 /u01/app/oracle/oradata/ORCL/redo03.log 0
2 /u01/app/oracle/oradata/ORCL/redo02. log 0
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

1 /u01/app/oracle/oradata/ORCL/redo01. log 0
SQL>

e. List the control files in the CDB by querying the V$CONTROLFILE view. There should be two -
control01.ctl and control02.ctl.
A database control file is a small binary file necessary for the database to start and operate successfully.
A control file is associated with only one Oracle Database. DBCA creates two control files when it
creates a CDB. Both files are very active while the database is running.
The CON_ID values in the query below are equal to zero because the control files exist for the whole
instance and not for particular containers.
s a
SQL> COLUMN name FORMAT A55 )h ฺ a
m
SQL> SELECT name, con_id FROM v$controlfile;
f o ฺco uCON_IDide
NAME
a G
in nt----------
-------------------------------------------------------
c n
a tude
a r S
/u01/app/oracle/oradata/ORCL/control01.ctl
q
a et@
/u01/app/oracle/fast_recovery_area/ORCL/control02.ctl h i s 0
0
u l h
dฺ to us
SQL>
a
s
5. View information about the pre-created
( amusersninsyour
e CDB.
e
q in thelicCDB by querying the CDB_USERS view.
ausers
H leuser that has the same identity in the root container and in every existing
lis a database
a. List only the common
b
U a
adPDB. Every ercommon user can connect to and perform operations within the root container,
A common user
m
and future s f
S
andawithintany
- r anPDB in which it has privileges. Every common user is either Oracle-supplied or
non
user-created. Examples of Oracle-supplied common users are SYS and SYSTEM.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 62 of 812
SQL> SET PAGES 140
SQL> SELECT DISTINCT username FROM cdb_users WHERE common ='YES' ORDER BY
1;

USERNAME
--------------------------
ANONYMOUS
APPQOSSYS
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

AUDSYS
CTXSYS
DBSFWUSER
DBSNMP
DIP
DVF
DVSYS
FLOWS_FILES
GGSYS
GSMADMIN_INTERNAL
GSMCATUSER
s a
GSMUSER
LBACSYS ) h a
MDDATA
ฺ c o m
i d eฺ
MDSYS
i n fo t Gu
OJVMSYS
OLAPSYS
c a na den
ORACLE_OCM
@ ar s Stu
ORDDATA
l h aq e thi
dฺu to us
ORDPLUGINS
ORDSYS
a
OUTLN
( s am nse
aq e lice
REMOTE_SCHEDULER_AGENT
H
SI_INFORMTN_SCHEMA
l abl
U
SPATIAL_CSW_ADMIN_USR
ad sfer
SYS
m
Sa -tran
SYS$UMF

non
SYSBACKUP
SYSDG
SYSKM
SYSRAC
SYSTEM
WMSYS
XDB
XS$NULL
36 rows selected.
SQL>

b. List all the users in every PDB in the CDB by querying the CDB_USERS view. In the results, notice that
the SYS, SYSTEM, HR (for the sample data), and PDBADMIN user accounts are listed for PDB1. The root
container's id is 1 and PDB1's id is 3. PDB$SEED is an Oracle-managed template database for default
provisioning. For this reason, it is ignored/filtered in the management views. Note: The order of your
results may differ than the results below.

SQL> COLUMN username FORMAT A25

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 63 of 812
SQL> SELECT con_id, username FROM cdb_users;

CON_ID USERNAME
---------- -------------------------
1 SYS
1 SYSTEM
1 XS$NULL
1 OJVMSYS
1 LBACSYS
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

1 OUTLN
1 SYS$UMF
1 DBSNMP
1 APPQOSSYS
1 GGSYS
1 ANONYMOUS
1 CTXSYS
1 SI_INFORMTN_SCHEMA
1 DVSYS
1 DVF
1 GSMADMIN_INTERNAL
s a
1
1
ORDPLUGINS
MDSYS
) h a
1 OLAPSYS
ฺ c o m
i d eฺ
1 ORDDATA
i n fo t Gu
na den
1 XDB
1 WMSYS
c a
1 ORDSYS
@ ar s Stu
1
aq e thi
GSMCATUSER
l h
dฺu to us
1 MDDATA
1
a SYSBACKUP
1
( s am nseREMOTE_SCHEDULER_AGENT

aq e lice
1 DBSFWUSER
H 1
l abl
GSMUSER
U 1 SYSRAC

m ad sfer1 AUDSYS

Sa -tran 1 DIP

non
1 SYSKM
1 ORACLE_OCM
1 SYSDG
1 SPATIAL_CSW_ADMIN_USR
3 SYS
3 SYSTEM
3 XS$NULL
3 LBACSYS
3 OUTLN
3 DBSNMP
3 APPQOSSYS
3 GGSYS
3 ANONYMOUS
3 HR
3 CTXSYS
3 SI_INFORMTN_SCHEMA
3 DVSYS
3 DVF
3 GSMADMIN_INTERNAL
3 ORDPLUGINS

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 64 of 812
3 MDSYS
3 OLAPSYS
3 ORDDATA
3 XDB
3 WMSYS
3 ORDSYS
3 GSMCATUSER
3 MDDATA
3 SYSBACKUP
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

3 REMOTE_SCHEDULER_AGENT
3 DBSFWUSER
3 PDBADMIN
3 GSMUSER
3 SYSRAC
3 OJVMSYS
3 AUDSYS
3 DIP
3 SYSKM
3 ORACLE_OCM
3 SYS$UMF
s a
3
3
SYSDG
SPATIAL_CSW_ADMIN_USR )h ฺa
m
ฺco uide
SQL>
f o
in nt G
n a
rca Stude
6. View information about the database instance and the services.
a
@ container
a q
a. View the database instance name, its status, and which
t h is, which
database it is associated with by

ฺ u lh se
querying the V$INSTANCE view. The instance's status is OPEN means users can access the CDB
and PDB.
m ad to u
( s e se con_id FROM v$instance;
a nstatus,
aq e lic
SQL> SELECT instance_name,
H
l aSTATUS b l
d U
INSTANCE_NAME
r CON_ID

a ma ansfe OPEN
---------------- --------- ----------
SSQL> -tr
ORCL 0

non
b. List the services for all the containers in the CDB by querying the V$SERVICES view. The query returns
the following five services. The PDB$SEED service is not listed because no one should connect to it and
no operation should be performed with it. It is reserved as a template to create other PDBs.

a. ORCLXDB: This is an internal service for Oracle XMLDB (XDB). You use Oracle XML DB to store,
generate, manipulate, manage, and query XML data in the database. Oracle Enterprise Manager
Express 12c is developed using Oracle XML DB.
b. ORCL.example.com: This is the service for the CDB.
c. SYS$USERS: This internal service is for user sessions that are not associated with services.
d. SYS$BACKGROUND: This internal service is used by Oracle background processes only.
e. pdb1.example.com: This is the service for the PDB.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 65 of 812
SQL> SELECT con_id, name FROM v$services ORDER BY 1;

CON_ID NAME
---------- -----------------------------------------
1 ORCLXDB
1 ORCL.example.com
1 SYS$USERS
1 SYS$BACKGROUND
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

3 pdb1.example.com
SQL>

7. Exit SQL*Plus and close the terminal window.

SQL > EXIT

Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 -


64bit Production
$
s a
) h a
ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 66 of 812
Practice 1-2 Exploring a PDB

Objectives
In this practice, you learn how to do the following things:

Connect to a PDB indirectly through a CDB


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

Query the data dictionary to view information about data files, temp files, and users in a PDB
Connect to a PDB directly by using the Easy Connect syntax

Note: Some of the results in the Tasks section have been formatted for easier viewing.

Tip:

To find data dictionary information specific to a root container or a PDB:

Query DBA_ views to return container-specific information.


s a
) h a
When you're logged into a PDB, queries against the data dictionary return information about that PDB
only, regardless of the view you query. For example, you'll get the same results if you query
ฺ c o m
i d eฺ
DBA_DATA_FILES or its corresponding CDB_DATA_FILES view, even though CDB_DATA_FILES
i n fo t Gu contains more data than DBA_DATA_FILES.

c a na den When queried from a PDB, the DBA_PDBS view returns the information related to the PDB to which

@ ar s Stu you are connected. When queried from the root container, the DBA_PDBS view describes all PDBs
belonging to a given CDB.
l h aq e thi
a dฺu to us
Assumptions
( s am nse
aq euser.lice
You are logged in to VM1 as the oracle
H
U l abl
Tasks
m ad sfer
Compete theS
a r anon VM1.
following-tsteps

1. Connect n
on
to PDB1 indirectly through the root container.

a. Open a new terminal window and source the oraenv script. For the ORACLE_SID value, enter ORCL.

$ . oraenv
ORACLE_SID = [oracle] ? ORCL

The Oracle base has been set to /u01/app/oracle


$

b. Start SQL*Plus and connect to the root container as the SYS user with the sysdba privilege.
Oracle allows any DBA group user at the operating system level to log into SQL*Plus without any
authentication.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 67 of 812
$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Fri Jul 15 19:17:37 2016


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

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit
Production
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

SQL>

c. Verify that PDB1 is open. After DBCA creates a PDB, it opens it automatically. The results below indicate
that PDB1's open mode is READ WRITE, which means PDB1 is open.
PDB users with the SYSDBA, SYSOPER, SYSBACKUP, SYSDG, SYSKM, or SYSRAC privilege can connect to
a closed PDB; however, all other PDB users can connect only when the PDB is open.
Note: You'll learn more about open modes in Opening and Closing PDBs in Lesson 2.

SQL> COLUMN con_id FORMAT 999


SQL> COLUMN name FORMAT A10
s a
SQL> SELECT con_id, name, open_mode FROM v$pdbs;
)h ฺ a
m
CON_ID NAME OPEN_MODE
f o ฺco uide
------ ---------- ----------
2 PDB$SEED READ ONLY
n a in nt G
3 PDB1 READ WRITE
a rca Stude
a q @ his
lh se t
SQL>
ฺ u u was MOUNTED in the previous step, then open it
adits opentomode
d. If PDB1 is closed for some reason and
m
s a nDATABASE
now by using the ALTER PLUGGABLE
( e se command.

H aq e lic
U l abl DATABASE PDB1 OPEN;
SQL> ALTER PLUGGABLE
d
mais already
s f er you will get the following message:
S -tran
If a
PDB1 open,

*n
on
ERROR at line 1:
ORA-65019: pluggable database PDB1 already open

e. Switch to PDB1.
When logged in to a CDB as an appropriately privileged user, you can use the ALTER SESSION
command to switch between containers within the CDB.

SQL> ALTER SESSION SET CONTAINER = PDB1;

Session altered.
SQL>

From this point on, your queries against the data dictionary will retrieve information for PDB1 only.

f. Verify that the container name is PDB1.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 68 of 812
f.

SQL> SHOW con_name

CON_NAME
----------------------------
PDB1
SQL>
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

2. Query the data dictionary to list the data files and temp files for PDB1. The results are formatted for easier
viewing.
Note: The steps below could be performed without switching containers by querying the CDB_DATA_FILES
view while displaying the CON_ID column.

a. List the data files for PDB1 and the tablespaces to which they belong by querying the DBA_DATA_FILES
view.

SQL> SELECT file_name, tablespace_name FROM dba_data_files;

FILE_NAME TABLESPACE_NAME
s a
----------------------------------------------------------------
) h a
m eฺ
/u01/app/oracle/oradata/ORCL/PDB1/undotbs01.dbf UNDOTBS1
/u01/app/oracle/oradata/ORCL/PDB1/sysaux01.dbf SYSAUX
ฺ c o i d
/u01/app/oracle/oradata/ORCL/PDB1/system01.dbf SYSTEM
i n fo t Gu
/u01/app/oracle/oradata/ORCL/PDB1/users01.dbf USERS
c a na den
SQL>
@ ar s Stu
aqto which i belong by querying the
ththey
l h
b. List the temp files for PDB1 and the tablespaces
e
DBA_TEMP_FILES view.
a dฺu to us
( s am n se
SQL> SELECT file_name,
a q l i c e
tablespace_name FROM dba_temp_files;

FILE_NAMEUl
H ble
d r a TABLESPACE_NAME

ma ansfe
----------------------------------------------------------------
a
/u01/app/oracle/oradata/ORCL/PDB1/temp01.dbf
SSQL> -tr TEMP

n on
c. List the local users for PDB1 by querying the DBA_USERS view.

SQL> SELECT DISTINCT username FROM dba_users WHERE common='NO';

USERNAME
----------------------------------------------
PDBADMIN
HR
SQL>

3. Make a direct connection to PDB1 by using the Easy Connect syntax.


The Easy Connect syntax enables you to connect to the PDB without 1) requiring a connection to the root
container, and 2) having to set up a net service name for the PDB. You'll learn how to set up net service names
later in the course.

a. Disconnect from the PDB.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 69 of 812
a.

SQL > DISCONNECT

Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0


- 64bit Production
SQL>

You are still in SQL*Plus, but no longer connected to the database as a user.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

b. Verify that you aren't connected as any user. The SHOW user command returns " ".

SQL> SHOW user

USER is ""
SQL>

c. Connect to PDB1 directly by using the Easy Connect syntax. See Appendix - Product-Specific
Credentials for the SYSTEM user password.

s a
SQL> CONNECT system/<password>@localhost:1521/PDB1.example.com a
)h ฺ
m
Connected.
f o ฺco uide
SQL>
n a in nt G
rcusing
d. Verify that you are now connected as the SYSTEM useraby
de user command again.
a thetuSHOW
@ i s S
q h
ฺ u lha se t
ad to u
SQL> SHOW user

s m
a nse
USER is "SYSTEM"
(
SQL>
H aq e lice
e. Exit SQL*PlusU
l athe b l terminal window.
ad sfer
and close
m
a EXIT an
SSQL> - t r
n on
Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0
- 64bit Production
$

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 70 of 812
Practice 1-3 Exploring a CDB and PDB with EM Express

Objectives
In this practice, you practice the following things:

Determine the HTTPS port number on which your CDB listens to Oracle Enterprise Manager Database
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Express (EM Express)


Enable the global port for your CDB so that you can start EM Express for a PDB
Start EM Express for your CDB
Start EM Express for PDB1
Explore the differences in the EM Express interface when connected to a CDB versus a PDB

Tip:

Although you can connect to EM Express by using the SYS account, Oracle recommends that you create a
a
named user account specifically for administering the Oracle database. This way, you can monitor database
s
)h ฺ a
activity. For now, however, you'll log in with the SYS account. To back up, recover, or upgrade the database,
m
you must log in as a user with the SYSDBA or SYSBACKUP privilege.

f o ฺco uide
n a in nt G
Assumptions
a rca Stude
You are logged in to VM1 as the oracle user.
a q @ his
ฺ u lh se t
Tasks
m ad to u
Complete the following steps on VM1. (sa
e n se
H aqand source
e l icthe oraenv script. For the ORACLE_SID value, enter ORCL .
Ul rab
1. Open a new terminal window l
d
a ma ansfe
S -=tr[oracle] ? ORCL
$ . oraenv

non
ORACLE_SID

The Oracle base has been set to /u01/app/oracle


$

2. Determine the port number on which your CDB listens to EM Express.

a. Log in to SQL*Plus as the SYS user with the SYSDBA privilege.

$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Fri Jul 15 20:11:37 2016


Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit
Production
SQL>

b. Execute the DBMS_XDB_CONFIG.GETHTTPSPORT procedure to view the HTTPS port number

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 71 of 812
b.
automatically configured on your CDB by DBCA for EM Express. The query should return port 5500. A
value of zero indicates that an EM Express port is not configured and you'll need to manually configure
one. All communication between your CDB and EM Express is encrypted, by default. The DUAL table
has one column, DUMMY, defined to be VARCHAR2(1), and contains one row with a value X. Selecting
from the DUAL table is useful for computing a constant expression with the SELECT statement.
Note: You can execute the DBMS_XDB_CONFIG.GETHTTPPORT procedure to check for unencrypted
protocols being used. This is good for security audits and will return a port number of zero.

SQL> SELECT dbms_xdb_config.gethttpsport() FROM dual;


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

DBMS_XDB_CONFIG.GETHTTPSPORT()
------------------------------
5500
SQL>

3. Enable the global port for the CDB.

SQL> exec dbms_xdb_config.SetGlobalPortEnabled(TRUE);

s a
PL/SQL procedure successfully completed. ) h a
SQL>
ฺ c o ideฺ
m
i n fo t Gu
4. Exit SQL*Plus and close the terminal window.
c a na den
@ ar s Stu
aq e thi
SQL> EXIT

Disconnected from Oracle Databaseฺu


l h
a us
d 12ctoEnterprise Edition Release 12.2.0.1.0 -
64-bit Production
$ ( s am nse
H aq e lice
5. Start EM Express for alCDB. Tob dol this, open a Firefox web browser, and enter the URL
U a
r .
adentersthefeURL
https://localhost:5500/em
m
Sa EM -Express
The first time
messages.
you
t r an is a servlet
for EM Express in your web browser, your browser may display warning
built on top of Oracle XML DB. The Oracle XML DB default wallet has a
n
self-signed o n
certificate, and some existing browsers consider self-signed certificates as untrusted because they
are not signed by a trusted certificate authority. However, the self-signed certificate is still secure, as it ensures
that the traffic is encrypted between the Oracle XML DB server and the client (browser). Therefore, you'll need
to enter a security exception for the EM Express URL in your web browser.

6. If needed, enter a security exception for the EM Express URL. VM1 is set up so that you don't have to enter a
security exception.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 72 of 812
a. On the "This Connection is Untrusted" page is displayed, expand I Understand the Risks, and click
Add Exception.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

s a
a
)h ฺ
m
f o ฺco uide
n a in nt G
a rca Stude
q @defaulthsettings,
b. In the Add Security Exception dialog box, retain the
a is and click Confirm Security
t
Exception.
d ฺ ulh use
m a to
a
(s cens e
q
l Ha ble li
a d U fera
m s
Sa -tran
non

c.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 73 of 812
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ c. To the left of the URL, click the icon, and then click Allow and Remember.

s a
a
) h in ฺAppendix -
7. On the Login page for EM Express, enter the user name SYS and the password as m specified
Product-Specific Credentials. Leave the Container Name box empty. Select theฺc
o
as sysdbaid
e
f o u check box. Click
in log innast aGuser with the SYS DBA
a
Login. Remember, to manage a root container with EM Express, you must
n
rca Stude
privilege.
a
@ his
a q
ฺ u lh se t
m ad to u
( s a nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

8. View the EM Express Home page for the CDB. The Status column provides information about:

Up time duration
Instance type (single instance named ORCL; a CDB with 1 PDB)
Database version (12.2.0.1.0)
Database name (ORCL)
Instance name (ORCL)
Platform name (Linux x86 64-bit)
Host name (12cr2db)
Thread number (1)
Whether the archiver process is running or stopped (currently stopped)
Also notice that you can view configuration, storage, security, and performance information.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 74 of 812
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

s a
a
)h ฺ
m
f o ฺco uide
9. Click the tabs and menus to review the interface.
n a in nt G
10. In the upper right corner, click Log Out.
a rca Stude
11. Start EM Express for PDB1. To do this, on the Login a q @for EMhExpress,
is enter the user name SYS and the
l h page
e t
ฺu Credentials
password as specified in Appendix - Product-Specific
the as sysdba check box. Click Login. ad
u s . Enter PDB1 as the container name. Select
m se t o
s a
a q ( licen
U l H able
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 75 of 812
12. View the EM Express Home page for PDB1. Notice that in the upper left corner, the Home page identifies the
container as PDB1. In the Status column you have a field named Container Name, which also indicates the
container to which you are currently connected is PDB1.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

s a
) h a
ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
13. Browse the Configuration, Storage, Security, and Performance
l h hi
aq e tmenus.
a
14. Click Log Out and close the browser window.dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 76 of 812
Practice 1-4 Getting Started with SQLcl

Overview
In this practice, you launch SQLcl and using a simple query, experiment with different output formats.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Assumptions
You are currently logged in to VM1 as the oracle user.

Tasks
Complete the following steps on VM1.

1. Open a new terminal window and source the oraenv script. For the ORACLE_SID value, enter ORCL.

$ . oraenv
ORACLE_SID = [oracle] ? ORCL s a
) h a
The Oracle base has been set to /u01/app/oracle
ฺ c o m
i d eฺ
$
i n fo t Gu
2. Change to the directory where the SQLcl executable resides.
c a na den
@ ar s Stu
$ cd $ORACLE_HOME/sqldeveloper/sqlcl/bin
l h a q
e t hi
$
a dฺu to us
( s am nse
aq e lice
3. List the files in the current directory.
H
U l abl
$ ls
m ad sfer
a transql.exe
sql S sql.bat -
$ non
4. Allow everyone to be able to read and execute the sql file.

$ chmod 755 sql


$

5. Make sure that you're running Java version 8 or more. Look for a 1.8 version or newer version in the results.

$ java -version

java version "1.8.0_101"


Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
$

6.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 77 of 812
6. Launch SQLcl and connect directly to PDB1 as the system user. See Appendix - Product-Specific Credentials
for the password.

$ sql system/<password>@localhost:1521/PDB1.example.com

SQLcl: Release 12.2.0.1.0 RC on Tue Nov 22 20:21:53 2016


Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

SQL>

Note: Alternatively, you can launch SQLcl, log in to the CDB, and then switch to PDB1:

$ ./sql

SQLcl: Release 12.2.0.1.0 RC on Tue Nov 22 20:21:53 2016


Copyright (c) 1982, 2016, Oracle. All rights reserved.
Username? (' '?)system
Password? (**********?) <password>
s a
Connected to: ) h a
ฺ c m
i d eฺ
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - o64bit Production

i n fo t Gu
SQL> ALTER SESSION SET CONTAINER = PDB1;
c a na den
Session altered.
@ ar s Stu
SQL>
l h aq e thi
7. Show the container name. a dฺu to us
( s am nse
SQL> SHOW con_name
H aq e lice
U l abl
CON_NAME
m ad sfer
an
------------------------
PDB1Sa r
- t
non
SQL>

8. View the list of commands that you can use in SQLcl. You'll see a lot of SQL commands that are also available
in SQL*Plus, plus several new ones (these are underlined and bolded).

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 78 of 812
SQL> help

For help on a topi type help <topic>


List of Help topics available:
/
@
@@
ACCEPT
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

ALIAS
APEX
APPEND
...
SQL>

9. Generate the DDL for the LOCATIONS table.

SQL> ddl hr.locations


s a
CREATE TABLE "HR"."LOCATIONS"
)h ฺa
m
ฺco uide
( "LOCATION_ID" NUMBER(4,0),
"STREET_ADDRESS" VARCHAR2(40),
f o
in nt G
...
n a
rca Stude
SQL>
a
@ddl hcommand.
10. You can affect how the DDL is formatted by using the q
a set
t is This command shows you all the
different flags.
d ฺ ulh use
m a to
SQL> HELP set ddl a
(s cens e
SET DDL [[ PRETTY H
q li
| aSQLTERMINATOR
U l b l e | CONSTRAINTS | REF_CONSTRAINTS |

a d f e ra
CONSTRAINTS_AS_ALTER|OID | SIZE_BYTE_KEYWORD | PARTITIONING |

SQL> am
...
s
S -tran
11. Create an on query against the HR schema. By default, SQLcl uses the same column formatting as
simple
SQL*Plus. In the results below, the data is printed to the size of the column definitions.

SQL> SELECT first_name, last_name, salary, hire_date FROM hr.employees;

FIRST_NAME LAST_NAME SALARY HIRE_DATE


----------------------- ----------------------- ----------- ---------
Steven King 24000 17-JUN-03
Neena Kochhar 17000 21-SEP-05
...
107 rows selected.
SQL>

12. Show the SQL formatting style. Notice that the style is set to Default.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 79 of 812
SQL> SHOW sqlformat

SQL Format : Default


SQL>

13. Change the SQL formatting style to ansiconsole.


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

SQL> SET sqlformat ansiconsole

14. Rerun the query against the HR.EMPLOYEES table and observe the new formatting. The columns are fit to the
screen. You can use the Up arrow key to insert the SQL code.

SQL> SELECT first_name, last_name, salary, hire_date FROM hr.employees;

FIRST_NAME LAST_NAME SALARY HIRE_DATE


Steven King 24000 17-JUN-03
Neena Kochhar 17000 21-SEP-05
...
s a
SQL>
) h a
ฺ c o m
i d eฺ
15. You can also format the output as comma-separated values (CSV).
i n fo t Gu
c a na den
ar s Stu
SQL> SET sqlformat csv
@
16. Enter a forward slash to rerun the previous query. aq
l h e thi
a d ฺu us
t o
SQL> /
( s am nse
"FIRST_NAME", "LAST_NAME",
H a q "SALARY",
l i ce "HIRE_DATE"
Ul 17000, l e
rab 21-SEPT-05
"Steven", "King", 24000, 17-JUN-03
a d
"Neena", "Kochhar",
f e
...
SQL>S
am trans
n on-
17. Hide the column headers.

SQL> SET head off


SQL>

18. Rerun the query.

SQL> /

"Steven", "King", 24000, 17-JUN-03


"Neena", "Kochhar", 17000, 21-SEPT-05
...
SQL>

19. Set the formatting back to ansiconsole, set the page size, and rerun the query. Notice that there are 50 rows
per page.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 80 of 812
SQL> SET sqlformat ansiconsole
SQL> set pagesize 50
SQL> /

FIRST_NAME LAST_NAME SALARY HIRE_DATE


Steven King 24000 17-JUN-03
Neena Kochhar 17000 21-SEP-05
...
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

SQL>

20. View the history of queries that you have run so far on the database. Your list may be different than the list
below.

SQL> history

1 select name, cdb, con_id FROM v$database;


2 select name, cdb, con_id from v$database;
3 select name, cdb from v$database;
s a
4 alter session set container = PDB1
5 ddl hr.locations )h ฺ a
m
6 select first_name, last_name from hr.employees;
f o ฺco uide
7 select first_name, last_name, salary, hire_date from hr.employees;
SQL>
n a in nt G
a r ca tude
@ s S "h 2" will do the same thing as
21. Rerun one of the queries. In this example, query 2 is rerun. Note: Entering
i
q h
entering "history 2."
ฺ u lha se t
m ad to u
SQL> history 2
( s a nse
1 select name, cdb, acon_id
H
q l i ce
2* from v$database
U l able
SQL> / m
ad sfer
Sa -tran
NAME
n on CON_ID
CDB
ORCL YES 0
SQL>

22. Exit SQLcl.

SQL> EXIT

Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64


bit Production
$

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 81 of 812
Lesson 2 Managing Database Instances
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

2
Managing Database a s a
) h
Instances ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 82 of 812
Objectives for Lesson 2

After completing this lesson, you should be able to:


Describe initialization parameter files and initialization parameters
View and modify initialization parameters in SQL*Plus
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Start up and shut down Oracle Databases


Open and close PDBs
Work with the Automatic Diagnostic Repository (ADR)
Query dynamic performance views

s a
)h ฺa
m
f o ฺco uide
n a in nt G
a rca Stude
a q @ his
ฺ u lh se t
m ad to u
( s a nse
Now that you've had a chance to H aq aeCDB
explore l iceand PDB, you're ready to start manipulating them. One of the most
basic tasks you'll do is startU upl and shut
a b l your Oracle database because if it's not started up, you can't access
down
adto learn
the data in it. So therefore, it's atfe r time that you need to become familiar with the initialization parameter file. It's an
this
m n s
Sainside-antrainitialization
important file and useful early on because it determines how your system starts itself up and how your system

nonthe course.
operates. Also, parameter file are initialization parameters, and these parameters are discussed
and used throughout

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 83 of 812
Working with Initialization Parameters
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

s a
)h ฺa
m
f o ฺco uide
n a in nt G
a rca Stude
a q @ his
ฺ u lh se t
m ad to u
( s a nse
H a q l i ce
Initialization Parameterl Files ble
a d Uinstance,
f e rait reads instance configuration parameters (initialization parameters) from an
When you start a database
s
am tfilera(parameter
n
S
initialization parameter
directory by default.n-
file). On most platforms, parameter files are stored in the $ORACLE_HOME/dbs

no
You can use one of the following types of parameter files to start your database instance, as illustrated above:

Server parameter file (spfile): An spfile is a binary file that is written to and read by the database server. You
can't edit it manually. An spfile is preferred over a pfile because you can change initialization parameters with
ALTER SYSTEM commands in SQL*Plus and the changes persist when you shut down and start up the
database instance. It also provides a basis for self-tuning by Oracle Database. An spfile is automatically
created for you by Database Configuration Assistant (DBCA) when you create a CDB. It resides on the server
on which the Oracle instance is running. The default name of the spfile, which is automatically sought at
startup, is spfile<SID>.ora.
Text initialization parameter file (pfile): A pfile is a text file containing parameter values in name/value pairs,
which the database server can read to start the database instance. Unlike an spfile, the database server cannot
write to and alter a pfile. Therefore, to change parameter values in a pfile and make them persist during
shutdown and startup, you must manually edit the pfile in a text editor and restart the database instance to
refresh the parameter values. Your installation includes a sample pfile named init.ora in the default
directory for parameter files. You can use this file as a starting point for a pfile, or you can create a pfile from

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 84 of 812
the spfile. If you save your pfile as init<SID>.ora in the default directory, the database server will
automatically use it if an spfile is not available. If you save the pfile under a different name, you'll need to
specify it during startup.

Search Order for a Parameter File


The database server locates your parameter file by examining file names in the $ORACLE_HOME/dbs directory in the
following order:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

1. spfile<SID>.ora, where SID is the system ID and identifies the instance name (for example, ORCL)
2. spfile.ora
3. init<SID>.ora (pfile)

s a
) h a
ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 85 of 812
Initialization Parameters

Initialization parameters (parameters) do the following:


Set database limits
Set database-wide defaults
Specify files and directories
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Affect performance
Parameters can be of two types: basic or advanced.
Tune around 30 basic parameters to get reasonable database performance.
Example basic parameter: SGA_TARGET
Example advanced parameter: DB_CACHE_SIZE
Derived parameters calculate their values from the values of other parameters.
Example: SESSIONS is derived from PROCESSES.
s a
Some parameter values or value ranges depend on the host operating
h a system.
Example: DB_BLOCK_SIZE m) ฺ
f o ฺco uide
n a in nt G
a rca Stude
a q @ his
ฺ u lh se t
m ad to u
( s a nse
H a q l i ce
l able
About Initialization Parameters
U
m
Initialization parameters
s er set database limits, set database-wide defaults, specify files and directories,
ad(parameters)
f
Sa -trThe
and affect performance. anparameter file must, at a minimum, specify the DB_NAME parameter. All other
non
parameters have default values.

Types of Initialization Parameters


Parameters can be of two types: basic or advanced. In the majority of cases, you'll need to set and tune only the 30
or so basic parameters to get reasonable performance from the database. In rare situations, you'll need to modify one
or more of the 300 or so advanced parameters to achieve optimal performance. An example of a basic parameter is
SGA_TARGET, which specifies the total memory size of all SGA components. And example of an advanced parameter
is DB_CACHE_SIZE, which specifies the size of the default buffer pool.

Derived Parameters
Some parameters are derived, meaning their values are calculated from the values of other parameters. Normally,
you shouldn't alter values for derived parameters. But if you do, the value that you specify overrides the calculated
value. For example, the default value of the SESSIONS parameter is derived from the value of the PROCESSES
parameter. If the value of PROCESSES changes, the default value of SESSIONS changes as well, unless you override
it with a specified value.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 86 of 812
Parameter Values That Depend on the OS
Some parameter values or value ranges depend on the host operating system. For example, the
DB_FILE_MULTIBLOCK_READ_COUNT parameter specifies the maximum number of blocks that are read in one I/O
operation during a sequential scan; this parameter is platform dependent. The size of those blocks, which is set by
DB_BLOCK_SIZE, has a default value that depends on the operating system.

View:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Review the information about the following parameter. Oracle Database Reference is a good source of
information about parameters. In this example, you'll learn the parameter's datatype (string), syntax (
CONTROL_FILES = filename, [, filename]...), default value (operating system-dependent),
whether its modifiable (no), whether you can modify its value in a PDB (no), its range of values (1 to 8
filenames), whether it is a basic parameter (yes), and details for Oracle RAC (multiple instances must have
the same value).

CONTROL_FILES

s a
) h a
ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 87 of 812
Modifying Initialization Parameters

Modify parameters to set capacity limits or improve performance.


Use EM Express or SQL*Plus (ALTER SESSION or ALTER SYSTEM).
Query the V$PARAMETER view for a particular initialization parameter to learn
whether you can make:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Session-level changes (ISSES_MODIFIABLE column)


System-level changes (ISSYS_MODIFIABLE column)
PDB-level changes (ISPDB _MODIFIABLE column)
Use the SCOPE clause with the ALTER SYSTEM command to tell the system
where to update the system-level parameter:
MEMORY
SPFILE
s a
BOTH a
)h ฺ
DEFERRED o m e
f o ฺc uid
a i n n t G
n
a rca Stude
a q @ his
ฺ u lh se t
m ad to u
( s a nse
H a q l i ce
Using ALTER SESSION
U l or ALTERa b le SYSTEM Commands
m
You modify parametersadbecause s f eyour want to set capacity limits or improve performance. You can use the ALTER
SESSION or S a SYSTEM
ALTER
- t r ancommands in SQL*Plus to modify parameters. In your own environment, you'll likely
noninitialization parameters to keep your database running with good performance. You can also
only modify the basic
use EM Express to modify parameters. You'll learn how to do this in Practice 2-4 Modifying an Initialization Parameter
with EM Express.

Increasing the values of parameters may improve your system’s performance, but increasing most parameters also
increases the SGA size. A larger SGA can improve database performance up to a point. An SGA that is too large can
degrade performance if it is swapped in and out of memory. You should set operating system parameters that control
virtual memory working areas with the SGA size in mind. The operating system configuration can also limit the
maximum size of the SGA.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 88 of 812
Learning Before Modifying
Before modifying a parameter, you should query the V$PARAMETER view to learn about how you can modify a
parameter.

Information Column in the V$PARAMETER View Notes


about...
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Session-level The ISSES_MODIFIABLE column value You can change some parameters at the session level,
changes tells you whether you can change the but not all. Changes are applied to your current session
parameter for your current session ( immediately (dynamically) and expire when you end
TRUE) or not (FALSE) by using the your session.
ALTER SESSION command. Parameters with a value of TRUE are referred to as
session-level parameters.
Example: SQL> ALTER SESSION SET
NLS_DATE_FORMAT ='mon dd yyyy';

System-level The ISSYS_MODIFIABLE column value You can change all parameters at the system level by
changes tells you when a system-level change to using the ALTER SYSTEM command, and the change is
s a
)h ฺa
the parameter, made by using the
ALTER SYSTEM command, takes effect.
applied to all sessions.
Parameters with a value of FALSE are referred to as
m
IMMEDIATE means the change will f o ฺco uide static parameters. For static parameters, you need to
shut down and restart the database instance to
take effect immediately and be
n a in nt G implement the change. Also, the database instance
applied to all current sessions.
DEFFERED means the change will a rca Stude must have been started with an spfile.
Example: SQL> ALTER SYSTEM SET
a q @ his
lh se t
take effect in subsequent sessions. SEC_MAX_FAILED_LOGIN_ATTEMPTS=2
FALSE means the change will take
ฺ u SCOPE=SPFILE;
ad to u
effect in subsequent instances.
m
( s a nse
PDB-level H
The ISPDB_MODIFIABLEaq e columnl ice value In a non-CDB, the value of this column is NULL.
changes U l youabcanl (TRUE) or
tells you whether
can'ta(d
m f er the parameter
FALSE) modify
s
n
Sainside-taraPDB.
n on
Setting the Scope in the ALTER SYSTEM Command
Use the SCOPE clause with the ALTER SYSTEM command to tell the system where to update the system-level
parameter. This location dictates how long the change will stay in effect. Scope also depends on whether you started
the database instance using a pfile or an spfile. Scope can have the following values:

MEMORY: This value tells the system to make the parameter change in memory only. The change will take
effect immediately, but will not persist in subsequent sessions. If you started the database instance using a
pfile, then this is the only scope you can specify. This specification is not allowed for static parameters.

SPFILE: This value tells the system to make the parameter change in the spfile only. The change will take
effect immediate and will persist after you restart the database instance. This is the only scope allowed for
static parameters.

BOTH: This value tells the system to make the parameter change in both memory and in the spfile. The change
will take effect immediately and persist after you restart the database instance. If you started the database
instance using an spfile, then BOTH is the default.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 89 of 812
DEFFERED: This value tells the system to make the parameter change effective only for future sessions. This
specification is valid only for a small number of dynamic parameters, for example, AUDIT_FILE_DEST.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

s a
) h a
ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 90 of 812
Viewing Initialization Parameters

Ways to view initialization parameters in SQL*Plus:


Issue the SHOW PARAMETER command.
Example: Find information about all parameters whose names contain the
word 'para':
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

SQL> SHOW PARAMETER para

Query the following views:


V$PARAMETER
V$PARAMETER2
V$SPPARAMETER
V$SYSTEM_PARAMETER
s a
)h ฺa
m
f o ฺco uide
n a in nt G
a rca Stude
a q @ his
ฺ u lh se t
m ad to u
( s a nse
H a q l i ce
Issuing the SHOW PARAMETER
U l abCommandle
m ad PARAMETER
You can issue the SHOW s f er command in SQL*Plus to view information about an initialization parameter; for
example, viewS - t r andatatype and default value. For example, the following SHOW PARAMETER command
aaparameter's
n parameters whose names contain the word 'para.'
noabout
returns information

SQL> SHOW PARAMETER para

NAME TYPE VALUE


------------------------------------ ----------- ---------------------
cell_offload_parameters string
fast_start_parallel_rollback string LOW
parallel_adaptive_multi_user boolean TRUE
parallel_automatic_tuning boolean FALSE

Querying Views
You can also query the V$PARAMETER view in SQL*Plus to view information about an initialization parameter. For
example, the following query against the V$PARAMETER view returns information about parameters whose names
contain the word 'pool.'

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 91 of 812
SQL> SELECT name, value FROM v$parameter WHERE name LIKE '%pool%';

NAME VALUE
------------------------- ----------
shared_pool_size 0
large_pool_size 0
java_pool_size 0
streams_pool_size 0
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

shared_pool_reserved_size 15728640

9 rows selected.

Other views that contain parameter information include:

V$SPPARAMETER: Displays information about the contents of the spfile. If you didn't use an spfile to start the
database instance, each row of the view will contain FALSE in the ISSPECIFIED column.
V$PARAMETER2: Displays information about the parameters that are currently in effect for the session, with
each parameter value appearing as a row in the view. A new session inherits parameter values from the
s
database instance-wide values displayed in the V$SYSTEM_PARAMETER2 view. a
) h a
V$SYSTEM_PARAMETER: Displays information about the parameters that are currently in effect for the database
instance
ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 92 of 812
Starting Up Oracle Databases
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

s a
)h ฺa
m
f o ฺco uide
n a in nt G
a rca Stude
a q @ his
ฺ u lh se t
m ad to u
( s a nse
H aq instance,
Before users can connect to a database l i cea database administrator must start up the database server. To do
U
this, three tasks are required
a lein the diagram above): start the database instance, mount the database
l(as illustrated
b
adone
instance, and then open
m f er You can use the STARTUP command in SQL*Plus to perform all three tasks at
the database.
s
Sa -tran
once or to perform each separately.

1. Starting n ondatabase instance puts the database server in NOMOUNT mode. During this step, the Oracle
the
software reads an initialization parameter file, starts background processes, allocates memory to the SGA, and
opens the alert log and trace files.
2. Mounting the database instance puts the database server in MOUNT mode. During this step, the Oracle
software associates the database (CDB) with the previously started database instance, opens and reads the
control files that are specified in the initialization parameter file, and obtains the names and statuses of the data
files and online redo log files. No checks, however, are performed to verify the existence of the data files and
online redo log files at this time. Start up in MOUNT mode to perform some maintenance operations, such as
renaming data files and performing full database recoveries.
3. Opening the database puts the database in OPEN mode. The Oracle software opens the redo log files and
data files according to the list registered in the control files. Start up in OPEN mode to enable users to connect
to the database instance. PDBs are not, by default, started up when you open the database.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 93 of 812
Shutting Down Oracle Databases

Sometimes you need to shut down the database instance, for example, to
change a static parameter or patch the database server.
Use the SHUTDOWN command to shut down the database server in various
modes: ABORT, IMMEDIATE, TRANSACTIONAL, and NORMAL.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

ABORT IMMEDIATE TRANSACTIONAL NORMAL


Allows new connections No No No No

Waits until current sessions end No No No Yes

Waits until current transactions end No No Yes Yes

Forces a checkpoint and closes files No Yes Yes Yes

s a
)h ฺa
m
f o ฺco uide
n a in nt G
a rca Stude
a q @ his
ฺ u lh se t
m ad to u
( s a nse
H a q l i ce
IMMEDIATE Mode
U l able
m ad mode
A shutdown in IMMEDIATE s f eisrthe most typically used option.
S a tran
Current SQL n
o -
statements being processed by the database instance are not completed.
n
The database server does not wait for the users who are currently connected to the database instance to
disconnect.
The database server rolls back active transactions and disconnects all connected users.
The database server closes and dismounts the database before shutting down the database instance.

TRANSACTIONAL Mode
A shutdown in TRANSACTIONAL mode prevents clients from losing data, including results from their current activity.

No client can start a new transaction on this particular instance.


A client is disconnected when the client ends the transaction that is in progress.
When all transactions have been completed, a shutdown occurs immediately.

NORMAL Mode
NORMAL is the default shutdown mode if no mode is specified with the SHUTDOWN command.

No new connections can be made.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 94 of 812
The Oracle server waits for all users to disconnect before completing the shutdown.
Database and redo buffers are written to disk.
Background processes are terminated and the SGA is removed from memory.
The Oracle server closes and dismounts the database before shutting down the instance.

ABORT Mode
If the other shutdown modes don't work, you can use the ABORT mode. ABORT mode performs the least amount of
work before shutting down. Because this mode puts the database in an inconsistent state and requires recovery
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

before startup, use it only when necessary. It's not advisable to back up the database in this state. It's typically used
when no other form of shutdown works, when there are problems with starting the database instance, or when you
need to shut down immediately because of an impending situation (such as notice of a power outage within
seconds). ABORT mode is usually the fastest shutdown mode and NORMAL mode is the slowest. NORMAL and
TRANSACTIONAL modes can take a long time depending on the number of sessions and transactions.

The following happens during a shutdown in ABORT mode, an instance failure, or a database instance startup in
FORCE mode:

Current SQL statements being processed by the Oracle server are immediately terminated.
a
The Oracle server does not wait for users who are currently connected to the database to disconnect.
s
)h ฺ a
Database and redo buffers are not written to disk.
Uncommitted transactions are not rolled back.
m
f o ฺco uide
The instance is terminated without closing the files.
The database is not closed or dismounted.
a in nt G
The next startup requires instance recovery, which occurs automatically.
n
a r ca tude
Comparing Shutdown Modes @ i s S
q
ha se, and h
t NORMAL shutdown modes to the ABORT
ฺ u l
The following diagrams compare the IMMEDIATE, TRANSACTIONAL
shutdown mode (and instance failure or STARTUP dFORCE mode). u Notice that the database becomes inconsistent
ait stays consistent
t o
when you perform an ABORT shutdown, whereas
s m e an ABORT
aafter younsperform during the other shutdown modes. Also note that
q (
you need to recover the database instance
c e shutdown; whereas with the other shutdown
a l i
l H able
modes, you don't need to do so.
U
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 95 of 812
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

s a
) h a
ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 96 of 812
Opening and Closing PDBs

Open/close a PDB to open/close its data files.


A PDB has four open modes:
READ WRITE (the PDB is fully started/opened)
READ ONLY
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

MIGRATE
MOUNTED (the PDB is shut down/closed)
Use the ALTER PLUGGABLE DATABASE command or STARTUP and
SHUTDOWN commands to open and close PDBs.
Example:
SQL> ALTER PLUGGABLE DATABASE PDB1 OPEN;

The ALTER PLUGGABLE DATABASE command lets you change from any s aopen
mode to another.
a
)h ฺ
m de
ฺco uimode.
To use the STARTUP command, the PDB must first be in oMOUNTED
a i nf nt G
r c an tude
@ a sS
l h a e thi
q
a dฺu to us
( s am nse
H a q l i ce
Open Modes
U l able
adopeningsfaePDBr mean the same thing, and you'll find both phrases used in documentation and
m
Starting up a PDB and
anopen a PDB, the database server opens the data files for that PDB. Similar to a CDB, a
Sa When
online resources.
PDB has four levelsn
ryou
of-tbeing open, and these levels are referred to as open modes. The open modes are READ
WRITE (the PDB nisofully started/opened), READ ONLY, MIGRATE, and MOUNTED (the PDB is shut down/closed).
View:

Click the following link to review each open mode.

ALTER PLUGGABLE DATABASE (Scroll down to Table 11-2 PDB Open Modes)

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 97 of 812
Commands to Open and Close PDBs
You can use the ALTER PLUGGABLE DATABASE command to open and close a PDB from either the root container
or within the PDB itself. You can also use STARTUP and SHUTDOWN commands. The ALTER PLUGGABLE
DATABASE command lets you change from any open mode to another for a PDB. To use the STARTUP command, the
PDB must first be in MOUNTED mode. Either command requires you to be connected to the root container or PDB
with one of the following system privileges: AS SYSBACKUP, AS SYSDBA, AS SYSDG, or AS SYSOPER.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Examples
In this example, PDB1 is started up (opened). Its open mode is changed from MOUNT to READ WRITE.

SQL> ALTER PLUGGABLE DATABASE PDB1 OPEN;

In this example, PDB1 is shut down (closed). Its open mode is changed to MOUNT.

SQL> ALTER PLUGGABLE DATABASE PDB1 CLOSE;

s a
View:
)h ฺ a
m
Click the following link to view other examples using the ALTER PLUGGABLE ฺDATABASE
f o ide
co ucommand.
a in the n t G
ALTER PLUGGABLE DATABASE (Scroll down to the subtopicnChanging
r c a tude State of a PDB:
Examples)
@ a sS
l h a e thi
q
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 98 of 812
Working with the Automatic Diagnostic Repository

The Automatic diagnostic repository (ADR):


Is a file-based repository outside the database
Is a system-wide central tracing and logging repository
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Stores database diagnostic data such as:


Traces
Alert log
Health monitor reports

s a
)h ฺa
m
f o ฺco uide
n a in nt G
a rca Stude
a q @ his
ฺ u lh se t
m ad to u
( s a nse
H a q l i ce
About the Automatic Diagnostic
U l ableRepository
ad tracing f r logging central repository for database diagnostic data such as traces, the
eand
m
The ADR is a system-wide
s
an and more.
Samonitor-trreports,
alert log, health

non is known as ADR base. Its location is set by the DIAGNOSTIC_DEST initialization parameter,
The ADR root directory
for example, /u01/app/oracle.

The location of an ADR home is given by the following path, which starts at the ADR base directory:

<ADR Base>/diag/product_type/db_id/instance_id

For example:

/u01/app/oracle/diag/rdbms/orcl/ORCL

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 99 of 812
Viewing the Alert Log

The alert file is a chronological log of messages about the database instance and
database, such as:
Any nondefault initialization parameters used at startup
All internal errors (ORA-600), block corruption errors (ORA-1578), and
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

deadlock errors (ORA-60) that occurred


Administrative operations, such as the SQL statements CREATE, ALTER,
DROP DATABASE, and TABLESPACE; and the Enterprise Manager or
SQL*Plus statements STARTUP, SHUTDOWN, ARCHIVE LOG, and RECOVER
Several messages and errors relating to the functions of shared server and
dispatcher processes
Errors during the automatic refresh of a materialized view
Query V$DIAG_INFO to find the location of the alert log. s a
The path to alert_SID.log corresponds to the Diag Trace a
) h entry.
The path to log.xml corresponds to the Diag Alert ฺ c oentry. ideฺ
m
i n fo t Gu
an tude a
You can view the alert log in a text editor or in ADRCI. n
r
a sSc
@
a e thi
q
l h
a dฺu to us
( s am nse
Each database instance has anH aq e licefile. The file is on the server with the database and is stored in
alert_SID.log
U l abl
$ORACLE_BASE/diag/rdbms/<db_name>/<SID>/trace by default if $ORACLE_BASE is set.
d r
Oracle Databasea m a
n sfloge to keep a record of these events as an alternative to displaying the information on
uses theaalert
an operator’sS n -
console. tr systems also display this information on the console. If an administrative operation is
Many
no is written in the alert log as “completed” along with a time stamp.
successful, a message

Enterprise Manager Cloud Control monitors the alert log file and notifies you of critical errors. You can also view the
log to see noncritical error and information messages. Because the file can grow to an unmanageable size, you can
periodically back up the alert file and delete the current alert file. When the database attempts to write to the alert file
again, it creates a new one.

Note: There is an XML version of the alert log in the $ORACLE_BASE/diag/rdbms/<db_name>/<SID>/alert


directory.

ADRCI is an Oracle command-line utility that enables you to investigate problems, view health check reports, and
package and upload first-failure data to Oracle Support. You can also use the utility to view the names of the trace
files in the Automatic Diagnostic Repository (ADR) and to view the alert log. ADRCI has a rich command set that you
can use interactively or in scripts.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 100 of 812
Using Trace Files

Trace files contain:


Error information (contact Oracle Support Services if internal error occurs)
Information that can provide guidance for tuning applications or an instance
Each server and background process can write to an associated trace file.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Trace file names for background processes are named after their processes.
Exception: Trace files generated by job queue processes
Oracle Database includes an advanced fault diagnosability infrastructure for
preventing, detecting, diagnosing, and resolving problems.
When a critical error occurs:
An incident number is assigned to the error.
Diagnostic data for the error (such as trace files) is immediately captured
and tagged with the incident number. s a
Data is stored in the ADR
a
)h ฺ
m
o ide
ADR files can be automatically purged with retention policy
i nf nt G oฺcparameters.
u
a
an tude
r
a sSc
@
a e thi
q
l h
a dฺu to us
( s am nse
H a q l i ce
About Trace Files
U l able
m ad process
Each server and background
s f er can write to an associated trace file. When a process detects an internal error,
Sa about
it dumps information
t r n error to its trace file. If an internal error occurs and information is written to a trace file,
athe
-
non
the administrator should contact Oracle Support Services.

All file names of trace files associated with a background process contain the name of the process that generated the
trace file. The one exception to this is trace files that are generated by job queue processes (Jnnn).

Additional information in trace files can provide guidance for tuning applications or an instance. Background
processes always write this information to a trace file when appropriate.

Oracle Database includes an advanced fault diagnosability infrastructure for preventing, detecting, diagnosing, and
resolving problems. In particular, problems that are targeted include critical errors such as those caused by database
code bugs, metadata corruption, and customer data corruption.

When a critical error occurs, an incident number is assigned to it; diagnostic data for the error (such as trace files) is
immediately captured and tagged with this number. The data is then stored in the automatic diagnostic repository
(ADR)—a file-based repository outside the database—where it can later be retrieved by incident number and
analyzed.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 101 of 812
Purging Mechanism
The purging mechanism allows you to specify a retention policy stating:

How old ADR contents should be before they are automatically deleted.
The long retention period is used for the relatively higher-value diagnostic data, such as incidents and
alert log. (Default value is 365 days)
The short retention period is used for traces and core dumps. (Default value is 30 days).
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Older items are deleted first. The long retention period items are typically older than any of the items in the short
retention period. So a mechanism is used in which the time periods are “scaled,” so that roughly the same
percentage of each gets deleted. Some components use these periods in slightly different ways. For instance,
IPS, the packaging facility, uses the short retention period to determine when to purge packaging metadata and
the staging directory contents. However, the age of the data is based on when the package was completed, not
when it was originally created.

The size-based retention to specify a target size for an ADR home. When purging, the old data, determined by
the time-based retention periods, is deleted first. If the size of the ADR home is still greater than the target size,
diagnostics are automatically deleted until the target size is no longer exceeded.
s a
) h a
ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 102 of 812
Administering the DDL Log File

Enable the capture of certain DDL statements to a DDL log file by setting
ENABLE_DDL_LOGGING to TRUE.
DDL log contains one log record for each DDL statement.
Two DDL logs containing the same information:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

XML DDL log: log.xml written to


$ORACLE_BASE/diag/rdbms/<dbname>/<SID>/log/ddl
Text DDL: ddl_<sid>.log written to
$ORACLE_BASE/diag/rdbms/<dbname>/<SID>/log
Example:
$ more ddl_orcl.log
Thu Nov 15 08:35:47 2016
s a
diag_adl:drop user app_user )h ฺa
m
f o ฺco uide
n a in nt G
a rca Stude
a q @ his
ฺ u lh se t
m ad to u
( s a nse
The DDL log is created only if theH
q l i ce
aENABLE_DDL_LOGGING initialization parameter is set to TRUE. When this
parameter is set to FALSEU l statements
b l e
d , DDL
r a are not included in any log. A subset of executed DDL statements is

ma ansfe
written to the DDL log.
a
SDDL logs- trthat contain the same information. One is an XML file, and the other is a text file. The DDL
There are two n
theolog/ddl subdirectory of the ADR home.
log is stored in n

Important: You must have a license for Database Lifecycle Management Pack to enable DDL logging.

View:

Click the following link to Oracle Database Reference and view the complete list of DDL commands that are
captured in the DDL log.

ENABLE_DDL_LOGGING

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 103 of 812
Querying Dynamic Performance Views

Dynamic performance views contain information about the changing states of the
instance memory structures:
Sessions, file states, and locks
Progress of jobs and tasks
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Backup status, memory usage and allocation


System and session parameters
SQL execution
Statistics and metrics
Dynamic performance views start with the prefix V$.
Example query: Which current sessions have logged in from the EDXX9P1
computer in the last day?
s a
)h ฺa
SELECT * FROM V$SESSION
m
WHERE machine = 'EDXX9P1'

f o ฺco uide
AND logon_time > SYSDATE - 1;

n a in nt G
a rca Stude
a q @ his
ฺ u lh se t
m ad to u
( s a nse
H aq a dynamic
The Oracle Database server maintains l i ceset of data about the operation and performance of the database
U l abviews
instance. These dynamic performance le are based on virtual tables that are built from memory structures inside
the database server. a d are not
They f r
econventional tables that reside in a database. This is the reason why some of them
m s
Sa -tran
are available before a database is mounted or open.

Note: The DICT onDICT_COLUMNS views also contain the names of these dynamic performance views.
nand
You can use dynamic performance views to answer the following two questions:

1. For which SQL statements (and their associated numbers of executions) is the CPU time consumed greater
than 200,000 microseconds?

SQL> SELECT sql_text, executions FROM V$SQL WHERE cpu_time > 200000;

2. What are the session IDs of those sessions that are currently holding a lock that is blocking another user, and
how long have those locks been held?

SQL> SELECT sid, ctime FROM v$lock WHERE block > 0;

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 104 of 812
Considerations for Dynamic Performance Views

These views are owned by the SYS user.


Different views are available at different times:
The instance has been started.
The database is mounted.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

The database is open.


You can query V$FIXED_TABLE to see all the view names.
These views are often referred to as “v-dollar views.”
Read consistency is not guaranteed on these views because the data is dynamic.

s a
)h ฺ a
m
f o ฺco uide
n a in nt G
a rca Stude
a q @ his
ฺ u lh se t
m ad to u
( s a nse
Some dynamic views contain data H athat ce to all states of an instance or database. For example, if an
q is notlapplicable
i
U
instance has just been started b le is mounted, you can query V$BGPROCESS to see the list of
l but noadatabase
background processes
m er But you cannot query V$DATAFILE to see the status of database data files
adthat aresfrunning.
S -tr na database that reads the control file to find out about the data files associated with a
because it is theamountingaof
database.
n on
Some V$ views contain information that is similar to information in the corresponding DBA_ views. For example,
V$DATAFILE is similar to DBA_DATA_FILES. Note also that V$ view names are generally singular and DBA_ view
names are plural.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 105 of 812
Summary for Lesson 2

In this lesson, you should have learned how to:


Describe initialization parameter files and initialization parameters
View and modify initialization parameters in SQL*Plus
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Start up and shut down Oracle Databases


Open and close PDBs
Work with the Automatic Diagnostic Repository (ADR)
Query dynamic performance views

s a
) h a
ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 106 of 812
Practice 2 Overview

2-1: Creating a PFILE from an SPFILE


2-2: Viewing Initialization Parameters with SQL*Plus
2-3: Modifying Initialization Parameters with SQL*Plus
2-4: Modifying an Initialization Parameter with EM Express
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

2-5: Shutting Down and Starting Up the Oracle Database


2-6: Viewing Diagnostic Information

s a
) h a
ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 107 of 812
Practice 2-1 Creating a PFILE from an SPFILE

Overview
In this practice, you create a pfile named initORCL.ora from the default spfile while being connected to the root
container of your CDB.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Tip:

When you create a pfile in a CDB, the current container can be the root or a PDB. If the current container is
the root, then the database creates a text file that contains the parameter settings for the root. If the current
container is a PDB, the database create a text file that contains the parameter settings for the PDB. You
must specify a pfile_name , and you must have the SYSDBA, SYSOPER, or SYSBACKUP system privilege to
execute the CREATE PFILE statement. You can execute this statement either before or after you start a
database instance.

a
The name of the parameter file varies depending on your operating system. For example, it may be in mixed
s
)h ฺ a
case or lowercase, or it may have a logical name or a variation on the name INIT.ORA. As the DBA, you
m
can choose a different filename for your parameter file.

f o ฺco uide
n a in nt G
Assumptions
a rca Stude
You are logged in to VM1 as the oracle user.
a q @ his
ฺ u lh se t
Tasks
m ad to u
( s
Complete the following steps on VM1. Note:
e n sefor some steps are formatted for easier viewing.
aThe results
H aqand source
e l icthe oraenv script. For the ORACLE_SID value, enter ORCL .
Ul rab
1. Open a new terminal window l
d
a ma ansfe
S -=tr[oracle] ? ORCL
$ . oraenv

non
ORACLE_SID

The Oracle base has been set to /u01/app/oracle


$

2. Start SQL*Plus and connect to the root container as the SYS user with the SYSDBA privilege.

$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Thu Jul 21 19:40:55 2016


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

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL>

3. Locate the default spfile for your database instance. The results show that the spfile is located at
/u01/app/oracle/product/12.2.0/dbhome_1/dbs/spfileORCL.ora, which is $ORACLE_HOME/dbs
. Minimize the terminal window for a moment.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 108 of 812
SQL> SHOW PARAMETER spfile

NAME TYPE VALUE


------------ ----------- ------------------------------
spfile string /u01/app/oracle/product/12.2.0
/dbhome_1/dbs/spfileORCL.ora
SQL>
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

4. On your desktop, open Computer, and then Filesystem. Browse to the $ORACLE_HOME/dbs directory (
/u01/app/oracle/product/12.2.0/dbhome_1/dbs ). Notice that the spfile (spfileORCL.ora) and
init.ora files are stored here. The naming convention for an spfile is spfile<SID>.ora.

5. View the init.ora file. This is a sample pfile provided with the Oracle Database installation.
a. Right-click init.ora, and select Rename.

b. Change the name to init.ora.txt.

c. Double-click init.ora.txt to open it in gedit.


s a
d. Scroll through the file (the code is shown below) to view the parameters. ) h a
ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 109 of 812
#####################################################################
# Example INIT.ORA file
#
# This file is provided by Oracle Corporation as a starting point for
# customizing the Oracle Database installation for your site.
#
# NOTE: The values that are used in this file are example values only.
# You may want to adjust those values for your specific requirements.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

# You might also consider using the Database Configuration Assistant


# tool (DBCA) to create a server-side initialization parameter file
# and to size your initial set of tablespaces. See the
# Oracle Database 2 Day DBA guide for more information.
#####################################################################

# Change '<ORACLE_BASE>' to point to the oracle base (the one you


specify at
# install time)

db_name='ORCL'
s a
memory_target=1G
processes = 150 ) h a
audit_file_dest='<ORACLE_BASE>/admin/orcl/adump'
ฺ c o m
i d eฺ
audit_trail ='db'
i n fo t Gu
db_block_size=8192
db_domain=''
c a na den
ar s Stu
db_recovery_file_dest='<ORACLE_BASE>/fast_recovery_area'
@
l h aq e thi
db_recovery_file_dest_size=2G

dฺu to us
diagnostic_dest='<ORACLE_BASE>'
a
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'

( s am nse
open_cursors=300

aq e lice
remote_login_passwordfile='EXCLUSIVE'
H
undo_tablespace='UNDOTBS1'
l abl
U
# You may want to ensure that control files are created on separate
ad sfer
physical
m
Sa -tran
# devices

non
control_files = (ora_control1, ora_control2)
compatible ='11.2.0'

e. Close the file and rename it back to init.ora.

6. In the terminal window, create a pfile named initORCL.ora from the default spfile by using the CREATE
PFILE statement. By naming the file as initORCL.ora, you put the file in the default search order for
parameter files. If the database server doesn't find an spfile, then this file will be used.
A few things to know about the CREATE PFILE statement: If you do not specify a name for the pfile, then the
database uses the platform-specific default initialization parameter file name. If you do not specify a path to the
pfile, then the database adds the path for the default storage location, which is platform dependent.
You can specify the name of the spfile in the default directory, or specify the full path to an spfile located
somewhere else. If you don't specify any name, the database will use the spfile name currently associated with
the database instance. If no spfile is associated with the instance, then the database looks for the
platform-specific default server parameter file name. If that file does not exist, then the database returns an
error.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 110 of 812
SQL> CREATE PFILE = 'initORCL.ora' FROM SPFILE;

File created.
SQL>

7. Verify that the pfile you just created is listed in the $ORACLE_HOME/dbs directory and view the file.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

a. In the "dbs - File Browser" window, verify that the pfile named initORCL.ora is listed.

b. Right-click initORCL.ora , and select Rename.

c. Rename the file as init.ora.txt .

d. Double-click init.ora.txt to open it in gedit.

e. Scroll through the file (the code is shown below) to view the parameters. Because you created the pfile
when you were connected to the root container, the pfile contains the parameter settings for the root
container only.
s a
) h a
ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 111 of 812
ORCL.__data_transfer_cache_size=0
ORCL.__db_cache_size=1157627904
ORCL.__inmemory_ext_roarea=0
ORCL.__inmemory_ext_rwarea=0
ORCL.__java_pool_size=16777216
ORCL.__large_pool_size=33554432
ORCL.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

ORCL.__pga_aggregate_target=822083584
ORCL.__sga_target=2466250752
ORCL.__shared_io_pool_size=134217728
ORCL.__shared_pool_size=1107296256
ORCL.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/ORCL/adump'
*.audit_trail='db'
*.compatible='12.2.0'
*.control_files='/u01/app/oracle/oradata/ORCL/control01.ctl','/u01/
app/oracle/fast_recovery_area/ORCL/control02.ctl'
*.db_block_size=8192 s a
*.db_domain='example.com'
) h a
*.db_name='ORCL'
ฺ c o m
i d eฺ
i n fo t Gu
*.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area/ORCL'

na den
*.db_recovery_file_dest_size=12780m
c a
*.diagnostic_dest='/u01/app/oracle'
ar s Stu
*.dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
@
l h aq e thi
*.enable_pluggable_database=true

dฺu to us
*.local_listener='LISTENER_ORCL'
a
*.nls_language='AMERICAN'
s am nse
*.nls_territory='AMERICA'
(
aq e lice
*.open_cursors=300
H
l abl
*.pga_aggregate_target=783m
U
ad sfer
*.processes=300
m
*.remote_login_passwordfile='EXCLUSIVE'
Sa -tran
*.sga_target=2348m

non
*.undo_tablespace='UNDOTBS1'

f. Close the file and rename it back to initORCL.ora .


8. In the terminal window, shut down the database instance in IMMEDIATE mode. It takes about 35 seconds.
Shutting down the database instance in immediate mode causes the following things to happen:

Current SQL statements being processed by the database instance are not completed.
The database server does not wait for the users who are currently connected to the database instance to
disconnect.
The database server rolls back active transactions and disconnects all connected users.
The database server closes and dismounts the database before shutting down the database instance.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 112 of 812
SQL> SHUTDOWN IMMEDIATE

Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

9. In the "dbs - File Browser" window, in the $ORACLE_HOME/dbs directory, rename the spfileORCL.ora file
as orig_spfileORCL.ora . Renaming this file will take it out of the search order for parameter files when
you start up the database instance. Instead, the database server will automatically find the initORCL.ora file
(pfile) to start the database instance.

s a
) h a
ฺ c o m
i d eฺ
i n fo t Gu
c a na den
@ ar s Stu
l h aq e thi
a dฺu to us
( s am nse
H aq e lice
U l abl
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 113 of 812
10. In the terminal window, start the database instance by using the STARTUP command. It takes about 30
seconds.

SQL> STARTUP

ORACLE instance started.


Total System Global Area 2466250752 bytes
Fixed Size 8795760 bytes
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Variable Size 671091088 bytes


Database Buffers 1778384896 bytes
Redo Buffers 7979008 bytes
Database mounted.
Database opened.
SQL>

11. Verify that the database instance was started with your pfile by issuing the SHOW PARAMETER spfile
command. The value is null, which means the database instance was started with a pfile.

SQL> SHOW PARAMETER spfile


s a
a
)h ฺ
NAME TYPE VALUE m
------------------------------------ ----------- ------------------------------
f o ฺco uide
spfile string
n a in nt G
rca Stude
SQL>
a
@ his
a q
12. Configure the database instance to start with the spfile again.
t
ฺ u lh mode s e
a d to u
a. Shut down the database instance in IMMEDIATE . It takes about 35 seconds.

( s am nse
aq e lice
SQL> SHUTDOWN IMMEDIATE

Database U
H
l abl
closed.
adinstance
Database
m f er
dismounted.
s
a tran shut down.
SSQL>
ORACLE
-
non
b. In the "dbs - File Browser" window, in the $ORACLE_HOME/dbs directory, rename the
orig_spfileORCL.ora file as spfileORCL.ora .

c. In the terminal window, start the database instance by using the STARTUP command. It takes about 30
seconds.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 114 of 812
SQL> STARTUP

ORACLE instance started.


Total System Global Area 2466250752 bytes
Fixed Size 8795760 bytes
Variable Size 671091088 bytes
Database Buffers 1778384896 bytes
Redo Buffers 7979008 bytes
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Database mounted.
Database opened.
SQL>

d. Verify that the database instance was started with the spfile.

SQL> SHOW PARAMETER spfile

NAME TYPE VALUE


--------------- ----------- ------------------------------
s a
spfile string /u01/app/oracle/product/12.2.0
/dbhome_1/dbs/spfileORCL.ora
a
)h ฺ
m
SQL>
f o ฺco uide
13. Exit SQL*Plus and close the terminal window.
n a in nt G
a rca Stude
SQL> EXIT
a q @ his
Disconnected from Oracle Databaseฺu
lh se t Edition Release 12.2.0.1.0
ad to u
12c Enterprise -
64bit Production
s m
a nse
$
q ( ce
H a l i
l window.
14. Close the dbs - File Browser
U a b le
m ad sfer
Sa -tran
non

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 115 of 812
Practice 2-2 Viewing Initialization Parameters

Overview
In this practice, you view initialization parameters (parameters) by using SQL*Plus. You do this in two ways:

By using the SHOW PARAMETER command


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

By querying the following views:


V$PARAMETER
V$SPPARAMETER
V$PARAMETER2
V$SYSTEM_PARAMETER

Tip:

In almost all dictionary views, the data is converted to uppercase. The V$PARAMETER view, however, is an
a
exception - the data is stored in lowercase. Therefore, when writing SQL statements, make sure you use
s
)h ฺa
lowercase when enclosing text in quotation marks, for example: WHERE parameter_name =
m
'job_queue_processes'.

f o ฺco uide
n a in nt G
Assumptions
a rca Stude
You are logged in to VM1 as the oracle user.
a q @ his
ฺ u lh se t
Tasks
m ad to u
View Basic Parameters ( s a nse
H a q l i ce
In this section, you view basicl parameters
U a b lewith the SHOW PARAMETER command.
m adPARAMETER
s f er command with any string to view parameters that contain that string. For
example, theS
a trSHOW
You can use the SHOW
command - an PARAMETER processes will return all initialization parameters that contain the word
"processes." Basic n
noparameters are those parameters that you are likely to modify.

1. Open a new terminal window and source the oraenv script. For the ORACLE_SID value, enter ORCL.

$ . oraenv
ORACLE_SID = [oracle] ? ORCL

The Oracle base has been set to /u01/app/oracle


$

2. Start SQL*Plus and connect to the root container as the SYS user with the sysdba privilege.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 116 of 812
$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Thu Jul 21 19:40:55 2016


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

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL>
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

3. View the DB_NAME and DB_DOMAIN parameters. Together, these values equal the global database name,
which is ORCL.example.com.

a. View the DB_NAME parameter. This parameter specifies the current database identifier of up to 8
characters. If you have multiple databases, the value of this parameter should match the Oracle instance
identifier of each one to avoid confusion with other databases running on the system. The value of
DB_NAME should be the same in both the standby and production initialization parameter files.

SQL> SHOW PARAMETER db_name


s a
)h ฺ a
NAME TYPE VALUE
m
------------------------------------ ----------- -----
f o ฺco uide
db_name string
n a in nt G
ORCL

ca tude
SQL>

a r S DB_DOMAIN specifies the logical


q @
b. View the DB_DOMAIN parameter. In a distributed database
h s
system,
i
ever will be part of a distributed system.ฺu lhais nosdefault
location of the database within the network structure. You
e t should set this parameter if this database is or

ad to u
There value.
m
a nse
SQL> SHOW PARAMETER(sdb_domain
H aq e lice
NAME U l abl TYPE VALUE
a d f e r
------------------------------------ ----------- -----------
m
a tran
db_domain s string example.com
SSQL>
n on-
4. View the DB_RECOVERY_FILE_DEST and DB_RECOVERY_FILE_DEST_SIZE parameters. These parameters
set the fast recovery area and size.

The DB_RECOVERY_FILE_DEST parameter specifies the default location for the fast recovery area. The
fast recovery area contains multiplexed copies of current control files and online redo logs, as well as
archived redo logs, flashback logs, and Recovery Manager (RMAN) backups. Specifying this parameter
without also specifying the DB_RECOVERY_FILE_DEST_SIZE initialization parameter is not allowed.

The DB_RECOVERY_FILE_DEST_SIZE parameter specifies (in bytes) the hard limit on the total space to
be used by target database recovery files created in the fast recovery area.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 117 of 812
SQL> SHOW PARAMETER db_recovery_file_dest

NAME TYPE VALUE


------------------------------------ ----------- -----------------------
db_recovery_file_dest string /u01/app/oracle/
fast_recovery_area/ORCL
db_recovery_file_dest_size big integer 12780M
SQL>
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

5. View the SGA_TARGET and SGA_MAX_SIZE parameters.

SGA_TARGET specifies the total amount of SGA memory available to a database instance and
SGA_MAX_SIZE sets a maximum size for the SGA.
If you set the SGA_TARGET parameter, you enable the Automatic Shared Memory Management (ASMM)
feature. The Oracle Database will automatically distribute memory among the various SGA memory
pools (buffer cache, shared pool, large pool, java pool, and streams pool), ensuring the most effective
memory utilization. Note, the log buffer pool, other buffer caches (such as KEEP and RECYCLE), other
a
block sizes, fixed SGA, and other internal allocations must be manually sized and are not affected by
s
SGA_TARGET when ASMM is enabled. )h ฺ a
ASMM. The memory allocated to these pools is deducted from the total available memory for

m
f o ฺco uide
The manageability monitor process (MMON) computes the values of the automatically tuned memory
pools to support ASMM.
n a in nt G
rca Stude
In addition to SGA_TARGET and SGA_MAX_SIZE, you can set minimum nonzero values for each memory

treat those values as minimum levels. a


pool if an application component needs a minimum amount of memory to function properly. ASMM will
@ his
a q
ฺ u lh se t
The range of values for SGA_TARGET can be from 64 MB to an operating system-dependent value. You

ad to u
can't modify this value in a PDB. The current value for this parameter is 2352 MB.
m
a is the
The current SGA_MAX_SIZEsvalue
( n e that was accepted during the creation of the CDB, which
svalue
is 2352 MB.
aq e lic e
H
l abl
U
ad PARAMETER
SQL> SHOW
m s f er sga
a tran
SNAME
o n - TYPE VALUE
n
------------------------------------
allow_group_access_to_sga
----------- --------
boolean FALSE
lock_sga boolean FALSE
pre_page_sga boolean TRUE
sga_max_size big integer 2352M
sga_min_size big integer 0
sga_target big integer 2352M
unified_audit_sga_queue_size integer 1048576
SQL>

6. View the UNDO_TABLESPACE parameter. This parameter specifies the undo tablespace to be used when an
instance starts. Oracle Database creates and manages information that is used to roll back, or undo, changes
to the database. Such information consists of records of the actions of transactions, primarily before they are
committed. These records are collectively referred to as undo and are stored in the undo tablespace. The
results below indicate that the undo tablespace in your environment is UNDOTBS1.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 118 of 812
SQL> SHOW PARAMETER undo_tablespace

NAME TYPE VALUE


------------------------------------ ----------- --------
undo_tablespace string UNDOTBS1
SQL>
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

7. View the COMPATIBLE parameter. This parameter specifies the release with which Oracle must maintain
compatibility. It enables you to use a new release of Oracle, while at the same time guaranteeing backward
compatibility with an earlier release. This is helpful if it becomes necessary to revert to the earlier release. By
default, the value for the compatible entry for this parameter is equal to the version of the Oracle Database that
you have installed. In your environment, this value is 12.2.0.

SQL> SHOW PARAMETER compatible

NAME TYPE VALUE


------------------------------------ ----------- ------
compatible string 12.2.0
s a
noncdb_compatible
SQL>
boolean a
FALSE
)h ฺ
m
8. View the CONTROL_FILES initialization parameter. This parameter specifiesfo ide files,
ฺcoromoreucontrol
a in Oracle
one
n t Gstrongly recommends
n
separated by commas, and including paths. One to eight file names are listed.
that you multiplex and mirror control files.
a rca Stude
SQL> SHOW PARAMETER control_files lha
q@ this
d ฺ u u se
m a to
NAME
s a
( cen
------------------------------------ s e TYPE
----------
VALUE
------------------------------
q
control_files
l Ha ble li string /u01/app/oracle/oradata/ORCL/c

d U ra ontrol01.ctl, /u01/app/oracle/

m a s f e fast_recovery_area/ORCL/contro

SQL>S
a tran l02.ctl

n on-
9. View the PROCESSES , SESSIONS , and TRANSACTIONS initialization parameters.

a. View the PROCESSES parameter. This parameter, which is the eighth entry below, specifies the
maximum number of operating system user processes that can simultaneously connect to an Oracle
server. This value should allow for all background processes and user processes. The default values of
the SESSIONS and TRANSACTIONS initialization parameters are derived from the PROCESSES
parameter. Therefore, if you change the value of PROCESSES, you should evaluate whether to adjust the
values of those derived parameters.The range of values is from six to an OS-dependent value. The
default value is dynamic and dependent on the number of CPUs.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 119 of 812
SQL> SHOW PARAMETER processes

NAME TYPE VALUE

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


aq_tm_processes integer 1
asm_io_processes integer 20
db_writer_processes integer 1
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

gcs_server_processes integer 0
global_txn_processes integer 1
job_queue_processes integer 4000
log_archive_max_processes integer 4
processes integer 300
SQL>

b. View the SESSIONS parameter. This parameter specifies the maximum number of sessions that can be
created in the system. Because every login requires a session, this parameter effectively determines the
maximum number of concurrent users in the system. Notice in the results that the session entry has a
s a
value of 472. You should always set this parameter explicitly to a value equivalent to your estimate of the
)h ฺa
maximum number of concurrent users, plus the number of background processes, plus approximately
m
ฺco uide
10% for recursive sessions.
f o
in nt G
SQL> SHOW PARAMETER sessions
n a
a tude
a r c
NAME
@
TYPE
i s S VALUE
------------------------------------
h q
a integert h
----------- -----
u l s e
dฺ to uinteger
java_max_sessionspace_size 0
java_soft_sessionspace_limit
license_max_sessions am
a 0

( s n s e integer 0
aq e lic
license_sessions_warning e integer 0
sessions H
l abl integer 472
U
er
shared_server_sessions
SQL> ad
integer
m s f
t r an
Sa -TRANSACTIONS
nonwhen the UNDO_MANAGEMENT initialization parameter is equal to MANUAL. A transaction is
c. View the parameter. This parameter specifies how many rollback segments to bring
online
assigned to a rollback segment when the transaction starts, and it can't change for the life of the
transaction. A transaction table exists in the rollback segment header with limited space, limiting how
many transactions a single segment can support. Therefore X number of concurrent transactions require
at least X number of rollback segments. With Oracle Automatic Undo Management, the database
creates rollback segments, brings them online, takes them offline, and drops them as needed. In the
past, a database administrator had to do all of that.

SQL> SHOW PARAMETER transactions

NAME TYPE VALUE


------------------------------------ ----------- -----
transactions integer 519
transactions_per_rollback_segment integer 5
SQL>

10. View the configuration for the DB_FILES initialization parameter. This parameter specifies the maximum
number of database files that can be opened for this database. The range of values is OS dependent. The

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 120 of 812
10.

default value is 200.

SQL> SHOW PARAMETER db_files

NAME TYPE VALUE


------------------------------------ ----------- -----
db_files integer 200
SQL>
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

View Advanced Parameters with the SHOW PARAMETER Command

1. View the COMMIT_LOGGING parameter. This parameter is used to control how redo is batched by the Log
Writer process. There is no default value, as shown below. You can modify this parameter in a PDB.

SQL> SHOW PARAMETER commit_logging

NAME TYPE VALUE


------------------------------------ ----------- -----
commit_logging string
s a
SQL>
)h ฺ a
2. View the COMMIT_WAIT parameter. This parameter is used to control when the c m de is flushed to
o for a icommit
f o ฺ redo u
the redo logs. There is no default value.
n a in nt G
SQL> SHOW PARAMETER commit_wait a rca Stude
a q @ his
NAME lh-----------
TYPE e t VALUE
ฺ u
d string u s
------------------------------------
a t o -----
commit_wait
( s am nse
aq e lice
SQL>
H l
l aparameter.
b
d U
3. View the SHARED_POOL_SIZE
r
This parameter specifies the size of the shared pool in bytes. The

ma abuffers.
shared pool contains
s f eThe range of values
objects such as shared cursors, stored procedures, control structures, and parallel
executionamessage
S parametert r n is set, which is the caseisbelow.
OS-dependent. The default value is zero if the
SGA_TARGET
n- platform.
48 MB fornao32-bit
Otherwise, the value is 128 MB for a 64-bit platform or

SQL> SHOW PARAMETER shared_pool_size

NAME TYPE VALUE


------------------------------------ ----------- -----
shared_pool_size big integer 0
SQL>

4. View the DB_BLOCK_SIZE parameter. This parameter specifies the standard Oracle database block size (in
bytes) and is used by all tablespaces by default. Its value is set during database creation and cannot be
subsequently changed. The range of values is from 2048 to 32768 (OS-dependent). The default value is 8192.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Database 12c R2: Administration Workshop 121 of 812
SQL> SHOW PARAMETER db_block_size

NAME TYPE VALUE


------------------------------------ ----------- -----
db_block_size integer 8192
SQL>
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

5. View the DB_CACHE_SIZE initialization parameter. You configure this parameter to specify the size of the
standard block buffer cache (default buffer pool). The range of values is at least 4 MB times the number of
CPUs. Smaller values are automatically rounded up to this value. The default value is zero if the SGA_TARGET
initialization parameter is set, otherwise the larger of 48 MB or (4 MB*CPU_COUNT).

SQL> SHOW PARAMETER db_cache_size

NAME TYPE VALUE


------------------------------------ ----------- -----
db_cache_size big integer 0
SQL>
s a
6. View the UNDO_MANAGEMENT parameter. This parameter specifies the undo space management
a
) h ฺ mode that the
m
f o u ideas
ฺ ois allocated
system should use. When set to AUTO, the instance is started in automatic undocmanagement mode.

a in ntTheGrange of values
Otherwise, it is started in rollback undo mode. In rollback undo mode, undo space
segments. In automatic undo mode, undo space is allocated as undontablespaces.
rollback

c a d e is AUTO
or MANUAL. If the UNDO_MANAGEMENT parameter is omitted when
@ ar s Stu
the instance is started, the default value

aq e thi
AUTO is used. This is the case on VM1.