Karen Lorena - Naranjo VillegasD79027GC10 - sg2 PDF
Karen Lorena - Naranjo VillegasD79027GC10 - sg2 PDF
Karen Lorena - Naranjo VillegasD79027GC10 - sg2 PDF
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
s a
) ha
Oracle Database 12c: o m
Admin,
Install and Upgrade a ilc e
h o tm Guid
Accelerated
a @ e n t
l o renGuide
Student S
d
tuVolume II
( n v his
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
D79027GC10
Edition 1.0
December 2013
D84979
Aula Matriz SAS
Dominique Jeunot This document contains proprietary information and is protected by copyright and
James L. Spiller 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
Technical Contributors may not use, share, download, upload, copy, print, display, perform, reproduce,
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
publish, license, post, transmit, or distribute this document in whole or in part without
and Reviewers the express authorization of Oracle.
Darryl Balaski
The information contained in this document is subject to change without notice. If you
Rainer Bien 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
Maria Billings warranted to be error-free.
Andy Fortunak
Restricted Rights Notice
Gerlinde Frenzen
Mark Fuller 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
Joel Goodman applicable:
Daniela Hansell
U.S. GOVERNMENT RIGHTS
s a
Pat Huey
Prakash Jashnani ) ha
The U.S. Governments rights to use, modify, reproduce, release, perform, display, or
disclose these training materials are restricted by the terms of the applicable Oracle
o m
license agreement and/or the applicable U.S. Government contract.
Gwen Lazenby
Trademark Notice
a ilc e
otm t Guid
Ira Singer
Roy Swonger h
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names
@ en
a
may be trademarks of their respective owners.
n
re Stud
Carol Tagliaferri
Lori Tritz l o
v his
Branislav Valny ( n
s se t
g a
ille e to u
Harald Van Breederode
V
Editors
r a njo icens
Daniel Milne N a le l
Aju Kumar ena r a b
r
Lo ransf e
n
re on-t
aPublishers
K Pavithran
n Adka
Veena Narasimhan
Aula Matriz SAS
Contents
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
1 Introduction
Objectives 1-2
Course Objectives 1-3
Suggested Schedule 1-4
Oracle Database Innovation 1-6
Enterprise Cloud Computing 1-7
Course Examples: HR Sample Schema 1-8
Summary 1-9
s a
) ha
2 Exploring the Oracle Database Architecture m
o
Objectives 2-2
a ilc e
Oracle Database Server Architecture: Overview 2-3
h o tm Guid
Oracle Database Instance Configurations 2-4
a @ e n t
Connecting to the Database Instance 2-5
l o ren Stud
Oracle Database Memory Structures 2-6 nv is
s ( t h
Shared Pool 2-8
Database Buffer Cache 2-10 ille
ga use
Redo Log Buffer 2-11 jo
V se to
Large Pool 2-12ara
n icen
N l e l
Java Poolna
e 2-13
r a b
r
Lo rPool
Streams f e
s2-14
n a n
a o n -t Global Area (PGA) 2-15
re Program
K n 2-16
Quiz
Process Architecture 2-18
Process Structures 2-20
Database Writer Process (DBWn) 2-22
Log Writer Process (LGWR) 2-24
Checkpoint Process (CKPT) 2-26
System Monitor Process (SMON) 2-27
Process Monitor Process (PMON) 2-28
Recoverer Process (RECO) 2-29
Listener Registration Process (LREG) 2-30
Archiver Processes (ARCn) 2-31
Database Storage Architecture 2-32
Logical and Physical Database Structures 2-34
iii
Aula Matriz SAS
( n v his
Installation Option: Silent Mode 3-11
g a s se t
Quiz 3-12
Summary 3-14 V ille e to u
r a njo icens
N
4 Installing Oracle
aDatabase
l e lSoftware
r e
Objectives
na4-2 ferab
n Lo rans Installation: System Requirements 4-3
Oracle Database
a o n -t Operating System Groups and Users 4-4
re Creating
K n
Types of Installations 4-6
Quiz 4-7
Summary 4-8
Practice 4 4-9
iv
Aula Matriz SAS
Practice 5 5-16
V ille e to u
Controlling the Enterprise Manager Cloud Control Framework 6-15
Starting the Enterprise Manager Cloud Control Framework 6-16
r a njo icens
Stopping the Enterprise Manager Cloud Control Framework 6-17
N a le l
Types of Enterprise Manager Cloud Control Targets 6-18
r e na ferab
Enterprise Manager Cloud Control 6-19
n Lo rans
Using Enterprise Manager Cloud Control 6-20
a re on-t
K nQuiz 6-21
Summary 6-22
Practice 6 6-23
v
Aula Matriz SAS
vi
Aula Matriz SAS
r a njo icens
Creating a User 9-14
N a le l
Unlocking a User Account and Resetting the Password 9-15
r e na ferab
Privileges 9-16
n Lo rans
System Privileges 9-17
a re on-t
K nRevoking System Privileges with ADMIN OPTION 9-19
Granting Object Privileges 9-20
Object Privileges 9-21
Revoking Object Privileges with GRANT OPTION 9-22
Using Roles to Manage Privileges 9-23
Assigning Privileges to Roles and Assigning Roles to Users 9-24
Predefined Roles 9-25
Creating a Role 9-26
Secure Roles 9-27
Assigning Roles to Users 9-28
Privilege Analysis 9-29
Privilege Analysis Flow 9-30
Profiles and Users 9-31
Implementing Password Security Features 9-33
vii
Aula Matriz SAS
Quiz 9-42
Summary 9-46
Practice 9 9-47
r a njo icens
Enlarging the Database 10-23
N a le l
Moving or Renaming an Online Data File 10-24
r e na ferab
Summary 10-26
n Lo rans
Practice 10 10-27
a re on-t
K n
11 Managing Space
Objectives 11-2
Space Management: Overview 11-3
Block Space Management 11-4
Row Chaining and Migration 11-5
Quiz 11-7
Free Space Management Within Segments 11-8
Types of Segments 11-9
Allocating Extents 11-10
Understanding Deferred Segment Creation 11-11
Viewing Deferred Segment Information 11-12
Controlling Deferred Segment Creation 11-13
Restrictions and Exceptions 11-14
viii
Aula Matriz SAS
ix
Aula Matriz SAS
Practice 12 12-22
x
Aula Matriz SAS
xi
Aula Matriz SAS
xii
Aula Matriz SAS
19 Moving Data
Objectives 19-2
Moving Data: General Architecture 19-3
Oracle Data Pump: Overview 19-4
Oracle Data Pump: Benefits 19-5
Directory Objects for Data Pump 19-7
Creating Directory Objects 19-8
Data Pump Export and Import Clients: Overview 19-9 s a
Data Pump Utility: Interfaces and Modes 19-10 ) ha
o m
ilc e
Performing a Data Pump Export by Using Enterprise Manager Cloud Control 19-11
a
otm t Guid
Performing a Data Pump Import 19-12
Data Pump Import: Transformations 19-13 h
@ en
n a
SQL*Loader: Overview 19-15 l o re Stud
Using Enterprise Manager Cloud Control to Monitor Data Pump Jobs 19-14
( n v his
SQL*Loader Control File 19-17
g a s se t
Loading Methods 19-19
V ille e to u
Loading Data by Using Enterprise Manager Cloud Control 19-20
r a njo icens
SQL*Loader Express Mode 19-21
N a le l
External Tables 19-23
r e na ferab
External Table: Benefits 19-24
n Lo rans
Defining an External Tables with ORACLE_LOADER 19-25
a re on-t
K External Table Population with ORACLE_DATAPUMP 19-26
n
Using External Tables 19-27
Data Dictionary 19-28
Quiz 19-29
Summary 19-31
Practice 19 19-32
xiii
Aula Matriz SAS
xiv
Aula Matriz SAS
a renSetting
n - tra Preferences by Using Enterprise Manager Cloud Control 22-9
Global
K o Optimizer Statistics Manually 22-10
Gathering
n
Setting Optimizer Statistics Preferences 22-12
Concurrent Statistics Gathering 22-14
Viewing Statistics Information 22-15
SQL Plan Directives 22-17
Adaptive Execution Plans 22-18
Using the SQL Advisors 22-19
Automatic SQL Tuning Results 22-20
Implementing Automatic Tuning Recommendations 22-21
SQL Tuning Advisor: Overview 22-22
Using the SQL Tuning Advisor 22-23
SQL Tuning Advisor Recommendations 22-25
Duplicate SQL 22-26
SQL Access Advisor: Overview 22-27
xv
Aula Matriz SAS
a n - tra 24-2
renObjectives
K o to Upgrade 24-3
Preparing
n
Planning the Upgrade 24-4
Developing a Test Plan 24-5
Performance Testing 24-6
Requirements for Databases Using Oracle Label Security or Oracle Database
Vault 24-7
Requirement for Databases Using Oracle Warehouse Builder 24-8
Using the Pre-Upgrade Information Tool 24-9
Backing Up the Database 24-10
Summary 24-11
Practice 24 24-12
xvi
Aula Matriz SAS
Summary 25-11
Practice 25 25-12
xvii
Aula Matriz SAS
xviii
Aula Matriz SAS
xix
Aula Matriz SAS
Objectives F-2
Working with Oracle Support F-3
Using My Oracle Support F-4
Researching an Issue F-6
Logging Service Requests F-8
Accessing My Oracle Support Community F-10
Managing Patches F-11
Applying a Patch Release F-12
s
Enterprise Manager Cloud Control: My Oracle Support Integration F-13 a
Using the Patch Advisor F-14 ) ha
o m
Online Patching: Overview F-15
a ilc e
otm t Guid
Installing an Online Patch F-16
Benefits of Online Patching F-17 h
@ en
n a
Online Patching Considerations F-19l o re Stud
Conventional Patching and Online Patching F-18
( n v his
Quiz F-20
g a s se t
V ille e to u
Using the Support Workbench F-21
Accessing the Support Workbench F-22
r a njo icens
Viewing Problem Details F-23
N a le l
Viewing Incident Details F-24
r e na ferab
Packaging and Uploading Diagnostic Data to Oracle Support F-25
n Lo rans
Tracking the Service Request and Implementing Repairs F-26
a re on-t
K nSummary F-27
xx
Aula Matriz SAS
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
B k
Backup and
dRRecovery: C
Concepts
t
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Aula Matriz SAS
Objectives
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
DBA Responsibilities
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
a ra(DBA)
The database administrator
e n b is typically responsible for ensuring that the database is
Lor ransfe
open and available when users need it. To achieve that goal, the DBA (working with the
systemnadministrator):
a o n -t and works to avoid common causes of failure
reAnticipates
K
n
Works to increase the mean time between failures (MTBF) that negatively affect
availability
Ensures that hardware is as reliable as possible, that critical components are protected
by redundancy, and that operating system maintenance is performed in a timely
manner. Oracle Database provides advanced configuration options to increase MTBF,
including:
- Real Application Clusters
- Oracle Data Guard
Decreases the mean time to recover (MTTR) by practicing recovery procedures in
advance and configuring backups so that they are readily available when needed
Minimizes the loss of data. DBAs who follow accepted best practices can configure their
databases so that no committed transaction is ever lost. Entities that assist in
guaranteeing this include:
- Archive log g files ((discussed later in this lesson))
- Flashback technology
- Standby databases and Oracle Data Guard (discussed in the Oracle Database 12c:
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
Categories of Failure
Statement failure
User process failure
Network failure
User error
Instance failure
Media failure
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
a Arasingle
Statement failure:
e n b database operation (select, insert, update, or delete) fails.
User process
L s fe A single database session fails.
or nfailure:
re
a Network
n tra Connectivity to the database is lost
n -failure: lost.
K User o
n error: A user successfully completes an operation, but the operation (dropping a
table or entering bad data) is incorrect.
Instance failure: The database instance shuts down unexpectedly.
Media failure: A loss of any file that is needed for database operation (that is, the files
have been deleted or the disk has failed).
Statement Failure
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a operation
When a single database
r a b fails, DBA involvement may be necessary to correct errors
L or even
with user privileges
n s fe
or database space allocation. DBAs may also need to assist in
r e n -tra
troubleshooting, for problems that are not directly in their task area. This can vary
K a from
greatly
n o none organization to another. For example, in organizations that use off-the-shelf
applications (that is, organizations that have no software developers), the DBA is the only
point of contact and must examine logic errors in applications.
To understand logic errors in applications, you should work with developers to understand the
scope of the problem. Oracle Database tools may provide assistance by helping to examine
audit trails or previous transactions.
N t In
Note: I many cases, statement
t t t failures
f il are by
b design
d i and dddesired.
i d F For example,
l security
it
policies and quota rules are often decided upon in advance. If a user gets an error while trying
to exceed his or her limits, it may be desired for the operation to fail and no resolution may be
necessary.
n e n
N ara le lic
User processes that
e n a abnormally
r a b disconnect from the instance may have uncommitted work in
progress that rneeds to fbe
L opolls server
s e rolled back. The Process Monitor (PMON) background process
n
n -tra processes to ensure that their sessions are still connected. If PMON
periodically
r e
a a server
finds nprocess whose user is no longer connected, PMON recovers from any ongoing
K n o
transactions; it also rolls back uncommitted changes and releases any locks that are held by
the failed session.
A DBAs intervention should not be required to recover from user process failure, but the
administrator must watch for trends. One or two users disconnecting abnormally is not a
cause for concern. A small percentage of user process failures may occur from time to time.
B t consistent
But i t t and d systemic
t i ffailures
il iindicate
di t other
th problems.
bl A llarge percentage
t off abnormal
b l
disconnects may indicate a need for user training (which includes teaching users to log out
rather than just terminate their programs). It may also be indicative of network or application
problems.
Network Failure
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
n e n
N ara le lic
e n r b is to provide redundant paths for network connections.
The best solution toanetwork failure
a
Lor rwill
Backup listeners, fe connections, and network interface cards reduce the chance that
network
n s
networknfailures
r e - t a affect system availability.
Ka non
User Error
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
s a
)ha
m
co
i l
o t ma uide
Oracle LogMiner @ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a delete
Users may inadvertently
r a b or modify data. If they have not yet committed or exited their
L orcan simply
program, they
n s feroll back.
enusenOracle
Yourcan
a - tra LogMiner to query your online redo logs and archived redo logs through
K o Manager or SQL interface. Transaction data may persist in online redo logs
an Enterprise
n
longer than it persists in undo segments; if you have configured archiving of redo information,
redo persists until you delete the archived files. Oracle LogMiner is discussed in the Oracle
Database Utilities reference.
Users who drop a table can recover it from the recycle bin by flashing back the table to before
the drop.
If the recycle bin has already been purged, or if the user dropped the table with the PURGE
option, the dropped table can still be recovered by using point-in-time recovery (PITR) if the
database has been properly configured.
In Oracle Database 12c, RMAN enables you to recover one or more tables or table partitions
to a specified point in time without affecting the remaining database objects.
Note: Flashback technologies, PITR, and table recovery are discussed in the Oracle
Database 12c:
12c Backup
Back p and Reco
Recovery
er Workshop course
co rse and in the Oracle Database Back
Backup
p
and Recovery Users Guide.
Flashback Technology
n e n
N ara le lic
e n a rOracle
Oracle Database includes
a b Flashback technology: a group of features that support
L n fe
r ofsdataand
viewing pastostates winding data back and forth in timewithout requiring
r e n -tra
restoring the database from backup. With this technology, you help users analyze and recover
K a errors.
from
n o n users who have committed erroneous changes, use the following to analyze
For
the errors:
Flashback Query: View committed data as it existed at some point in the past. The
SELECT command with the AS OF clause references a time in the past through a time
stamp or system change number (SCN).
Flashback Version Query: View committed historical data for a specific time interval.
Use the VERSIONS BETWEEN clause of the SELECT command (for performance reasons
with existing indexes).
Flashback Transaction Query: View all database changes made at the transaction
level.
Possible solutions to recover from user error:
Flashback Transaction Backout: Rolls back a specific transaction and dependent
transactions
Flashback Table: Rewinds one or more tables to their contents at a previous time
without affecting other database objects
Flashback Drop: Reverses the effects of dropping a table by returning the dropped table
from the recycle bin to the database along with dependent objects such as indexes and
triggers
Flashback Database: Returns the database to a p past time or SCN
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
Instance Failure
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
n e n
N ara le lic
e n a when
Instance failure occurs
r a bthe database instance is shut down before synchronizing all
r An instance
database files.
Louse n s fe failure can occur because of hardware or software failure or
throughnthe
r e - t of
r athe emergency SHUTDOWN ABORT and STARTUP FORCE shutdown
a non
commands.
K
Administrator involvement in recovering from instance failure is rarely required if Oracle
Restart is enabled and is monitoring your database. Oracle Restart attempts to restart your
database instance as soon as it fails. If manual intervention is required, then there may be a
more serious problem that prevents the instance from restarting, such as a memory CPU
failure.
SGA
Updating data file headers with
checkpoint information
Database
Updating control files with buffer cache
checkpoint information
Signaling DBWn at
full checkpoints DBWn
Database Writer s a
process
)ha
m
co
i l
Control
files o t ma uide
CKPT @ h nt G
r e na tude
Checkpoint process
( n vlo his S Data files
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n
ra lic e n
N a le you need to understand the functioning of certain
n a
To understand instance b
recovery,
a
ore nsfer
background processes.
L
Everyyethree
a
document n tra (or
r n otheseconds ( more frequently),
-modified data blocks
q
that
y), the CKPT p
DBWn has
process stores data in a control file to
written from the SGA to disk. This is called
K n
an incremental checkpoint. The purpose of a checkpoint is to identify that place in the online
redo log file where instance recovery is to begin (which is called the checkpoint position).
In the event of a log switch, the CKPT process also writes this checkpoint information to the
headers of data files.
Checkpoints exist for the following reasons:
ToT ensure that
th t modified
difi d d
data
t bl
blocks
k iin memory are written
itt tto th
the di
disk
k regularly
l l so th
thatt
data is not lost in case of a system or database failure
To reduce the time required for instance recovery (Only the online redo log file entries
following the last checkpoint need to be processed for recovery.)
To ensure that all committed data has been written to data files during shutdown
The checkpoint information written by the CKPT process includes checkpoint position, system
change number (SCN), location in the online redo log file to begin recovery, information about
logs, and so on.
Note: The CKPT process does not write data blocks to the disk or redo blocks to the online
redo log files.
n j o
e n se
N ara le lic
Redo log files record
e n a changes
r a bto the database as a result of transactions and internal Oracle
L or (A
server actions. fe is a logical unit of work consisting of one or more SQL
transaction
n s
r e n -tra
statements run by a user.) Redo log files protect the database from loss of integrity because
of a
K n o n caused by power outages, disk failures, and so on. Redo log files should be
system failures
multiplexed to ensure that the information stored in them is not lost in the event of a disk
failure.
The redo log consists of groups of redo log files. A group consists of a redo log file and its
multiplexed copies. Each identical copy is said to be a member of that group, and each group
is identified by a number. The Log Writer (LGWR) process writes redo records from the redo
log buffer to all members of a redo log group until the files are filled or a log switch operation
is requested.
It then switches and writes to the files in the next group. Redo log groups are used in a
circular fashion.
Best practice tip: If possible, multiplexed redo log files should reside on different disks.
n e n
N ara le lic
The Oracle database
e n r a b recovers from instance failure. All that needs to happen is
a automatically
L orthen
for the instance fe normally. If Oracle Restart is enabled and configured to monitor
to be started
n s
r e n -tra happens automatically. The instance mounts the control files and then
this database, this
a ntooopen
attempts
K n the data files. When it discovers that the data files have not been
synchronized during shutdown, the instance uses information contained in the redo log
groups to roll the data files forward to the time of shutdown. Then the database is opened and
any uncommitted transactions are rolled back.
otm t Guid
SCN:129
Undo
@ enh
SCN: 99
n a d
l o refiles StControlufiles Redo log
( n v Data
h is group
as use t
e g
V
Copyright 2013, ill and/or
Oracle
e titsoaffiliates. All rights reserved.
j o
n icen s
r a
For an instance to a open e l the system change number (SCN) contained in the data
Naa datablfile,
r enmatch
files headeromust f e racurrent SCN that is stored in the databases control files.
the
If there n L -do
numbers t r nsmatch, the instance applies redo data from the online redo logs,
anot
K a nonredoing transactions until the data files are up-to-date. After all data files have
sequentially
been synchronized with the control files, the database is opened and users can log in.
When redo logs are applied, all transactions are applied to bring the database up to the state
as of the time of failure. This usually includes transactions that are in progress but have not
yet been committed. After the database has been opened, those uncommitted transactions
are rolled back.
At the end of the rollback phase of instance recovery, the data files contain only committed
data.
n e n
N ara le lic
e n a b in the redo log groups before the instance returns
a isrrecorded
Transaction information
forfaetransaction. The information in the redo log groups guarantees that
L or can nbe
commit complete
srecovered in case of a failure. The transaction information must also be
e n
the transaction
t r a
- file. The data file write usually happens at some time after the information
ar tonthe
written
K o ndata
is recorded in redo log groups because the data file write process is much slower than the
redo writes. (Random writes for data files are slower than serial writes for redo log files.)
Every three seconds, the checkpoint process records information in the control file about the
checkpoint position in the redo log. Therefore, the Oracle Database server knows that all redo
log entries recorded before this point are not necessary for database recovery. In the graphic
in the slide,
slide the striped blocks have not yet been written to the disk.
disk
The time required for instance recovery is the time required to bring data files from their last
checkpoint to the latest SCN recorded in the control file. The administrator controls that time
by setting an MTTR target (in seconds) and through the sizing of redo log groups. For
example, for two redo groups, the distance between the checkpoint position and the end of
the redo log group cannot be more than 90% of the smallest redo log group.
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n
ra lic e n
N a le initialization parameter simplifies the configuration of
a
The FAST_START_MTTR_TARGET
n a b
recovery time
L o e instance
rfrom s f er or system failure. The MTTR Advisor converts the
n -tran
FAST_START_MTTR_TARGET
r e value into several parameters to enable instance recovery in
adesired
the
K n (or as close to it as possible). Please note, explicitly setting the
notime
FAST_START_MTTR_TARGET parameter to 0 disables the MTTR Advisor.
The FAST_START_MTTR_TARGET parameter must be set to a value that supports the service
level agreement for your system. A small value for the MTTR target increases I/O overhead
because of additional data file writes (affecting the performance). However, if you set the
MTTR target too large, the instance takes longer to recover after a crash.
F assistance
For i t in
i setting
tti the
th MTTR target
t t by
b using
i Enterprise
E t i Manager
M Cloud
Cl d Control,
C t l
navigate as follows:
Performance > Advisors Home > MTTR Advisor
Availability > Backup & Recovery > Recovery Settings
Media Failure
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
n e n
N ara le lic
e n r b failure as any failure that results in the loss or corruption of
Oracle Corporationadefines media
a
L r
one or moreodatabase
n s fe (data, control, or redo log file).
files
ren ofrom
Recovering a failure requires that you restore and recover the missing files.
-trmedia
K a n n
n e n
N ara le lic
When you performa complete b recovery, you bring the database to the state where it is fully up-
e n fe r a
L or allncommitted
to-date, including
s data modifications to the present time.
a r en recovery,
Incomplete
n - tra however, brings the database or tablespace to some point of time in the
K
past. This
n ois also known as point-in-time recovery (PITR). It means there are missing
transactions; any data modifications done between the recovery destination time and the
present are lost. In many cases, this is the desirable goal because there may have been
some changes made to the database that need to be undone. Recovering to a point in the
past is a way to remove the unwanted changes.
Archived
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
log Archived
log Online
Redo log
2 4
s a
)h a
1 3 5 lco m
a i e
Restored Data files containing t m i d
data files committed and uncommitted @ ho nRecovered
t Gu
transactions ena u de data files
r t
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
The following stepsadescribe b what takes place during complete recovery:
e n r a
fe files are restored from a backup.
1. Damaged
L or or missing
n s
2 re
2.
a
n -from
Changes
n tra incremental backups
backups, archived redo log files files, and online redo log files are
K applied o
n as necessary. The redo log changes are applied to the data files until the current
online log is reached and the most recent transactions have been re-entered. Undo
blocks are generated during this entire process. This is referred to as rolling forward or
cache recovery.
3. The restored data files may now contain committed and uncommitted changes.
4. The undo blocks are used to roll back any uncommitted changes. This is sometimes
referred to as transaction recovery.
5. The data files are now in a recovered state and are consistent with the other data files in
the database.
Archived
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
log Archived
X
log Online
Redo log X
Ch
Changes applied
li d to
t point
i t in
i time
ti (PIT) Database
opened Undo applied
2
4 5
s a
1 3 ha
6 om)
Restored data Data files containing a ilc e
files from as far committed and u id
otmPIT-recovered
uncommitted @ h n G
tdata files
back as necessary a e
transactions up to PIT
l o ren Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
Incomplete recovery,
e n r a b point-in-time recovery (DBPITR), uses a backup to produce
a or database
r
a noncurrentoversion
L s e database. That is, you do not apply all of the redo records
offthe
n -tra
generated after the n
most recent backup. Perform this type of recovery only when absolutely
r e
a noTo
necessary. n perform point-in-time recovery, you need:
K
A valid offline or online backup of all the data files made before the recovery point
All archived logs from the time of the backup until the specified time of recovery
The steps to perform a point-in-time recovery are as follows:
1. Restore the data files from backup: The backup that is used must be from before your
target
g recovery y point. This entails either copying
y g files using
g OS commands or using
g the
RMAN RESTORE command.
2. Use the RECOVER command: Apply redo from the archived redo log files, including as
many as necessary to reach the restore point destination.
3. State of over-recovery: Now the data files contain some committed and some
uncommitted transactions because the redo can contain uncommitted data.
4. Use the ALTER DATABASE OPEN command: The database is opened before undo is
applied.
li d This
Thi iis to provide
id hi
higher
h availability.
il bili
RESETLOGS, but Flashback Database is typically faster because it does not require you to
restore data files and requires only limited application of redo compared to media recovery.
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
r a n icen
Na bledatal protection solution depending on your backup and
Oracle provides anaappropriate
r
recovery objective
o ra
en andsfRTO:
e
e n L ecoraeny Manager
Oracle
O ac e Recovery a age ((RMAN)) is s tthe
e co core eO Oracle
ac e Database
atabase sosoftware
t a e co
component
po e t
a - t
r that manages
n
K no database backup, restore, and recovery processes.
Oracle Secure Backup (OSB) is Oracles enterprise-grade tape backup management
solution for both database and file system data.
Oracle Database Flashback technologies are a set of data recovery solutions that
enable human errors to be reversed by selectively and efficiently undoing the effects of
a mistake.
The Data Recovery Advisor provides intelligent database problem identification and
recovery capabilities.
Data Guard and Active Data Guard enable physical standby databases to be open for
read access while being kept synchronized with the production database through media
recovery.
Quiz
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
Answer: b
r e na ferab
n Lo rans
a re on-t
K n
Summary
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
B k
Backup and
dRRecovery: C
Configuration
fi ti
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Aula Matriz SAS
Objectives
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
must:
Schedule regular backups
Multiplex control files
Multiplex redo log groups
Retain archived copies of redo logs
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
To provide the bestaprotectionbfor your data, you must:
Schedule o r ra
n febackups:
eregular Most media failures require that you restore the lost or
L n s
r edamaged
n rafrom backup.p
n g -tfile
a no control files: All control files associated with a database are identical.
K Multiplex
Recovering from the loss of a single control file is not difficult; recovering from the loss of
all control files is much more challenging. Guard against losing all control files by having
at least two copies.
Multiplex redo log groups: To recover from instance or media failure, redo log
information is used to roll data files forward to the last committed transaction. If your
redo log groups rely on a single redo log filefile, the loss of that file means that data is likely
to be lost. Ensure that there are at least two copies of each redo log group; if possible,
each copy should be under different disk controllers.
Retain archived copies of redo logs: If a file is lost and restored from backup, the
instance must apply redo information to bring that file up to the latest SCN contained in
the control file. With the default setting, the database can overwrite redo information
after it has been written to the data files. Your database can be configured to retain redo
information in archived copies of the redo logs logs. This is known as placing the database in
ARCHIVELOG mode.
You can perform configuration tasks in Enterprise Manager Cloud Control or by using the
SQL command line.
Oracle Database 12c: Admin, Install and Upgrade Accelerated 16 - 3
Aula Matriz SAS
n e n
N ara le lic
The fast recovery area
e n b that is set aside on disk to contain archived logs, backups,
a is araspace
L n s fe control files, and multiplexed redo logs. A fast recovery area
or multiplexed
flashback logs,
r e n -tra
simplifies backup storage management and is strongly recommended. You should place the
K a recovery
fast
n o narea on storage space that is separate from the location of your database data
files and primary online log files and control file.
The amount of disk space to allocate for the fast recovery area depends on the size and
activity levels of your database. As a general rule, the larger the fast recovery area, the more
useful it is. Ideally, the fast recovery area should be large enough for copies of your data and
control files and for flashback, online redo, and archived logs needed to recover the database
with the backups kept based on the retention policy
policy. (In short
short, the fast recovery area should
be at least twice the size of the database so that it can hold one backup and several archived
logs.)
Space management in the fast recovery area is governed by a backup retention policy. A
retention policy determines when files are obsolete, which means that they are no longer
needed to meet your data recovery objectives. The Oracle Database server automatically
manages this storage by deleting files that are no longer needed.
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n b
a yourraarchived
If you have configured logs to be written to this location, it is important to
monitor thiso
L
space
n fe that it does not reach its capacity. If the instance is unable to
r to sensure
create an
r e n -tra
archived log because of lack of space, it pauses until the administrator corrects the
a non
situation.
K
In Enterprise Manager Cloud Control, select Availability > Backup & Recovery > Recovery
Settings. On this page, you can:
Verify how much of the fast recovery area has been consumed
Specify the location of the fast recovery area
Specify y the size of the fast recoveryy area
Configure Flashback Database
Specify the retention time
The retention time determines when files are obsolete (that is, when they are no longer
needed to meet your data recovery objectives). The Oracle Database server automatically
manages this storage, deleting files that are no longer needed. You can back up the recovery
area so that Oracle Recovery Manager (RMAN) can fail over to other archived redo log
destinations if the archived redo log in the fast recovery area is inaccessible or corrupted.
Periodically copying backups to tape frees space in the fast recovery area for other files, but
retrieving files from tape causes longer database restoration and recovery times.
ASM Storage
g File System
y Storage
g
Best One copy on each disk group At least two copies, each on separate disk
Practice (such as +DATA and +FRA) (at least one on separate disk controller)
Steps to No additional control file 1. Alter the SPFILE with the ALTER
create copies required SYSTEM SET control_files
command. s a
additional
2 Shut
2. Sh d down the
h ddatabase.
b )ha
control m
files 3. Copy control file to a new location.
i l co
4. Open the database and verify the
o t ma uide
h nt G
addition of the new control file.
@
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a binary
A control file is a small
r a bfile that describes the structure of the database. It must be
r bysfthe
available forowriting
L file, e Oracle server whenever the database is mounted or opened.
Withoutnthis
t r a
the ndatabase cannot be mounted, and recovery or re-creation of the control
r e -
n Your database should have a minimum of two control files on different storage
fileais required.
K n o
devices to minimize the impact of a loss of one control file.
The loss of a single control file causes the instance to fail because all control files must be
available at all times. However, recovery can be a simple matter of copying one of the other
control files. The loss of all control files is slightly more difficult to recover from but is not
usually catastrophic.
In a database using regular file system storage, adding a control file is a manual operation:
1. Alter the SPFILE with the following command specifying the appropriate location of your
files:
ALTER SYSTEM SET control_files =
'/u01/app/oracle/oradata/orcl/control01.ctl' ,
'/u02/app/oracle/oradata/orcl/control02.ctl' ,
'/u03/app/oracle/oradata/orcl/control03.ctl' SCOPE=SPFILE;
2. Shut down the database instance.
3. Use an operating system command to copy an existing control file to the location you
select for your new file.
s a
4 Open the database.
4. database
)ha
Note: More information about using RMAN is provided in the Oracle Database m
o Backup and
c12c:
Recovery Workshop and in product documentation. i l
a ide
t m
@ ho nt Gu
r e na tude
( n vlo his S
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
n e n
N ara le lic
Redo log groups are
e n a maderaupbof one or more redo log files. Each log file in a group is a
duplicate of o
L
the e Corporation recommends that redo log groups have at least
r others.sfOracle
n -tra
two files per group. n
If using file system storage, then each member should be distributed on
r e
a ndisks
separate n or controllers so that no single equipment failure impacts an entire log group. If
K o
you are using ASM storage, then each member should be in a separate disk group, such as
+DATA and +FRA.
The loss of an entire current log group is one of the most serious media failures because it
can result in loss of data. The loss of a single member of a multiple-member log group is
trivial and does not affect database operation (other than causing an alert to be published in
the alert log).
log) Recovery from the loss of an entire log group requires advanced recovery
techniques and is discussed in the course titled Oracle Database 12c: Backup and Recovery
Workshop.
Remember that multiplexing redo logs may heavily influence database performance because
a commit cannot complete until the transaction information has been written to the logs. You
must place your redo log files on your fastest disks served by your fastest controllers. If
possible, do not place any other database files on the same disks as your redo log files
( l
(unless you are using
i ASM)
ASM). B Because onlyl one group iis written
itt tto att a given
i titime, th
there iis no
performance impact in having members from several groups on the same disk.
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a redo
You can multiplex your
r a b by adding a member to an existing log group. To add a
log
r logsgroup
member to aoredo
L following n fe (with open database and no impact on user performance),
performnthe
r e - t r a steps in Enterprise Manager Database Express:
Archiver (ARCn):
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
SGA
Is an optional background
process
Automatically archives online Redo log
g buffer
o t ma uide
@ h nt G
e n a d e ARCn
l or is St u
( n v h
Archiver process
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
ARCn is an optional
e n abackground
r a b process. However, it is crucial to the recovery of a database
Lortorthe
after the loss e an online redo log group gets filled, the Oracle Database server
of a disk. fWhen
s
begins n writing
t a nnext online redo log group. The process of switching from one online
redo r e -
n to another is called a log switch. The ARCn process initiates archiving of the
a log ngroup
K o
filled log group at every log switch. It automatically archives the online redo log group before
the log group can be reused so that all the changes made to the database are preserved. This
enables recovery of the database to the point of failure even if a disk drive is damaged.
One of the important decisions that a DBA must make is whether to configure the database to
operate in ARCHIVELOG mode or in NOARCHIVELOG mode.
In NOARCHIVELOG mode,mode the online redo log files are overwritten each time a log switch
occurs.
In ARCHIVELOG mode, inactive groups of filled online redo log files must be archived
before they can be used again.
Note
ARCHIVELOG mode is essential for most backup strategies.
If the archived redo log file destination fills up or cannot be written to
to, the database will
eventually come to a halt. Remove archived redo log files from the archived redo log file
destination and the database will resume operations.
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a redoralogb file names and destinations by using Enterprise Manager
To configure archived
Cloud Control,
L fe
or selectnsAvailability > Backup & Recovery > Recovery Settings.
Each
a r n -redo
earchived
n tra log file must have a unique name to avoid overwriting older log files.
K
Specify the
n onaming format as shown in the slide. To help create unique file names, Oracle
Database allows several wildcard characters in the name format:
%s: Includes the log sequence number as part of the file name
%t: Includes the thread number as part of the file name
%r: Includes the resetlogs ID to ensure that the archive log file name remains unique
((even after certain advanced recoveryy techniques that reset log g sequence numbers))
%d: Includes the database ID as part of the file name
The format should include %s, %t, and %r as best practice (%d can also be included if multiple
databases share the same archive log destination).
By default, if the fast recovery area is enabled, then USE_DB_RECOVERY_FILE_DEST is
specified as an archived redo log file destination. Archived redo log files can be written to as
many as ten different destinations. Destinations may be local (a directory) or remote (an
Oracle Net alias for a standby database).
Click Add Another Row to add further destinations. To change recovery settings, you must be
connected as SYSDBA, SYSOPER, or SYSBACKUP.
Note: If you do not want archives sent to this location, delete
USE_DB_RECOVERY_FILE_DEST.
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
following steps:
Using Enterprise Manager Cloud Control:
1 On the Recovery Settings page
1. page, select ARCHIVELOG
ARCHIVELOG
Mode and click Apply. The database can be set to
ARCHIVELOG mode only from the MOUNT state.
2. Restart the database instance by clicking Yes when
prompted.
Using
g SQL commands: s a
) ha
Mount the database. o m
Issue the ALTER DATABASE ARCHIVELOG command. a ilc e
h o tm Guid
Open the database.
a @ e n t
l o ren Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n
ra lic e n
N a le mode prevents redo logs from being overwritten until
Placing the database
n a b
in ARCHIVELOG
a
orearchived.
they have been
L s f er
r e n Manager
In Enterprise - t r an Cloud Control, select Availability > Backup & Recovery > Recovery
K a nSelect
Settings. on ARCHIVELOG Mode and click Apply. The database instance must be
restarted after making this change.
To issue the SQL command to put the database in ARCHIVELOG mode, the database must be
in MOUNT mode. If the database is currently open, you must shut it down cleanly (not abort),
and then mount it as shown in the following example:
shutdown immediate
startup mount
alter database archivelog;
alter database open;
With the database in NOARCHIVELOG mode (the default), recovery is possible only until the
time of the last backup. All transactions made after that backup are lost.
In ARCHIVELOG mode, recovery is possible until the time of the last commit. Most production
databases are operated in ARCHIVELOG mode.
Note: Back up your database after switching to ARCHIVELOG mode because your database
is recoverable only from the first backup taken in that mode.
Quiz
a. FLASH_RECOVERY_AREA_SIZE
b. DB_RECOVERY_FILE_DEST
c FLASH_RECOVERY_AREA_LOC
c. FLASH RECOVERY AREA LOC
d. DB_RECOVERY_FILE_DEST_SIZE
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
Answer: b, d
r e na ferab
n Lo rans
a re on-t
K n
Summary
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Practice 16
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
Aula Matriz SAS
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
P f
Performing
i Database
D t b Backups
B k
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Aula Matriz SAS
Objectives
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
recovery
area or
other disk Backup pieces
Archive areas
log files RMAN
Backup to disk B k d
Backup data
t
Backup
Backup
with
to SBT RMAN third-
Control channel
file party
Target database
media
s a
manager
)ha
Media Management m
co
(Example: Oracle Secure Backup) il
Oracle o t ma uide
Backup to Tape
@ h nt G
Non database files
Secure
Backup r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
Recovery Managera(RMAN) is
e n r a bthe recommended method of backing up your Oracle
can usefiteto back up to disk or to a system backup to tape (SBT) channel.
Lor ranthat
database. You
Oracle n
recommends
s disk backups be stored in the fast recovery area (FRA).
e t
K
Oracle n on-Backup complements existing functionality by adding backup to tape and
ar Secure
backup of file system data. It interacts transparently with RMAN. Third-party media managers
can also be used to back up to tape.
User-managed backups are non-RMAN backups, for example, using an OS utility. They are
often based on scripts that a DBA must write. This option is being phased out because it is
more labor intensive.
n e n
N ara le lic
e n a and
Oracles current backup
r a b
recovery product for the database is Recovery Manager. Oracle
r Co
e Complete a up so
n p ete-trbac
backup solution:
ut o O Oracle
ac e Secu
Secure e Backup
ac up p provides
o des data p protection
otect o for
o tthe
e
a n
no and nondatabase data to protect the entire Oracle environment.
K database
Media management: Oracle Secure Backup provides the media management layer for
RMAN database backups to tape. Before Oracle Secure Backup, customers had to
purchase expensive third-party media management products offering integration with
RMAN tape backups.
Backup anywhere on the network: Oracle Secure Backup backs up data from multiple
network-attached
t k tt h d computert systems
t to
t tertiary
t ti storage
t resources on the
th network.
t k Oracle
O l
Secure Backup supports diverse configurations of servers, clients, Network Attached
Storage (NAS) servers, and tertiary storage devices and protects network storage
environments.
The combination of RMAN and Oracle Secure Backup provides an end-to-end backup
solution that is entirely within the Oracle product stack. This solution makes better customer
pp p
support possible because Oracle Corporation
p is responsible
p for the entire backup
p solution.
User-Managed Backup
A user-managed scenario:
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
n e n
N ara le lic
A user-managed backup
e n a can r a bbe performed interactively. However, most often it entails the
Lober written
writing of scripts fe the backup. There are several scenarios that can be run, and
to perform
n s
scripts n
r e must
- t r a to handle them.
K a ofntheonactions that scripts must take:
Some
Querying V$DATAFILE to determine the data files that need to be backed up and their
current state
Querying V$LOGFILE to identify the online redo log files
Querying V$CONTROLFILE to identify the control file to back up
Placing each tablespace in online backup mode
Querying V$BACKUP to see what data files are part of a tablespace that has been
placed in online backup mode
Issuing operating system copy commands to copy the data files to the backup location
Bringing each tablespace out of online backup mode
m )h
Backup mode may be:
i l co
Offline (consistent, cold) o t ma uide
Online (inconsistent, hot) @ h nt G
Control
n a files de
Online
Data o
l re Database
files
S tu redo log
files
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
Whole database backup:
e n a raIncludesb all data files and at least one control file (Remember that
L n s fe are identical.)
or in a database
all control files
Partial
a r endatabase
n - trabackup: May include zero or more tablespaces and zero or more data files;
K
may or mayno not include a control file
Full backup: Makes a copy of each data block that contains data and that is within the files
being backed up
Incremental backup: Makes a copy of all data blocks that have changed since a previous
backup. Oracle Database supports two levels of incremental backup (0 and 1). A level 1
incremental backup can be one of two types: cumulative or differential. A cumulative backup
backs up all changes since the last level 0 backup. A differential backup backs up all changes
since the last incremental backup (which could be either a level 0 or level 1 backup). Change
Tracking with RMAN supports incremental backups.
Offline backups (also known as cold or consistent backup): Are taken while the database is
not open. They are consistent because, at the time of the backup, the system change number
(SCN) in data file headers matches the SCN in the control files.
Online backups
back ps (also known
kno n as hot or inconsistent backup):
back p) Are taken while
hile the database
is open. They are inconsistent because, with the database open, there is no guarantee that
the data files are synchronized with the control files.
Image copies
Backup sets
n e n
N ara le lic
Image copies: Areaduplicates
e n r a bof data or archived log files (similar to simply copying the files
L or system
by using operating
n s fe commands)
Backup
a r tracollections of one or more binary files that contain one or more data files,
ensets:n-Are
K o server parameter files, or archived log files. With backup sets, empty data blocks
control files,
n
are not stored, thereby causing backup sets to use less space on the disk or tape. Backup
sets can be compressed to further reduce the space requirements of the backup.
Image copies must be backed up to the disk. Backup sets can be sent to the disk or directly to
the tape.
The advantage of creating a backup as an image copy is improved granularity of the restore
operation. With an image copy, only the file or files need to be retrieved from your backup
location. With backup sets, the entire backup set must be retrieved from your backup location
before you extract the file or files that are needed.
The advantage of creating backups as backup sets is better space usage. In most databases,
20% or more of the data blocks are empty blocks. Image copies back up every data block,
even if the data block is empty. Backup sets significantly reduce the space required by the
backup In most systems
backup. systems, the advantages of backup sets outweigh the advantages of image
copies.
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
n e n
N ara le lic
RMAN is the component
e n a ofratheb Oracle Database server that is used to perform backup and
L r
recovery operations.
oand n s fe be used to make consistent and inconsistent backups, perform
It can
r e n -tra
incremental full backups, and back up either the whole database or a portion of it.
K a uses
RMAN n onits own powerful job control and scripting language, as well as a published API
that interfaces RMAN with many popular backup software solutions.
RMAN can store backups on the disk for quick recovery or place them on the tape for long-
term storage. For RMAN to store backups on the tape, you must either use Oracle Secure
Backup or configure an interface to the tape device known as a media management library
(MML).
Enterprise Manager Cloud Control provides a graphical interface to the most commonly used
RMAN functionality. Advanced backup and recovery operations are accessible through
RMANs command-line client. For more information about advanced RMAN capabilities, see
the course titled Oracle Database 12c: Backup and Recovery Workshop or consult the Oracle
Backup and Recovery Users Guide.
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a raorbthe Enterprise Manager Cloud Control interface, you can
By using RMAN commands
L r
manage theopersistent
n s fe settings that are used for creating backups. In Enterprise
backup
Manager
r e n -tra select Availability > Backup & Recovery > Backup Settings. There
Cloud Control,
are
K aseparate
n o nsettings for disk and tape. Tape settings depend on the media management
library capabilities. Disk settings include:
Parallelism: How many separate streams of backup information do you want to create?
The best setting for parallelism depends on your hardware. As hardware resources
increase, the appropriate degree of parallelism also increases. Generally, you want to
set your parallelism to the number of disks that your disk backup location is striped over.
For tape backup, you want to set your parallelism to the same number of tape drives
that you have.
Disk backup location: Where should backups be stored? The default is the fast
recovery area. If you change this, click Test Disk Backup to verify that RMAN can write
to the new location.
Disk backup type: Select Backup Set, Compressed Backup Set, or Image Copy.
Click the Backup
p Set tab to set the maximum file size of backup
pppieces,, specify
p y the
compression algorithm to be used for compressed backup sets, and specify redundancy for
tape backups. Host credentials are required to save changes to the backup settings.
Best practice
Backup
pieces
Change
tracking Recovery
Data files file area
s a
)h a
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e n ferab
Click the Policy tabato:
n Lupo You
Automatically
backup.
bac acan
s up the control file and server parameter file (SPFILE) with each
back
n
r aalso
ou ca so spec
specify y a location
ocat o for o tthese ese bacbackups ups if you do notot wanta t tthem
e to go
a n -trecovery
reto theofast
K n area.
Optimize backups by not backing up files that exactly match a file that is already part of
the retained backups. This setting enables you to skip read-only and offline data files.
Enable block change tracking and specify a location for the tracking file. If you intend to
create incremental backups, this setting can decrease the time required to choose which
blocks to include in the incremental backup.
Exclude tablespaces from a whole database backup. Some administrators choose not to
back up tablespaces containing data or objects that can be easily re-created (such as
indexes or data that is batch-loaded frequently).
Specify a retention policy: How long should RMAN keep your backups? If you are using
the fast recovery area to store backups, RMAN automatically deletes old backups to
make room for new ones (if the retention policy allows it). By default, only the last
backup is retained. The retention policy can be specified as a number of backups or a
number of days.
Oracle-Suggested Backup
backup destination
Sets up a recovery window for backup management
Schedules recurring and immediate backups:
Full backup
+ daily incremental
= new full backup
+ daily archived logs for recovery s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
Enterprise Manager
e n b makes it easy for you to set up an Oracle-suggested
aCloudraControl
L orhours,
backup strategy fe your data and provides efficient recoverability to any point in the
that protects
n s
r e n -tra possibly as far back as 48 hours, depending on when the last
preceding 24 and
K a was
backup
n o ncreated. The Oracle-suggested strategy uses the incremental backup and
incrementally updated backup features, providing faster recoverability than is possible when
applying database changes from the archived redo log files.
Because these backups on disk are retained, you can always perform a full database
recovery or a point-in-time recovery to any time within the past 24 hours, at the minimum. The
recovery time could reach back as far as 48 hours. This is because just before a backup is
taken on a given day
day, the backup from the beginning of day n1
n 1 still exists.
exists
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a rab strategy, navigate to the database home page > Availability
To establish an Oracle-suggested
> Backup & o r
Recovery >fe
Schedule Backup. The Backup Strategies section enables you to
L n s
r e n -tra
select from the Oracle-suggested backup and Customized backup strategies. The Oracle-
suggested
K n takes a full database copy as the first backup. Because it is a whole
a nostrategy
database backup, you might want to consider taking this at the period of least activity. After
that, an incremental backup to disk is taken every day. Optionally, a weekly tape backup can
be made, which backs up all recovery-related files.
By clicking Schedule Customized Backup, you gain access to a wider range of configuration
options. Select the objects that you want to back upthe whole database (the default) or
individual tablespaces,
tablespaces data files
files, archived logs,
logs or any Oracle backups currently residing on
the disk (to move them to the tape).
Both strategies enable you to set up encrypted backups.
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
In Enterprise Manager
e n a Database
r a b Express, select Storage > Control Files to manage your
r files.
databases control
Lofile. n s feControl files have an additional backup option; they may be backed
up to a n
r e trace
- t rAa control file trace backup contains the SQL statement required to re-create
K acontrol
the
n n in the event that all control files are lost.
ofiles
Although it is very unlikely that a properly configured database (with multiple copies of the
control file placed on separate disks and separate controllers) would lose all control files at
the same time, it is possible. Therefore, you should back up the control file to a trace file after
each change to the physical structure of the database (adding tablespaces or data files, or
adding additional redo log groups).
T
Trace copies
i off the
th control
t l file
fil can b
be created
t dbby using
i E Enterprise
t i MManager DDatabase
t b
Express, Enterprise Manager Cloud Control, or by using the following SQL command:
ALTER DATABASE BACKUP CONTROLFILE TO TRACE
The trace backup is created in the location specified by the DIAGNOSTIC_DEST initialization
parameter. For example, in this course the trace file for the orcl database is found in the
/u01/app/oracle/diag/rdbms/orcl/orcl/trace directory and will have a file name
such as o
suc orcl
c _o
oraa_9924.trc.
.t c
Managing Backups
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a Cloud
In Enterprise Manager
r a bControl, select Availability > Backup & Recovery > Manage
L or where
Current Backups fe your existing backups. On this page, you can see when a backup
to manage
n s
r e n -tra it was created (disk or tape), and whether it is still available.
was completed,
Ata
K the top
n onthe Manage Current Backups page, four buttons enable you to work with existing
of
backups:
Catalog Additional Files: Although RMAN (working through Enterprise Manager) is the
recommended way to create backups, you might have image copies or backup sets that
were created by some other means or in some other environment with the result that
RMAN is not aware of them. This task identifies those files and adds them to the
catalog.
catalog
Crosscheck All: RMAN can automatically delete obsolete backups, but you can also
delete them by using operating system commands. If you delete a backup without using
RMAN, the catalog does not know whether the backup is missing until you perform a
cross-check between the catalog and what is really there.
Delete All Obsolete: This deletes backups older than the retention policy.
Delete All Expired: This deletes the catalog listing for any backups that are not found
when the cross-check is performed as described previously.
1
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
$ rman target /
2 RMAN> CONFIGURE
RMAN> BACKUP DATABASE PLUS ARCHIVELOG;
3
s a
) ha
o m
Control a i lc e
Data files
Control
filesfile
Archived tredo
h
log
uid
ofilem t GSPFILE
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
a rastart
1. In a terminal session,
e n b RMAN and connect to the target database.
2. Execute
L n fe commands:
orconfiguration
s
a n - tra DEFAULT DEVICE TYPE TO disk;
ren-- oCONFIGURE
K n CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COPY;
- CONFIGURE CONTROLFILE AUTOBACKUP ON;
3. A whole database backup is a copy of all data files and the control file. You can
optionally include the server parameter file (SPFILE) and archived redo log files. Using
RMAN to make an image copy of all the database files simply requires mounting or
opening the database, starting RMAN, and entering the BACKUP command shown in the
slide.
Optionally, you can supply the DELETE INPUT option when backing up archive log files.
That causes RMAN to remove the archive log files after backing them up. This is useful
especially if you are not using a fast recovery area, which would perform space
management for you, deleting files when space pressure grows. In that case, the
command in the slide would look like the following:
RMAN> BACKUP DATABASE PLUS ARCHIVELOG DELETE INPUT;
You can also create a backup (either a backup set or image copies) of previous image
copies of all data files and control files in the database by using the following command:
RMAN> BACKUP COPY OF DATABASE;
Quiz
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
Answer: b
r e na ferab
n Lo rans
a re on-t
K n
Summary
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Practice 17
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
P f
Performing
i Database
D t b Recovery
R
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Aula Matriz SAS
Objectives
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Opening a Database
To open a database:
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
OPEN
s a
STARTUP
)ha
MOUNT m
co
i l
o t ma uide
NOMOUNT
@ h nt G
r e na tude
vlo his S
SHUTDOWN
(
s se tn
g a u
V
Copyright 2013, ille and/or
Oracle t o
its affiliates. All rights reserved.
n j o
e n se
N ara le lic
As a database moves
e n a fromratheb shutdown stage to being fully open, it performs internal
consistencyo
L r with
checks
n s fethe following stages:
e n -trFor
NOMOUNT:
r instance a an instance to reach the NOMOUNT ((also known as STARTED)) status,, the
K a n
no must read the initialization parameter file. No database files are checked while
the instance enters the NOMOUNT state.
MOUNT: As the instance moves to the MOUNT status, it checks whether all control files
listed in the initialization parameter file are present and synchronized. If even one
control file is missing or corrupt, the instance returns an error (noting the missing control
file) to the administrator and remains in the NOMOUNT state.
OPEN When
OPEN: Wh th the instance
i t moves from
f the
th MOUNT state
t t to
t the
th OPEN state,
t t it does
d the
th
following:
- Checks whether all redo log groups known to the control file have at least one
member present. Any missing members are noted in the alert log.
- Verifies that all data files known to the control file are present unless they have been
taken offline. Offline files are not checked until the administrator tries to bring them
online. The administrator may take a data file offline and open the instance if the
data file does not belong to the SYSTEM or UNDO tablespaces. If any files are
missing, an error noting the first missing file is returned to the administrator and the
instance remains in the MOUNT state. When the instance finds files that are missing,
only the first file causing a problem appears in the error message. To find all files that
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
r a njo icens
/oracle/oradata/orcl/users01.dbf FILE NOT FOUND
N a le l
/oracle/oradata/orcl/example01.dbf FILE NOT FOUND
r e nathatfall
- Verifies e r ab files that are not offline or read-only are synchronized with the
data
o file.
Lcontrol nsIf necessary, instance recovery is automatically performed. However, if a
e n t r a
r
Ka nofile n-is out of synchronization to the extent that it cannot be recovered by using the
online redo log groups, then the administrator must perform media recovery. If any
files require media recovery, an error message noting the first file requiring recovery
is returned to the administrator and the instance remains in the MOUNT state:
ORA-01113: file 4 needs media recovery
ORA-01110: data file 4: '/oracle/oradata/orcl/users01.dbf'
Again v$recover_file
Again, v$recover file gives a complete list of files that need attention
attention. Files that
are present and require media recovery are listed, but no error message is
displayed.
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
After a database isaopen, instance
e n r a b failure can be caused by media failure: for example, by the
loss of a control file, thefe
oorr UNDO loss of an entire redo log group, or the loss of a data file belonging to
L n s
r e n -tra
the SYSTEM tablespaces. Even if an inactive redo log group is lost, the database
would
K n on fail due to log switches.
a eventually
In many cases, the failed instance does not completely shut down but is unable to continue to
perform work. Recovering from these types of media failure must be done with the database
down. As a result, the administrator must use the SHUTDOWN ABORT command before
beginning recovery efforts.
The loss of data files belonging to other tablespaces does not cause instance failure, and the
d t b
database can b
be recovered d while
hil open, with
ith work
k continuing
ti i iin other
th ttablespaces.
bl
These errors can be detected by inspecting the alert log file or by using the Data Recovery
Advisor.
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n r a b
The Data RecoveryaAdvisor automatically gathers data failure information when an error is
encountered.
L n s feit can proactively check for failures. In this mode, it can potentially
orIn addition,
r e n -tra failures before a database process discovers the corruption and
detect and analyze data
signals
K n (Note that repairs are always under human control.)
a annoerror.
Data failures can be very serious. For example, if your current log files are missing, you
cannot open your database. Some data failures (like block corruptions in data files) are not
catastrophic because they do not take the database down or prevent you from opening the
Oracle database. The Data Recovery Advisor handles both cases: the one when you cannot
start up the database (because required database files are missing, inconsistent, or
corrupted) and the one when file corruptions are discovered during run time
time.
The preferred way to address serious data failures is as follows:
1. Fail over to a standby database if you are in a Data Guard configuration. This allows
users to come back online as soon as possible.
2. Repair the primary cause of the data failure.
User Interfaces
The Data Recovery Advisor is available in Enterprise Manager Cloud Control. When failures
exist, there are several ways to access the Data Recovery Advisor.
You can also use the Data Recovery Advisor by using the RMAN command line:
rman target /
rman> list failure all;
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
n e n
N ara le lic
e n a from
The options for recovery
r a bthe loss of a control file depend on the storage configuration of
the control files
L e
or andnonsfwhether at least one control file remains or have all been lost.
a r - tra and at least one control file copy remains, you can perform guided
enASMnstorage,
If using
K no Enterprise Manager or perform manual recovery using RMAN as follows:
recovery using
1. Put the database in NOMOUNT mode.
2. Connect to RMAN and issue the RESTORE CONTROLFILE command to restore the
control file from an existing control file, for example:
restore controlfile from
'+DATA/orcl/controlfile/current.260.695209463';
3. After the control file is successfully restored, open the database.
If your control files are stored as regular file system files and at least one control file copy
remains, then, while the database is down, you can just copy one of the remaining control
files to the missing files location. If the media failure is due to the loss of a disk drive or
controller, copy one of the remaining control files to some other location and update the
instances parameter file to point to the new location. Alternatively, you can delete the
reference to the missing g control file from the initialization p
parameter file. Remember that
Oracle recommends having at least two control files at all times.
Note: Recovering from the loss of all control files is covered in the course titled Oracle
Database 12c: Backup and Recovery Workshop.
If a member of a redo log file group is lost and if the group still
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
n e n
N ara le lic
Recovering from the
e n a loss ofraabsingle redo log group member should not affect the running
instance. or
L n s fe
ren othis
To perform
n ra
-trecovery by using SQL commands:
a
K1. Determine
n whether there is a missing log file by examining the alert log.
2. Restore the missing file by first dropping the lost redo log member:
ALTER DATABASE DROP LOGFILE MEMBER '<filename>'
Then add a new member to replace the lost redo log member:
ALTER DATABASE ADD LOGFILE MEMBER '<filename>
TO GROUP <integer>
Note: If you are using Oracle Managed Files (OMF) for your redo log files and you use
the preceding syntax to add a new redo log member to an existing group, that new redo
log member file will not be an OMF file. If you want to ensure that the new redo log
member is an OMF file, then the easiest recovery option would be to create a new redo
log group and then drop the redo log group that had the missing redo log member.
3. If the media failure is due to the loss of a disk drive or controller, rename the missing file.
4 If the group has already been archived
4. archived, or if you are in NOARCHIVELOG mode,
mode you may
choose to solve the problem by clearing the log group to re-create the missing file or
files. You can clear the affected group manually with the following command:
ALTER DATABASE CLEAR LOGFILE GROUP <integer>;
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n
ra lic e n
N a le mode, the loss of any data file not belonging to the
With the database a
n b
in ARCHIVELOG
a
SYSTEM or UNDO
L o re tablespaces
s f er affects only the objects that are in the missing file. The rest of
r e n remains
the database
- t r an available for users to continue work.
Toarestore
K n n recover the missing data file by using Enterprise Manager Cloud Control, use
oand
the Data Recovery Advisor or perform the following steps:
1. Select Availability > Backup & Recovery > Perform Recovery.
2. In the User Directed Recovery section, select Datafiles in the Recovery Scope menu
and then select Recover to current time.
3. Click Recover to begin
g the g guided restore and recoveryy process.
4. Click Add to select the data files to restore and recover.
5. Specify whether you want to restore the files to the default location or (if a disk or
controller is missing) to a new location.
6. Submit the RMAN job to restore and recover the missing files.
Because the database is in ARCHIVELOG mode, recovery is possible up to the time of the last
commit and users are not required
q to re-enter any
y data.
n
ra lic e n
N a le tablespace or containing UNDO data are considered
Data files belonging
n a b
to the SYSTEM
a
r of these files requires the database to be restored from the
L o reA losssoffeone
system critical.
MOUNT n
r e state (unlike
- t r another data files that may be restored with the database open).
Toaperform
K n recovery by using Enterprise Manager Cloud Control:
nothis
1. If the instance is not already shut down, shut it down.
2. Mount the database.
3. Select Availability > Backup & Recovery > Perform Recovery.
4. In the User Directed Recovery Section, select Datafiles in the Recovery Scope menu
and then select Recover
Recover to current time.
time.
5. Click Add to select all data files that need recovery.
6. Specify whether you want to restore the files to the default location or (if a disk or
controller is missing) to a new location.
7. Submit the RMAN job to restore and recover the missing files.
8. Open the database. Users are not required to re-enter data because the recovery is up
to the time of the last commit.
Quiz
occurs:
a. Loss of a control file if there is a remaining multiplexed
control file
b. Loss of the SYSTEM tablespace
c. Loss of one redo log member if there is a remaining
multiplexed redo log member from the same group of the
lost member a
d Loss of the active undo tablespace
d. ) has
i l com
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
Answer: c
r e na ferab
n Lo rans
a re on-t
K n
Summary
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Practice 18
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
M i
Moving Data
D t
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Aula Matriz SAS
Objectives
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
SQL*Loader
expdp impdp Other clients
(sqlldr)
Data Pump
DBMS_DATAPUMP
Data/Metadata Movement Engine
s a
) ha
o m
Oracle Oracle a ilc e
Loader DataPump Direct Path API DBMS_METADATA h otm t Guid
n a @Metadata
en API
e u d
External Table API
v l or is St
s (n th
a e
us All rights reserved.
i l l egand/ortitsoaffiliates.
j o V se
Copyright 2013, Oracle
r a n icen
N a le l
r e r ab the API for high-speed export and import utilities for bulk
na feContains
Major functional components:
o ns
DBMS_DATAPUMP:
Land
n
re ond-metadata
data a a movement
tretadata o e e t
a
K Direct
n Path API (DPAPI): Oracle Database supports a Direct Path API interface that
minimizes data conversion and parsing at both unload and load time.
DBMS_METADATA: Used by worker processes for all metadata unloading and loading.
Database object definitions are stored using XML rather than SQL.
External Table API: With the ORACLE_DATAPUMP and ORACLE_LOADER access
drivers, you can store data in external tables (that is, in platform-independent files). The
SELECT statement reads external tables as though they were stored in an Oracle
database.
SQL*Loader: Has been integrated with external tables, providing automatic migration of
loader control files to external table access parameters
expdp and impdp: Thin layers that make calls to the DBMS_DATAPUMP package to
initiate and monitor Data Pump operations
Oth clients:
Other li t Applications
A li ti ((such
h as replication,
li ti ttransportable
t bl ttablespaces,
bl and
d user
applications) that benefit from this infrastructure. SQL*Plus may also be used as a client
of DBMS_DATAPUMP for simple status queries against ongoing operations.
n e n
N ara le lic
Oracle Data Pumpa
e n r a b high-speed data and metadata loading and unloading of
enables very
or custom
Oracle databases.
L s e Pump infrastructure is callable via the DBMS_DATAPUMP PL/SQL
The fData
package. Thus, n
n -tra data movement utilities can be built by using Data Pump.
r e
K
Oracle non provides the following tools:
a Database
Command-line export and import clients called expdp and impdp, respectively
Export and import interface in Enterprise Manager Cloud Control
Data Pump automatically decides the data access methods to use; these can be either direct
path or external tables. Data Pump uses direct path load and unload when a tables structure
g
allows it and when maximum single-stream performance is desired. However,, if there are
p
clustered tables, referential integrity constraints, encrypted columns, or several other items,
Data Pump uses external tables rather than direct path to move the data.
The ability to detach from and re-attach to long-running jobs without affecting the job itself
enables you to monitor jobs from multiple locations while they are running. All stopped Data
Pump jobs can be restarted without loss of data as long as the metainformation remains
undisturbed. It does not matter whether the job is stopped voluntarily or involuntarily due to a
crash.
Data Pump offers many benefits and many features, such as:
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
n
ra lic e n
N a le
andbCONTENT
The EXCLUDE, INCLUDE,
e n a r a parameters are used for fine-grained object and data
selection. or
L n s fe
enspecify
You can
r - a database version for objects to be moved (using the VERSION
trthe
K a
parameter)
n n
oto create a dump file set that is compatible with a previous release of Oracle
Database that supports Data Pump.
You can use the PARALLEL parameter to specify the maximum number of threads of active
execution servers operating on behalf of the export job.
You can estimate how much space an export job would consume (without actually performing
the export) by using the ESTIMATE_ONLY parameter.
Network mode enables you to export from a remote database directly to a dump file set. This
can be done by using a database link to the source system.
During import, you can change the target data file names, schemas, and tablespaces.
In addition you can specify a percentage of data to be sampled and unloaded from the source
database when performing a Data Pump export. This can be done by specifying the SAMPLE
parameter.
You can use the COMPRESSION parameter to indicate whether the metadata should be
compressed in the export dump file so that it consumes less disk space. If you compress the
metadata, it is automatically uncompressed during import.
- You can specify the type of security to use for performing encryption and decryption
during an export. For example, perhaps the dump file set will be imported into a
different or remote database and it must remain secure in transit. Or perhaps the
dump p file set will be imported
p on-site using
g the Oracle Encryption
yp Wallet but it may
y
also need to be imported off-site where the Oracle Encryption Wallet is not available.
Perform table mode exports and imports using the transportable method; specify how
partitioned tables should be handled during import operations
Overwrite existing dump files during an export operation
Rename tables during an import operation
s a
p
Specify y that a data load should p a
proceed even if nondeferred constraint violations are
) h
m
encountered (This is valid only for import operations that use the external tables access
o
method.)
a ilc e
h otm t Guid
Specify that XMLType columns are to be exported in uncompressed CLOB format
regardless of the XMLType storage format that was defined for them
n a @ en
l o re Stud
During an export, specify a remap function that takes as a source the original value of the
( n v his
designated column and returns a remapped value that will replace the original value in the
dump file
g a s se t
ille e to u
Remap data as it is being imported into a new database
V
r a njo icens
Use legacy mode to support the use of original Export (exp) and Import (imp) scripts
N a le l
r e na ferab
n Lo rans
a re on-t
K n
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a logical
Directory objects are
r a b
structures that represent a physical directory on the servers file
system. They
L ocan n felocation of a specific operating system directory. This directory
rcontainsthe
r e n -tra
object name be used in Enterprise Manager so that you do not need to hard-code
a npath
directory
K n specifications. This provides greater flexibility for file management. Directory
oowned
objects are by the SYS user. Directory names are unique across the database
because all the directories are located in a single name space (that is, SYS).
Directory objects are required when you specify file locations for Data Pump because it
accesses files on the server rather than on the client.
In Enterprise Manager Cloud Control, select Schema > Database Objects > Directory Objects.
To edit or delete a directory object, select the object and click the appropriate button.
s a
)h a
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
1. On the Directory
e n a Objects
r a bpage, click Create.
or namensoffethe directory object and the OS path to which it maps. OS directories
2. Enter the
L
n raeated before
nou d be-tccreated
resshould be o e they
t ey are
a e used
used. You ou ca can test tthis s by cclicking
c g Testest File
e Syste
System.
a
K Fornthe o test, provide the host login credentials (the OS user who has privileges on this
OS directory).
3. Permissions for directory objects are not the same as OS permissions on the physical
directory on the server file system. You can manage user privileges on individual
directory objects. This increases the level of security and gives you granular control over
these objects. On the Privileges page, click Add to select the user to which you give
read or write privileges (or both).
both)
4. Click Show SQL to view the underlying statements. Click Return when finished.
5. Click OK to create the object.
Source Target
Data Pump Server
job process
Database Database
Master Dump Dump Master
table file set file set table
Network mode s a
) ha
Server Data Pump o m
process job a ilc e
h otm t Guid
n a @ en
l o re S tud
impdp
( n v his client
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
Data Pump Export a is a utility b
for unloading data and metadata into a set of operating system
e n r a
fe Data Pump Import is used to load metadata and data stored in an
r file sets.
files called dump
L ofile n s
r e n -tra a target system.
export dump set into
K
The on API accesses its files on the server rather than on the client.
a DatanPump
These utilities can also be used to export from a remote database directly to a dump file set,
or to load the target database directly from a source database with no intervening files. This is
known as network mode. This mode is particularly useful to export data from a read-only
source database.
At the center of every Data Pump operation is the master table (MT), which is a table created
in the schema of the user running the Data Pump job. The MT maintains all aspects of the
job. The MT is built during a file-based export job and is written to the dump file set as the last
step. Conversely, loading the MT into the current users schema is the first step of a file-based
import operation and is used to sequence the creation of all objects imported.
Note: The MT is the key to Data Pumps restart capability in the event of a planned or
unplanned stopping of the job. The MT is dropped when the Data Pump job finishes normally.
Command line
Parameter file
Interactive command line
Enterprise Manager Cloud Control
Data Pump Export and Import modes:
Full
Schema
s a
Table )ha
m
co
Tablespace i l
Transportable tablespace o t ma uide
@ h nt G
Transportable database
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
a DataraPump
You can interact with
e n b Export and Import by using one of the following interfaces:
Command-line
L fe
or nsinterface: Enables you to specify most of the export parameters directly
on
o n
re on-tr
t
the
e co a
commanda d line
e
a
K Parameter
n file interface: Enables you to specify all command-line parameters in a
parameter file. The only exception is the PARFILE parameter.
Interactive-command interface: Stops logging to the terminal and displays the export
or import prompts, where you can enter various commands. This mode is enabled by
pressing Ctrl + C during an export operation that is started with the command-line
interface or the parameter file interface. Interactive-command mode is also enabled
when
h you attach
tt h to
t an executing
ti or stopped
t d job.
j b
GUI interface: Select Schema > Database Export/Import. In the menu select the export
or import operation you want to execute.
Data Pump Export and Import provide different modes for unloading and loading different
portions of the database. The mode is specified on the command line by using the appropriate
parameter. The available modes are listed in the slide and are the same as in the original
export and import utilities
utilities.
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
Enterprise Manager
e n b provides a wizard to guide you through the process of
aCloudraControl
L r Pump
performing aoData
n s feexport and import procedure. The example in the slide shows a Data
a r en n-tra
Pump export.
K o
From thenDatabase home page, expand the Schema menu, select Database Export/Import,
and then select Export to Export Files to begin a Data Pump export session.
The next window that appears is the selection of export type. If a privileged user is connected
to the database instance, then the export types include the following:
Database
Schemas
Tables
Tablespace
If a non-administrative account is used, then the export type list is limited to the following:
Schemas
Tables
Cli k C
Click Continue
ti tto proceed
d with
ith th
the export.
t
$ impdp hr DIRECTORY=DATA_PUMP_DIR \
DUMPFILE=HR_SCHEMA.DMP \
PARALLEL=1 \
CONTENT=ALL \
TABLES="EMPLOYEES" \
LOGFILE=DATA_PUMP_DIR:import_hr_employees.log \
JOB_NAME=importHR \
s a
TRANSFORM=STORAGE:n ) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a includes
Oracle Database also
r a b Data Pump command-line clients for import and export
L or example
operations. The
n s fein the slide illustrates a Data Pump import using the impdp utility.
r e n -tra
There are some parameters that are available only by using the command-line interface. For
a nolist
a complete
K n of options, refer to Oracle Database Utilities.
s a
REMAP TABLE = 'EMPLOYEES':'EMP'
REMAP_TABLE )ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
Because object metadata
e n b as XML in the dump file set, it is easy to apply
a risastored
L or when
transformations
n s fe is being formed during import. Data Pump Import supports several
DDL
r e n -tra
transformations:
a on
K REMAP_DATAFILE
n is useful when moving databases across platforms that have
different file-system semantics.
REMAP_TABLESPACE enables objects to be moved from one tablespace to another.
REMAP_SCHEMA provides the old FROMUSER /TOUSER capability to change object
ownership.
REMAP_TABLE provides the ability to rename entire tables.
REMAP_DATA provides the ability to remap data as it is being inserted.
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a raManager
You can use the Enterprise b graphical user interface (GUI) to monitor all Data Pump
L o nsfe package.
jobs, includingr those created by using the expdp or impdp command-line interfaces or by
a r en n-tra
using the DBMS_DATAPUMP
K no the current status of the job and change the status to EXECUTE, STOP, or
You can view
SUSPEND.
To access the Export and Import Jobs page, select View Export and Import Jobs in the
Database Export/Import menu.
SQL*Loader: Overview
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
SQL*Loader Rejected
Field processing
Discarded Accepted
Record selection
Selected
Bad
Oracle server file s a
Di
Discard d file
fil )ha
Inserted Rejected m
(optional) i l co
o t ma uide
Log file
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
SQL*Loader loads a data from b external files into tables of an Oracle database. It has a powerful
e n
r that
data parsingoengine r a
feputs little limitation on the format of the data in the data file.
L n s
SQL
a
n uses
reLoader
SQL*Loader
n - trathe following files:
K nofiles: SQL*Loader reads data from one or more files (or operating system
Input data
equivalents of files) that are specified in the control file. From SQL*Loaders perspective, the
data in the data file is organized as records. A particular data file can be in fixed record
format, variable record format, or stream record format. The record format can be specified in
the control file with the INFILE parameter. If no record format is specified, the default is
stream record format.
Control file: The control file is a text file that is written in a language that SQL*Loader
understands. The control file indicates to SQL*Loader where to find the data, how to parse
and interpret the data, where to insert the data, and so on. Although not precisely defined, a
control file can be said to have three sections.
The first section contains such session-wide information as the following:
- Global options, such as the input data file name and records to be skipped
- INFILE clauses
l to
t specifyif where
h th
the iinputt d
data
t iis llocated
t d
- Data to be loaded
Bad file: The bad file contains records that are rejected, either by SQL*Loader or by the Oracle
database. Data file records are rejected by SQL*Loader when the input format is invalid. After a
data file record is accepted for processing by SQL*Loader, it is sent to the Oracle database for
i
insertion
ti iinto
t a ttable
bl as a row. If th
the O
Oracle
l d
database
t b d
determines
t i th
thatt th
the row iis valid,
lid th
the row iis
inserted into the table. If the row is determined to be invalid, the record is rejected and
SQL*Loader puts it in the bad file.
Discard file: This file is created only when it is needed and only if you have specified that a
discard file should be enabled. The discard file contains records that are filtered out of the load
because they do not match any record-selection criteria specified in the control file.
s a
For more information about SQL
SQL*Loader guide ) ha
Loader, see the Oracle Database Utilities guide.
i l com
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
n e n
N ara le lic
e n a file
The SQL*Loader control
r a ba text file that contains data definition language (DDL)
is
L r is used
instructions.oDDL
n s feto control the following aspects of a SQL*Loader session:
e
a
ne e SQ
r Where n - tra oade finds
SQL*Loader ds tthee data to load
oad
K HownoSQL*Loader expects that data to be formatted
How SQL*Loader is being configured (including memory management, selection and
rejection criteria, interrupted load handling, and so on) as it loads the data
How SQL*Loader manipulates the data being loaded
8 WHEN (57) = .
9 TRAILING NULLCOLS
10 (hiredate SYSDATE,
deptno POSITION(1:2) INTEGER EXTERNAL(3)
NULLIF deptno=BLANKS,
job POSITION(7:14) CHAR TERMINATED BY WHITESPACE
NULLIF job=BLANKS "UPPER(:job)",
mgr POSITION(28:31) INTEGER EXTERNAL
TERMINATED BY WHITESPACE, NULLIF mgr=BLANKS,
ename POSITION(34:41) CHAR
s a
TERMINATED BY WHITESPACE "UPPER(:ename)",
) ha
empno POSITION(45) INTEGER EXTERNAL
o m
TERMINATED BY WHITESPACE,
a ilc e
otm t Guid
sal POSITION(51) CHAR TERMINATED BY WHITESPACE
"TO_NUMBER(:sal,$99,999.99)", h
@ en
a
comm INTEGER EXTERNAL ENCLOSED BY ( AND %
n
":comm * 100" l o re Stud
( n v his
)
g a s se t
ille e to u
The explanation of this sample control file (by line numbers) is as follows:
V
1. Comments can appear anywhere in the command section of the file, but they must not
r a njo icens
appear in the data. Precede any comment with two hyphens. All text to the right of the
a le l
double hyphen is ignored until the end of the line.
N
r e na ferab
2. The LOAD DATA statement indicates to SQL*Loader that this is the beginning of a new
n Lo rans
data load. If you are continuing a load that has been interrupted in progress, use the
CONTINUE LOAD DATA statement.
a re on-t
K3. The INFILE keyword specifies the name of a data file containing data that you want to
n
load.
4. The BADFILE keyword specifies the name of a file into which rejected records are placed.
5. The DISCARDFILE keyword specifies the name of a file into which discarded records are
placed.
6. The APPEND keyword is one of the options that you can use when loading data into a table
p y To load data into a table that is empty,
that is not empty. p y, use the INSERT keyword.
y
7. The INTO TABLE keyword enables you to identify tables, fields, and data types. It defines
the relationship between records in the data file and tables in the database.
8. The WHEN clause specifies one or more field conditions that each record must match
before SQL*Loader loads the data. In this example, SQL*Loader loads the record only if
the 57th character is a decimal point. That decimal point delimits dollars and cents in the
field and causes records to be rejected if SAL has no value.
9. The
9 e TRAILING U CO S cclause
G NULLCOLS ause pprompts
o pts SQSQL*Loader
oade to ttreat
eat a
any
y relatively
e at e y pos
positioned
t o ed
columns that are not present in the record as null columns.
10. The remainder of the control file contains the field list, which provides information about
column formats in the table that is being loaded.
Loading Methods
Data Block
insert writes
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
Table
HWM
Always generates redo entries Generates redo only under specific conditions
Enforces all constraints Enforces only PRIMARY KEY, UNIQUE, and NOT NULL
n j o
e n se
N ara le lic
Method of SavingaData
r e n ferab
A conventional
L o pathnload s executes SQL INSERT statements to populate tables in an Oracle
n a
-tr path
re dataoA nblocks
database. direct load eliminates much of the Oracle database overhead by formatting
K a
Oracle n and writing the data blocks directly to the database files. A direct load
does not compete with other users for database resources, so it can usually load data at close
to disk speed. Conventional path loads use SQL processing and a database COMMIT
operation for saving data. The insertion of an array of records is followed by a COMMIT
operation. Each data load may involve several transactions.
Direct path loads use data saves to write blocks of data to Oracle data files. This is why the
di t path
direct th lloads
d are ffaster
t ththan th
the conventional
ti l ones. Th
The ffollowing
ll i ffeatures
t diff
differentiate
ti t a
data save from COMMIT:
During a data save, only full database blocks are written to the database.
The blocks are written after the high-water mark (HWM) of the table.
After a data save, the HWM is moved.
Internal resources are not released after a data save.
A data save does not end the transaction.
Indexes are not updated at each data save.
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
You can load data a
e n r a b
by using Enterprise Manager Cloud Control. In the Schema menu, select
or nsfeThen select Load Data From User Files.
Database Export/Import.
L
On the
r enfirst page
- a indicate whether you are using an existing control file or want a new
tryou
K a n
noto be generated. Click Continue on this page to invoke the wizard.
control file
number, or datetime).
A data file can contain only delimited character data.
SQL*Loader
SQL Loader uses table column definitions to determine
input data types.
There is no need to create a control file.
$ sqlldr hr TABLE=test
s a
)h a
test.log file m
cooptions
SQL*Loader control i l
a ide
file
t m u
@ ho table
Create external
t G statement
n a
test_%p.log_xt
e u d enfile
test.dat file hr.test table (nv Load
lor iresult
s St
a s e th
i l l us All rights reserved.
egand/ortitsoaffiliates.
j o V se
Copyright 2013, Oracle
r a n icen
N a Expressl e l
e n a rab Mode, specifying only the username and the TABLE
If you activate SQL*Loader
r default
parameter, itouses
s fe settings for several other parameters. You can override most of the
defaultsnbyLspecifying
r a n additional parameters on the command line.
r e - t
a nonExpress Mode generates two files. The names of the log files come from the
K
SQL*Loader
name of the table (by default).
A log file that includes:
The control file output
A SQL script for creating the external table and performing the load using a SQL
INSERT AS SELECT statement
Neither the control file nor the SQL script are used by SQL*Loader Express Mode. They
are made available to you in case you want to use them as a starting point to perform
operations using regular SQL*Loader or stand-alone external tables.
A log file similar to a SQL*Loader log file that describes the result of the operation
The %p represents the process ID of the SQL*Loader process.
$ sqlldr hr TABLE=test
$ more test.log
Express Mode Load, Table: TEST
Data File: test.dat
Bad File: test_%p.bad
Table TEST, loaded from every logical record.
Insert option in effect for this table: APPEND
Column Name Position Len Term Encl Datatype
s a
-------------------- ---------- ----- ---- ---- ---------
) ha
C1 FIRST * , CHARACTER
, CHARACTER c o m
C2 NEXT *
a il e
t m i d
ho nt Gu
C3 NEXT * , CHARACTER
Generated control file for possible reuse:
@
na tude
OPTIONS(EXTERNAL_TABLE=EXECUTE, TRIM=LRTRIM)
r e
o TEST S
LOAD DATA INFILE 'test' APPEND INTOvlTABLE s
( n t h i
FIELDS TERMINATED BY "," " " ( C1,
g a
C1s C2,C2 eC3)
s
End of generated control u
illefileefortopossible reuse.
V
jo ens
r a n
a ltable
creating external
N e lic "SYS_SQLLDR_X_EXT_TEST"
CREATE a
r e ab
n TABLEfer"SYS_SQLLDR_X_EXT_TEST"
o NUMBER,"C2"
L("C1" n s CHAR(1),"C3" VARCHAR2(20)) ORGANIZATION external(
n
re onTYPE a
-tr oracle_loader
oracle loader DEFAULT DIRECTORY SYS_SQLLDR_XT_TMPDIR_00000
SYS SQLLDR XT TMPDIR 00000
K a n ACCESS PARAMETERS
( RECORDS DELIMITED BY NEWLINE CHARACTERSET US7ASCII
BADFILE 'SYS_SQLLDR_XT_TMPDIR_00000':'test_%p.bad'
LOGFILE 'test_%p.log_xt' READSIZE 1048576
FIELDS TERMINATED BY "," LRTRIM REJECT ROWS WITH ALL NULL FIELDS ("C1"
CHAR(255),"C2" CHAR(255),"C3" CHAR(255)))
location ('test.dat')) REJECT LIMIT UNLIMITED
executing INSERT statement to load database table TEST
INSERT /*+ append parallel(auto) */ INTO TEST (C1, C2, C3)
SELECT "C1", "C2", "C3" FROM "SYS_SQLLDR_X_EXT_TEST"
Table TEST: 2 Rows successfully loaded.
External Tables
(Text)
ext_table
(Metadata Only)
s a
)ha
m
co
ORACLE_DATAPUMP
i l
driver
o t ma uide
@ h nt G
Database r e na tude
( n vlo his S (Binary)
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a datarainbexternal sources as if it were in a table in the database. You
External tables access
L n s fe and create metadata for the external table using DDL. The DDL
can connectotor the database
r e n -tra
for an external table consist of two parts: one part that describes the Oracle Database column
K a and
types,
n n part that describes the mapping of the external data to the Oracle
another
o
Database data columns.
An external table does not describe any data that is stored in the database. Nor does it
describe how data is stored in the external source. Instead, it describes how the external table
layer must present the data to the server. It is the responsibility of the access driver and the
external table layer to do the necessary transformations required on the data in the external
file so that it matches the external table definition
definition. External tables are read only; therefore
therefore, no
DML operations are possible, and no index can be created on them.
There are two access drivers used with external tables. The ORACLE_LOADER access driver
can be used only to read table data from an external table and load it into the database. It
uses text files as the data source. The ORACLE_DATAPUMP access driver can both load table
data from an external file into the database and also unload data from the database into an
external file. It uses binary files as the external files. The binary files have the same format as
th files
the fil used dbby th
the D
Data
t PPump IImportt and dEExportt utilities
tiliti and
d can bbe iinterchanged
t h d with
ith
them.
n e n
N ara le lic
The data files created
e n a for the
r a bexternal table can be moved and used as the data files for
r tablesinfethe same database or different database. External data can be
another external
Lojoined
queriednand
t r n
adirectly in parallel to tables residing in the database, without requiring the
r e -
n first. You can choose to have your applications directly access external
a to benoloaded
data
K
tables with the SELECT command, or you can choose to have data loaded first into a target
database.
The results of a complex query can be unloaded to an external file using the
ORACLE_DATAPUMP access driver.
Data files that are populated by different external tables can all be specified in the LOCATION
clause
l off another
th external
t l table.
t bl This
Thi provides
id an easy way off aggregating ti ddata
t ffrom multiple
lti l
sources. The only restriction is that the metadata for all the external tables must be exactly the
same.
(employee_id NUMBER(4),
first_name VARCHAR2(20),
last_name VARCHAR2(25),
hire date
hire_date DATE)
ORGANIZATION EXTERNAL
( TYPE ORACLE_LOADER DEFAULT DIRECTORY extab_dat_dir
ACCESS PARAMETERS
( records delimited by newline
badfile extab_bad_dir:'empxt%a_%p.bad'
s a
logfile extab_log_dir:'empxt%a_%p.log'
)ha
fields terminated by ','
m
co
missing field values are null
i l
( employee_id, first_name, last_name,
o t ma uide
hire_date char date_format date mask "dd-mon-yyyy))
@ h nt G
LOCATION ('empxt1.dat', 'empxt2.dat') )
r e na tude
PARALLEL REJECT LIMIT UNLIMITED;
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a external
The metadata for an
r a btable is created using the SQL language in the database. The
L or notaccess
ORACLE_LOADER
n s fe driver uses the SQL*Loader syntax to define the external table. This
command
r e n -tra
does create the external text files.
K
The
n onin the slide shows three directory objects (EXTAB_DAT_DIR, EXTAB_BAD_DIR,
a example
and EXTAB_LOG_DIR) that are created and mapped to existing OS directories to which the
user is granted access.
When the EXTAB_EMPLOYEES table is accessed, SQL*Loader functionality is used to load the
table, and at that instance the log file and bad file are created.
Best-practice tip: If you have a lot of data to load, enable PARALLEL for the load operation:
ALTER SESSION ENABLE PARALLEL DML;
r a n icen
N a le l
This example shows
e n a how
you
r a bthe external table population operation can help to export a
or records
selective set of
L s e
fresulting from the join of the EMPLOYEES and DEPARTMENTS tables.
n
tra table can be large, you can use a parallel populate operation to unload
a r en thenexternal
Because -
K o an external table. As opposed to a parallel query from an external table, the
your datanto
degree of parallelism of a parallel populate operation is constrained by the number of
concurrent files that can be written to by the access driver. There is never more than one
parallel execution server writing into one file at a particular point in time.
The number of files in the LOCATION clause must match the specified degree of parallelism
because each input/output (I/O) server process requires its own file. Any extra files that are
specified
ifi d are iignored.
d If th
there are nott enough
h fil
files ffor th
the specified
ifi d d
degree off parallelism,
ll li th
the
degree of parallelization is lowered to match the number of files in the LOCATION clause.
The external table is read-only after is has been populated. The SELECT command can be
very complex, allowing specific information to be populated in the external table. The external
table, having the same file structure as binary Data Pump files, can then be migrated to
another system, and imported with the impdp utility or read as an external table.
Note: For more information about the ORACLE_DATAPUMP
ORACLE DATAPUMP access driver parameters, see the
Oracle Database Utilities guide.
Q y g and joining
Querying j g an external table with an internal
table:
SQL> SELECT e.employee_id, e.first_name, e.last_name,
d.department_name FROM departments d, extab_employees e
WHERE d.department_id = e.department_id;
s a
ha
Appending
A di d data t tto an iinternalt l ttablebl ffrom an external t bl)
l ttable:
m
o
a ilc* e
otm t Guid
SQL> INSERT /*+ APPEND */ INTO hr.employees SELECT
FROM extab_employees;
@ enh
n a
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
External tables areaqueried just
e n r a b like internal database tables. The first example illustrates
or ntable
querying an external
s fe named EXTAB_EMPLOYEES and only displaying the results. The
areLnot stored
results n r a the database.
in
r e - t
K a second
The
n onexample shows the joining of an internal table named DEPARTMENTS with an
external table named EXTAB_EMPLOYEES and only displaying the results.
The third example in the slide illustrates the direct appending of an internal table data with the
query and load of data from an external table.
Data Dictionary
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n
ra lic e n
N a leslide provide information about external tables:
n a b
The data dictionaryaviews in the
L
[DBA| ALL| re sfer
oUSER]_EXTERNAL_TABLES: Specific attributes of external tables in the
n a n
re on-tr
database
a
K n USER]_EXTERNAL_LOCATIONS: Data sources for external tables
[DBA| ALL|
[DBA| ALL| USER]_TABLES: Descriptions of the relational tables in the database
[DBA| ALL| USER]_TAB_COLUMNS: Descriptions of the columns of tables, views, and
clusters in the database
[DBA| ALL]_DIRECTORIES: Descriptions of the directory objects in the database
Quiz
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
Answer: b
r e na ferab
n Lo rans
a re on-t
K n
Quiz
a. True
b. False
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
Answer: b
r e na ferab
n Lo rans
a re on-t
K n
Summary
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Practice 19
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
P f
Performing
i Database
D t b Maintenance
M i t
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Aula Matriz SAS
Objectives
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Database Maintenance
tasks
Automatic Automatic
Workload Diagnostic
Repository Repository s a
Efficient
) ha
o m
a ilc e
h otm t Guid
Data warehouse Automatic collection na@ n
Directememory
e u d
of the database of important statistics
v l or is St access
s (n th
a e
us All rights reserved.
i l l egand/ortitsoaffiliates.
j o V se
Copyright 2013, Oracle
r a n icen
Na bleisl made easy by the sophisticated infrastructure of the
Proactive databaseamaintenance
r
Oracle database,
o enincluding
f e rathe following main elements:
LAutomatic a s
nWorkload
e n
The
r database.- t r Repository
p y ((AWR)) is a built-in repository
p y in each Oracle
a n
no intervals, the Oracle database server makes a snapshot of all its vital
K At regular
statistics and workload information and stores this data in the AWR. The captured data
can be analyzed by you, by the database server itself, or by both.
Using automated tasks, the database server performs routine maintenance operations,
such as regular backups, refreshing optimizer statistics, and database health checks.
Reactive database maintenance includes critical errors and conditions discovered by
database health checkers:
For problems that cannot be resolved automatically and require administrators to be
notified (such as running out of space), the Oracle database server provides
server-generated alerts. The Oracle database server, by default, monitors itself and
sends out alerts to notify you of problems. The alerts notify you and often also provide
recommendations on how to resolve the reported problem.
Recommendations are generated from several advisors, each of which is responsible
for a subsystem. For example, there are memory, segment, and SQL advisors.
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a displays
The Alert History page
r a b a chart that shows the alert history of the current database in
segments ofotime
L r thatsyou
n fe designate. An alert indicates a potential problem: either a warning
r e n -tra monitored metric, or an indication that a target is no longer available.
or critical threshold for a
a thenmetric
Click
K o n name listed on the Alert History page to get detailed statistics, graphs, and
actual time stamps for each alert.
Terminology
detail
Optimizer statistics: Used by query optimizer
Database statistics: Used for performance
p
Metric: Rate of change in a cumulative statistic
Threshold: A boundary value against which metric values
are compared
Automatic Workload Repository (AWR): Infrastructure for s a
data gathering analysis and solutions recommendations) ha
gathering, analysis,
AWR Baseline: A set of AWR snapshots for i l com
performance comparison o t ma uide
h G @ n t
a e
l o ren Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
a ofradata
Statistics are collections
e n b that provide more details about the database and the objects
L or statistics
in it. Optimizer
n s feare used by the query optimizer to choose the best execution plan for
each SQL
r e n -tra
statement. Database statistics provide information for performance monitoring.
K a Automatic
The n on Workload Repository (AWR) provides services to internal Oracle server
components to collect, process, maintain, and use performance statistics for problem
detection and self-tuning purposes. Active Session History (ASH) is the history of recent
session activity stored in the AWR.
AWR snapshots include database statistics and metrics, application statistics (transaction
volumes, response time), operating system statistics, and other measures. An AWR baseline
i a sett off AWR snapshots
is h t collected
ll t d over a period
i d off titime. Th
The b
baseline
li iis used
d ffor
performance comparison, either current performance versus the baseline or one baseline
compared to another.
The System Moving Window baseline is collected by default. The System Moving Window
baseline is a changing set of snapshots that include the last eight days of snapshots by
default. This baseline becomes valid after sufficient data has been collected and the statistics
y Saturday
calculation occurs. The statistics calculation is scheduled for every y at midnight
g by y
default.
s a
)ha
In-memory 60 minutes m
co
statistics i l
ma uide
MMON Snapshots
SGA o
h nt Gt
n a @ eAWR
e u d
v l or is St
s (n th
a e
us All rights reserved.
i l l egand/ortitsoaffiliates.
j o V se
Copyright 2013, Oracle
r a n icen
N a le l
e n a rabthat provides services to Oracle Database components to
The AWR is the infrastructure
L r andsuse
collect, maintain,
odata n fe statistics for problem detection and self-tuning purposes. You can
r e n -tra
view it as a warehouse for database statistics, metrics, and so on.
K
Every on (by default), the database automatically captures statistical information from
a 60nminutes
the SGA and stores it in the AWR in the form of snapshots. These snapshots are stored on
disk by a background process called Manageability Monitor (MMON). By default, snapshots
are retained for eight days. You can modify both the snapshot interval and the retention
intervals.
The AWR contains hundreds of tables, all belonging to the SYS schema and stored in the
SYSAUX tablespace.
tablespace Oracle recommends that the repository be accessed only through
Enterprise Manager or the DBMS_WORKLOAD_REPOSITORY package to work with the AWR.
Direct data manipulation language (DML) commands against the repository tables are not
supported.
AWR Infrastructure
External clients
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
EM SQL*Plus
SGA
Efficient V$ DBA_*
in-memory AWR
statistics snapshots
collection MMON
s a
) h a
o m
a ilc e
h otm t Guid
Self-tuning @ Self-tuning
ADDM
component e n a
u d en
component
Internal clients
v l or is St
s (n th
a e
us All rights reserved.
i l l egand/ortitsoaffiliates.
j o V se
Copyright 2013, Oracle
r a n icen
N a le l
The AWR infrastructure
e n a has r a b major parts:
two
An in-memory
L or nstatistics
s fe collection facility that is used by Oracle Database components
ncollect
retoStatistics
n - rast cs These
co ect statistics.
stat
tstored ese statistics
stat st cs are
a e stored
sto ed in memory e o y for
o performance
pe o a ce reasons.
easo s
K a no in memory are accessible through dynamic performance (V$) views.
The AWR snapshots that represent the persistent portion of the facility. AWR snapshots
are accessible through data dictionary views and Enterprise Manager.
Statistics are stored in persistent storage for several reasons:
The statistics need to survive instance crashes.
Some analyses need historical data for baseline comparisons.
A memory overflow can occur. When old statistics are replaced by new ones because of
memory shortage, the replaced data can be stored for later use.
The memory version of the statistics is transferred to disk on a regular basis by the MMON
background process. With the AWR, the Oracle database server provides a way to capture
historical statistics data automatically without DBA intervention.
ADDM finds
MMON
top problems.
SYSAUX
SGA
6:00 AM
Snapshot 1
In-memory 7:00 AM
Snapshot 2
statistics 8:00 AM a
Snapshot 3 s
9:00 AM
)ha
S
Snapshot
h 4
m
co
i l
o t ma uide
@ h nt G
9:30 AM r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a Repository
The Automatic Workload
r a b (AWR) is a collection of persistent system performance
or by nSYS.
statistics owned
L s feThe AWR resides in the SYSAUX tablespace.
A snapshot
r ra of performance statistics captured at a certain time and stored in the
en isn-atset
K a
AWR. Each
n osnapshot is identified by a snapshot sequence number (SNAP_ID) that is unique
in the AWR. By default, snapshots are generated every 60 minutes. You can adjust this
frequency by changing the snapshot INTERVAL parameter. Because the database advisors
rely on these snapshots, be aware that adjustment of the interval setting can affect diagnostic
precision. For example, if the INTERVAL is set to four hours, you may miss transient events
that would be noticeable in 60-minute intervals.
You can use the DBMS_WORKLOAD_REPOSITORY.MODIFY_SNAPSHOT_SETTINGS
DBMS WORKLOAD REPOSITORY MODIFY SNAPSHOT SETTINGS stored
procedure or Enterprise Manager to change the settings that control snapshot collection.
You can take manual snapshots by using Enterprise Manager or the
DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT stored procedure. Taking manual
snapshots is supported in conjunction with the automatic snapshots that the system
generates. Manual snapshots are expected to be used when you want to capture the system
behavior at two specific points in time that do not coincide with the automatic schedule.
Statspack is a bundled utility that provides a subset of the collection and reporting capability of
the AWR. However, there is no supported path to migrate Statspack data into the workload
repository. Also, the workload repository is not compatible with the Statspack schema.
Statspack is not accessible through Enterprise Manager; it requires setup, and does not have
automatic retention settings, or automatic purge. The Statspack utility does provide scripts for
setup, automatic snapshot collection, and reporting. Statspack snapshots can be marked for
retention, as part of a Statspack baseline, or purged with provided scripts.
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
AWR Baselines
Relevant period
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
in the past
s a
) ha
o m
ilc e
DBMS_WORKLOAD_REPOSITORY.CREATE_BASELINE ( -
a
otm t Guid
start_snap_id IN NUMBER,
end_snap_id IN NUMBER,
@ enh
baseline_name IN VARCHAR2); na
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
An AWR baseline is
e n b snapshots. This is usually a set of snapshot data for an
aa set rofaAWR
L or snapshots
important period fetag and retain in the AWR. A baseline is defined on a pair of
that you
n s
r e n -tra
snapshots; the are identified by their snapshot sequence numbers (SNAP_IDs) or
K a and
a start
n n time. Each snapshot set has starting and ending snapshots and includes all
end
o
the snapshots in between. Snapshot sets are used to retain snapshot data. Therefore, by
default, snapshots belonging to snapshot sets are retained until the snapshot sets are
dropped. You can specify an expiration value to indicate the number of days that the snapshot
will be retained.
A baseline is identified by a user-supplied name. Execute the CREATE_BASELINE procedure
to create a baseline from a set of snapshots,
snapshots and specify a name and a pair of snapshot
identifiers. A baseline identifier that is unique for the life of a database is assigned to the
newly created baseline. Usually, you set up baselines from representative periods in the past,
to be used for comparisons with current system behavior. You can also set up
threshold-based alerts by using baselines from Enterprise Manager. You can set the
expiration time (in number of days) with the expiration parameter of this procedure. The
default is NULL, meaning never expire.
Y can gett the
You th SNAP_IDs
SNAP ID directly
di tl ffrom DBA_HIST_SNAPSHOT,
DBA HIST SNAPSHOT or from
f Enterprise
E t i Manager.
M
Note: For more information about the DBMS_WORKLOAD_REPOSITORY package, see the
Oracle Database PL/SQL Packages and Types Reference guide.
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a Cloud
In Enterprise Manager
r a bControl, navigate to the Automatic Workload Repository page by
L orPerformance
expanding the
n s fe menu, selecting AWR and then selecting AWR Administration.
a renAutomatic
On the
n - traWorkload Repository page, click Edit to change the settings.
K no
On the Automatic Workload Repository page, you can:
Edit the workload repository settings
Look at detailed information about created snapshots and manually create new ones
Create AWR baselines
Generate an AWR report
Retention period
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
n e n
N ara le lic
AWR settings include
e n a retention
r a b period, collection interval, and collection level. Remember that
L or ofthethese
decreasing any
n s fesettings affects the functionality of components that depend on the
a r en n-tra
AWR, including advisors.
K
Increasing
n othe settings can provide improved advisor recommendationsbut at the cost of
the space that is required to store the snapshots and the performance expended in collecting
the snapshot information.
Consider setting collection level to ALL when tuning a new application. The ALL setting
collects SQL execution plans and timing statistics that enhance the recommendations of the
SQL advisors. When tuning is complete, this setting should be returned to the TYPICAL
setting.
tti
Statistic Levels
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
STATISTICS_LEVEL
s a
)ha
m
co
i
a idel
Additional mstatistics
Self-tuning Recommended o t
hfor manual G u
capabilities disabled default value @ en t
a SQL ddiagnostics
e n u
v l or is St
s (n th
a e
us All rights reserved.
i l l egand/ortitsoaffiliates.
j o V se
Copyright 2013, Oracle
r a n icen
N l e l
a initialization
The STATISTICS_LEVEL
e n a rab parameter controls the capture of a variety of statistics
and variouso
L r
advisors,
n s fe
including the automatic maintenance tasks. The automatic maintenance
r e n -tra
tasks include gathering optimizer statistics. The STATISTICS_LEVEL parameter can be set
to a
K on levels:
the following
n
BASIC: The computation of AWR statistics and metrics is turned off. The automatic
optimizer statistics task is disabled, as are all advisors and server-generated alerts.
TYPICAL: Major statistics that are required for database self-management are collected.
They represent what is typically needed to monitor Oracle database behavior. This
includes automatic gathering of statistics to reduce the likelihood of poorly performing
SQL statements due to stale or invalid statistics
statistics.
ALL: All possible statistics are captured. This level of capture adds timed OS statistics
and plan execution statistics. These statistics are not needed in most cases and should
not be enabled for best performance; they are sometimes needed for specific
diagnostics tests.
Oracle recommends that the default value of TYPICAL be set for the STATISTICS_LEVEL
initialization p
parameter. Setting g the value to BASIC disables the automatic ggathering
g of
optimizer statistics.
Automatic Database
Diagnostic Monitor (ADDM)
Runs after each AWR snapshot
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
Snapshots
s a
)ha
m
co
i l
EM ADDM o t ma uide
@ h results
ADDM n t G
r e na tude
( n vlo his S AWR
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a rthe
Unlike the other advisors,
a bADDM runs automatically after each AWR snapshot. Each time
ortaken,
a snapshot is thefe
ADDM performs an analysis of the period corresponding to the last
L n s
r e n -tra
two snapshots. The ADDM proactively monitors the instance and detects most bottlenecks
K a they
before
n n
obecome a significant problem.
In many cases, the ADDM recommends solutions for detected problems and even quantifies
the benefits for the recommendations.
Some common problems that are detected by the ADDM:
CPU bottlenecks
Poor Oracle Net connection management
g
Lock contention
Input/output (I/O) capacity
Undersizing of database instance memory structures
High-load SQL statements
High PL/SQL and Java time
High checkpoint load and cause (for example
example, small log files)
The results of each ADDM analysis are stored in the AWR and are also accessible through
Enterprise Manager.
ADDM Findings in
Enterprise Manager Cloud Control
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a Manager
You can use Enterprise
r a b Cloud Control to view ADDM findings. Select Advisors
L r
Home in theoPerformance
n s fe menu. Select an ADDM autorun on the Advisors Central page.
On the
a r enAutomatic
n - traDatabase Diagnostic Monitor (ADDM) page, you see the detailed findings
K o ADDM run. Database Time represents the sum of the nonidle time spent by
for the latest
n
sessions in the database for the analysis period. A specific impact percentage is given for
each finding. The impact represents the time consumed by the corresponding issue compared
with the database time for the analysis period.
Click the View Report button to get details about the performance analysis in the form of a
text report.
ADDM Findings in
Enterprise Manager Database Express
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a rab
You can also use Enterprise Manager Database Express to view ADDM information. Select
Lor ransfe
Performance Hub from the Performance menu. Click the ADDM tab. Select a task to view
detailedninformation.
a re on-t
K n
Advisory Framework
Advisor
SQL Access Shared Pool
Advisor Advisor
n e n
N ara le lic
e n a b feedback about resource utilization and performance for their
a with ruseful
Advisors provide you
pool.
Mean-Time-To-Recover (MTTR) Advisor
Using the MTTR Advisor, you set the length of time required for the database to recover after an
instance crash.
Segment Advisor
This advisor looks for tables and indexes that consume more space than they require. The
advisor checks for inefficient space consumption at the tablespace or schema level and
produces scripts to reduce space consumption where possible.
SQL Access Advisor s a
a
) h the
This advisor analyzes all SQL statements that are issued in a given period and suggests m
co
creation of additional indexes or materialized views that will improve performance. i l
SQL Tuning Advisor o t ma uide
@ h nt G
This advisor analyzes an individual SQL statement and makes
e n a d e
recommendations for improving
its performance. Recommendations may include actions,
l or is St
such as u
rewriting the statement,
changing the instance configuration, or adding indexes. (n v
a s e th
Undo Management Advisor
i l l eg to us
With the Undo Management Advisor,
j o V you scan e determine the undo tablespace size that is
required to support a given a
r n icperiod.
retention n
e Undo management and the use of the advisor is
covered in the lesson N a l
le Undo Data.
titled Managing
n a a b
Data Recovery
L oreAdvisor s f er
This advisor
r e - t an y diagnoses
n automatically
r g p
persistent data failures,, p
presents repair
p optionsp to the
K a
user, and
n o n
executes repairs at the users request. The purpose of the Data Recovery Advisor is
to reduce the mean time to recover (MTTR) and provide a centralized tool for automated data
repair.
SQL Repair Advisor
You run the SQL Repair Advisor after a SQL statement fails with a critical error that generates a
problem in the Automatic Diagnostic Repository. The advisor analyzes the statement and, in
many cases, recommends d a patch
t h tto repair
i th
the statement.
t t t If you implement
i l t the
th
recommendation, the applied SQL patch circumvents the failure by causing the query optimizer
to choose an alternative execution plan for future executions. This is done without changing the
SQL statement itself.
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
The Advisor Central
e n b main page of all advisors. You can reach this page by
apage risathe
L or contexts.
selecting Advisors Home
n s fein the Performance menu. It is also possible to have access to
a r en n-tra
advisors in certain
K o tab of the Advisor Central page, you can see all the advisor tasks that are
On the Advisors
n
registered in the workload repository. You can also filter this list by advisor type and for
predefined time periods.
The Checkers tab of the Advisor Central page enables you to schedule various database
integrity checkers. You can see all the checker runs by name, type, or time period.
Some advisors are described in greater detail in the lessons titled Managing Undo Data,
Managing Performance, Managing Performance: SQL Tuning, and Backup and Recovery
Concepts.
Note: Use the Change Default Parameters page to change the default expiration (in days) for
all future tasks. You can also use this page to change the parameters of some important
advisors.
n
ra lic e n
N a le
The DBMS_ADVISOR
e n a package
r a b contains all constants and procedure declarations for all
r e n -tra
recommends you use the advisor-specific package rather than DBMS_ADVISOR for the
following
K on
a nadvisors:
Automatic Database Diagnostic Monitor (DBMS_ADDM)
SQL Performance Analyzer (DBMS_SQLPA)
SQL Repair Advisor (DBMS_SQLDIAG)
SQL Tuning Advisor (DBMS_SQLTUNE)
Compression
p Advisor ((DBMS_COMPRESSION.GET_COMPRESSION_RATIO))
You can use DBMS_ADVISOR and the other advisor packages to execute tasks from the
command line.
To execute advisor procedures, you must be granted the ADVISOR privilege. The ADVISOR
privilege permits full access to the advisor procedures and views.
Note: For more information about all the procedures found in the advisor packages, refer to
Q Packages
the Oracle Database PL/SQL g and Typesyp Reference.
n e n
N ara le lic
e n a rabstored in the AWR, the database server can identify the need to
By analyzing the information
r e n -tra
maintenance infrastructure enables the Oracle Database server to automatically
K a such
perform
n o noperations. It uses the Scheduler to run such tasks in predefined maintenance
windows.
By default, the weekday maintenance windows start at 10:00 PM and last four hours. On
Saturday and Sunday, the maintenance window starts at 6:00 AM and lasts for 20 hours. All
attributes of the maintenance windows are customizable, including the start and end times,
frequency, days of the week, and so on. In addition, the impact of automated maintenance
tasks on normal database operations can be limited by associating a Database Resource
Manager resource plan to the maintenance window.
Examples of maintenance:
Optimizer statistics are automatically refreshed by using the automatic maintenance task
infrastructure.
The Automatic Segment Advisor has default jobs, which run in the maintenance window.
When creating a database with the DBCA
DBCA, you can initiate regular database backups
backups.
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a b
a rMaintenance
To access the Automated Task page, expand the Administration menu and
select Automated
L oautomated
n s fe
r Maintenance Tasks in the Oracle Scheduler submenu. On this page, you
can view
r e n -tra
the maintenance task schedule and recent history. From here, you can
a downntoondetails on some tasks. Click Configure to go to the Automated Maintenance
drill
K
Tasks Configuration page. A task executes in a window. The graph shows the last window in
which a task was executed and the next window in which the task is scheduled to be
executed.
Note: The default windows for tasks are shown in the example. When the maintenance
window closes, the Scheduler terminates the optimizer statisticsgathering job by default. The
remaining objects are then processed in the next maintenance window
window.
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
On the Automated a
e n Maintenance
r a b Tasks Configuration page, you can enable and disable
L or the
automatic maintenance
n s fetasksall at once, by individual tasks, or by particular windows. You
can also
r e n -tra
configure settings that are used for optimizer statistics gathering and the job
control
K n on for the automatic SQL Tuning Advisor.
a parameters
Select the window name to view or edit the window schedule.
Click Edit Window Group to add and remove windows in the window group.
Server-Generated Alerts
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
Enterprise Manager
Server
alerts
s a
Oracle queue.
) ha
instance o m
Metric exceeds a ilc e
threshold. h otm t Guid
n a @ en
l o re Stud AWR
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a of when
Alerts are notifications
r a b a database is in an undesirable state and needs your
L r
attention. Byodefault,
n
the
s feOracle Database server provides alerts via Enterprise Manager.
r e n -tra
Optionally, Enterprise Manager can be configured to send an email message to the
a nonabout problem conditions as well as display alert information on the console.
administrator
K
You can also set thresholds on many of the pertinent metrics for your system. Oracle
Database proactively notifies you if the database deviates sufficiently from normal readings to
reach those thresholds. An early notification of potential problems enables you to respond
quickly and, in many cases, resolve issues before users even notice them.
Approximately, 60 metrics are monitored by default, among which are:
Broken
B k Job J bC Countt
Database Time Spent Waiting (%)
Dump Area Used (%)
SQL Response Time (%) compared to baseline
Tablespace Used (%)
Generic Incident
A few additional key metrics can provide early problem notification:
Average File Read Time (centiseconds)
Response Time (per transaction)
Wait Time (%)
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
To access the Metric
e n r a b Settings page, expand the Oracle Database menu and
a and Collection
L n s fe Settings from the Monitoring submenu.
r Collection
select Metricoand
Enter
a r n desired
eyour n - trawarning and critical threshold values for the metric. The appropriate alerts
K no the database reaches your specified values.
appear when
The thresholds that are already set appear in the Metrics with thresholds list. By default,
approximately 60 metrics have preset thresholds; you may change these as needed. The All
metrics list shows the metrics that do not have thresholds set.
Click the Edit icon to access a page where you can specify additional corrective actions for
either warning or critical thresholds.
Click a Collection Schedule link to change the scheduled collection interval. Be aware that
each schedule affects a group of metrics.
Reacting to Alerts
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
When you receive a
e n r a b the recommendations that it provides. Or you can consider
an alert, follow
running the oADDM fe advisor as appropriate) to obtain more detailed diagnostics of
r (orsanother
systemnorL n
a r e n-t a
objectrbehavior.
K
Alerts and
n oincidents are generated for critical errors. Critical errors usually generate incidents
that are collected into problems. You use the Support Workbench to investigate and possibly
report the problem to Oracle Support.
Most alerts (such as Out of Space) are cleared automatically when the cause of the problem
disappears. However, other alerts (such as Generic Alert Log Error) are sent to you for
notification and must be acknowledged by you. After taking the necessary corrective
measures, you acknowledge
k l d an alert
l tb
by clearing
l i or purging i itit. Cl
Clearing
i an alert
l t sends
d th
the
alert to the Alert History, which is accessible from the Monitoring submenu. Purging an alert
removes it from the Alert History.
Metric based
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
MMON
DBA_OUTSTANDING_ALERTS DBA_ALERT_HISTORY
n e n
N ara le lic
There are two kinds
e n r a b
aof server-generated alerts: threshold and nonthreshold.
or nsfalerts
Most server-generated
L e are configured by setting a warning and critical threshold values
a r - tra You can define thresholds for more than 120 metrics, including the
en nmetrics.
on database
following:no
K
Physical Reads Per Sec
User Commits Per Sec
SQL Service Response Time
Except for the Tablespace Space Usage metric, which is database related, the other metrics
are instance related
related. Threshold alerts are also referred to as stateful alerts
alerts, which are
automatically cleared when an alert condition clears. Stateful alerts appear in
DBA_OUTSTANDING_ALERTS and, when cleared, go to DBA_ALERT_HISTORY.
Other server-generated alerts correspond to specific database events, such as ORA-* errors,
Snapshot too old errors, Recovery Area Low On Free Space, and Resumable Session
Suspended. These are non-threshold-based alerts, also referred to as stateless alerts.
Stateless alerts go directly to the history table.
Quiz
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
Answer: b
r e na ferab
n Lo rans
a re on-t
K n
Summary
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Practice 20
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
M
Managing
i Performance
P f
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Aula Matriz SAS
Objectives
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Performance Monitoring
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
Memory
allocation
issues
Input/output Resource
device contention
contention
?
s a
A li ti
Application
DBA
)ha
Network m
code bottlenecksi l co
problems
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a Database
To administer Oracle
r a b and keep it running smoothly, the database administrator
(DBA) musto r
regularly fe its performance to locate bottlenecks and to correct problem
monitor
s
areas. n L n
a r e n-tra
K
A DBA can
n olook at hundreds of performance measurements, covering everything from
network performance and disk input/output (I/O) speed to the time spent working on individual
application operations. These performance measurements are commonly referred to as
database metrics.
Note: For more information about Oracle database performance, see the Oracle Database
12c: Performance Tuning course.
Performance Monitoring
Performance overview
Graphs of metrics and details
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
You can respond toachanges b in performance only if you know the performance has changed.
e n r a
fe several ways to monitor the current performance of the database
L ordatabase
Oracle Database provides
n s
r e n -tra home page of Enterprise Manager Database Express provides a
instance. The
K a check
quick
n o nof the health of the instance and the server, with graphs showing CPU usage,
active sessions, memory and data storage usage. The home page also shows any alerts that
have been triggered.
Additional detail is available on the Performance Hub page. This page will be reviewed later
in the lesson.
The information displayed in Enterprise Manager is based on performance views that exist in
th database.
the d t b You
Y can access these
th views
i directly
di tl with
ith SQL*Plus.
SQL*Pl O
Occasionally,
i ll you may
need to access these views for some detail about the raw statistics.
Tuning Activities
Performance planning
Instance tuning
SQL tuning
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n r b performance planning, instance tuning, and SQL tuning.
The three facets ofatuning involve
a
or planning
Performance
L n s fe is the process of establishing the environment: the hardware,
reso
software,
n ra at g syste
nt a e,-tope
operating system,, network
et o infrastructure,
ast uctu e, and a d so o on.
a no tuning is the actual adjustment of Oracle database parameters and operating
K Instance
system (OS) parameters to gain better performance of the Oracle database.
SQL tuning involves making your application submit efficient SQL statements. SQL
tuning is performed for the application as a whole, as well as for individual statements.
At the application level, you want to be sure that different parts of the application are
taking advantage of each others work and are not competing for resources
unnecessarily.
il
Note: For more information about performance tuning, refer to the Oracle Database
Performance Tuning Guide.
Performance Planning
Investment options
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
System architecture
Scalability
Application design principles
Workload testing, modeling, and implementation
Deploying new applications
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
There are many facets
e n r a b
a to performance planning. Planning must include a balance between
L r
performanceo(speed),
n s fe and reliability. You must consider the investment in your system
cost,
r e n -tra
architecture: the hardware and software infrastructure needed to meet your requirements.
K n o n requires analysis to determine the value for your given environment,
a of course,
This,
application, and performance requirements. For example, the number of hard drives and
controllers has an impact on the speed of data access.
The ability of an application to scale is also important. This means that you are able to handle
more and more users, clients, sessions, or transactions, without incurring a huge impact on
overall system performance. The most obvious violator of scalability is serializing operations
among users
users. If all users go through a single path one at a time
time, then
then, as more users are
added, there are definitely adverse effects on performance. This is because more and more
users line up to go through that path. Poorly written SQL also affects scalability. It requires
many users to wait for inefficient SQL to complete; each user competing with the other on a
large number of resources that they are not actually in need of.
The principles of application design can greatly affect performance. Simplicity of design, use
of views and indexes, and data modeling are all very important.
Any application must be tested under a representative production workload. This requires
estimating database size and workload, and generating test data and system load.
Performance must be considered as new applications (or new versions of applications) are
deployed.
dep oyed SoSometimes,
et es, des
design
g dec
decisions
so sa are
e made
ade to maintain
a ta co
compatibility
pat b ty with
t oold
d syste
systems
s
during the rollout. A new database should be configured (on the basis of the production
environment) specifically for the applications that it hosts.
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
A difficult and necessary task is testing the existing applications when changing the
infrastructure. For example, upgrading the database to a newer version, or changing the
operating system or server hardware. Before the application is deployed for production in the
new configuration, you want to know the impact. The application will almost certainly require
additional tuning
tuning. You need to know that the critical functionality will perform
perform, without errors
errors.
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
Instance Tuning
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a activity,
At the start of any tuning
r a b it is necessary to have specific goals. A goal, such as
Loasrfast
Process 500 fe
sales transactions
n s per minute is easier to work toward than one that says,
Make itngo
r e - t r aas you can, and well know when its good enough.
K
You on Oracle database memory suitably for your application to attain optimum
a mustnallocate
performance. You have a finite amount of memory to work with. Too little memory allotted to
certain parts of the Oracle database server can cause inefficient background activity, which
you may not even be aware of without doing some analysis.
Disk I/O is often the bottleneck of a database and, therefore, requires a lot of attention at the
outset of any database implementation.
The operating system configuration can also affect the performance of an Oracle database.
For more information, see the Oracle Database Installation Guide for your particular platform.
n e n
N ara le lic
Oracle has developed
e n a a tuning
r a b methodology based on years of experience. The basic steps
are:
L or nsfe
r CCheck
1. e a stat
nec tthe-etrOS statistics
st cs and
a d gegeneral
e a machine
ac e health ea t be before
o e tu
tuningg tthe
e instance
sta ce to be
a n
K surenothat the problem is in the database. Use the Enterprise Manager database home
page.
2. Tune from the top down. Start with the design, then the application, and then the
instance. For example, try to eliminate the full tables scans causing the I/O contention
before tuning the tablespace layout on disk. This activity often requires access to the
application code.
3 Tune
3. T the
th area with
ith the
th greatest
t t potential
t ti l benefit.
b fit The
Th tuning
t i methodology
th d l presented
t d in
i
this course is simple. Identify the biggest bottleneck and tune it. Repeat this step. All the
various tuning tools have some way to identify the SQL statements, resource contention,
or services that are taking the most time. The Oracle database provides a time model
and metrics to automate the process of identifying bottlenecks. The Advisors available in
Oracle Database use this methodology.
g when yyou meet yyour g
4. Stop tuning goal. This step implies that yyou set tuning
gggoals.
This is a general approach to tuning the database instance and may require multiple passes.
Cumulative statistics:
Wait events with time information
Time model
Metrics: Statistic rates
Sampled statistics: Active session history
Statistics by session
Statistics by SQL s a
)ha
Statistics by service m
Other dimensions i l co
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
The Oracle database
e n a server
r a b
software captures information about its own operation. Three
major typeso
L s e
ofrdata arefcollected: cumulative statistics, metrics, and sampled statistics.
n
tra are counts and timing information of a variety of events that occur in the
a r en statistics
Cumulative
n -
K o Some are quite important, such as buffer busy waits. Others have little
databasenserver.
impact on tuning, such as index block split. The most important events for tuning are usually
the ones showing the greatest cumulative time values. The statistics in Oracle Database are
correlated by the use of a time model. The time model statistics are based on a percentage of
DB time, giving them a common basis for comparison.
Metrics are statistic counts per unit. The unit could be time (such as seconds), transaction, or
session.
i M
Metrics
t i provide
id a b
base tto proactively
ti l monitor
it performance.
f Y
You can sett th
thresholds
h ld
on a metric, causing an alert to be generated. For example, you can set thresholds for when
the reads per millisecond exceed a previously recorded peak value or when the archive log
area is 95% full.
Sampled statistics are gathered automatically when STATISTICS_LEVEL is set to TYPICAL
or ALL. Sampled statistics allow you to look back in time. You can view session and system
statistics that were g
gathered in the past, in various dimensions, even if yyou had not thought
g of
specifying data collection for these beforehand.
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
You can access theaPerformance
e n r a b Hub page from the Performance menu. On the Performance
or can nview
Hub page, you
L s feall the performance data available for a specified time period.
a enchoose
Yourcan
n - trtoaview real-time
real time data or historical data. More granular data is shown when
K
you choose
n oreal-time data. When you view historical data, the data points are averaged out to
the Automatic Workload Repository (AWR) interval (usually an hour).
Different tabs are available on the Performance Hub page based on whether you choose
real-time or historical data.
The following tabs are available for both real-time and historical data:
Summary: y Provides an overall view of the pperformance of the system
y for the specified
p
time period
RAC: Appears only when Enterprise Manager Database Express is being used with an
Oracle Real Application Clusters (RAC) database or cluster database
Activity: Shows Active Session History (ASH) analytics
Workload: Profile charts show the pattern of user calls, parse calls, redo size, and
SQL*Net over the last 60 minutes in real-time mode. The Sessions chart shows the
logon rate, current logons, and open cursors.
Monitored SQL: Shows information about monitored SQL statements that were executing
or that completed during the selected time period
ADDM: Shows performance findings and recommendations from the Automatic Database
g
Diagnostics Monitor ((ADDM)) for tasks p
performed in the database during
g the selected time
period
The following tab is only available if you select real-time data:
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
Current Findings: Shows ADDM findings for the past five minutes
The following tabs are only available if you select historical data:
Database Time: Shows wait events by category for various metrics, and to view time
statistics for various metrics for the selected time period
Resources: Shows operating system resource usage statistics, I/O resource usage
statistics, and memory usage statistics for the selected time period
System Statistics: Shows database statistics by value, per transaction, or per second for
the selected time period
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a rab
You can also use Enterprise Manager Cloud Control to manage the performance of your
L omenu. n fe
r thesPerformance
database. Access Home page by selecting Performance Home in the
a r en n-tra
Performance
K o
The Performance
n Home page provides an overall view of performance statistics for your
database. You can use the information on this page to determine whether resources need to
be added or redistributed.
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
Enterprise Manager
e n b provides session detail pages so that you can view the
aCloudraControl
wait events o r
occurring infeindividual sessions. Select Top Activity in the Performance menu to
L n s
view the
r e n -tra
summary of all sessions. In the lower right corner of the Top Activity page is a list of
the
K n on Click the session identifier to view the Session Details page.
aTop Sessions.
The Top Activity page and Session Details page are based on performance views in the
database.
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n r b page, click Top Consumers in the Additional Monitoring Links
At the bottom of theaTop Activity
a
or thensTop
section to access
L fe Consumers page.
a en Consumers
TherTop
n - tra Overview page shows in graphical format:
o
K Topnservices
Top modules (by service)
Top actions (by service and module)
Top clients
On the Top Consumers page, click the Top Sessions tab to see critical statistics of the
sessions using the most resources:
CPU
PGA Memory
Logical Reads
Physical Read
Hard Parse count
Sort count
Cli k a column
Click l name to h
have the
h results
l sorted
dbby the
h value
l iin that
h column.
l
SID SADDR
NAME STATISTIC# SID
CLASS VALUE
STAT_ID CON_ID EVENT#
DISPLAY_NAME
CON_ID EVENT
P1/2/3TEXT
P1/2/3
V$SESSION_EVENT V$EVENT_NAME P1/2/3RAW
SID WAIT_CLASS
EVENT#
EVENT WAIT_TIME
EVENT_ID a
has
TOTAL_WAITS NAME SECONDS_IN_WAIT
TOTAL_TIMEOUTS
TOTAL TIMEOUTS PARAMETER1 STATE m )
o
TIME_WAITED PARAMETER2 ... ilc a ide
AVERAGE_WAIT PARAMETER3 t m
MAX_WAIT
@ ho nt Gu
TIME_WAITED_MICRO
r e na tude
vlo his S
EVENT_ID
(
s se tn
g a u
V
Copyright 2013, ille and/or
Oracle t o
its affiliates. All rights reserved.
n j o
e n se
a ra lic
a N
You can display current b
session leinformation for each user logged on by querying V$SESSION.
n
e cansuse
For example, ryou f a
erV$SESSION to determine whether a session represents a user
L o
session,
r e r an by a database server process (BACKGROUND).
nor was-tcreated
K
You on either V$SESSION or V$SESSION_WAIT to determine the resources or events
a can nquery
for which active sessions are waiting.
You can view user session statistics in V$SESSTAT. The V$SESSION_EVENT view lists
information about waits for an event by a session.
Cumulative values for instance statistics are generally available through dynamic
performance views, such as V$SESSTAT and V$SYSSTAT. Note that the cumulative values in
dynamic views are reset when the database instance is shut down.
The V$MYSTAT view displays the statistics of the current session.
You can also query V$SESSMETRIC to display the performance metric values for all active
sessions. This view lists performance metrics, such as CPU usage, number of physical reads,
number of hard parses, and the logical read ratio.
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
In multitier systemsawhere there
e n r a b is an application server that is pooling database connections,
L orservice
viewing sessions fe provide the information you need to analyze performance. Grouping
may not
n s
sessions
r e n -tra
into names enables you to monitor performance more accurately.
a noofn the session that was used for a particular request, if it connected via one of
Regardless
K
these services, the performance data of the session is captured under that service name.
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a where
In an n-tier environment
r a b there is an application server that is pooling database
L r
connections,oviewing
n fe may not provide the information you need to analyze
sessions
s
r e n -tra sessions into service names enables you to monitor performance
performance. Grouping
K n o n These two views provide the same information that their like-named session
a accurately.
more
counterparts provide, except that the information is presented at the service level rather than
at the session level.
V$SERVICE_WAIT_CLASS shows wait statistics for each service, broken down by wait class.
V$SERVICE_EVENT shows the same information as V$SERVICE_WAIT_CLASS, except that
it is further broken down by event ID.
You can define a service in the database by using the DBMS_SERVICE package and use the
net service name to assign applications to a service.
s a
)h a
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
You can access detailed
e n r a b
a information on waits from the Average Active Sessions graph on the
Performance
L r page.
oHome n s fe
When
a r eyou n tra to a particular wait category, you can view details of specific five-minute
n drill-down five minute
K
intervalsn o
and also see the Top Working SQL and the Top Working Sessions associated with
that particular wait event during that time. This enables you to perform after-the-fact analysis
of system slowdowns and determine potential causes.
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a that
Wait events are statistics
r a bare incremented by a server process or thread to indicate that it
L ran event
had to wait for
ovariousn s feto complete before being able to continue processing. Wait event
r e n -tra
data reveals symptoms of problems that might be impacting performance, such as
K n o n buffer contention, and I/O contention. Remember that these are only
a contention,
latch
symptoms of problems, not the actual causes.
Wait events are grouped into classes. The wait event classes include: Administrative,
Application, Cluster, Commit, Concurrency, Configuration, Idle, Network, Other, Scheduler,
System I/O, and User I/O.
There are more than 800 wait events in the Oracle database, including free buffer wait,
l t h free,
latch f b ff
buffer busy
b waits,
it db filfile sequential ti l read,d and db filfile
scattered read.
n e n
N ara le lic
Because there is aa
e n finite amount
r a b of memory available on a database server and thus, on an
L or instance,
Oracle database
n s fe you must pay attention to how memory is allocated. If too much
memory
r e n -tra used by a particular area that does not need it, other areas may not
is allowed to be
a nproperly
function
K o n because of lack of memory. With the ability to have memory allocation
automatically determined and maintained for you, the task is simplified greatly. But even
automatically tuned memory needs to be monitored for optimization and may need to be
manually configured to some extent.
n e n
N ara le lic
e n a ryou
Oracle Database enables
a bto specify the total memory allocated to the instance. Memory
L oasr needed.
will be dynamically fe between the System Global Area (SGA) and Program Global
reallocated
n s
r e n -tra This method is called Automatic Memory Management (AMM) and is
Area (PGA)
a nonononly those platforms that support dynamic release of memory. This simplifies
available
K
your memory management tasks.
Memory advisors are available to help you set the initialization parameters on various levels.
The advisor available depends on the level on which you are specifying the memory
parameters. If you enable AMM, only the Memory Size Advisor is available.
Automatic Shared Memory Management (ASMM) enables you to manage the SGA as a
whole.
h l ThThe SGA comprises
i severall components.
t The
Th sizes
i off many off these
th componentst are
dynamically adjusted for best performance within the limits of the initialization parameters.
When the AMM is enabled, the ASMM is automatically enabled. If the ASMM is enabled but
not the AMM, the SGA Size Advisor is available.
You can manage the size of individual components manually by setting the initialization
parameter for each component. If the Oracle server notifies you of a performance problem
that is related to the size of an SGA or PGA component, yyou can use the Memoryy Advisor for
the component to determine appropriate new settings. The Memory Advisor can model the
effect of parameter changes.
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
If possible, it is bestato fit the bSGA into physical memory, which provides the fastest access.
Even thoughothe e n
r OS may r a
feprovide additional virtual memory, that memory, by its nature, can
L n s
often be
r e n -tra disk. On some platforms, you can use the LOCK_SGA initialization
swapped out to
a notonlock the SGA into physical memory. This parameter cannot be used in
parameter
K
conjunction with AMM or ASMM.
When a SQL statement executes, data blocks are requested for reading or writing, or both.
This is considered a logical I/O. As the block is requested, the block is checked to see
whether it already exists in memory. If it is not in memory, it is read from disk, which is called
a physical I/O. When the block is found in memory, the cost is several orders of magnitude
less than the cost of reading the block from disk
disk. The size of the SGA components in
combination with the workload has a large affect on the number of physical reads. A simple
view of this implies that you should increase the memory for the SGA components as much
as possible. A larger SGA is not always better. There is a point where adding more memory
yields diminishing returns. This principle applies to the buffer cache, the shared pool, and
other SGA components. In practice, you find that shifting memory from one SGA component
to another may increase overall performance, without changing the total amount of memory
given to the SGA depending on the characteristics of the workload
workload.
Memory has an upper limit in all current machines. That limit may be imposed by the hardware,
operating system, or the cost of the memory. The goal of memory tuning is to produce the most
efficient use of existing memory. When the workload changes often, the most efficient division of
memory between the SGA components will change. There is also the amount of memory
allocated to SGA and PGA. Online transaction processing (OLTP) systems typically use very
little PGA memory compared to data warehouse (DW) or decision support systems (DSS).
Enterprise Manager Cloud Control and Enterprise Manager Database Express both provide
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
Memory Advisors. These tools monitor the memory usage by the SGA components, and PGA,
and project the differences in terms of efficiency for increased and decreased memory
allocations. These projections use the current workload. They can help you size the SGA on the
basis of the activity in your particular database. The advisors will make sizing recommendations
for manual settings, when the automatic memory management is disabled. These same
advisors provide input to the automatic memory management, to determine the most efficient
component sizes.
Using the existing memory efficiently also includes tuning the applications. A poorly tuned
application can use large quantities of memory. For example, an application that uses frequent
s a
full table scans because indexes do not exist or are unusable can cause a large amount of I/O,
reducing
d i performance.
f Th
The fifirstt and
d mostt effective
ff ti tuning )
t i technique
t h i ha
is
i to
t tune
t high
hi h costt SQL
o m
Performance: SQL Tuning. a ilc e
statements. Tuning SQL statements is covered in more detail in the lesson titled Managing
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
800 MB
Memory Target
640 MB
Memory Target
s a
ALTER SYSTEM SET )ha
MEMORY_TARGET=800M; m
co
i l
o t ma uide
@ h nt G
r e na tude
Oracle recommends the use of AMM unless
( n vloyouhhave i s S special requirements.
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
Automatic MemoryaManagement
e n r a b (AMM) allows the Oracle Database server to manage SGA
r
memory andoinstance
s fe memory sizing automatically. To do so (on most platforms), you
PGA
set onlyna L a n
target rmemory size initialization parameter (MEMORY_TARGET) and a maximum
r e
a nsize
memory - t
ninitialization parameter (MEMORY_MAX_TARGET), and the database server
K o
dynamically exchanges memory between the SGA and the instance PGA as needed to meet
processing demands.
With this memory management method, the database server also dynamically tunes the sizes
of the individual SGA components and the sizes of the individual PGAs.
Because the target memory initialization parameter is dynamic, you can change the target
memory size
i att any time
ti without
ith t restarting
t ti the
th database
d t b instance.
i t Th
The maximum
i memory
size serves as an upper limit so that you cannot accidentally set the target memory size too
high. Because certain SGA components either cannot easily shrink or must remain at a
minimum size, the database server also prevents you from setting the target memory size too
low.
This indirect memory transfer relies on the operating system (OS) mechanism of freeing
shared memory. y After memoryy is released to the OS, the other components can allocate
memory by requesting memory from the OS. Currently, Automatic Memory Management is
implemented on Linux, Solaris, HPUX, AIX, and Windows.
MEMORY_MAX_TARGET
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
PGA_AGGREGATE_TARGET
PGA AGGREGATE TARGET
SGA_TARGET
PGA_AGGREGATE_LIMIT
This enables ASMM.
Changing SGA_TARGET Child parameters:
affects only automatically Providing minimum values
sized components. Others
Automatic change of size onlys a
ha
SHARED_POOL_SIZE
LOG_BUFFER
m)
with autotuned parameters
co
RESULT_CACHE_SIZE
i l
ma uide
DB_CACHE_SIZE
LARGE_POOL_SIZE DB_KEEP_CACHE_SIZE o
h nt Gt
JAVA_POOL_SIZE DB_RECYCLE_CACHE_SIZE
a @
STREAMS_POOL_SIZE DB_nK_CACHE_SIZE ren t u de
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
The graphic in the a
e n slide shows
r a b you the memory initialization parameters hierarchy. Although
L s fe
or toonlysetnMEMORY_TARGET
you have to set to trigger Automatic Memory Management, you still
have the
r e n -tra
ability lower bound values for various caches. Therefore, if the child
a noare
parameters
K n user-set, they will be the minimum values below which the Oracle database
server will not autotune that component.
If SGA_TARGET and PGA_AGGREGATE_TARGET are set to a nonzero value, they are
considered to be the minimum values for the sizes of the SGA and the PGA,
respectively. MEMORY_TARGET can take values from SGA_TARGET +
PGA_AGGREGATE_TARGET to MEMORY_MAX_SIZE.
If SGA_TARGET
SGA TARGET is set,
set the database server autotunes only the sizes of the
subcomponents of the SGA. PGA is autotuned independent of whether it is explicitly set
or not. However, the whole SGA(SGA_TARGET) and the PGA
(PGA_AGGREGATE_TARGET) are not autotunedthat is, do not grow or shrink
automatically.
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
If you did not enable
e n a Automatic
r a b Memory Management (AMM) when you configured your
database, you
L orcan enable
n s fe it by performing the following steps:
1. e etra
nect Memory
a r Se
Select
n - o y Advisors
d so s in tthe e Performance
e o a ce menu. e u
K2. Click noEnable for Automatic Memory Management.
3. The Enable Automatic Memory Management page appears. Set the values for Total
Memory Size and Maximum Memory Size for Automatic Memory Management.
Note: If you change the Maximum Memory Size, the database instance must be
restarted.
4. Click OK.
You can increase the size at a later time by increasing the value of the Total Memory Size
field or the MEMORY_TARGET initialization parameter. However, you cannot set it higher than
the value specified by the Maximum Memory Size field or the MEMORY_MAX_TARGET
parameter. For more information, see the Oracle Database Administrators Guide.
After AMM is enabled, the Memory Size Advisor is available to help you adjust the maximum
and target memory sizes.
Note: Oracle recommends that you use Automatic Memory Management to simplify memory
management tasks.
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a Management
After Automatic Memory
r a b is enabled, you can see the graphical representation of
the history of
L r memory
oyour n s fe size components in the Allocation History section of the Memory
Advisors
r e n -tra portion in the first histogram is tunable PGA only and the lower portion
page. The top
is a
K on
all of SGA.
n
Additional data is available on the page showing the SGA components history and a graphical
representation of the SGA allocation.
On this page, you can also access the memory target advisor by clicking the Advice button.
This advisor gives you the possible DB time improvement for various total memory sizes.
Note: You can also look at the memory target advisor by using the
V$MEMORY_TARGET_ADVISOR view.
Management:
V$MEMORY_DYNAMIC_COMPONENTS: Current status of all
memory y components
p
V$MEMORY_RESIZE_OPS: Circular history buffer of the last
800 memory resize requests
V$MEMORY_TARGET_ADVICE: Tuning advice for the
MEMORY_TARGET initialization parameter a
a s
m )h
i l co
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n
ra lic e n
N a le
e n a
The V$MEMORY_DYNAMIC_COMPONENTS
r a b dynamic performance view shows the current sizes
L or Thetuned
of all dynamically
n s fememory components, including the total sizes of the SGA and
instance
r e n -tra
PGA. V$MEMORY_TARGET_ADVICE view provides tuning advice for the
a non initialization parameter.
MEMORY_TARGET
K
In the V$MEMORY_TARGET_ADVICE view, the row with the MEMORY_SIZE_FACTOR of 1
shows the current size of memory, as set by the MEMORY_TARGET initialization parameter,
and the amount of DB time required to complete the current workload. In previous and
subsequent rows, the results show several alternative MEMORY_TARGET sizes. For each
alternative size, the database server shows the size factor (the multiple of the current size),
and the estimated DB time to complete the current workload if the MEMORY_TARGET
MEMORY TARGET
parameter were changed to the alternative size. Notice that for a total memory size smaller
than the current MEMORY_TARGET size, the estimated DB time increases.
Buffer cache
Buffer cache
n e n
N ara le lic
If AMM does not work
e n a for you,
r a bbecause you need a fixed PGA, consider the use of Automatic
Shared Memory
s fe (ASMM) which simplifies SGA memory management. You
or Management
specifyn theLtotal ramount
n
a of SGA memory available to an instance by using the SGA_TARGET
r e - t
a nonparameter and Oracle Database server automatically distributes this memory
initialization
K
among the various SGA components to ensure the most effective memory utilization.
For example, in a system that runs large online transactional processing (OLTP) jobs during
the day (requiring a large buffer cache) and runs parallel batch jobs at night (requiring a large
value for the large pool), you would have to simultaneously configure both the buffer cache
and the large pool to accommodate your peak requirements.
With ASMM,
ASMM when h ththe OLTP jjob
b runs, th
the b
buffer
ff cache
h uses mostt off th
the memory tto allow
ll ffor
good I/O performance. When the data analysis and reporting batch job starts up later, the
memory is automatically migrated to the large pool so that it can be used by parallel query
operations without producing memory overflow errors.
The Oracle Database server remembers the sizes of the automatically tuned components
across instance shutdowns if you are using a server parameter file (SPFILE). As a result, the
y
system does need to learn the characteristics of the workload again
g each time an instance is
started. It can begin with information from the past instance and continue evaluating workload
where it left off at the last shutdown.
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n b
a raManagement
Automatic Shared Memory is automatically enabled if you have enabled AMM. If
you have not
L r
oenabled
n s fe or did not enable ASMM when you configured your database, you
AMM
r e n -tra
can enable Automatic Shared Memory Management by performing the following steps:
n e n
N ara le lic
e n a Memory
The Automatic Shared
r a b Management feature uses the SGA memory broker that is
L or two
implemented by
n s fe
background processes: Manageability Monitor (MMON) and Memory
Manager
r e n -tra
(MMAN). Statistics and memory advisory data are periodically captured in memory by
a MMAN
MMON.
K n o ncoordinates the sizing of the memory components according to MMON decisions.
The SGA memory broker keeps track of the sizes of the components and pending resize
operations.
The SGA memory broker observes the system and workload in order to determine the ideal
distribution of memory. It performs this check every few minutes so that memory can always
be present where needed. In the absence of Automatic Shared Memory Management,
components had to be sized to anticipate their individual worst-case
worst case memory requirements
requirements.
On the basis of workload information, Automatic Shared Memory Management:
Captures statistics periodically in the background
Uses memory advisors
Performs what-if analysis to determine the best distribution of the memory
Moves memory to where it is most needed
Saves component sizes across shutdown if an SPFILE is used (the sizes can be
resurrected from before the last shutdown)
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a you
Before enabling ASMM,
r a b remove the individual memory area parameters from the
should
L orAdvisor
SPFILE because having
n s fethem set can impose restrictions on ASMM. After ASMM is enabled,
the SGA
r e n -tra available to help you choose the best value for total SGA size.
Size is
K a seeing
If after n onthe effects of the ASMM allocations you decide that you want to adjust certain
component allocations, you can specify values for those components. If the values you are
specifying are lower than the current values, those values are treated as minimum memory
sizes for their respective components. If the values you are specifying are larger than the
current values, the sizes of the memory components are resized upward to the values you
provided as long as free memory is available. Setting limits reduces the amount of memory
available for automatic adjustment
adjustment, but the capability is available and can help overall
performance.
The initialization parameters of concern are the following:
SHARED_POOL_SIZE
LARGE_POOL_SIZE
JAVA_POOL_SIZE
DB_CACHE_SIZE
STREAMS_POOL_SIZE
To adjust these parameters while ASMM is enabled, you must use the ALTER SYSTEM
command.
n
ra lic e n
N a le differs depending on whether you are changing to ASMM
The procedure for enabling
n a a b
ASMM
L o re memory
from manual shared
s f er management or from automatic memory management. To
change to ASMM a
n t r n manual shared memory management:
from
r e -
n the following query to obtain a value for SGA_TARGET:
K1.a Execute
n o
SELECT ((SELECT SUM(value) FROM V$SGA) - (SELECT CURRENT_SIZE
FROM V$SGA_DYNAMIC_FREE_MEMORY)) SGA_TARGET FROM DUAL;
2. Set the value of SGA_TARGET:
ALTER SYSTEM SET SGA_TARGET=value [SCOPE={SPFILE|MEMORY|BOTH}]
where value is the value computed in step 1 or is some value between the sum of all
SGA component sizes and SGA_MAX_SIZE.
SGA MAX SIZE
3. Set the values of the automatically sized SGA components to 0. Do this by editing the
text initialization parameter file or by issuing ALTER SYSTEM statements. Restart the
instance if required.
To change to ASMM from automatic memory management:
1. Set the MEMORY_TARGET initialization parameter to 0.
ALTER SYSTEM SET MEMORY_TARGET = 0;
The database sets SGA_TARGET based on current SGA memory allocation.
2. Set the values of the automatically sized SGA components to 0. Restart the instance
when finished.
r a n icen
N a le l
You can dynamically
e n a rabto disable Automatic Shared Memory Management by setting
choose
SGA_TARGET rto 0. In this
Loof the n s fecase, the values of all the autotuned parameters are set to the
currentn
r e sizes
- t r a corresponding components, even if the user had earlier specified a
a nnonzero
different
K on value for an autotuned parameter.
In the example in the slide, the value of SGA_TARGET is 8 GB and the value of
SHARED_POOL_SIZE is 1 GB. If the system has internally adjusted the size of the shared
pool component to 2 GB, setting SGA_TARGET to 0 results in SHARED_POOL_SIZE being set
to 2 GB, thereby overriding the original user-specified value.
SGA_TARGET = 8G
DB_CACHE_SIZE
DB CACHE SIZE = 0
JAVA_POOL_SIZE = 0
LARGE_POOL_SIZE = 0
SHARED_POOL_SIZE = 0
STREAMS_POOL_SIZE = 0
s a
)ha
m
co
SELECT name, value, isdefault
i l
FROM v$parameter
o t ma uide
WHERE name LIKE '%size';
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n
ra lic e n
N
When you specify aanonzero b
a le for SGA_TARGET and do not specify a value for an
value
autotuned SGA
n
reparameter,f a
er the value of the autotuned SGA parameters in the V$PARAMETER
L o s
n of the ISDEFAULT column is TRUE.
view is n
r e 0, and the
- t r avalue
K a have
If you n n
ospecified a value for any of the autotuned SGA parameters, the value that is
displayed when you query V$PARAMETER is the value that you specified for the parameter.
Server PGA
process Private Cursor
Session Work
UGA SQL and SQL
memory area
areas area
Dedicated
connections UGA
Shared
PGA
server Shared pool
s a
or UGA
)ha
Shared server large pool m
co
i l
connections
o t ma uide
@ h nt G
r e na tude
Automatic PGA memory management vlo ishienabled S by default.
( n s
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
The Program Global
e n a Arear(PGA)
a b is a memory region that contains data and control
L s e
forr a serverfprocess.
information o It is nonshared memory created by the Oracle server when a
n -tra
server process is n
started. Access to it is exclusive to that server process. The total PGA
r e n by all server processes attached to an Oracle instance is also referred to as
a nallocated
memory
K o
the aggregated PGA memory allocated by the instance.
Part of the PGA can be located in the SGA when using shared servers.
PGA memory typically contains the following:
Private SQL Area
A private SQL area also called the user global area (UGA) contains data, such as bind
information and runtime memory structures. This information is specific to each sessions
invocation of the SQL statement; bind variables hold different values, and the state of the
cursor is different, among other things. Each session that issues a SQL statement has a
private SQL area. Each user that submits the same SQL statement has his or her own private
SQL area that uses a single shared SQL area. Thus, many private SQL areas can be
associated with the same shared SQL area. The location of a private SQL area depends on
the type of connection established for a session
session. If a session is connected through a
dedicated server, private SQL areas are located in the server processs PGA. However, if a
session is connected through a shared server, part of the private SQL area is kept in the SGA.
For complex queries (for example, decision support queries), a big portion of the PGA is
dedicated to work areas allocated by memory-intensive operators, such as:
Sort-based operators, such as ORDER BY, GROUP BY, ROLLUP, and window functions
Hash-join
Hash join
Bitmap merge
Bitmap create
Write buffers used by bulk load operations
A sort operator uses a work area (the sort area) to perform the in-memory sort of a set of rows.
Similarly, a hash-join operator uses a work area (the hash area) to build a hash table from its left s a
input.
input )ha
The size of a work area can be controlled and tuned. Generally, bigger work areas m
co can
i l
significantly improve the performance of a particular operator at the cost of
consumption. o t mahigher u
e
idmemory
@ h nt G
Session Memory
r e na tude
Session memory is the memory allocated to hold avsessions
n lo isvariables
S (logon information) and
(
session For asshared server,
other information related to the session. t h
server the session memory is shared and
not private.
l l e ga use
Automatic PGA Memory Management j o Vi se to
r a n c e n
a le
By default, Oracle Database
N l i
automatically and globally manages the total amount of memory
r e na fePGA.
dedicated to the instance
r ab You canOracle
parameter PGA_AGGREGATE_TARGET.
control this amount by setting the initialization
Database then tries to ensure that the total
L o ns
re onever a y allocated across all database server processes
amountnof PGAtmemory
- rexceeds p and background
g
K a
processes
n n this target. But this is target value and not a hard limit.
PGA_AGGREGATE_LIMIT sets a hard limit for the amount of PGA that can be used. The
minimum value is 1024 MB and the maximum is 120% of physical memory minus the total SGA,
and it must be at least as large as PGA_AGGREGATE TARGET. If PGA_AGGREGATE_LIMIT is
not set, it defaults to 200% of PGA_AGGREGATE_TARGET within the same minimum and
maximum as stated. When PGA_AGGREGATE_LIMIT is exceeded, the sessions using the most
memoryy will have their calls aborted. Parallel q
queries will be treated as a unit. If the total PGA
memory usage is still over the limit, sessions using the most memory will be terminated. SYS
processes and fatal background processes are exempt from this limit.
re Stud
EVENT_ID TIME_WAITED_MICRO
Wait events l
v hiso
(
s se tn
g a u
V
Copyright 2013, ille and/or
Oracle t o
its affiliates. All rights reserved.
n j o
e n se
N ara le lic
e n a raforb the effective diagnosis of performance problems. The Oracle
Statistics must be available
or many
server generates
L s e of statistics for different levels of granularity.
ftypes
n
n -tra session, and service levels, both wait events and accumulated statistics
At the
r esystemwide,
K a on In the slide, the top row of views shows the cumulative statistics. The bottom
are computed.
n
row shows the wait event views.
When analyzing a performance problem in any of these scopes, you typically look at the
change in statistics (delta value) over the period of time you are interested in. All the possible
wait events are cataloged in the V$EVENT_NAME view. All statistics are cataloged in the
V$STATNAME view; approximately 480 statistics are available in Oracle Database.
Instance/Database Disk
V$DATABASE V$DATAFILE
V$INSTANCE V$FILESTAT
V$PARAMETER V$LOG
V$SPPARAMETER V$LOG_HISTORY
V$SYSTEM_PARAMETER V$DBFILE
V$PROCESS V$TEMPFILE
V$BGPROCESS V$TEMPSEG_USAGE
V$PX_PROCESS_SYSSTAT V$SEGMENT_STATISTICS
V$SYSTEM_EVENT s a
) ha
Contention m
o
Memory V$LOCK
a ilc e
V$BUFFER_POOL_STATISTICS V$UNDOSTAT
h o tm Guid
V$LIBRARYCACHE V$WAITSTAT
a @ e n t
V$SGAINFO V$LATCH
l o r en Stud
V$PGASTAT
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
In the slide, some of
e n a the views
r a bthat can help you determine the cause of performance
L r
problems oroanalyze
n
the
s fecurrent status of your database are listed.
For raecomplete
n ra
n -tdescription of these views, see the Oracle Database Reference.
K a n o
Quiz
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
Answer: c
r e na ferab
n Lo rans
a re on-t
K n
Quiz
a. LOG_BUFFER
b. SGA_MAX_SIZE
c STREAMS_POOL_SIZE
c. STREAMS POOL SIZE
d. PGA_AGGREGATE_TARGET
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
Answer: b
r e na ferab
n Lo rans
a re on-t
K n
Summary
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Practice 21
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
Aula Matriz SAS
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
M
Managing
i Performance:
P f SQL Tuning
T i
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Aula Matriz SAS
Objectives
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
SQL Tuning
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
Generally, the tuning
e n b yields the most benefit is SQL tuning. Poorly tuned SQL uses
a effortrathat
L or thannand
more resources fe This inefficiency prevents scalability, uses more OS and
required.
s
database
r e n -tra
resources, increases response time. To tune poorly tuned SQL statements,
a mustnobenidentified, and then tuned. SQL statements can be tuned individually, but often
they
K
the solution that optimizes one statement can hurt the performance of several others.
The SQL statements that use the most resources are by definition the statements in need of
tuning. These are statements that have the longest elapsed time, use the most CPU, or do the
most physical or logical reads.
Tune the individual statements by checking the optimizer statistics, check the explain plan for
th mostt efficient
the ffi i t access path,
th test
t t alternate
lt t SQL constructions,
t ti andd test
t t possible
ibl new
indexes, materialized views, and partitioning.
Test the application as a whole, using the tuned SQL statements. Is the overall performance
better?
The methodology is sound, but tedious. Tuning an individual statement is not difficult. Testing
the overall impact of the individual statement tuning on an application can be very difficult.
In Oracle Database,
Database a set of SQL ad
advisors
isors are a
available
ailable to identif
identify and ttune
ne statements
statements,
individually, or as a set.
n e n
N ara le lic
The optimizer is theapart of the
e n r a b Oracle Database server that creates the execution plan for a
L oranyTheSQL
SQL statement.
n s fe
determination of the execution plan is an important step in the
r e n -tra
processing of statement and can greatly affect execution time.
K
The n on plan is a series of operations that are performed in sequence to execute the
a execution
statement. The optimizer considers many factors related to the referenced objects and the
conditions specified in the query. The information necessary to the optimizer includes:
Statistics gathered for the system (I/O, CPU, and so on) as well as schema objects
(number of rows, index, and so on)
Information in the dictionary
WHERE clause qualifiers
Hints supplied by the developer
When you use diagnostic tools, such as Enterprise Manager, EXPLAIN PLAN, and SQL*Plus
AUTOTRACE, you can see the execution plan that the optimizer chooses.
Note: The Oracle optimizer has two names based on its functionality: the query optimizer and
the Automatic Tuning Optimizer.
Optimizer Statistics
r a n icen
Na table, l e l
Optimizer statisticsainclude
e n r a b column, index, and system statistics. Statistics for tables
and indexesoare
L r storedsfine the data dictionary. These statistics are not intended to provide
r e n -They
real-time data.
t r anprovide the optimizer a statistically correct snapshot of data storage and
a nowhich
distribution,
K n the optimizer uses to make decisions on how to access data.
The statistics that are collected include:
Size of the table or index in database blocks
Number of rows
Average row size and chain count (tables only)
Height and number of deleted leaf rows (indexes only)
As data is inserted, deleted, and modified, these facts change. Because the performance
impact of maintaining real-time data distribution statistics is prohibitive, these statistics are
updated by periodically gathering statistics on tables and indexes.
Optimizer statistics are collected automatically by an automatic maintenance job that runs
during predefined maintenance windows once daily by default. System statistics are operating
system characteristics that are used by the optimizer. These statistics are not collected
y For details about collecting
automatically. g system
y statistics,, see the Oracle Database
Performance Tuning Guide.
Optimizer statistics are not the same as the database performance statistics that are gathered
in the AWR snapshot.
accurate statistics
Optimizer statistics:
Object statistics
Operating system statistics
Ways to collect statistics:
Automatically: Automatic Maintenance Tasks
Manually: DBMS_STATS package
s a
ByB setting
tti database
d t b iinitialization
iti li ti parameters t )ha
m
co
By importing statistics from another database i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n r b of data that are specific details about database objects.
Optimizer statisticsaare collections
a
These statistics
L s fe for the query optimizer to choose the best execution plan for
or arenessential
each SQL
r e n -tra
statement. These statistics are gathered periodically and do not change between
a non
gatherings.
K
The recommended approach to gathering optimizer statistics is to allow the Oracle Database
server to automatically gather the statistics. The Automatic Maintenance Tasks can be
created automatically at database creation time and is managed by the Scheduler. It gathers
statistics on all objects in the database that have either missing or stale optimizer statistics by
default. You can change the default configuration through the Automatic Maintenance Tasks
page.
page
System statistics describe the systems hardware characteristics, such as I/O and CPU
performance and utilization, to the query optimizer. When choosing an execution plan, the
optimizer estimates the I/O and CPU resources required for each query. System statistics
enable the query optimizer to more accurately estimate I/O and CPU costs, and thereby
choose a better execution plan. System statistics are collected using the
DBMS_STATS.GATHER_SYSTEM_STATS procedure. When the Oracle Database server
gathers
th system
t statistics,
t ti ti it analyzes
l system
t activity
ti it in
i a specified
ifi d period
i d off time.
ti System
S t
statistics are not automatically gathered. Oracle Corporation recommends that you use the
DBMS_STATS package to gather system statistics.
If you choose not to use automatic statistics gathering, you must manually collect statistics in all
schemas, including system schemas. If the data in your database changes regularly, you also
need to gather statistics regularly to ensure that the statistics accurately represent
characteristics of your database objects. To manually collect statistics, use the DBMS_STATS
package. This PL/SQL package is also used to modify, view, export, import, and delete
statistics.
You can also manage optimizer and system statistics collection through database initialization
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
To manage optimizer
e n r a b in Enterprise Manager, select Optimizer Statistics in the SQL
a statistics
submenu ofo the
L following
n s fe menu. On the Manage Optimizer Statistics page, you can
r Performance
a r e n-tra
performnthe tasks:
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a preference
You can manage global
r a b settings by using Enterprise Manager. Click the Global
or nOptions
Statistics Gathering
L s fe link on the Manage Optimizer Statistics page.
On the
a r tra Gathering Options page, change the global preferences in the Gather
enGlobaln-Statistics
K
Optimizer o
nStatistics Default Options section. When finished, click the Apply button.
Note: To change the statistics gathering options at the object level or schema level, click the
Object Level Statistics Gathering Preferences link on the Manage Optimizer Statistics page.
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a statistics
You may need to gather
r a b manually at certain times, such as when the contents of a
table have changed
L s e between automatic gathering jobs that the statistics no longer
ortable naccurately.
so fmuch
r e n -tra
represent the This is common for large tables that experience more than a
K n n in size in a 24-hour period.
10apercentochange
Best-practice tip: Collect statistics often enough that the table never changes by more than
about 10 percent between collection periods. This may require manual statistics collection or
additional maintenance windows.
Statistics can be manually collected by using either Enterprise Manager or the DBMS_STATS
package. System statistics can be gathered only by using the DBMS_STATS package. System
statistics
t ti ti describe
d ib th
the systems
t h hardware
d characteristics,
h t i ti such
h as I/O and
d CPU performance
f
and utilization, to the query optimizer.
The Gather Optimizer Statistics menu selection starts a wizard that enables you to select the
scope, objects, options, and schedule for a job that will gather optimizer statistics. The wizard
submits a DBMS_STATS.GATHER_*_STATS job at the scope you specify: table, schema, or
database. In this wizard, you set the preferences for the default values used by the
DBMS_STATS package and you schedule this job to run at a time that you determine.
Gathering statistics manually for routine statistics collection is not recommended because the
statistics are gathered more efficiently and with less impact on users during the maintenance
windows. A manual job can also be submitted if the automatic job has failed or been disabled.
You can also g gather optimizer
p statistics with the DBMS_STATS p packageg directly:
y
SQL> EXEC dbms_stats.gather_table_stats('HR','EMPLOYEES');
SQL> SELECT num_rows FROM dba_tables
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
s (n t h
l l e ga use
j o Vi se to
r a n icen
N a le l
r e na ferab
n Lo rans
a re on-t
K n
n
ra lic e n
N a le
e n a
The DBMS_STATS.GATHER_*_STATS
r a b procedures can be called at various levels to gather
statistics foroan
L n fe
r entiresdatabase or for individual objects, such as tables. When the
n -tra
GATHER_*_STATS
r e procedures are called, several of the parameters are often allowed to
K a The
default.
n o nsupplied defaults work well for most of the objects in the database, but for some
objects or schemas the defaults need to be changed. Instead of running manual jobs for each
of these objects, Oracle Database enables you to set values (called preferences) for
individual objects, schemas, or databases, or to change the default values with the
global-level command.
The preferences specify the parameters that are given to the gather procedures. The
PREFS procedures create preference values for any object that is not owned by SYS
SET_*_PREFS
SET
or SYSTEM. The expected use is that the DBA will set the global preferences for any
parameters that should be database-wide. These will be applied for any parameter that is
allowed to default.
The SET_DATATBASE_PREFS procedure iterates over all the tables and schemas in the
database setting the specified preference. SET_SCHEMA_PREFS iterates over the tables in the
specified schema. SET_TABLE_PREFS sets the preference value for a single table.
All object preferenceswhether set at the database, schema, or table levelare held in a
single table. Changing the preferences at the schema level overwrites the preferences that
were previously set at the table level.
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a 12c,
Before Oracle Database
r a bthe automatic statistics gather job gathered statistics one
segment at o
L r It now
a time.
n s feuses concurrency.
a r en Database
In Oracle
n - tra 12c, you can run multiple statistics gathering tasks concurrently which
K o considerable improvements in statistics gathering time by increasing the
may provide
n
resource utilization rate, in particular, on multi-CPU systems.
Employ smart scheduling mechanisms to have maximum degree of concurrency (to the extent
that resources are available), for example, allow gathering of statistics for multiple partitioned
tables concurrently.
POOL
NAME WAIT_CLASS# NAME
CLASS WAIT_CLASS BYTES
VALUE TOTAL_WAITS
STAT_ID TIME_WAITED
V$EVENT_NAME
V$SYSTEM_EVENT
EVENT_NUMBER
EVENT
EVENT_ID s a
NAME
TOTAL_WAITS
) ha
TOTAL_TIMEOUTS
o m
TIME_WAITED ailc
PARAMETER1
PARAMETER2
t m i d e
PARAMETER3
@ ho nt Gu
AVERAGE_WAIT
TIME_WAITED_MICRO
a e
ren Stud
WAIT_CLASS
l
v hiso
(
s se tn
g a u
V
Copyright 2013, ille and/or
Oracle t o
its affiliates. All rights reserved.
n j o
e n se
N ara le lic
To effectively diagnose
e n r a b
a performance problems, statistics must be available. The Oracle
Database instance
L s fe many types of cumulative statistics for the system, sessions,
orSQL ngenerates
r e n -tra
and individual statements at the instance level. The Oracle Database server also tracks
cumulative
K n
a nostatistics on segments and services. When analyzing a performance problem in
any of these scopes, you typically look at the change in statistics (delta value) over the period
of time you are interested in.
Note: Instance statistics are dynamic and are reset at every instance startup. These statistics
can be captured at a point in time and held in the database in the form of snapshots.
Wait Events Statistics
All the possible wait events are cataloged in the V$EVENT_NAME view.
Cumulative statistics for all sessions are stored in V$SYSTEM_EVENT, which shows the total
waits for a particular event since instance startup.
When you are troubleshooting, you need to know whether a process has waited for any
resource.
Systemwide Statistics
All the systemwide statistics are cataloged in the V$STATNAME view: Over 400 statistics are
available in Oracle Database.
...
table scans (short tables) 64 135116
table scans (long tables) 64 250
table scans (rowid ranges) 64 0
table scans (cache partitions) 64 3
table scans (direct read) 64 0
table scan rows gotten 64 14789836
table scan blocks gotten 64 558542
...
Systemwide statistics are classified by the tuning topic and the debugging purpose. The classes
s a
include general instance activity
activity, redo log buffer activity
activity, locking,
)ha
locking database buffer cache activity
activity,
m
co
and so on. Each of the system statistics can belong to more than one class, so you cannot do a
simple join on V$SYSSTATS.CLASS and V$SYSTEM_WAIT_CLASS.WAIT_CLASS#. i l
You can also view all wait events for a particular wait class by querying o t ma uide
V$SYSTEM_WAIT_CLASS, as in this example (with formatting @ h nt G
applied):
r e na tude
vlo his S
SQL> SELECT * FROM V$SYSTEM_WAIT_CLASS
2 WHERE wait_class LIKE '%I/O%'; ( n t
s TOTAL_WAITS
CLASS_ID CLASS# WAIT_CLASS g a u s e TIME_WAITED
l l e
i e to ----------- -----------
j o V
---------- ------ ------------
s
1740759767
r a n 8 iUserc e n I/O 1119152 39038
N
4108307767a le 9 l System I/O 296959 27929
r e na ferab
SGA Global Statistics
The server o nalls calculated memory statistics in the V$SGASTAT view. You can query this
Ldisplays
a
view
n
n -tra totals of detailed SGA usage since the instance started, as in the
reto findocumulative
K
followingnexample:
SQL> SELECT * FROM v$sgastat;
POOL NAME BYTES
------ ------------------------- ----------
fixed_sga 7780360
buffer_cache 25165824
log_buffer 262144
shared pool sessions 1284644
shared pool sql area 22376876
...
The results shown are only a partial display of the output.
When the STATISTICS_LEVEL p parameter is set to BASIC, the value of the
TIMED_STATISTICS parameter defaults to FALSE. Timing information is not collected for wait
events and much of the performance-monitoring capability of the database is disabled. The
explicit setting of TIMED_STATISTICS overrides the value derived from STATISTICS_LEVEL.
l o r e Stud
Purged if not used after a yearv is
s (n t h
l l e ga use
i and/or
VOracle
Copyright 2013,
e titsoaffiliates. All rights reserved.
j o
n icen s
r a l
In Oracle Databasea12c,Nathe database
b l e server can use a SQL plan directive, which is
e n r a
fe instructions that the optimizer can use to generate a more optimal
L or n
additional information
sand
r e n -tra
plan. For example, a SQL plan directive might instruct the optimizer to collect missing
a ncreate
statistics,
K o n column group statistics, or perform dynamic sampling. During SQL
compilation or execution, the database analyzes the query expressions that are missing
statistics or that misestimate optimizer cardinality to create SQL plan directives. When the
optimizer generates an execution plan, the directives give the optimizer additional information
about objects that are referenced in the plan.
SQL plan directives are not tied to a specific SQL statement or SQL ID. The optimizer can
use SQL plan directives for SQL statements that are nearly identical because SQL plan
directives are defined on a query expression. For example, directives can help the optimizer
with queries that use similar patterns, such as web-based queries that are the same except
for a select list item. The database stores SQL plan directives persistently in the SYSAUX
tablespace. When generating an execution plan, the optimizer can use SQL plan directives to
obtain more information about the objects that are accessed in the plan.
Directives are automatically maintained, created as needed, purged if not used after a year.
Directives can be monitored in DBA_SQL_PLAN_DIR_OBJECTS. SQL plan directives improve
plan accuracy by persisting both compilation and execution statistics in the SYSAUX
tablespace, allowing them to be used by multiple SQL statements.
n
ra lic e n
N a e enables the optimizer to automatically adapt a poorly
lfeature
n a
The Adaptive Execution Plans
a b
L o re splan
performing execution f erat run time and prevent a poor plan from being chosen on
subsequent n The optimizer instruments its chosen plan so that at run time, it can
executions.
traoptimizers
ren onif -the
beadetected estimates are not optimal. Then the plan can be automatically
K n
adapted to the actual conditions. An adaptive plan is a plan that changes after optimization
when optimizer estimates prove inaccurate.
The optimizer can adapt plans based on statistics that are collected during statement
execution. All adaptive mechanisms can execute a plan that differs from the plan which was
originally determined during hard parse. This improves the ability of the query-processing
engine (compilation and execution) to generate better execution plans.
The two Adaptive Plan techniques are:
Dynamic plans: A dynamic plan chooses among subplans during statement execution.
For dynamic plans, the optimizer must decide which subplans to include in a dynamic
plan, which statistics to collect to choose a subplan, and thresholds for this choice.
Re-optimization: In contrast, re-optimization changes a plan for executions after the
current execution. For re-optimization, the optimizer must decide which statistics to
collect at which p
points in a p
plan and when re-optimization
p is feasible.
Note: OPTIMIZER_ADAPTIVE_REPORTING_ONLY controls reporting-only mode for adaptive
optimizations. When set to TRUE, adaptive optimizations run in reporting-only mode where the
information required for an adaptive optimization is gathered, but no action is taken to change
the plan.
Oracle Database 12c: Admin, Install and Upgrade Accelerated 22 - 18
Aula Matriz SAS
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
a raaset
Oracle Database provides
e n b of advisors for SQL. The AWR identifies and records
L n s fe high-load SQL statements.
or the recent
statistics about
a en Access
TherSQL
n - traAdvisor considers changes applied to a set of SQL statements and looks for
K
a net gainn oin performance. This set can be a hypothetical set of SQL, a historical set, or a
manually created set.
The SQL Performance Analyzer can be used to predict and prevent potential performance
problems for any database environment change that affects the structure of the SQL
execution plans.
The SQL Repair Advisor is run from the Support Workbench when a SQL statement fails with
a critical error. A critical error also produces an incident. The repair advisor attempts to find
and recommend a SQL patch. If no patch is found, you can continue in the Support
Workbench to package the incident and submit the package to Oracle Support as a Service
Request (SR).
The SQL Tuning Advisor analyzes one or more SQL statements one at a time. It examines
statistics, SQL profiles, indexes, materialized views, and restructured SQL. The SQL Tuning
Advisor can be run manually at any time
time, but it is run during every maintenance window
against the recent high-load SQL statements. Click Automatic SQL Tuning Results to view
and implement the recommendations. This automatic job can be configured to automatically
implement recommended SQL profiles for the high-load statements.
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
The Automatic SQLaTuning Task
e n r a b runs by default every night.
You can access
L s fe SQL Tuning Result Summary page by selecting Automated
or thenAutomatic
a r en nTasks
Maintenance - tra in the Oracle Scheduler submenu of the Administration menu. Select the
K noSQL Tuning link to view the result summary page.
Automatic
Click Configure to display a page where you can change the defaults of the Automatic Tuning
Task and enable automatic implementation of SQL profiles.
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a onratheb Automatic Tuning Results Summary page, you will see the
If you click View Report
Automatic SQL e Details. You can implement all the recommendations or drill
Loror rimplement
Tuning fResult
s
down tonview
t a n individual recommendations. On the Recommendations page, you
can r e
a clicknthe -
neyeglass icon on the right to see the differences that implementing a SQL profile
K o
will make in the explain plan.
n e n
N ara le lic
a israthe
The SQL Tuning Advisor
e n b primary driver of the tuning process. It performs several types
of analyses:or
L n s fe
r Stat
e Statistics
n raa ys s CChecks
n st cs-tAnalysis: ec s eac
each quequeryy object for o missingss g o or sta
stalee statistics,
stat st cs, and
a d
a
K makes no recommendations to gather relevant statistics.
SQL Profiling: The optimizer verifies its own estimates and collects auxiliary
information to remove estimation errors. It builds a SQL profile using the auxiliary
information and makes a recommendation to create it. When a SQL profile is created, it
enables the query optimizer to generate a well-tuned plan.
Access Path Analysis: New indexes are considered if they significantly improve
access to
t eachh table
t bl iin th
the query. Wh
When appropriate,
i t recommendations
d ti tto create
t such
h
objects are made.
SQL Structure Analysis: SQL statements that use bad plans are identified and
relevant suggestions are made to restructure them. The suggested changes can be
syntactic as well as semantic.
The SQL Tuning Advisor considers each SQL statement included in the advisor task
independently. Creating a new index may help a query
independently query, but may hurt the response time of
DML. So, a recommended index or other object should be checked with the SQL Access
Advisor over a workload (a set of SQL statements) to determine whether there is a net gain in
performance.
n e n
N ara le lic
e n a runs
The SQL Tuning Advisor
r a bautomatically every night as the Automatic SQL Tuning Task.
There may be
L oAdvisor n s fe a SQL statement needs immediate tuning action. You can use the
rtimes when
r e n -tra analyze SQL statements and obtain performance recommendations at
SQL Tuning to
any
K on you run this advisor as an ADDM performance-finding action.
a time.nTypically,
Additionally, you can run the SQL Tuning Advisor when you want to analyze the top SQL
statements consuming the most CPU time, I/O, and memory.
Even though you can submit multiple statements to be analyzed in a single task, each
statement is analyzed independently. To obtain tuning recommendations that consider overall
performance of a set of SQL, use the SQL Access Advisor.
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
On the Schedule SQL
e n a Tuning
r a bAdvisor page, you can choose the SQL statements to include
and changeo
L r automatic
the
n s fe defaults for a tuning task. You can set the source of the SQL
r e n -tra
statements, and if you have been granted the ADVISOR system privilege, you can submit the
task.
K n on Manager then creates a tuning task for the SQL Tuning Advisor.
a Enterprise
The SQL statement options allow you to choose one or more SQL statements from recent
Top Activity, choose Historical SQL stored in the AWR, or choose from a SQL Tuning Set that
you have already created.
It is important to choose the appropriate scope for the tuning task. If you choose the Limited
option, the SQL Tuning Advisor produces recommendations based on statistics check, access
pathth analysis,
l i and d SQL structure
t t analysis.
l i TheTh Li
Limited
it d option
ti willill nott make
k a SQL profile
fil
recommendation. If you choose the Comprehensive option, the SQL Tuning Advisor produces
all the recommendations that the Limited option produces, but it also invokes the optimizer
under the SQL profiling mode to build a SQL profile. With the Comprehensive option, you can
also specify a time limit for the tuning task, which by default is 30 minutes. After you select
Run SQL Tuning Advisor, configure your tuning task using the SQL Tuning Options page.
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a for
The SQL Tuning Results
r a b task are displayed as soon as the task completes and can
the
orYoulater
also be accessed
L s e the Advisor Central page. A summary of the recommendations
ffrom
n -tra
are displayed. n
can review and implement individual recommendations. Select the
r e
a noand
statement n click view.
K
Duplicate SQL
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a rare
Duplicate SQL statements
a bstatements that are different only in the literal values they use
Lor ranthat
or in their formatting. fe
sStatements that are different each get a separate cursor in the Library
Cache.nStatements are duplicates can use the same cursor if the literals are replaced
a
with o n -t and the formatting is made to be the same.
e variables,
rbind
K n
Duplicate SQL statements can be identified by clicking Duplicate SQL in the Additional
Monitoring Links section of the Performance Home page. SQL that is determined to be
duplicate, except for formatting or literal differences, is listed together. This helps you
determine which SQL in your application can be consolidated, thus lowering the requirements
on the Library Cache and speeding up the execution of the statement.
Workload specification
Recommendations
R d ti
- SQL statement
- Indexes
- SQL Tuning Set
- Materialized views
- SQL cache contents
- Materialized view logs
- Statistics
- Partitioning
- Schema name
s a
)ha
m
co
SQL Access i l
Advisor o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a can
The SQL Access Advisor
r a brecommend the proper set of materialized views, materialized
L r
view logs, partitioning,
oessential
n s fe indexes for a given workload. Understanding and using these
and
r e n -tra
structures is when optimizing SQL because they can result in significant
a nonimprovements in data retrieval.
performance
K
The SQL Access Advisor recommends bitmap, function-based, and B-tree indexes. A bitmap
index offers a reduced response time for many types of ad hoc queries and reduced storage
requirements compared to other indexing techniques. B-tree indexes are most commonly
used in a data warehouse to index unique or near-unique keys.
Another component of the SQL Access Advisor also recommends how to optimize
materialized
t i li d views
i so th
thatt th
they can b
be ffastt refreshable
f h bl andd ttake
k advantage
d t off generall query
rewrite.
Note: For more information about materialized views and query rewrite, see the Oracle
Database Performance Tuning Guide.
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
Access the SQL Access
e n a Advisor
r a b by selecting SQL Access Advisor in the SQL submenu of the
Performance
L r
omenu. n s fe
Whenr n -atrSQL
estarting a Access Advisor session, you can select Use Default Options and start
K a n
o set of advisor options that are recommended. Additionally, you can start a
with a predefined
n
task and have it inherit a set of option values as defined by a template or task by selecting
Inherit Options from a Task or Template. These include several generic templates designed
for general-purpose environments, OLTP, and data warehousing databases. You can save
custom templates from a previous task and reuse them when needed.
Click Continue to launch the SQL Access Advisor Wizard.
Workload Source
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
Use the SQL Access
e n a Advisor
r a bWizards Workload Source page to provide a defined workload
or Access
that allows the
L s e to make recommendations. Supported workload sources are:
fAdvisor
n
trdaRecent
n e t -aand
r Cu
e
a
Current
n
ece t SQSQL Activity:
ct ty Uses tthe e cu current
e t SQ SQL from o tthe
e cac
cachee as tthe
e
no
K workload
Use an existing SQL Tuning Set: Enables you to specify a previously created SQL
Tuning Set as the workload source
Create a Hypothetical Workload from the Following Schemas and Tables: Provides
a schema that allows the advisor to search for dimension tables and produce a workload
The scope of the workload can be further reduced by y applying
y g filters that yyou can access in
the Filter Options section. With these options, you can reduce the scope of the SQL
statements that are present in the workload. The filters are applied to the workload by the
advisor to focus the tuning effort. Possible filter options are:
Top resource consuming SQL statements
Users, module identifier, or actions
Tables
Recommendation Options
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
a raOptions
Use the Recommendations
e n b page to choose whether to limit the advisor to
L
based
n s feon a single access method. Choose Indexes, Materialized Views,
oorr a combination
recommendations
r e n -tra
Partitioning, of those from the Access Structures to Recommend section.
You
K o n Evaluation Only to evaluate only existing access structures. In this mode, the
a can nchoose
advisor does not generate new recommendations but comments on the use of existing
structures. This is useful to track the effectiveness of the current index, materialized view, and
MV log usage over time.
You can use the Scope section to specify a mode of Limited or Comprehensive. These modes
affect the quality of recommendations as well as the length of time required for processing. In
the Comprehensive mode,mode the advisor searches a large pool of candidates resulting in
recommendations of the highest quality. In the Limited mode, the advisor performs quickly,
limiting the candidate recommendations.
Recommendation Options
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
You can choose Advanced
e n a raOptions b to show or hide options that enable you to set space
restrictions, o r options,
tuning
s fe and default storage locations. Use the Workload Categorization
sectionnto L
set options
r a n for Workload Volatility and Workload Scope. You can choose to favor
r e
read-only n
a noperations - t or you can consider the volatility of referenced objects when forming
K o
recommendations. You can also select Partial Workload, which does not include
recommendations, to drop unused access structures, or Complete Workload, which does
include recommendations to drop unused access structures.
Use the Space Restrictions section to specify a hard space limit, which forces the advisor to
produce recommendations only with total space requirements that do not exceed the
specified limit
limit.
Use the Tuning Options section to specify options that customize the recommendations made
by the advisor. Use the Prioritize Tuning of SQL Statements by drop-down list to prioritize by
Optimizer Cost, Buffer Gets, CPU Time, Disk Reads, Elapsed Time, and Execution Count.
Use the Default Storage Locations section to override the defaults defined for schema and
tablespace locations. By default, indexes are placed in the schema and tablespace of the
table theyy reference. Materialized views are placed in the schema and tablespace of the user
who executed one of the queries that contributed to the materialized view recommendation.
After you define these parameters, you can schedule and review your tuning task.
Reviewing Recommendations
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a rpage,
Using the Advisor Central
a b you can list all the completed SQL Access Advisor tasks.
LorUse
Select the one for which
n s feyou want to see the recommendations, and then click the View
Result n
r e button.
- t r athe Results for Task Summary page to get an overview of the advisor
a nThe
findings.
K o npage presents charts and statistics that provide overall workload performance
and query execution time potential improvement for the recommendations. You can use the
page to show statement counts and recommendation action counts.
To see other aspects of the results for the advisor task, click one of the three other tabs on the
page: Recommendations, SQL Statements, or Details.
The Recommendations page displays a chart and a table that show the top recommendations
ordered
d db by th
their
i percentage
t iimprovementt tto th
the total
t t l costt off the
th entire
ti workload.
kl d ThThe ttop
recommendations have the biggest total performance improvement.
By clicking the Show SQL button, you can see the generated SQL script for the selected
recommendations. You can click the corresponding recommendation identifier in the table to
see the list of actions that need to be performed in order to implement the recommendation.
On the Actions page, you can actually see all the corresponding SQL statements to execute
in order to implement the action. For recommendations that y you do not want to implement,
keep those check boxes deselected. Then, click the Schedule Implementation button to
implement the retained actions. This step is executed in the form of a Scheduler job.
n e n
N ara le lic
e n a rSQL
Oracle Database includes
a b Performance Analyzer, which gives you an exact and
accurate assessment offe
or Performance
the impact of change on the SQL statements that make up the
L n s
r e n -tra
workload. SQL Analyzer helps you forecast the impact of a potential change on
K n o n of a SQL query workload. This capability provides you with detailed
aperformance
the
information about the performance of SQL statements, such as before-and-after execution
statistics, and statements with performance improvement or degradation. This enables you
(for example) to make changes in a test environment to determine whether the workload
performance will be improved through a database upgrade.
cases:
Database upgrades
Implementation of tuning recommendations
Schema changes
Statistics gathering
Database parameter changes
OS and hardware changes s a
) ha
It is accessible through Enterprise Manager and the o m
DBMS_SQLPA package. a ilc e
m id ot t Gu
@ enh
n a
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
SQL Performance a
e n r a b be used to predict and prevent potential performance
Analyzer can
L r database
problems foroany
n s fe environment change that affects the structure of the SQL
r e n -tra
execution plans. The changes can include (but are not limited to) any of the following:
on upgrades
Ka Database
n
Implementation of tuning recommendations
Schema changes
Statistics gathering
Database parameter changes
OS and hardware changes
You can use SQL Performance Analyzer to predict SQL performance changes that result from
changes for even the most complex environments. As applications evolve through the
development life cycle, database application developers can test changes to schemas,
database objects, and rewritten applications to mitigate any potential performance impact.
SQL Performance Analyzer also enables the comparison of SQL performance statistics.
You can access SQL Performance Analyzer through Enterprise Manager or by using the
DBMS SQLPA package.
DBMS_SQLPA package
For details about the DBMS_SQLPA package, see the Oracle Database PL/SQL Packages and
Types Reference Guide.
n
ra lic e n
N a
1. Gather SQL:aIn this phase, leyou collect the set of SQL statements that represent your
n a b
re onsfthe
SQL workload
L o er production system.
2. Transport:
n d-fromt r n must transport the resultant workload to the test system. The STS is
aYou
r e
non before-version performance: Before any changes take place, you
K3.a Compute
exported f the
h production
d i system and d theh STS is i imported
i d iinto the
h test system.
execute the SQL statements, collecting baseline information that is needed to assess
the impact that a future change might have on the performance of the workload.
4. Make a change: After you have the before-version data, you can implement your
planned change and start viewing the impact on performance.
5. Compute after-version performance: This step takes place after the change is
made in the database environment. Each statement of the SQL workload runs under a
mock execution (collecting statistics only), collecting the same information as captured
in step 3.
6. Compare and analyze SQL Performance: After you have both versions of the SQL
workload performance data, you can carry out the performance analysis by comparing
the after-version data with the before-version data.
7. Tune regressed SQL: At this stage, you have identified exactly which SQL statements
may cause performance
f problems
bl when
h ththe ddatabase
t b change
h iis made.
d H Here, you can
use any of the database tools to tune the system. After implementing any tuning action,
you should repeat the process to create a new after-version and analyze the
performance differences to ensure that the new performance is acceptable.
Quiz
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
Answer: b
r e na ferab
n Lo rans
a re on-t
K n
Quiz
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
Answer: a
r e na ferab
n Lo rans
a re on-t
K n
Quiz
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
Answer: a
r e na ferab
n Lo rans
a re on-t
K n
Quiz
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
Answer: a
r e na ferab
n Lo rans
a re on-t
K n
Summary
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Practice 22
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
Aula Matriz SAS
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
IIntroduction
t d ti to
t Upgrading
U di to
t
Oracle Database 12c
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Aula Matriz SAS
Objectives
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Upgrading:
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
n e n
N ara le lic
e n a rab an existing Oracle Database environment into a new release
Upgrade refers to transforming
or ninsfthe
of Oracle Database,
L e case of this course to Oracle Database 12c.
Datare n -trefers
migration
n ra to moving data from one Oracle Database into a database that was
K a
created in
n oadvance for the migrated data. Migration does not involve an upgrade of the Oracle
Database software.
Note: Best practice is to perform migration and upgrade operations separately.
This lesson provides details on how you can upgrade to Oracle Database 12c and how you
can migrate data to an Oracle Database 12c database.
Upgrade Methods
s a
)ha
m
co
i l
Upgrade
o t ma uide
@ h nt G
Oracle Database 11g r e naOracle
t u e
dDatabase 12c
v l o is S
s (n th
a e
us All rights reserved.
i l l egand/ortitsoaffiliates.
j o V se
Copyright 2013, Oracle
r a n icen
N a le l
e n a rofabupgrading a database to Oracle Database 12c through careful
You can ease the process
planning and
L r of the
ouse n s feOracle Database tools. The method you choose to upgrade depends
r e n -tra
on several factors. Oracle Database supports the following methods for upgrading a
a non
database:
K
Using the Database Upgrade Assistant (DBUA): This tool can be launched by the
Oracle Universal Installer (OUI) or as a stand-alone tool at any time in the future to
upgrade a database. DBUA provides a graphical user interface (GUI) that guides you
through the upgrade of a database.
Performing a manual upgrade: A manual upgrade is a command-line upgrade of a
database by using SQL scripts and utilities
utilities. Though a manual upgrade gives you finer
control over the upgrade process, it is susceptible to errors if any of the upgrade or
preupgrade steps are either not followed or are performed out of order.
Note: DBUA is the preferred method of upgrading a database. It is highly recommended that
you use DBUA to upgrade to Oracle Database 12c.
n e n
N ara le lic
e n a Assistant
The Database Upgrade
r a b (DBUA):
L r through
Guidesoyou
n s fethe upgrade process and configures a database for the new release
re n -trthe
Automates a upgrade process and makes appropriate recommendations for the
a no n
K configuration options, such as tablespaces and redo logs
Shows the upgrade progress for each component, while the upgrade is running
Writes detailed trace and log files and produces a complete HTML report for later
reference
Automatically locks new user accounts in the upgraded database to enhance security
Proceeds to create new configuration files (initialization parameter and listener files) in
the new Oracle home
Upgrades all the database and configuration files on all nodes in the cluster, in an
Oracle RAC environment
Supports a silent mode of operation where no user interface is presented to the user
If the DBA requires more control over the individual steps in the upgrade process, a manual
upgrade is still possible. Usually, however, the manual upgrade method is more error prone,
is harder to automate, and involves a greater amount of work than upgrading with the DBUA.
Manual Upgrade:
Advantages and Disadvantages
Advantages:
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
ha
It is subject to errors. DBAm)
i l co
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
A manual upgrade a consists ofbrunning SQL scripts and utilities from a command line to
r e
upgrade to Oracle
o
n f e
Databasera 12c. Depending on the release of the database being upgraded,
you mayn need
t ns additional preupgrade steps. If you must upgrade to an intermediate
L torperform
a
e
release,
K on-the release documentation for the release that you are upgrading to.
ar ncheck
Though a manual upgrade gives you finer control over the upgrade process, it is susceptible
to errors if any of the upgrade or preupgrade steps are either not followed or are performed
out of order. In contrast, DBUA performs all the necessary preupgrade and upgrade steps.
Refer to the Oracle Database Upgrade Guide for a list of the scripts and the order in which
they should be run.
Upgrade Paths
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a software
If your Oracle Database
r a b is release 10.2.0.5, 11.1.0.7, or 11.2.0.2 or later, you can
L or upgrade
perform a direct
n s feto Oracle Database 12c.
If your
a r eOracle
n - tra software is earlier than 10.2.0.5 or is release 11.2.0.1, then you must
n Database
K
upgrade ntooan intermediate Oracle Database release before upgrading to Oracle Database
12c. The intermediate release should be one of the releases that can be directly upgraded to
Oracle Database 12c.
limitations:
Target and source must be on the same platform.
s a
) h a
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
Both DBUA and theamanual upgrade
e n r a b method have certain limitations:
or and
The source
L n s fe are the same database. The upgrade is an in-place operation.
target
a
The
rehardware
n - tra stays on
ne database o thet e same
sa e platform.
p at o Noo cchange
a ge in ope operating
at g syste
system (OS) oor
K no can take place during the upgrade. The OS must be compatible with both
versions of the database.
n e n
N ara le lic
e n a lists rthe
The table in the slide
a bmajor steps that you should perform to upgrade to a new
L or Database.
release of Oracle
n s fe
Basic
a n tra step are as follows:
n of -each
retasks
no to upgrade: Become familiar with the new features in the release. Develop a
K1. Prepare
test plan and backup strategy.
2. Upgrade a test database: Test the upgrade process by using a test database, not the
production database system.
3. Test the upgraded database: Use the test plan developed in step 1 and test the
upgraded
g database. If there are any
y issues with the upgraded
g system,
y address the
issues and retest.
4. Prepare the production database: Prepare the production database system for the
upgrade. Schedule downtime as necessary and perform a full or incremental backup.
5. Upgrade the production database: Use the procedures you tested in steps 2 and 3 to
upgrade the production database. Back up the database after the upgrade.
6. Tune and adjust the upgraded production database: Implement new features. Test the
applications
li i to ensure they
h operate correctly.
l TTune the
h ddatabase
b as necessary.
Migration Methods
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
You can use Oracle
e n aData rPump
a b to perform a full or partial export from your database followed
L or import
by a full or partial
n s feinto a new Oracle Database 12c database. The use of Oracle Data
Pump is
r e n -tra
described in the appendix titled Migrating Data by Using Oracle Data Pump.
K a There
Note: n onmay be installations to be migrated that do not support Oracle Data Pump, such
as versions before Oracle Database 10.1.0. In those cases legacy Export and Import may be
used.
The CREATE TABLE AS SELECT SQL statement can be used to copy data from one database
into a new Oracle Database 12c database. Refer to the Oracle Database SQL Language
Reference for additional information about this command.
Change in platform
Upgrade from unsupported versions
Export and import are useful in certain cases:
Changes in character set
In combination with upgrade
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a Data
You can use the Oracle
r a bPump Export and Import utilities to perform a full or partial
export from o
L
your
n s fedatabase, followed by a full or partial import into a new Oracle
r existing
r e n -tra
Database 12c database. Export/Import can copy a subset of the data, leaving the database
a non
unchanged.
K
The Export and Import method is required in certain situations.
If you want to change operating systems or hardware platforms, you cannot use the
DBUA.
In some situations, a significant effort is required to move the database to a version
where the DBUA may be used. In these cases, the export and import method may be
used.
The Export and Import method is useful in certain cases
Character set conversion may be required in some upgrade scenarios.
If there is a partial export of problem data, you can use the DBUA and import. This
method can be used to solve character set issues involving a small number of tables.
Summary
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Practice 23
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
Aula Matriz SAS
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
P
Preparing
i to
t Upgrade
U d to
t Oracle
O l Database
D t b 12c
12
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Aula Matriz SAS
Objectives
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Preparing to Upgrade
12c.
2. Determine the upgrade path.
3 Choose an upgrade method
3. method.
4. Choose an OFA-compliant Oracle home directory.
5. Prepare a backup and recovery strategy.
6. Develop a test plan to test your database, applications,
and reports. s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a upgrade
In preparation of your
r a b to Oracle Database 12c, you should become familiar with the
L or Database
features of Oracle
n s fe 12c that you want to use. The Oracle Database New Features
r e n -tra
Guide 12c Release 1 provides a comprehensive list of the new features.
Ka non
n e n
N ara le lic
Choosing an Upgrade
e n a Method
r a b
r
o the nupgrade
In many cases,
L e
sf method chosen depends on a number of factors. The size of the
n
reare and
database -thea
tr time required to perform the upgrade are two of the most important factors.
K a
There n o n
other factors (such as platform, storage, and character sets) that may limit the
choice of the upgrade method.
Testing the Upgrade
In most production environments, the cost of down time is unacceptably high. So, testing the
upgrade becomes essential. As in any testing situation, the test environment should be as
similar to the production environment as possible. You would then perform the upgrade from
preupgrade to postupgrade.
Recording Problems
It is not unusual to find problems that were not anticipated in the plan during an upgrade.
Ensure that these issues are documented, especially the solutions.
Recording Lessons Learned
In sites where there are multiple databases to be upgraded, a record of the lessons learned
through the course of upgrade testing, and the upgrades themselves can be very valuable in
reducing the time it takes to perform each upgrade.
Minimal Move all or part of an application to the new database and run
the application without enabling any new database features
Functional Perform a set of tests in which new and existing features and
functions of the system are tested after the upgrade
High Availability Perform tests to ensure that the upgraded database system
meets RTO and RPO business requirements
r a n icen
N a le l
You should develop
e n a rab set of tests to validate all stages of the upgrade process.
a planned
orshould
Your test plan
L n s fe the following types of testing:
include
reUpgrade
n ra Planning and testing the upgrade path
n -ttesting:
a no testing: Moving all or part of an application from the current database to the
K Minimal
new database and running the application without enabling any new database features.
This type of testing helps to identify any application startup or invocation problems.
Functional testing: Performing a set of tests in which new and existing features and
functions of the system are tested after the upgrade
High availability testing: Performing tests to ensure that the upgraded database
system meets Recovery Time Objective (RTO) and Recovery Point Objective (RPO)
business requirements
Integration testing: Performing tests to ensure that interactions among components of
the system is correct
Performance testing: Performing tests to compare the performance of various SQL
statements in the new database with the performance of those same statements in the
current database
d b
Volume and load stress testing for Oracle Database upgrades: Performing tests of
the entire upgraded Oracle database under high volume and loads
Performance Testing
performance tests:
Database Replay: Perform real-world testing of a database
upgrade
pg using
gap production workload before actually
y
upgrading the production database
SQL Performance Analyzer: Forecast the impact of system
changes on a SQL workload
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
Copyright 2013,
j o VOracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
Performance tests a
e n are used to
r a bcompare the performance of SQL statements in the upgraded
L orthe
database with
n s fe
performance of the same statements in the current database. Prior to
r e n -tra
upgrading your database, you should ensure that you understand the performance profile of
the
K n on in the current database.
aapplication
The following Oracle Database features can be used to conduct performance tests:
Database Replay: You can use Database Reply to perform real-world testing of your
production database workload before you upgrade the database. Database Replay
captures the database workload on the current production system and enables you to
replay it on a test system.
SQ Performance
SQL f Analyzer: Use SQL
SQ Performance
f Analyzer to forecast
f the impact off
system changes on a SQL workload. SQL statements that will be impacted by the
upgrade are identified enabling you to evaluate the impact of the upgrade.
s a
) ha
o m
SYSTEM.AUD$ SYS.AUD$ a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
If you are upgrading
e n b prior to Oracle Database Release 12.1 that uses Oracle
a from ararelease
Label Security
L fe Database Vault, you must first execute the OLS preprocess script,
or (OLS)nsand
r e n -tra to process the AUD$ table. The OLS preprocess script moves the
olspreupgrade.sql,
a table
AUD$
K n n the SYSTEM schema to the SYS schema.
ofrom
To use the OLS preprocess script, copy
ORACLE_HOME/rdbms/admin/olspreupgrade.sql from the newly installed Oracle home
to the Oracle home of the database to be upgraded.
It is recommended that you archive your audit trail before executing the
olspreupgrade.sql script. Refer to the Oracle Database Security Guide for detailed
i f
information
ti about
b t archiving
hi i ththe audit
dit ttrail.
il
r a n icen
Na (OWB) l e l
Oracle WarehouseaBuilder
e n r a b is not installed as part of Oracle Database 12c, and OWB
componentsothat
L n fe in earlier releases are not upgraded as part of the Oracle
r maysexist
r e n -tra
Database upgrade process. However, you can use OWB release 11.2.0.3 with Oracle
a n12c.
Database
K o n You cannot use OWB releases earlier than release 11.2.0.3 with Oracle
Database 12c.
You can use OWB release 11.2.0.3 with Oracle Database 12c as follows:
Add Oracle Database 12c access to an existing standalone OWB 11.2.0.3 installation:
Oracle provides a patch update that enables OWB 11.2.0.3 to be used with Oracle
Database 12c.
Keep the existing OWB O 11.2.0.3 installation in-place with Oracle
O Database Release
11.2.0.3: If OWB release 11.2.0.3 is running on a platform where a standalone
installation is not available, you will need to keep the Oracle Database release 11.2.0.3
software in-place after the migration to Oracle Database 12c so that you can run OWB
from this Oracle home.
Use the standalone OWB 11.2.0.3 installation: If OWB 11.2.0.3 is running on a platform
where a standalone installation is available ((on Linux and Windows), ), you
y can install the
standalone software and then remove the Oracle Database release 11.2.0.3 software.
RUN
{
ALLOCATE CHANNEL chan
chan_name
name TYPE DISK;
BACKUP DATABASE FORMAT 'some_backup_directory%U' TAG
before_upgrade;
BACKUP CURRENT CONTROLFILE FORMAT 'controlfile location
and name';
}
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a rabInformation Tool, it is recommended that you back up the
After running the Pre-Upgrade
database. To
L orminimizes e
fdowntime, you may perform an online backup.
n
a ren on-tra
K n
Summary
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Practice 24
Script
24-2: Implementing the Pre-Upgrade Information Tool
Recommendations
24-3: Completing Prerequisites Steps Before the Upgrade
24-4: Performing a Full Database Backup
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
U
Upgrading
di to
t Oracle
O l Database
D t b 12c
12
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Aula Matriz SAS
Objectives
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
The DBUA guides a
e n you through
r a b the upgrade process and configures a database for the new
L r automates
release. TheoDBUA
n s fe the upgrade process and makes appropriate
r e n -tra
recommendations for configuration options, such as tablespaces and redo logs.
K a DBUA
The n n supports a silent mode of operation. Silent mode enables you to use a single
oalso
statement for the upgrade.
n e n
N ara le lic
Before starting the a
e n r a b
upgrade process, it is strongly recommended that you back up your
L or although
existing database,
n s fe the DBUA can perform a backup during the preupgrade stage.
If you
a r euse n - tra to back up your database, it creates a copy of all your database files in
n the DBUA
K o that you specify. The DBUA automatically performs this cold backup after it shuts
the directory
n
down the database and before it begins performing the upgrade procedure. However, the cold
backup does not compress your database files and the backup directory must be a valid file
system path. In addition, the DBUA creates a batch file in the specified directory. You can use
this batch file to restore the database files if needed.
During the upgrade, the DBUA automatically modifies or creates new required tablespaces
andd iinvokes
k ththe appropriate
i t upgrade
d scripts.
i t Whil
While th
the upgrade
d iis running,
i th
the DBUA shows
h
the upgrade progress for each component. It then creates new configuration files (parameter
and listener files) in the new Oracle home. The DBUA provides a comprehensive summary of
the preupgrade checks when finished.
n
ra lic e n
N a e
lautomatically
During the upgrade,
e n a the DBUA
r a b modifies or creates a new init.ora and server
L or(SPFILE)
parameter file
n s fein the new Oracle home directory. In addition, it updates the network
r e n -tra the required tablespaces, and invokes the appropriate upgrade scripts.
configurations, creates
While
K o n is running, the DBUA shows the upgrade progress for each component.
a thenupgrade
The DBUA writes detailed trace and log files in
$ORACLE_BASE/cfgtoollogs/dbua/<sid>/upgradeNN and produces a complete
HTML report for later reference.
n e n
N ara le lic
e n a preupgrade
After completing the
r a b steps, the DBUA automatically archives redo logs and
L or during
disables archiving
n s fethe upgrade phase.
a r - tra the DBUA automatically locks the new user accounts in the upgraded
en nsecurity,
To enhance
K no
database.
The DBUA is fully compliant with the Oracle RAC environments. In RAC environments, the
DBUA upgrades all the database and configuration files on all nodes in the cluster.
(preupgrd.sql).
2. Back up the source database.
3
3. Prepare the new Oracle home
home.
4. Log in to SQL*Plus and shut down the database instance.
5. Log in to SQL*Plus in the Oracle Database 12c home and
execute the STARTUP UPGRADE command.
6. Execute the Parallel Upgrade Utility (catctl.pl). s a
)ha
7. Restart the database instance. m
i l co
8. Execute the Post Upgrade Status Tool (utlu121s.sql).
o t ma uide
9. Execute additional scripts (catuppst.sql @ h andnt G
utlrp.sql). r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
As an alternative toausing DBUA,
e n r a b you can manually upgrade to Oracle Database 12c by
L or following
performing the
n s festeps:
1. e
a r Run n - trapg Information Tool byy executingg the ppreupgrd.sql
n the Preupgrade pg q script p in
no This script analyzes your database and generates scripts that you can use to
K SQL*Plus.
fix problems. You must execute this script prior to running the Parallel Upgrade Utility or
the catctl.pl upgrade script will terminate with errors.
2. Back up your database by using Recovery Manager (RMAN).
3. Prepare the new Oracle home by copying configuration files and modifying the
initialization parameter file.
4. Log in to SQL*Plus and shut down the database instance.
5. Set the environment variables for the Oracle Database 12c Oracle home and log in to
SQL*Plus. Execute the STARTUP UPGRADE command. The UPGRADE keyword enables
you to open the database before it is upgraded. The command also causes logons to be
restricted to only AS SYSDBA sessions, disables system triggers, and performs
additional operations that prepare the environment for the upgrade.
6 At the operating system prompt
6. prompt, run the Parallel Upgrade Utility by executing the
catctl.pl script from the new Oracle home. This utility provides parallel upgrade
options that reduce downtime. The script can also be executed in serial mode.
7. Log in to SQL*Plus again and restart the database instance. You must restart the instance
because the catctl.pl script shut down the instance.
8. Run the Post-Upgrade Status Tool by executing the utlu121s.sql script. The script
provides a summary
p y of the upgrade
pg operation.
p
9. Execute the catuppst.sql script to perform additional upgrade operations. This script is
run at this time because it does not require the database to be in UPGRADE mode.
Execute the utlrp.sql script to recompile PL/SQL and Java code.
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
exp/expdp
B2) Use 11g expdp / 12c impdp Datafiles Control Redo log
or files files
s a
ORCL 12h
)12ca
Use 9i or 10g exp / 12c imp m
co A1
i l
ma uide
exp/expdp
or t
Replication between non-CDB
B2 Datafiles
o
Control
h nt G Redo log
@ files
na tudeORCL 9i, 10g, 11g
files
and PDB r e
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a tormigrate
There are two methods
a b a non-CDB 11g database to a CDB.
The first method
L fe of two steps:
or "A",nsconsists
A1)
a
n -the
reUpgrade n tra11g database (or any other previous Oracle Database release) to 12c non- non
K CDB n o
A2) Plug the 12c non-CDB into a CDB. Use the DBMS_PDB.DESCRIBE procedure to
generate the XML file to plug the data files into the CDB as a new PDB. This is the
fastest solution.
The second method, "B", consists of two steps:
B1) Pre-create
Pre create a PDB in the CDB from the seed PDB.
PDB This operation establishes an Oracle
Database 12c dictionary in the newly created PDB.
B2) Use Data Pump Export and Import (or the original Export and Import) or replication to
load the 9i, 10g, and 11g data into the newly created PDB of the CDB.
r a n icen
N a le l
e n a methods
There are three possible
r a b to plug a non-CDB database into a CDB.
or nis sused,
WhicheverLmethod fe the non-CDB must be in a transactionally consistent state and
opened
a n -tra mode.
renin orestricted
K n
It is appropriate to use Oracle Data Pump when:
Both source and target databases are different endian.
The source character set is not equal to the target character set , and is not a binary
subset of the target.
Either use transportable tablespace (TTS), full conventional export / import, or full
transportable database (TDB) provided that any user-defined object resides in a single user-
defined tablespace. A Data Pump full transportable database does not support movement of
XDB or AWR repositories. Only user-generated XML schemas are moved.
In other cases, using the DBMS_PDB package is the easiest option. The DBMS_PDB package
constructs an XML file describing the non-CDB data files to plug into the CDB as a PDB. This
method requires that the non-CDB is an Oracle 12c database.
If the DBMS_PDB p packageg is not used, export/import
p p is usuallyy simpler
p than using g GoldenGate
replication, but export/import might require more down time during the switch from the non-
CDB to the PDB.
Summary
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Practice 25
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
P f
Performing
i Post-Upgrade
P tU d TTasks
k
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Aula Matriz SAS
Objectives
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
n e n
N ara le lic
After you upgrade to
e n a Oracle
r a b
Database 12c and before you can consider the database
operational,oyou fe
r mustscomplete some postupgrade tasks. The tasks you need to complete
dependnonLwhether r a n
you performed a manual upgrade or used DBUA, and also on your
r e - t
a nonand use of features. Some common tasks include the following:
configuration
K
Updating the environment variables following a manual upgrade: On Linux and UNIX
operating systems, ensure that the ORACLE_HOME and PATH environment variables
point to the new Oracle home.
Updating the oratab file and client scripts with the new Oracle home: DBUA
automatically points oratab to the new Oracle home. Regardless of the upgrade
method you must check client scripts
scripts.
Upgrading the RMAN Recovery Catalog: If the recovery catalog schema version is older
than what is required by the RMAN client, you must upgrade it.
Configuring the FTP and HTTP ports, and HTTP authentication for Oracle XML DB: The
Oracle Database 12c DBCA does not configure ports for Oracle XML DB so you must
manually configure them. You should also configure digest authentication for HTTP to
take advantageg of improved security
y features.
Enabling Database Vault: Register Database Vault by using the
DVSYS.DBMS_MACADM.ENABLE_DV procedure.
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
You should consider
e n r a b
a the recommended tasks that are listed in the slide depending on the
release youo
L
have
n s fe from and your use of various features. Additional information about
r migrated
r e n -tra
each task follows and more detail can be found in the Oracle Database Upgrade Guide 12c
Release
K n
a n1 o(12.1):
Reset passwords to enforce case-sensitivity: To take advantage of enforced case-
sensitive passwords for releases earlier than 11.1.0.7, you must reset the passwords of
existing users during the database upgrade. procedure. You can execute the
DBMS_VERIFIER.EXPIRE_ACCOUNTS_WITHOUT_LATEST_VERIFIER procedure that
forces users whose accounts do not yet have the latest verifier to change their
passwords the next time they log in.
Set threshold values for tablespace alerts: In an upgraded Oracle Database 12c
database, Tablespace Alerts are disabled (the thresholds are set to null). Tablespaces
in the database that are candidates for monitoring must be identified and the appropriate
threshold values must be set. The default threshold values for a newly created Oracle
Database 12c database are:
- 85% full warning
- 97% full critical
Implement new features: Refer to the Oracle Database New Features Guide for a
description of the new features in Oracle Database 12c. Attend the Oracle Database 12c:
New Features for Administrators course to learn more about the new features.
Migrate
g to unified auditing:
g Oracle Database 12c includes a new feature called the unified
audit trail. With unified auditing, all Oracle Database audit trails (SYS.AUD$ for the
database audit trail, SYS.FGA_LOG$ for fine-grained auditing, DVSYS.AUDIT_TRAIL$ for
Database Vault, and so on) are consolidated into one single audit trail. Additional
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
n e n
N ara le lic
e n a 12c,
Prior to Oracle Database
r a baudit records from various sources were stored in different
L or table.
locations. Oracle fe 12c supports unified auditing, in which all audit records are stored
Database
n s
a r en n-tra
in a single audit
K
When you n ocreate a new Oracle Database 12c database, mixed mode auditing is enabled.
This mode enables you to use the auditing features available before Oracle Database 12c
and also the unified auditing features. Mixed mode auditing is enabled by default through the
ORA_SECURECONFIG predefined auditing policy for newly created databases.
If you are upgrading a database to Oracle Database 12c, you must manually migrate to
unified auditing to use the unified auditing features.
Oracle Corporation recommends that you migrate to unified auditing.
n e n
N ara le lic
e n r b executable, shut down the database instance and the
Before enabling theaunified auditing
a
listener.
L or nsfe
a rentoothe
Change
n tra HOME/rdbms/lib directory and execute the following command:
-$ORACLE_HOME/rdbms/lib
$ORACLE
K
make fn ins_rdbms.mk uniaud_on ioracle ORACLE_HOME=$ORACLE_HOME
The make command is used to relink the Oracle executable with a different set of libraries to
enable unified auditing.
After the make command completes, restart the listener and the database instance.
You can log in to SQL*Plus and verify that unified auditing has been enabled as follows:
SQL> select value
2 from v$option
3 where parameter = 'Unified Auditing';
VALUE
----------------------------------------------------------------
TRUE
auditing tasks:
AUDIT_ADMIN enables the user to:
Create unified and fine-grained
fine grained audit policies
Execute the AUDIT and NOAUDIT SQL statements
View audit data
Manage the audit trail (table in the AUDSYS schema)
AUDIT_VIEWER enables the user to: a
a s
View
Vi and d analyzel audit
dit ddatat
m )h
i l co
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
Users must be granted
e n b
a theraappropriate privilege to configure auditing and view audit data. To
or ofnsduty,
support separation
L fe two default roles are provided:
e
a
n _ADMIN:
r AUDIT n - tra Enables the ggrantee to configure g auditing g settings,g , create and
no audit policies (unified and fine-grained), and view and analyze audit data.
K administer
This role is typically granted to a security administrator.
AUDIT_VIEWER: Enables the grantee to view and analyze audit data. This role is
typically granted to external auditors.
Summary
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Practice 26
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
U i
Using D
Database
t b Resource
R Manager
M
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Aula Matriz SAS
Objectives
following:
Configure the Database Resource Manager
Access and create resource plans
Create consumer groups
Specify directives for allocating resources to consumer
groups
Map consumer groups to plans s a
) ha
Activate a resource plan o m
Monitor the Resource Manager a ilc e
m id ot t Gu
@ enh
n a
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Database
Resource Manager
More resources
OLTP users
s a
)ha
DSS users Fewer resources m
i l co
Batch users o t ma uide
Least resources a@
h nt OracleG
r e n tude database
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n
ra lic e n
N a le Manager (also called the Resource Manager), you have
By using the Database
n a Resource
a b
L o f er of machine resources than is normally possible through
re thesallocation
more control over
operating
n system t r n
aresource management alone. If resource management decisions are made
reoperating-
non overhead resulting from operating system context switching of Oracle
b ath
by the ti system,
t it can llead
d tto problems
bl such h as:
K Excessive
Database server processes when the number of server processes is high
Suspension of a database server process that is holding a latch
Unequal distribution of resources among all Oracle Database processes, and an inability
to prioritize one task over another
Inabilityy to manage g database-specific
p resources,, such as parallel
p execution servers and
active sessions
The Database Resource Manager controls the distribution of resources among various
sessions by controlling the execution schedule inside the database. By controlling which
sessions run and for how long, the Database Resource Manager can ensure that resource
distribution matches the plan directive and, therefore, the business objectives. With the
Database Resource Manager, you can guarantee groups of users a minimum amount of
processing
p g resources regardless
g of the load on the system
y and the number of users.
The DBMS_RESOURCE_MANAGER_PRIVS package contains the procedures to grant and
revoke the ADMINISTER_RESOURCE_MANAGER system privilege, which is a prerequisite for
invoking the Resource Manager.
Resource
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
n e n
N ara le lic
e n a Manager
The Database Resource
r a b provides several means of allocating resources:
CPU Method:
L s fe you to specify how CPU resources are allocated among
or nEnables
consumer
n raoups aandd subp
n su e-tggroups
reco subplans
a s
a no of Parallelism Limit: Enables you to control the maximum degree of
K Degree
parallelism for any operation within a consumer group
Active Session Pool with Queuing: Allows you to limit the number of concurrent active
sessions for a consumer group or subplan. If a group exceeds the maximum allowed
number of sessions, new sessions are placed in a queue where they wait for an active
session to complete. You can also specify a time limit on how long a session will wait
b f
before exiting
iti with
ith an error.
Undo Pool: Enables you to control the total amount of undo that can be generated by a
consumer group or subplan. Whenever the total undo space exceeds the amount
specified by UNDO_POOL, no further INSERT, UPDATE, or DELETE commands are
allowed until undo space is freed by another session in the same group or the undo pool
is increased for the consumer group. If the consumer groups quota is exceeded during
the execution of a DML statement, the operation aborts and returns an error. Queries
are still allowed, even if a consumer group has exceeded its undo threshold.
Execution Time Limit: Allows you to specify a maximum execution time allowed for an
operation. The Oracle Database server uses cost-based optimizer statistics to estimate
how long an operation will take. If it is longer than the maximum time allowed
(MAX_EST_EXEC_TIME), the operation returns an error and is not started. If a resource
consumer group has more than one plan directive with MAX_EST_EXEC_TIME specified,
the Resource Manager chooses the most restrictive of all incoming values.
Idle Time Limit: Enables you to specify an amount of time for which a session can be idle,
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
after which it will be terminated (MAX_IDLE_TIME). You can further restrict the Resource
Manager to terminate only those sessions that are blocking other sessions
(MAX_IDLE_TIME_BLOCKER).
Consumer Group Switching: Specifies conditions that will cause a session to switch
consumer groups. Typically, overuse of a resource is specified and a session is switched
to a more restrictive consumer group. The session remains in the switched consumer
group until it becomes idle, or if directed after the top-level call is completed. Then it will
return to the initial consumer group. The initial consumer group is the group that a session
is assigned to at login. The top is the current PL/SQL block or each SQL statement that is
issued outside a PL/SQL block by the client. You can create a plan directive, so that the
s a
ha
Resource Manager automatically switches the user back to the initial consumer group at
)
the end of the top call. o m
a ilc e
Database Consolidation: The Resource Manager enables you to optimize resource
h otm t Guid
allocation among concurrent database sessions. Database consolidation requires that
a @ en
applications are isolated from each other. If one application experiences an increase in
n
l o re Stud
workload, that increase should not affect other applications. In addition, the performance
n v his
of each application should be consistent. Good candidate applications for database
(
a s se t
consolidation are automated maintenance tasks because currently, these applications can
g
ille e to u
take up to 100% of the server CPU resources.
V
r a njo icens
Server Consolidation: Because many test, development and small production databases
a le l
are unable to fully utilize the servers that they are on, server consolidation provides a
N
r e na ferab
possible alternative. With server consolidation, resources are more fully utilized by running
Lo rans
multiple database instances on the server. The method for managing CPU allocations on a
n
multi-CPU server with multiple p database instances is called Instance Caging.g g Because
a re on-t
K Instance Caging is simple to configure and does not require any new software to be
n
licensed or installed, it is an excellent alternative to other server consolidation tools, such
as virtualization and O/S workload managers.
You can access resource plans with the graphical interface of Enterprise Manager Cloud
Control or the command line of the DBMS_RESOURCE_MANAGER package.
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a rabtasks rely on the Resource Manager being enabled during the
The automated maintenance
maintenance
L r
owindows. s e a maintenance window opens, the
fWhen
n -tra n
DEFAULT_MAINTENANCE_PLAN resource manager plan is automatically set to control the
r e
a ofnoCPU
amount n used by automated maintenance tasks. To be able to give different priorities
K
to each possible task during a maintenance window, various consumer groups are assigned
to DEFAULT_MAINTENANCE_PLAN.
Default Plan
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n
ra lic e n
N a e is one of the default plans provided for you. It contains
lplan
The DEFAULT_PLAN
n a resource
a b
re following
directives forothe
L s f erprovided consumer groups:
n _GROUP: t r n initial consumer ggroupp for the SYS and SYSTEM users
aThe
r e
SYS
-
non
Ka OTHER_GROUPS: Used for all sessions that belong to consumer groups that are not part
of the active resource plan. There must be a plan directive for OTHER_GROUPS in any
active plan.
ORA$AUTOTASK: A group with lower priority than SYS_GROUP and OTHER_GROUPS in
this plan
The initial consumer g group of a user is the consumer g group to which any
y session created byy
that user initially belongs. If you have not set the initial consumer group for a user, the users
initial consumer group will automatically be DEFAULT_CONSUMER_GROUP.
The DEFAULT_PLAN and associated resource consumer groups can be used or not used. It
can be a template for new resource plans; it can be modified or deleted. Use it as appropriate
for your environment.
n e n
N ara le lic
e n a resource
You can create a simple
r a b plan by using the
r
Loallocate fe
DBMS_RESOURCE_MANAGER.CREATE_SIMPLE_PLAN
n s procedure. You can create consumer
groupsn
r e and
- t r a resources to them by using this single procedure.
K
The
non
a CREATE_SIMPLE_PLAN procedure accepts the following arguments:
SIMPLE_PLAN: Name of the plan
CONSUMER_GROUP1 (through CONSUMER_GROUP8): Consumer group name(s)
GROUP1_PERCENT (through GROUP8_PERCENT): CPU resource allocated to the
group(s)
The plan uses the default CPU allocation policy (EMPHASIS). Each consumer group uses the
default scheduling policy (ROUND_ROBIN).
The consumer groups specified in the plan are allocated CPU percentage at level 2 as shown
in the table in the slide. The plan also includes the SYS_GROUP consumer group and the
OTHER_GROUPS consumer group. As shown in the table in the slide, SYSGROUP is allocated
100% of the CPU at level 1 and OTHER_GROUPS is allocated 100% of the CPU at level 3.
n e n
N ara le lic
You can perform the
e n a following
r a bsteps by using the named procedures in the
or nsfe package or by using Enterprise Manager Cloud Control.
DBMS_RESOURCE_MANAGER
L
a r CCreate
1. e
n trad g aarea:
neate a-pending
pe ea To o ccreate
eate a newe resource
esou ce p plan,
a ,o or update o or de
delete
ete a
an e
existing
st g
no plan, you must create a pending area. The pending area is a staging area
K resource
where you can create and modify plans without affecting executing applications. After
you create the pending area, the Oracle Database server copies existing plans into it so
they can be updated if required. Create a pending area by using the
CREATE_PENDING_AREA procedure.
2. Create, modify, or delete consumer groups: Create a resource consumer group and
specify a resource allocation method (ROUND
(ROUND-ROBIN
ROBIN or RUN-TO-COMPLETION)
RUN TO COMPLETION) for
distributing CPU among the sessions in the consumer group. Use the
CREATE_CONSUMER_GROUP procedure.
3. Map sessions to consumer groups: Use the SET_CONSUMER_GROUP_MAPPING
procedure to map a session attribute type and attribute value to a consumer group. The
session attribute types include Oracle Database username, database service name,
operating system username, client program name, and module name. Refer to the
O
Oracle Database Administrators Guide
G f a complete list off accepted session
for
attributes.
Note: Unassigned sessions are part of the OTHER_GROUPS consumer group.
4. Create the resource plan: When you create the resource plan, you provide a name and
optionally specify the resource allocation method for CPU (EMPHASIS or RATIO), active
session pool resource allocation method (ACTIVE_SESS_POOL_ABSOLUTE), resource
allocation method for degree of parallelism (PARALLEL_DEGREE_LIMIT_ABSOLUTE),
and queuing resource allocation method (FIFO_TIMEOUT). Use CREATE_PLAN to create
a resource plan. Additional information follows in this lesson.
5. Create resource plan directives: Resources are allocated to consumer groups based on
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
the resource plan directives. Through resource plan directives, you can specify:
- The maximum number of concurrently active sessions for a consumer group
- A limit on the degree of parallelism for any operation
- The time (in CPU seconds) that a call can execute before an action is taken
- A maximum in kilobytes (K) on the total amount of undo for uncommitted
transactions that can be generated by a consumer group
Use CREATE_PLAN_DIRECTIVE to specify resource plan directives.
6. Validate the pending area: Use the VALIDATE_PENDING_AREA procedure to validate the
pending area at any time. The validate procedure checks for the following: s a
) ha
- Plans do not contain loops
o m
ilc e
- All plans and resource consumer groups referred to by plan directives exist
a
otm t Guid
- All plans have plan directives that point to either plans or resource consumer groups
h
a @ en
- All percentages in any given level do not add up to greater than 100
n
l o re Stud
- A plan that is currently being used as a top plan by an active instance is not being
( n v his
deleted
g a s se t
consumer groups V ille e to u
- That certain parameters appear only in plan directives that refer to resource
r a njo icens
- No more than 28 resource consumer groups appear in any active plan
N a le l
r e na ferab
- Plans and resource consumer groups do not have the same name
n Lo rans
- A plan directive for OTHER_GROUPS appears somewhere in any active plan
7 re
7.
a o n -t pending area: After validating the pending area
Submit the area, submit it by using
K SUBMIT_PENDING_AREA.
n When you submit the pending area, new and updated plan
information is stored in the data dictionary. New plans are not activated when the pending
area is submitted. Modified plans are reactivated with their new plan definition.
s a
) h a
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a Cloud
In Enterprise Manager
r a bControl, there are several property pages that you can use to
L r
specify planodirectives:
n s fe
1. e n the Getreaa page, assoc
a r OOn t e General
n - associate
ate coconsumer
su e g groups
oups with t p plans
a sa and d spec
specifyy how
o much
uc
K CPU noeach consumer group or subplan is allocated.
2. On the Parallelism page, specify a limit on the degree of parallelism for any operation
issued by this consumer group, a limit on the total number of parallel server processes
that can be used by all sessions in this consumer group, and the maximum time a
parallel statement can be queued.
3. On the Thresholds page, specify the time duration or the resource limits under which a
sessioni can executet iin a consumer group.
4. On the Idle Time page, specify an amount of time that a session can be idle, after which
it will be terminated. You can further restrict such termination to only those sessions that
are blocking other sessions.
_ _
PARALLEL_DEGREE_LIMIT_MTH: _ _ _ _
PARALLEL_DEGREE_LIMIT_ABSOLUTE
Limiting degree of parallelism of
any operation
ACTIVE_SESS_POOL_MTH: ACTIVE_SESS_POOL_ABSOLUTE
Limiting number of active
sessions, queuing inactive ones
s a
QUEUING_MTH:
_ Controlling
g FIFO_TIMEOUT
_
)ha
queues, how inactive sessions m
co
enter active session pool i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
Resource allocation
e n amethodsr a bdetermine how the Resource Manager allocates a particular
L s e
a rresource fconsumer
resource to o group or resource plan. You specify values for the following
resourcen -tra
allocation nmethods when creating the resource plan.
r e
a arenotwon ways of specifying the CPU distribution with the MGMT_MTH parameter when
K
There
you create a resource plan:
EMPHASIS is the default method for single-level plans. It is also used for multilevel plans
that use percentages to specify how CPU is distributed among consumer groups.
RATIO is for single-level plans that use ratios to specify how CPU is distributed.
PARALLEL_DEGREE_LIMIT_MTH limits the maximum degree g of p
parallelism of any
y operation.
p
This method can be specified only for resource consumer groups, not subplans. The
PARALLEL_DEGREE_LIMIT_ABSOLUTE method is the only possible value, specifying how
many processes may be assigned to an operation. If there are multiple plan directives
referring to the same subplan or consumer group, the minimum of all the possible values is
used as the parallel degree limit for that subplan or consumer group.
The ACTIVE_SESS_POOL_MTH parameter limits the number of active sessions. All other
sessions are inactive and wait in a queue to be activated
activated. The only value (the only available
method) for this parameter is ACTIVE_SESS_POOL_ABSOLUTE, which is its default value.
QUEUING_MTH controls the order in which queued inactive sessions execute.
FIFO_TIMEOUT is the default and only method available.
Oracle Database 12c: Admin, Install and Upgrade Accelerated A - 13
Aula Matriz SAS
EMPHASIS RATIO
The value specifies the maximum The value specifies a number that indicates
percentage
p g of CPU resources a the ratio of CPU resources to be allocated to
consumer group can use. the consumer group.
You can allocate resources for up to You can specify values for only one level.
eight different levels.
The sum of percentages at any given You must use integer values, but there is no
level must be less than or equal to 100. limit on the sum of values.
s a
D f lt value
Default l iis NULL. D f lt value
Default l iis NULL. )ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n
ra lic e n
N a le
The CPU allocationamethod EMPHASIS
e n r a b determines how much emphasis is given to sessions
Lo1r having
in different consumer
n fe in a resource plan. CPU usage is assigned levels from 1 through
groups
s
8, with n
r e Level
- t r a the highest priority. Percentages specify how to allocate CPU to each
a nogroup
consumer
K n at each level.
The following rules apply for the EMPHASIS resource allocation method:
CPU resources are distributed at a given level on the basis of the specified percentages.
The percentage of CPU specified for a resource consumer group is a maximum for how
much that consumer group can use at a given level.
Consumer resources that are not used at a given level are made available to consumer
groups at the next level. For example, iff the consumer groups at Level 1 use only 60% %
of the available resources, the additional 40% is made available to consumer groups at
Level 2.
The sum of percentages at any given level must be less than or equal to 100.
Any levels that have no plan directives explicitly specified have a default of 0% for all
subplans or consumer groups.
The EMPHASIS resource allocation method avoids starvation problems
problems, where
consumers with lower priorities are not given the opportunity to run.
BATCH_USERS: 2
OTHER: 1
This is similar to saying that OLTP users should get 40% of the resources, DSS users should
get 30%
g % of the resources,, BATCH users should g get 20%% of the resources,, and all other
consumer groups should get 10% of the available resources.
If there are no consumers in the OTHER or DSS_USERS consumer groups currently utilizing CPU
resources, the OLTP_USERS consumer group would get two-thirds (4 shares out of 6 shares) of
the available resources and the BATCH_USERS consumer group would get the other third (2
shares out of 6). If all groups had sessions running, the division would be based on 10 shares.
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
r a n icen
N a le l
e n a Pool
Using the Active Session
r a bfeature, you can control the maximum number of concurrently
active sessions
s fe consumer group. With this functionality, a DBA can indirectly
or perofnresource
theLamount
control n r a resources that any resource consumer group uses because resource
r e - t
a nonis proportional to the number of active sessions. Using an active session pool
consumption
K
can help to reduce the number of servers taking resources in the system, thus avoiding
inefficient paging, swapping, and other resource depletion (such as memory) resulting from
attempting to run too many jobs simultaneously.
After the Active Session Pool is filled with active sessions, the Resource Manager queues all
subsequent sessions attempting to become active until other active sessions complete or
become inactive
inactive. An active session is one currently involved in a transaction
transaction, query
query, or
parallel operation. Individual parallel slaves are not counted as sessions; the entire parallel
operation counts as one active session.
There is only one queue per resource consumer group and the queuing method is first in, first
out (FIFO) with a timeout. The queue is implemented as a memory structure and cannot be
queried directly.
Specifying Thresholds
n e n
N ara le lic
You can define theamaximumbestimated execution time any operation can take at any given
time by settingre
n feraplan directives MAX_EST_EXEC_TIME parameter.
the resource
o
L pa nsete iss set, the
e n e tthisstparameter
When
r specific - r aa t e Database
atabase Resource
esou ce Manager a age est estimates
ates tthe
e ttime
ea
K a n
no job will take, which is calculated using the statistics from the cost-based optimizer.
If a resource consumer group has more than one plan directive referring to it, it may
have more than one MAX_EST_EXEC_TIME. The Database Resource Manager then
chooses the most restrictive of all incoming values.
If the operations estimate is more than MAX_EST_EXEC_TIME, the operation does not
start and the ORA-07455 error is issued. This eliminates any exceptionally large jobs
th t would
that ld utilize
tili ttoo many system
t resources.
The SWITCH_IO_MEGABYTES directive specifies the amount of I/O (in MB) that a session
can issue before an action is taken. The default is NULL, which means unlimited.
The SWITCH_IO_REQS directive specifies the number of I/O requests that a session can
issue before an action is taken. The default is NULL, which means unlimited.
The SWITCH_FOR_CALL directive specifies that if an action is taken because of the
SWITCH IO MEGABYTES or SWITCH_IO_REQS
SWITCH TIME SWITCH_IO_MEGABYTES,
SWITCH_TIME, SWITCH IO REQS parameters,
parameters the
consumer group is restored to its original consumer group at the end of the top call.
Default is FALSE, which means that the original consumer group is not restored at the
end of the top call.
Oracle Database 12c: Admin, Install and Upgrade Accelerated A - 17
Aula Matriz SAS
This functionality is mostly beneficial for three-tier applications where the middle-tier server
implements session pooling. In this case, the middle tier tends to do one call for an end user
and then use the same session for a call for a different end user. Therefore, the boundaries of
work are really calls, and the actions of a prior end user should not affect the next end user.
Note: You cannot specify both the SWITCH_TIME_IN_CALL and SWITCH_TIME parameters
within the same directive. The SWITCH_TIME parameter is primarily intended for client/server
applications, whereas the SWITCH_TIME_IN_CALL parameter is for three-tier applications.
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
DBMS_RESOURCE_MANAGER.UPDATE_PLAN_DIRECTIVE
(PLAN => 'DAY
DAY_PLAN
PLAN',
,
GROUP_OR_SUBPLAN => 'APPUSER',
COMMENT => 'Limit Idle Time Example',
NEW_MAX_IDLE_TIME => 600,
NEW_MAX_IDLE_BLOCKER_TIME => 300);
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a Cloud
In Enterprise Manager
r a bControl, use the Idle Time tab to set the maximum idle timeouts
L orrespective
for a resource feIdle Time (sec) and Max Idle Time if Blocking Another Session
plan. Max
n s
r e n -tra equivalents of the NEW_MAX_IDLE_TIME and NEW_
(sec) are the
a non
MAX_IDLE_BLOCKER_TIME
K resource directives in the
DBMS_RESOURCE_MANAGER.UPDATE_PLAN_DIRECTIVE procedure. They are both
specified in seconds.
NEW_MAX_IDLE_TIME specifies the time that a session is neither executing nor waiting for
I/O. When the session exceeds the specified limit, the PMON process forcibly kills the session
and cleans up its state. In addition to limiting the maximum idle time for a session, you can
also limit the amount of time that an idle session can block another session.
session You impose this
limit by setting the NEW_MAX_IDLE_BLOCKER_TIME resource directive to the number of
seconds to allow a session to be idle while blocking another session. You can also specify a
value of UNLIMITED to indicate that no maximum time has been set. The default is NULL,
which means unlimited. These settings give you a more granular control than profiles, whose
single value cannot distinguish between blocking and nonblocking sessions.
In the slide example, the PMON process kills sessions that are idle for longer than 600
seconds.
d ThThe PMON process alsol kill
kills sessions
i that
th t are idle
idl ffor more than
th 300 secondsd and d
are blocking other sessions. PMON checks these limits once every minute and if it finds a
session that has exceeded one of the limits, it forcibly kills the session and cleans up all its
resources.
Oracle Database 12c: Admin, Install and Upgrade Accelerated A - 19
Aula Matriz SAS
n e n
N ara le lic
e n a sessions:
For concurrent database
r a b Database consolidation requires that applications are
isolated from r other.
oeach s feIf one application experiences an increase in workload, that increase
should nnotLaffectrother
a n applications. In addition, the performance of each application should
r e - t
K n on
beaconsistent.
Fixed Policy CPU Resource Management
The MAX_UTILIZATION_LIMIT attribute of resource plan directives enables you to impose
an absolute upper limit on CPU utilization for a resource consumer group. This absolute limit
overrides any redistribution of CPU within a plan.
Note: Good candidate applications for database consolidation are automated maintenance
tasks because currently these applications can take up to 100% of the server CPU resources.
You can set a maximum limit for each auto-task consumer group.
a
EXEC DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE( -
plan => 'db consolidation plan' ) h
> 'db_consolidation_plan',
as
group_or_subplan => 'App_1',
i l com
mgmt_p1 => 50,
t m a ide
max_utilization_limit => 60); h o Gu @ n t
a e
l o ren Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n
ra lic e n
N a le directive limits the CPU consumption of an application. You
a
The MAX_UTILIZATION_LIMIT
n a b
ore and
can set minimum
L f er boundaries, as shown in the slide.
maximum
s
e n example
TherPL/SQL - t r an in the slide specifies a minimum value percentage (50%) for the CPU
K
allocation on at level 1 for the APP_1 consumer group. This example also specifies an
a nresource
absolute maximum CPU utilization percentage (60%) permitted for that same consumer
group. The example uses the DB_CONSOLIDATION_PLAN plan.
Similar commands can be executed for each consumer group shown in the sample tables.
n e n
N ara le lic
Because many test,
e n r a b and small production databases are unable to fully utilize
adevelopment,
the servers o
L r they are
that
n s feon, server consolidation provides a possible alternative. With server
r e n -tra are more fully utilized by running multiple database instances on the
consolidation, resources
K a However,
server.
n o n this may bring about CPU contention and an adverse impact due to
workload surges on one instance.
Instance caging is a method that uses the CPU_COUNT initialization parameter to limit the
number of CPUs that an instance can use. In addition, the Resource Manager is employed to
allocate the CPUs for the database sessions based on the instance resource plan.
Configure instance caging in two steps, by enabling:
The Resource Manager, which limits the amount of CPU that the database instance
consumes
The CPU_COUNT parameter, which specifies the maximum (the limit), not actual amount
of CPU that the database instance can use at any time
By default, the CPU Resource Manager assumes that the database instance can use all
CPUs on a server. To enable instance caging, any resource plan with CPU directives can be
used.
used
32 16 Total number
Instance D of CPUs = 16
Instance D
24 12 Instance C
Instance C Instance B
16 Total number
8
Instance B
of CPUs = 16
s a
8 4 Instance A )ha
Instance A m
co
i l
a ide
t mhas
With all four instances active, h nt Ga u
Each instance
@
o
one instance can get dedicated
e n a numberd e of CPUs.
8 / (8 + 8 + 8 + 8) = 25% of CPU. l or is St u
(n v
a s e th
i l l us All rights reserved.
egand/ortitsoaffiliates.
j o V se
Copyright 2013, Oracle
r a n icen
Na blThis
Over-provisioningaapproach: e l approach is appropriate for noncritical databases and
o r en production
low-load, noncritical f e ra systems. Although the instances impact each others
L at any
performance, a s time, one or more of the instances may be idle or experiencing a low
ngiven
e n t r
l adr
load.
K n o n-
Although the database instances can impact each others performance, instance caging limits
their impact and helps to provide predictable performance. In the example on the left, where
all four instances have CPU_COUNT set to 8, the maximum percentage of CPU that a
database instance can consume at any point in time is its own limit divided by the sum of the
limits for all active databases. In this example, one instance will be able to consume 8 / (8 + 8
+ 8 + 8) = 25% of the CPU. If only two instances are active, one instance will be able to
consume 8 / (8 + 8) = 50% off ththe CPU
CPU.
Partitioning approach: This approach is appropriate for critical product systems. It prevents
the instances from interfering with each other and provides predictable performance.
Instance caging can partition the CPU resources by ensuring that the sum of all CPU limits
does not exceed the total number of CPUs. In the example on the right, if four database
instances share a 16-CPU server, their limits can be set to 8, 4, 2, and 2. By dedicating CPU
resources to a database instance, partitioning provides two advantages:
One database instances CPU load cannot affect anothers.
Each database instances CPU resources is fixed, leading to more predictable
performance.
Manage throttling:
s a
SELECT begin_time, consumer_group_name,
)ha
cpu_consumed_time, cpu_wait_time m
co
i l
ma uide
FROM v$rsrcmgrmetric_history
ORDER BY begin_time; o
h nt Gt
@
na tude
SELECT name, consumed_cpu_time, cpu_wait_time r e
FROM v$rsrc_consumer_group; ( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n
ra lic e n
N a le is not set, no value is returned by the first query.
If the CPU_COUNT
n a b
parameter
a
If no rows
L s fer by the second query in the slide, the Resource Manager is not
oreare nreturned
n rae CCPU.
na ag -gttthe
remanaging U If a row
o is s returned,
etu ed, itt indicates
d cates tthe e act
active epplan.
a
K a
Instancen o limits the CPU consumption of the foreground processes by throttling them. A
caging
foreground process is throttled when it is waiting on the resmgr:cpu quantum wait event.
You can monitor the amount of throttling in two ways:
The V$RSRCMGRMETRIC_HISTORY view shows the amount of CPU consumption
(CPU_CONSUMED_TIME) and throttling (CPU_WAIT_TIME) for each minute in the past
hour. Values are displayed
p y in milliseconds.
The V$RSRC_CONSUMER_GROUP view shows the amount of CPU consumption
(CPU_CONSUMED_TIME) and throttling (CPU_WAIT_TIME) since CPU Resource
Management was enabled. The time is displayed in milliseconds.
Note: For case studies, see the Oracle White Paper titled Database Instance Caging: A
Simple Approach to Server Consolidation.
SWITCH_IO_LOGICAL
SWITCH_ELAPSED_TIME
Meta consumer group called LOG_ONLY
LOG ONLY
Columns in V$SQL_MONITOR:
RM_LAST_ACTION
RM_LAST_ACTION_REASON
RM_LAST_ACTION_TIME s a
RM CONSUMER GROUP
RM_CONSUMER_GROUP )ha
m
co
V$RSRCMGRMETRIC and V$RSRCMGRMETRIC_HISTORY i l
always populated o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a queries,
To better track runaway
r a b Resource Manager included the following:
Directive
L n fe
or parameters:
s
a ren- oby tra IO LOGICAL: Number of logical I/Os that will trigger the action specified
-SWITCH_GROUP
SWITCH
SWITCH_IO_LOGICAL:
n
K n
- SWITCH_ELAPSED_TIME: Elapsed time that will trigger the action specified by
SWITCH_GROUP
LOG_ONLY meta-consumer group: This can be used as the argument for the
SWITCH_GROUP parameter to log the runaway query without changing its consumer
group or taking other action.
Resource Manager integrates the runaway query information with SQL Monitor. To
retain important results for Resource Manager, it pins up to five SQL statements per
consumer group. SQL Monitor does not purge these SQL executions until they are
unpinned. V$SQL_MONITOR columns:
- RM_LAST_ACTION: The most recent action that was taken on this SQL operation
by Resource Manager. Its value is one of the following: CANCEL_SQL,
KILL SESSION LOG_ONLY,
KILL_SESSION, LOG ONLY SWITCH TO <CG NAME>
- RM_LAST_ACTION_REASON: The reason for the most recent action that was taken
on this SQL operation by Resource Manager. Its value is one of the following:
SWITCH_CPU_TIME, SWITCH_IO_REQS, SWITCH_IO_MBS,
SWITCH_ELAPSED_TIME, SWITCH_IO_LOGICAL
- RM_LAST_ACTION_TIME: The time of the most recent action that was taken on
this SQL operation by Resource Manager
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
You can configure a
e n the Database
r a b Resource Manager to automatically assign consumer groups
to sessions oby providingfemappings between session attributes and consumer groups. Further,
L r rathensmappings
you cannprioritize so as to indicate which mapping has precedence in case of
r e
a nThere
conflicts. - t
n are two types of session attributes: login attributes and runtime attributes. The
K o
login attributes are meaningful only at session login time, when the Database Resource
Manager determines the initial consumer group of the session. In contrast, a session that has
already logged in can later be reassigned to another consumer group on the basis of its
runtime attributes.
Select Consumer Group Mappings on the Getting Started with Database Resource Manager
page of Enterprise Manager Cloud Control
Control. For each of the attributes
attributes, set up a mapping that
consists of a way to identify a session (for example, username), and a consumer group. Add
or remove rows for each of the resource consumer group categories, as required, and enter
text identifying the user, client, module, or service in the corresponding group. You can
establish a priority ordering between conflicting mappings of the attributes by using the
Priorities tab. You can set the priority from the most important to the least important by using
the navigational arrows. The mappings at the top of the list have the highest priority.
Example to give the Client OS User a higher priority than the Client Program:
BEGIN
dbms_resource_manager.clear_pending_area();
dbms_resource_manager.create_pending_area();
dbms_resource_manager.set_consumer_group_mapping(
dbms_resource_manager.oracle_user,
'SCOTT',
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
'LOW_GROUP'
);
dbms_resource_manager.set_consumer_group_mapping_pri(
EXPLICIT => 1, SERVICE_MODULE_ACTION => 2,
SERVICE_MODULE => 3,
,
MODULE_NAME_ACTION => 4,
MODULE_NAME => 5,
SERVICE_NAME => 6,
ORACLE_USER => 7,
CLIENT_OS_USER => 8,
CLIENT_PROGRAM => 9,
s a
);
CLIENT_MACHINE => 10
) ha
o m
ilc e
dbms_resource_manager.submit_pending_area();
END; a
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
s a
) ha
o m
a i lc e
otm t Guid
SQL> show parameter resource_manager_plan
VALUE a@
h
NAME TYPE
e n u d en
---------------------- ----------- -------------
v l or is St
resource_manager_plan string
s (n DEFAULT_PLAN
th
a e
us All rights reserved.
i l l egand/ortitsoaffiliates.
j o V se
Copyright 2013, Oracle
r a n icen
N ais defined
l e l
e n a rab using the RESOURCE_MANAGER_PLAN database
The plan for an instance
initializationo r
parameter.
s e parameter specifies the top plan to be used for this instance. If
fThis
no plannis L specified,
r n
a Resource Manager is not activated for the instance.
the
r e - t
K
You on deactivate, or change the current top plan by using an ALTER SYSTEM
a can nactivate,
statement. When a resource plan is changed using this command, the change takes effect
instantly.
If the parameter is set in a parameter file, and the plan specified is not defined in the
database, the database cannot be opened with that parameter file. The following error is
returned:
ORA-07452: specified resource manager plan does not exist in the
data dictionary
If this error is encountered, the parameter must be modified to show a correct value before the
instance can be restarted.
You can use the Resource Plans page of Enterprise Manager Cloud Control to manage
resource plans. To activate a plan, select the plan you want to make active, choose Activate
from the Actions drop-down list
list, and then click Go.
Go The plan you selected is then made the
current top plan for the instance.
DBA_RSRC_CONSUMER_GROUP_PRIVS Users/roles
r a n icen
N a le l
e n a rabare available to check the resource plans, consumer groups,
Several data dictionary views
r that
and plan directives
L othat s e declared in the instance. This section discusses some useful
fare
n -tra
information cannbe obtained from these views. For more detailed information about the
r e
a nofoeach
contents n of these views, refer to the Oracle Database Reference manual.
K
Use the following query to obtain information about resource plans defined in the database:
SQL> SELECT plan, num_plan_directives, status, mandatory
2 FROM dba_rsrc_plans;
PLAN NUM_PLAN_DIRECTIVES STATUS MAN
-------------- ------------------- --------- ---
DEFAULT_PLAN 3 ACTIVE NO
INTERNAL_QUIESCE 2 ACTIVE YES
INTERNAL_PLAN 1 ACTIVE YES
BUGDB_PLAN 4 ACTIVE NO
MAILDB_PLAN 3 ACTIVE NO
MYDB_PLAN 3 ACTIVE NO
A status of ACTIVE indicates that the plan has been submitted and can be used, whereas, a
status of PENDING shows that the plan has been created, but is still in the pending area.
If the MANDATORY column is assigned a value of YES, the plan cannot be deleted.
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a rManager
You can access Resource
a b statistics by selecting Performance Statistics on the
L oisrprovided
Getting Started fe Resource Manager page in Enterprise Manager Cloud Control.
with Database
n s
r e n -tra so that you can monitor the currently enabled resource plan.
Information
Ka non
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
CPU Utilization a
r e n ferab
There areLatoleast threes different views in the system that can provide you with information
n r a n
a rethe CPU
about
o n -tutilization inside the Oracle database:
K V$RSRC_CONSUMER_GROUP
n shows CPU utilization statistics on a per consumer group
basis, if you are running the Oracle Database Resource Manager. This view displays
data related to currently active resource consumer groups.
V$SYSSTAT shows the Oracle database CPU usage for all sessions. The statistic CPU
used by this session shows the aggregate CPU used by all sessions.
V$SESSTAT shows the Oracle database CPU usage per session. You can use this view
to determine which particular session is using the most CPU.
The V$RSRC_CONSUMER_GROUP view contains the following columns:
NAME: Name of the consumer group
ACTIVE_SESSIONS: Number of currently active sessions in this consumer group
EXECUTION_WAITERS: Number of active sessions waiting for a time slice
REQUESTS: Cumulative number of requests executed in this consumer group
CPU_WAIT_TIME: Cumulative amount of time that sessions waited for CPU
CONSUMED_CPU_TIME: Cumulative amount of CPU time consumed by all sessions
There is no view that shows the Active Session Pool queue directly, but you can get some
information from:
V$SESSION: The CURRENT_QUEUE_DURATION column shows how long a session has
been q
queued,, or 0 (zero)
( ) if the session is not currently
yqqueued.
V$RSRC_CONSUMER_GROUP: The QUEUE_LENGTH column shows the number of sessions
currently queued per consumer group.
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
Quiz
n j o
e n se
N ara le lic
Answer: b, c
r e na ferab
n Lo rans
a re on-t
K n
Summary
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Practice A
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
U i
Using O
Oracle
l Scheduler
S h d l to
t Automate
A t t Tasks
T k
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Aula Matriz SAS
Objectives
n j o
e n se
N ara le lic
e n a b Scheduler components and their interaction, see the Oracle
a the rvarious
For information about
or nsfeGuide.
Database Administrators
L
a r - tra about the DBMS_SCHEDULER
en ninformation
For detailed DBMS SCHEDULER package, see the Oracle Database
K
PL/SQL n o
Packages and Types Reference.
n e n
N ara le lic
Many tasks in the Oracle
e n r a b
a environment need job-scheduling capabilities. Routine database
maintenance
L oand n s fe logic require jobs to be scheduled and run periodically.
r application
r e n -tra
Business-to-business (B2B) applications require scheduling for their business events. DBAs
need
K n on regular maintenance jobs in specified time windows.
a to schedule
Oracle Database provides advanced scheduling capabilities through the Oracle Scheduler,
which is a collection of functions and procedures in the DBMS_SCHEDULER package. The
Scheduler can be invoked in any SQL environment, or through Enterprise Manager Cloud
Control.
The Scheduler enables database administrators and application developers to control when
and
d where
h various
i ttasks
k ttake
k place
l iin th
the d
database
t b environment.
i t Th
These ttasks
k can b
be titime
consuming and complicated; using the Scheduler, you can manage and plan these tasks.
Scheduler jobs can be started based on time or when a specified event occurs, and the
Scheduler can raise events when a jobs state changes (for example, from RUNNING to
COMPLETE). You can also use a named series of programs that are linked together for a
combined objective.
BEGIN
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
sys.dbms_scheduler.create_job(
job_name => '"HR"."CREATE_LOG_TABLE_JOB"',
job_type => 'PLSQL_BLOCK', job_action => 'begin
execute
t immediate
i di t (''create
('' t table
t bl session_history(
i hi t (
snap_time TIMESTAMP WITH LOCAL TIME ZONE,
num_sessions NUMBER)''); end;',
start_date => systimestamp at time zone
'America/New_York',
job_class => 'DEFAULT_JOB_CLASS',
s a
comments
co e ts =>
> 'Create
C eate the
t e SESSION
S SS O _HISTORY
S O tab
table',
e ,
) ha
auto_drop => FALSE, enabled => TRUE);
c o m
END; ail e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
A job has two key components:
Action:oWhat needs
n L rans to be done
re
a o n -tWhen
Schedule: When the action occurs
K n in the slide, the what is enclosed in the top box and the when portion is
In the example
shown in the second box. The what is expressed in the JOB_TYPE and JOB_ACTION
parameters. The when is expressed in a schedule, which can be based on time (as shown
by the START_DATE parameter) or events, or be dependent on the outcome of other jobs.
Job
Program Schedule
attributes
Job
Arguments
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n r a b approach for managing tasks within the Oracle database.
a a modularized
The Scheduler offers
L r a task
By breakingodown
n s feinto its components, such as time, location, and database object, the
r e n -tra easier way to manage your database environment. The Scheduler
Scheduler offers you an
uses
K on basic components:
a thenfollowing
A job specifies what needs to be executed. It could be as an example a PL/SQL
procedure, a native binary executable, a Java application, or a shell script. You can
specify the program (what) and schedule (when) as part of the job definition, or you can
use an existing program or schedule instead. You can use arguments for a job to
customize its runtime behavior.
A schedule specifies when and how many times a job is executed.
executed A schedule can be
based on time or an event. You can define a schedule for a job by using a series of
dates, an event, or a combination of the two, along with additional specifications to
denote repeating intervals. You can store the schedule for a job separately and then use
the same schedule for multiple jobs.
A program is a collection of metadata about a particular executable, script, or
procedure. An automated job executes some task. Using a program enables you to
modify
f the job task, or the what,
without modifying
f the job itself.
f You can define
f
arguments for a program, enabling users to modify the runtime behavior of the task.
n e n
N ara le lic
e n r b by using Enterprise Manager Cloud Control or by using the
You can perform allasteps either
a
or nPL/SQL
DBMS_SCHEDULER
L s fe package.
1. Creating
a tra
ren ona -Program
K n
Use the CREATE_PROGRAM procedure to create a program. Creating a program is an optional
part of using the Scheduler. You can also encode the action to be performed within an
anonymous PL/SQL block in the CREATE_JOB procedure. By creating the program
separately, you can define the action once, and then reuse this action within multiple jobs.
This enables you to change the schedule for a job without having to re-create the PL/SQL
block.
A program is created in a disabled state by default (unless the ENABLED parameter is set to
TRUE). A disabled program cannot be executed by a job until it is enabled. You can specify
that a program should be created in the enabled state by specifying a value of TRUE for
ENABLED.
2. Creating and Using Schedules
The schedule for a job can be a predefined schedule (created with the CREATE_SCHEDULE
proced re) or defined as part of the job creation
procedure) creation.
The schedule specifies attributes about when the job is run, such as:
A start time, which defines when the job is picked for execution and an end time, which
specifies the time after which the job is no longer valid and is not scheduled any more
An expression specifying a repeating interval for the job
A complex schedule created by combining existing schedules
A condition or change in state, called an event, that must be met before the job is started
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
By using a schedule (instead of specifying the execution times for a job within the job definition),
you can manage the scheduled execution of multiple jobs without having to update multiple job
definitions. If a schedule is modified, each job that uses that schedule automatically uses the
new schedule.
3. Creating and Running a Job
A job is a combination of a schedule and a description of what to do, along with any additional
arguments that are required by the job. There are many attributes that you can set for a job.
Attributes control how the job executes.
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
Quiz
n e n
N ara le lic
Answer: b, d
r e na ferab
n Lo rans
a re on-t
K n
n e n
N ara le lic
A lightweight job: a
r e n ferab
Lo raadatabase
Is for customers
n n swho need to create hundreds of jobs a second. With regular jobs, each
a
job
-t process. Theobject
creates
reredo oinnthe describing the job, modifying several tables, and creating
K n overhead associated with this type of job need is substantial. In
the Oracle Database Scheduler, there is a persistent lightweight job. The goal of a
lightweight job is to reduce the overhead and time required to start a job. A minimal
amount of metadata is created for the job. This reduces the time required and redo
created when the job starts.
Has a small footprint on disk for the job metadata and for storing runtime data. The small
footprint on disk also makes load
load-balancing
balancing possible in RAC environments
environments.
Is always created from a job template. The job template must be a stored procedure or a
program. The stored procedure holds all the information needed for the job, including
privileges. A few job attributes can be specified: job arguments and schedule.
Must be created in command line. The JOB_STYLE argument is not available in
Enterprise Manager Cloud Control.
In the example,
example MY_PROG
MY PROG is the job template and the schedule is applied from a named
schedule.
Schedule
s a
)ha
Time m
co
i l
Calendaring expression
Date-time expression o t ma uide
Event
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a schedule
To specify a time-based
r a b for a job, you can specify either a calendaring expression or
a date-time o
L r
expression.
n s feWhen using a calendaring expression, the next start time for a job is
r e n -tra
calculated using the repeat interval and the start date of the job. When using date-time
a nonthe specified expression determines the next time that the job should run. If no
expressions,
K
repeat interval is specified, the job runs only once on the specified start date.
If a job uses an event-based schedule, the job runs when the event is raised. At a high level,
an event can be viewed as a change in state. An event occurs when a Boolean condition
changes its state from FALSE to TRUE, or TRUE to FALSE.
The Scheduler uses Oracle Streams Advanced Queuing (AQ) to raise and consume events.
Note: The Scheduler does not guarantee that a job executes on the exact time because the
system may be overloaded and thus resources may be unavailable.
BEGIN
DBMS_SCHEDULER.CREATE_JOB(
job_name=>'HR.DO_BACKUP',
job_type => 'EXECUTABLE',
job_action =>
'/home/usr/dba/rman/nightly_incr.sh',
s a
start date=>
start_date > SYSDATE,
) ha
repeat_interval=>'FREQ=DAILY;BYHOUR=23', o m
/* next night at 11:00 PM */ a ilc e
h otm t Guid
comments => 'Nightly incremental backups');
n a @ en
re Stud
END;
/ v l o s i
s (n t h
l l e ga use
i and/or
VOracle
Copyright 2013,
e titsoaffiliates. All rights reserved.
j o
n icen s
r a
a leofl the DBMS_SCHEDULER package to create a job. Jobs are
N b
Use the CREATE_JOB
r e nbyadefault
procedure
e r a
L o Allnsjobf namesthey
created disabled and become active and scheduled only when they are
r e n -tra
explicitly enabled. are of the form: [SCHEMA.]NAME.
K a should
You n SYSTIMESTAMP and specify a time zone so that when the time changes
nouse
because of daylight saving time, your job adjusts its execution time automatically.
By default, a job is created in the current schema. You can create a job in another schema
by specifying the name of the schema, as shown in the example in the slide. The job owner is
the user in whose schema the job is created, whereas the job creator is the user who created
the job. Jobs are executed with the privileges of the job owner. The national language support
(NLS) environment
i t off th
the jjob
b when
h it runs iis th
the same as th
thatt presentt att th
the titime th
the jjob
b was
created. The JOB_TYPE parameter indicates the type of task to be performed by the job. The
possible values are:
PLSQL_BLOCK: An anonymous PL/SQL block
STORED_PROCEDURE: A named PL/SQL, Java, or external procedure
EXECUTABLE: A command that can be executed from the operating system (OS)
command line
An external job is a job that runs outside the database. All external jobs run as a low-privileged
guest user, as has been determined by the database administrator while configuring external
job support. Because the executable is run as a low-privileged guest account, you should verify
that it has access to necessary files and resources. Most, but not all, platforms support external
jobs For platforms that do not support external jobs
jobs. jobs, creating or setting the attribute of a job or a
program to type EXECUTABLE returns an error.
Refer to your Oracle database platform-specific documentation for more information about
configuring the environment to run external programs with the Scheduler.
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
Oracle Database
s a
)ha
Scheduler m
co
i l
a ide
t m
Event ADT
@ h nt Gu
o
Application
(Abstract
Data Type) r e na tude
Queue
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a based
Jobs can be triggered
r a bon events. An application can notify the Scheduler to start a job
Lor ransjob.
by enqueuing a message feonto an Oracle Streams queue. A job started in this way is referred
to as annevent-based To create an event-based job, you must set the following two
r e - t
additional
K on
a nattributes with the CREATE_JOB procedure:
QUEUE_SPEC: A queue specification that includes the name of the queue where your
application enqueues messages to raise job start events, or in the case of a secure
queue, the <queue_name>, <agent_name> pair
EVENT_CONDITION: A conditional expression based on message properties that must
evaluate to TRUE for the message to start the job. You can include user data properties
in the expression,
expression provided that the message payload is a user
user-defined
defined object type,
type and
that you prefix object attributes in the expression with TAB.USER_DATA.
You can either specify QUEUE_SPEC and EVENT_CONDITION as inline job attributes, or
create an event-based schedule with these attributes and then create a job that references
this schedule.
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
The Create Schedule
e n b you to choose between a standard, time-based schedule
a pageraenables
L fe If you choose an event-based schedule, you can specify the
oragentnname,
and an event-based schedule.
s
r e n -tra
queue name, and event condition, in addition to the other schedule attributes.
K
Note: n
a ThenoScheduler runs the event-based job for each occurrence of an event that matches
EVENT_CONDITION. However, events that occur while the job is already running are ignored;
the event gets consumed, but does not trigger another run of the job.
References
See the Oracle Streams Advanced Queuing Users Guide and Reference for information
about how to create queues and enqueue messages.
For more information about Oracle Streams AQ rules and event conditions, see the
DBMS_AQADM.ADD_SUBSCRIBER procedure in Oracle Database PL/SQL Packages and
Types Reference.
Example: Create a job that runs if a batch load data file arrives
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
n
ra lic e n
N a asle
e n a
To specify event information
r a b job attributes, you use an alternate syntax of CREATE_JOB
Event-Based Scheduling
Event types:
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
n e n
N ara le lic
You can create a job
e n r a b references an event as the means to start the job, instead of
a that directly
assigning a o r
schedule tofe
the job. There are two types of events:
L n s
e n ge -teraated or
r Use
User-generated o application-generated
app cat o ge e ated e events:
e ts An app application
cat o ca
can raise
a se a
an e
event
e t
a
K to be n
noconsumed by the Scheduler. The Scheduler reacts to the event by starting a job.
An example of such events: a running job completes; a file arrives on the file system; an
account within the database is locked; and the inventory reaches a low threshold.
Scheduler-generated events: The Scheduler can raise an event to indicate state
changes that occur within the Scheduler itself. For example, the Scheduler can raise an
event when a job starts, when a job completes, when a job exceeds its allotted run time,
and so on
on. The consumer of the event is an application that performs some action in
response to the event.
You can configure a job so that the Scheduler raises an event when the jobs state changes.
You do this by setting the RAISE_EVENTS job attribute. By default, a job does not raise any
state change events until you alter the RAISE_EVENTS attribute for a job. To alter this
attribute, you must first create the job by using the CREATE_JOB procedure and then use the
SET_ATTRIBUTE procedure to modify the attributes default value. The example shows that
the HR.DO_BACKUP job is altered, so that it raises an event if the job fails.
After you enable job state change events for a job, the Scheduler raises these events by
enqueuing messages onto the default event queue SYS.SCHEDULER$_EVENT_QUEUE.
The default Scheduler event queue is a secure queue. Depending on your application, you may
a e to configure
have co gu e tthe
e queue to e
enable
ab e ce
certain
ta use
users
s to pe
perform
o ope
operations
at o s o
on it.
t See tthe
eOOracle
ac e
Streams Concepts and Administration documentation for information about secure queues.
The default Scheduler event queue is intended primarily for Scheduler-generated events. Oracle
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
does not recommend the use of this queue for user applications, or user-defined events.
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a in rthe
A schedule is an object
a bdatabase. When you create schedules, they are automatically
saved. You o
L
can
n s fe
r use combinations of schedules to create more complex schedules. By
r e n -tra
combining schedules, you can add specific dates to or exclude specific dates from a
a nonexpression.
calendaring
K
You can use the following options when defining the repeat interval for a schedule:
INCLUDE: Adds a list of dates to the calendaring expression results
EXCLUDE: Removes a list of dates from the calendaring expression results
INTERSECT: Uses only the dates that are common to two or more schedules
When creating schedules to be used in combinations
combinations, you can code the list of dates by
including hard-coded dates of the form [YYYY]MMDD or by including named schedules
created with the CREATE_SCHEDULE procedure. For example, you can specify a list of dates
by using the following values for the repeat interval of a schedule:
0115,0315,0325,0615,quarter_end_dates,1215
This string represents the dates January 15, March 15, March 25, June 15, December 15, and
the list of dates specified by the QUARTER_END_DATES schedule.
If you do not specify the optional year component for hard-coded dates in your schedule, the
dates are included for every year.
Quiz
jobs:
a. Persistent lightweight jobs have a small footprint on disk
for the jjob metadata and also for storing
g runtime data.
b. Use persistent lightweight jobs for maximum flexibility.
c. Persistent lightweight jobs are created from a job template.
d. Persistent lightweight jobs can be created in Enterprise
Manager and via command line. s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
Answer: a, c
r e na ferab
n Lo rans
a re on-t
K n
DBMS_SCHEDULER.ADD_JOB_EMAIL_NOTIFICATION (
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
n
ra lic e n
N a le with the
Add one or more job
n a a b
email notifications
re sfer
DBMS_SCHEDULER.ADD_JOB_EMAIL_NOTIFICATION
L o procedure. Email messages will be
trtan ti ll modified
sent to the specified recipient addresses whenever any of the listed events are generated by the
enjjobb iisn-automatically
j barTh
job. The difi d tto raise
i th
these events. t If a filtfilter condition
diti iis specified,
ifi d only
l
K nomatch the specification in FILTER_CONDITION will generate an email message.
events that
This procedure will fail if the EMAIL_SERVER scheduler attribute is not set or if the specified
job does not exist. The user calling this procedure must be the owner of the job, have the
CREATE ANY JOB system privilege, or have been granted the ALTER privilege for the job.
The subject of notification emails can contain the following variables for which values
will be substituted: %job_owner%, %job_name%, %event_type%,
%event timestamp% %log_id%,
%event_timestamp%, %log id% %error_code%,
%error code% %error_message%,
%error message%
%run_count%, %failure_count%, %retry_count%, %job_subname%,
%job_class_name%.
The notification email message body can contain any of the variables that are valid in
the SUBJECT.
The comma-separated list of events cannot be NULL. Refer to the list of events for the
RAISE_EVENTS attribute of JOBS for valid events.
If filter_condition
filter condition is NULL (the default)
default), all occurrences of the specified events will be
emailed to all specified recipient addresses.
Remove one or more email notifications for a specified job with the
DBMS_SCHEDULER.REMOVE_JOB_EMAIL_NOTIFICATION procedure.
Job chain
2. Define chain steps.
3. Define chain rules.
4
4. Starting the chain:
Enable the chain.
Job
Create a job that points to the chain.
s a
)h a
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
A chain is a namedaseries of b programs that are linked together for a combined objective. This
is known aso r e n
dependency r a
fe scheduling. An example of a chain may be the following:
L n s
Run p
rprogram
e n ra then pprogram
ng A-tand g B,, but only y run p programg C if pprograms
g A and B complete
p
K a no otherwise run program D.
successfully,
Each position within a chain of interdependent programs is referred to as a step. Typically,
after an initial set of chain steps has started, the execution of successive steps depends on
the completion of one or more previous steps. To create and use a chain, you complete the
following steps in order. All procedures mentioned are part of the DBMS_SCHEDULER
package, unless noted otherwise.
1 Create
1. C t a chain
h i byb using
i th
the CREATE_CHAIN procedure.d Th
The chain
h i name can b be
optionally qualified with a schema name (for example, myschema.myname).
2. Define (one or more) chain steps. Defining a step gives it a name and specifies what
happens during the step. Each step can point to one of the following:
- A program
- Another chain (a nested chain)
- AnA eventt
You define a step that points to a program or nested chain by calling the
DEFINE_CHAIN_STEP procedure.
To define a step that waits for an event to occur, you use the
DEFINE_CHAIN_EVENT_STEP procedure. Procedure arguments can point to an event
schedule or can include an inline queue specification and event condition. A step that
points to an event waits until the specified event is raised. If the event occurs, the step
completes successfully.
3. After creating the chain object, you define chain rules. Chain rules define when steps
run, and define dependencies between steps. Each rule has a condition and an action:
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
- If the condition evaluates to TRUE, the action is performed. The condition can
contain any syntax that is valid in a SQL WHERE clause. Conditions are usually based
on the outcome of one or more previous steps. For example, you may want one step
to run if the two previous steps succeeded,
succeeded and another to run if either of the two
previous steps failed.
- The action specifies what is to be done as a result of the rule being triggered.
A typical action is to run a specified step. Possible actions include starting or
stopping a step. You can also choose to end the execution of the job chain, returning
either a value or a step name and error code.
s a
) ha
All rules added to a chain work together to define the overall behavior of the chain. When
the job starts and at the end of each step, all rules are evaluated to see what action or
m
o
ilc e
actions occur next. You add a rule to a chain with the DEFINE_CHAIN_RULE procedure.
a
4. Starting the chain involves two actions: h otm t Guid
You call this procedure once for each rule that you want to add to the chain.
n a @ en
l o re Stud
- Enable a chain with the ENABLE procedure. (A chain is always created disabled, so
( n v his
you can add steps and rules to the chain before it is executed by any job.) Enabling
g a s se t
an already enabled chain does not return an error
error.
ille e to u
- To run a chain, you must create a job of type CHAIN. The job action must refer to
V
job. r a njo icens
the chain name. You can use either event-based or time-based schedules for this
N a le l
r e na ferab
n Lo rans
a re on-t
K n
Example of a Chain
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
Dependency scheduling
START
Job LOAD_DATA_EVT 1 DO_BULK_LOAD 2
STOP_WHEN_
DISK_FULL_EVT 5 3
Schedule REBUILD_INDX
s a
)h a
m
co 4
END
Run_reports
i l
(HR.GEN_REPORTS)
o t ma uide
BULK_LOAD_CHAIN @ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n r b all the tasks and conditions that occur during a bulk data
As an example of aachain, consider
a
L ordomust
load. First, you
n fe data to load. Then load the data, observing the file system to make
have
s
sure that
r e n -tra out of space during the load. After the data load completes, you need
you not run
to a
K rebuild the
n o nindexes defined on the updated tables. Then you run reports against the newly
loaded data. The slide shows an example of dependency scheduling.
Resource DB
consumer service Resource Window
group name plan group
s a
) ha
Program Job Schedule o m
a ilc e
h otm t Guid
n a @ en
Arguments Arguments
l o reTimeStud Event
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n b
a rafeatures,
Using advanced Scheduler you can exercise more control over various aspects of
scheduling, o
L r as job
such
n s fewindows and prioritizing jobs. These advanced features are
r e n -tra are discussed in detail in the following slides.
summarized below, and
on is represented by an interval of time with a well-defined beginning and end,
Ka A window
n
and is used to activate different resource plans at different times. This allows you to
change resource allocation during a time period, such as time of day or time of the sales
year.
A window group represents a list of windows, and allows for easier management of
windows. You can use a window or window group as the schedule for a job to ensure
that the job runs only when a window and its associated resource plans are active
active.
A job class defines a category of jobs that share common resource usage requirements
and other characteristics. A job class groups jobs into larger entities.
A resource consumer group associated with the job class determines the resources
that are allocated to the jobs in the job class.
A resource plan enables users to prioritize resources (most notably CPU) among
resource consumer groups.
Note: The gray objects are not Scheduler objects.
Job Classes
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
a forratheir
Job classes are policies
e n b participating member jobs. Each job class specifies a set of
L or asForthe
attributes, such
n s fe level. When you assign a job to a job class, the job inherits
logging
r e n -tra
those attributes. example, you can specify the same policy for purging log entries for all
a jobs.
payroll
K n on
You can use the CREATE_JOB_CLASS procedure to create a job class. A class always
belongs to the sys schema. To create a class, you must have the MANAGE SCHEDULER
privilege. There is a default job class named DEFAULT_JOB_CLASS that is created with
the database.
After a job class has been created, you can specify jobs as members of this job class
when you create the jobs
jobs, or after the jobs are created,
created by using the SET_ATTRIBUTE
SET ATTRIBUTE
procedure of the DBMS_SCHEDULER package. If a job is not associated with a job class,
the job belongs to this default job class.
Set the service attribute of a job class to a desired database service name. This
determines the instances in a Real Application Clusters environment that run the
member jobs, and optionally, the system resources that are assigned to the member
jobs.
Set resource allocation for member jobs. Job classes provide the link between the
Database Resource Manager and the Scheduler because each job class can specify a
resource consumer group as an attribute. Member jobs then belong to the specified
consumer group and are assigned resources according to settings in the current resource
plan. Alternatively, you can leave the RESOURCE_CONSUMER_GROUP attribute as NULL
and set the service attribute of a job class to a desired database service name. That
service can in turn be mapped to a resource consumer group. If both the
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
RESOURCE_CONSUMER_GROUP and service attributes are set, and the designated service
maps to a resource consumer group, the resource consumer group named in the
RESOURCE_CONSUMER_GROUP attribute takes precedence. If a resource consumer group
is not specified when a job class is created, the job class maps to the
DEFAULT_CONSUMER_GROUP resource consumer group. Jobs in the default job class or in
a job class associated with the default resource consumer group may not be allocated
enough resources to complete their tasks when the Resource Manager is enabled.
Group jobs for prioritization. Within the same job class, you can assign priority values of 1
5 to individual jobs so that if two jobs in the class are scheduled to start at the same time,
a
the one with the higher priority takes precedence. This ensures that you do not have a less
s
ha
important job preventing the timely completion of a more important one.
) one If two jobs have
m
the same assigned priority value, the job with the earlier start date takes precedence. If no
o
ilc e
priority is assigned to a job, its priority defaults to 3.
a
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
Windows
Scheduler windows:
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
Resource
Resource
plan
consumer group a
a s
m )h
i l co
Job class
Window
o t ma uide
@ h nt G
r e na tude
Job vlo S
( n h i s
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
The priority of jobsa
e n can change
r a b over a period of time. For example, you might want to allocate
or ofnthe
a high percentage
s fedatabase resources to data warehouse loading jobs at night and
allocatena L a
higherrpercentage of the resources during the day to the application jobs. To
r e
a nothis,
accomplish - t
n you can change the database resource plan by using a Scheduler window.
K
Scheduler windows can automatically start jobs or change the resource allocation
among jobs during various time periods of the day, week, and so on. A window is
represented by an interval of time with a well-defined beginning and end, such as from
12:00 AM to 6:00 AM.
Only one window can be in effect at any given time.
Y can create
You t a window
i d with
ith th
the CREATE_WINDOW
CREATE WINDOW procedure.d
Scheduler windows work with job classes to control resource allocation. Each window
specifies the resource plan to activate when the window opens (becomes active), and each
job class specifies a resource consumer group or specifies a database service, which can
map to a consumer group. A job that runs within a window, therefore, has resources allocated
to it according to the consumer group of its job class and the resource plan of the window (as
shown in the ggraphic
p in this slide).
)
Prioritizing jobs:
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
Job Priority
Job1 Job2
Job1 1
APPL_JOBS
s a
Job3 Job2 2
) ha
o m
Job4 Job5 OTHER Job3
a i3lc e
ADMIN_JOBS h otm t 5Guid
Job4
n a @ en
Daytime window
l o re StJob5 ud 2
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a jobs
When creating multiple
r a ba database, you need a way to align the job processing with
in
your business
L omay n s fe and specify which jobs have the highest priority. For a particular
rrequirements
window,
r e n -tra several classes of jobs running, each with its own priority.
you have
K a arenotwon levels at which jobs can be prioritized: at the class level and at the job level.
There
The first prioritization is at the class level, using resource plans. Prioritization among
jobs of different classes is done purely on a class resource allocation basis.
The second prioritization is within the class, with the job priority attribute of the job.
Prioritization levels are relevant only when two jobs within the same class are supposed to
start at the same time. The jjob with the higher
g p
priority
y starts first.
Prioritization is not guaranteed for jobs in different job classes. For example, a high-priority job
in the APPL_JOBS job class might not get started before a low-priority job in the ADMIN_JOBS
job class, even if they share the same schedule. If the APPL_JOBS job class has a lower level
of resources available, the high-priority job in that class has to wait for resources to become
available, even if there are resources available to lower-priority jobs in a different job class.
sys.job_array:
DECLARE
newjob sys.job;
newjobarr sys.job_array;
r e n -tra
and submitted job queue in a single transaction. Notice that for a lightweight job, there
is a
K
defaults n
on amount of information needed. In the example, the START_TIME parameter
a very limited
to NULL, so the job is scheduled to start immediately.
1. Declare the variable to hold a job definition and a job array variable.
2. Initialize the job array using the SYS.JOB_ARRAY constructor. This creates a place for
one job in the array.
3. Set the size of the array to the number of expected jobs.
4. Create each job and place it in the array. In the example in the slide, the only difference
is the name of the job. The START_TIME variable of the job is omitted and it defaults to
NULL, indicating that the job will run immediately.
5. Use the CREATE_JOBS procedure to submit all the jobs in the array as one transaction.
Note: If the array is very small, the performance will not be significantly better than submitting
a single job.
@ enh
n a
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n
ra lic e n
The full code of this a N a
example is: le
n a b
DECLAREre
L o sys.job; s f er
r e
newjob
nnewjobarr
- t r ansys.job_array;
K a n
BEGINo n sys job array
Quiz
n e n
N ara le lic
Answer: a, c, d na
e r a b
r
Lo ransf e
n
re on-t
K a n
n e n
N ara le lic
e n a tasksratobcreate a file watcher and create the event-based job that starts
Perform the following
or nsfilefearrives:
when the designated
L
r CCreate
1. e
n
Sc
t raedu e ccredential
neate a-Scheduler ede t a object (a ccredential)
ede t a ) with t which c to aut authenticate
e t cate with
t tthe
e
a
K hostnooperating system for access to the file and grant EXECUTE on the credential to the
schema that owns the event-based job that the file watcher will start.
2. Create a file watcher and grant EXECUTE on the file watcher to any schema that owns
an event-based job that references the file watcher. Refer to the Oracle Database
Administrator's Guide for a detailed example of creating a file watcher.
3. Create a Scheduler program object with a metadata argument that references the event
message.
- Define the metadata argument using the EVENT_MESSAGE attribute.
- Create the stored procedure with an argument of the
SYS.SCHEDULER_FILEWATCHER_RESULT type that the program invokes. The
stored procedure must have an argument of the
SYS.SCHEDULER_FILEWATCHER_RESULT type, which is the data type of the
event message. The position of that argument must match the position of the
defined metadata argument. The procedure can access attributes of this abstract
data type to learn about the arrived file.
4. Create an event-based job that references the file watcher. You can use the
DBMS_SCHEDULER.SET_ATTRIBUTE procedure to enable the job to run for each instance
of the file arrival event, even if the job is already processing a previous event. Set the
PARALLEL_INSTANCES attribute to TRUE.
BEGIN
DBMS_SCHEDULER.SET_ATTRIBUTE('','PARALLEL_INSTANCES', TRUE);
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
END;
This enables the job to run as a lightweight job so that multiple instances of the job can be
started quickly. If PARALLEL_INSTANCES is set to the default value of FALSE, file watcher
events that occur while the event-based job is already processing another will be
discarded.
discarded
5. Enable the file watcher, the program, and the job.
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a events
To receive file arrival
r a b a remote system, you must install the Scheduler agent on
from
that system,oand
L n fe register the agent with the database. The remote system does not
r you smust
need an
r e n -tra
Oracle Database instance to generate file arrival events.
K a to ntheonOracle Database Administrators Guide for detailed information.
Refer
n e n
N ara le lic
You can now create
e n aa job rthat
a bruns stored procedures and anonymous PL/SQL blocks on
L oofrOracle
another database fe on the same host or a remote host. The target database can be
instance
n s
a r en n-tra
any release Database.
K nono new procedures to support remote database jobs, rather there have been
There are
changes to existing DBMS_SCHEDULER procedures to support this functionality. Additional
information is provided over the next few pages.
n e n
N ara le lic
You can perform the
e n a b in the slide to create a remote database job.
a tasksrlisted
To set up L
the
n fedatabase for remote jobs, perform the following steps:
ororiginating
s
1 re
1. Verify
n ra DB is installed.
n that-tXML installed
a
K2. Enable o
n HTTP connections to the database.
BEGIN
DBMS_XDB.SETHTTPPORT(port);
END;
3. Execute the prvtrsch.plb script.
4 Set
4. S t a registration
i t ti password
d for
f the
th Scheduler
S h d l agents.
t
BEGIN
DBMS_SCHEDULER.SET_AGENT_REGISTRATION_PASS('password');
END;
Refer to the Oracle Database Administrators Guide for a detailed example.
n e n
N ara le lic
e n a jobs
The multiple destination
r a bfeature enables you to specify multiple targets on which the jobs
L or Youthem.
should execute.
n fe the ability to monitor and control the jobs from the database at
have
s
r e n -tra
which you created The following capabilities are included:
n j o
e n se
a ra lic
a N
The job table is a container b
for lalle the jobs, with one table per database. The job table stores
information forre n a
er as the owner name or the level of logging. You can find this
all jobs, fsuch
L
information
o n s
r e n in -thet r a*_SCHEDULER_JOBS views.
Jobs
K o n objects, and can, therefore, accumulate and take up too much space. To
a arendatabase
avoid this, job objects are automatically dropped by default after completion. This behavior is
controlled by the AUTO_DROP job attribute.
There are many views available to the DBA and privileged users that provide essential
operating information regarding the scheduler, jobs, schedules, windows, and so on. These
views include:
SCHEDULER PROGRAM ARGS: Shows all arguments defined for all programs as well
*_SCHEDULER_PROGRAM_ARGS:
as the default values if they exist
*_SCHEDULER_JOBS: Shows all jobs, enabled as well as disabled
*_SCHEDULER_JOB_RUN_DETAILS show all completed (failed or successful) job runs.
It has a row for each job instance. Each row contains information about the job
execution for that instance. The ERROR# column shows the number of the first error
encountered
*_SCHEDULER_GLOBAL_ATTRIBUTE: Shows Sh th
the currentt values
l off S
Scheduler
h d l attributes
tt ib t
*_SCHEDULER_JOB_ARGS: Shows all set argument values for all jobs
*_SCHEDULER_JOB_CLASSES: Shows all job classes
Quiz
Select the statements that are true about the Oracle Scheduler:
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
n e n
N ara le lic
Answer: b, c
r e na ferab
n Lo rans
a re on-t
K n
Summary
n j o
e n se
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Practice B
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
Aula Matriz SAS
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
Mi
Migrating
ti Data
D t by
b Using
U i Oracle
O l Data
D t Pump
P
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Aula Matriz SAS
Objectives
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
n e n
N ara le lic
Oracle Data Pumpa
e n r a b
enables high-speed data and metadata loading and unloading of Oracle
L or custom
databases. The fe infrastructure is callable via the DBMS_DATAPUMP PL/SQL
Data Pump
n s
package.
r e n -tra data movement utilities can be built by using Data Pump.
Thus,
K
Oracle non provides the following tools:
a Database
Command-line export and import clients called expdp and impdp, respectively
Export and import interface in Enterprise Manager Cloud Control
Data Pump automatically decides the data access methods to use; these can be either direct
path or external tables. Data Pump uses direct path load and unload when a tables structure
g
allows it and when maximum single-stream performance is desired. However,, if there are
p
clustered tables, referential integrity constraints, encrypted columns, or several other items,
Data Pump uses external tables rather than direct path to move the data.
The ability to detach from and re-attach to long-running jobs without affecting the job itself
enables you to monitor jobs from multiple locations while they are running. All stopped Data
Pump jobs can be restarted without loss of data as long as the metainformation remains
undisturbed. It does not matter whether the job is stopped voluntarily or involuntarily due to a
crash.
Source Target
Data Pump Server
job p
process
Database Database
Master Dump Dump Master
table file set file set table
Network mode s a
) ha
Server Data Pump lc o m
process job ma
i e
t i d
@ ho nt Gu
r e na impdp t u de
( n vlo his Sclient
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
Data Pump Export a is a utility b
for unloading data and metadata into a set of operating system
e n r a
fe Data Pump Import is used to load metadata and data stored in an
r file sets.
files called dump
L ofile n s
r e n -tra a target system.
export dump set into
K
The on API accesses its files on the server rather than on the client.
a DatanPump
These utilities can also be used to export from a remote database directly to a dump file set,
or to load the target database directly from a source database with no intervening files. This is
known as network mode. This mode is particularly useful to export data from a read-only
source database.
At the center of every Data Pump operation is the master table (MT), which is a table created
in the schema of the user running the Data Pump job. The MT maintains all aspects of the
job. The MT is built during a file-based export job and is written to the dump file set as the last
step. Conversely, loading the MT into the current users schema is the first step of a file-based
import operation and is used to sequence the creation of all objects imported.
Note: The MT is the key to Data Pumps restart capability in the event of a planned or
unplanned stopping of the job. The MT is dropped when the Data Pump job finishes normally.
Command line
Parameter file
Interactive command line
Enterprise Manager Cloud Control
Data Pump Export and Import modes:
Full
Schema
s a
Table )ha
m
co
Tablespace i l
Transportable tablespace o t ma uide
@ h nt G
Transportable database
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
a DataraPump
You can interact with
e n b Export and Import by using one of the following interfaces:
Command-line
L fe
or nsinterface: Enables you to specify most of the export parameters directly
on
o n
re on-tr
t
the
e co a
commanda d line
e
a
K Parameter
n file interface: Enables you to specify all command-line parameters in a
parameter file. The only exception is the PARFILE parameter.
Interactive-command interface: Stops logging to the terminal and displays the export
or import prompts, where you can enter various commands. This mode is enabled by
pressing Ctrl + C during an export operation that is started with the command-line
interface or the parameter file interface. Interactive-command mode is also enabled
when
h you attach
tt h to
t an executing
ti or stopped
t d job.
j b
GUI interface: Select Schema > Database Export/Import. In the menu select the export
or import operation you want to execute.
Data Pump Export and Import provide different modes for unloading and loading different
portions of the database. The mode is specified on the command line by using the appropriate
parameter. The available modes are listed in the slide and are the same as in the original
export and import utilities
utilities.
Pump:
1. Export data from the source database
2 Install Oracle Database 12c and create a database
2.
3. Import data into the new Oracle Database 12c database
s a
) h a
o m
export import
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
You can use Oracle
e n b and Import to migrate your database to Oracle Database
aDumpraExport
L or provides
12c. This method
n s fe the following advantages:
e
a
The
r snapshot
n - tra can
ne database ca remain
e a available
a a ab e for o use
user access du during g tthe
e upg
upgrade.
ade If a co
consistent
s ste t
K no of the database is required, the database must operate in restricted mode or
must otherwise be protected from changes when the export executes.
The upgraded database can be created on a different operating system or hardware
platform.
The database can be restructured as part of the import. You can create new
tablespaces or modify existing tables, tablespaces, or partitions to be populated by
i
imported
t dddata.
t
database import
User performing the Export must have the
DATAPUMP_EXP_FULL_DATABASE role
User performing the Import must have the
DATAPUMP_IMP_FULL_DATABASE role
s a
)ha
impdp import_user m
co
i l
NETWORK_LINK=db_link
o t ma uide
FULL=Y
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
Data Pump Import a
e n can be used
r a b with a database link to perform a full database import. When
r
you use thisomethod, nofe
intermediate dump files are created.
L n s
The user
a r n - tra the export must be granted the DATAPUMP_EXP_FULL_DATABASE
en performing DATAPUMP EXP FULL DATABASE role.
K nouser when the database link is created.
Specify this
The user performing the import must be granted the DATAPUMP_IMP_FULL_DATABASE role.
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a a non-CDB
Another way to migrate
r a b database to a CDB is to create a multitenant container
database and
L n s fe the database. To create a CDB by using DBCA, select Create As
orthen import
a r en n-tra
Container Database.
K o provide a pluggable database name in the Pluggable Database Name field. If
You alsonmust
you select Advanced Mode you can create an empty CDB with only the root and seed
containers.
In Advanced Mode, you can register the CDB with Enterprise Manager Cloud Control,
configure the CDB for Enterprise Manager Database Express, and set passwords for the SYS
and SYSTEM users.
n j o
e n se
N ara le lic
The creation of a new
e n a PDBrafrom b the seed is nearly instantaneous. The operation copies the
data files fromrthe READfe ONLY seed PDB to the target directory defined in the CREATE
L oDATABASEn s
PLUGGABLE
r e n -tra statement.
K
It creates on
a ntablespaces such as SYSTEM to store a full catalog including metadata pointing to
Oracle-supplied objects, SYSAUX for local auxiliary data.
It creates default schemas and common users that exist in seed PDB, SYS who continues to
have all superuser privileges, and SYSTEM who can administer the PDB.
It creates a local user (the PDBA) granted a local PDB_DBA role. Until the PDB SYS user
grants privileges to the local PDB_DBA role, the new PDBA cannot perform any other
operation
ti than
th connectingti tot the
th PDB.
PDB
A new default service is also created for the PDB.
n j o
e n se
N ara le lic
To export data fromaa non-CDB
e n r a b and import it into a PDB of a CDB, perform the steps as
r slide.sfe
described inothe
L
e n in-tthe
Therexample r anslide describes how to perform a conventional full database export from
K anon-CDB
the n onand a conventional full database import into the PDB. You can also perform a
full transportable, a tablespace, schema, or table-level export and import.
The tablespace export and import can be of either type: conventional or transportable.
The users exported from the non-CDB database are re-created as local users in the PDB.
The tablespaces for the new local users and objects must be created in the PDB before the
import.
Summary
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Practice C
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
I t lli
Installing Oracle
O l Grid
G id Infrastructure
I f t t for
f a
Standalone Server
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Aula Matriz SAS
Objectives
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
n e n
N ara le lic
e n a rforaba standalone server provides the infrastructure to include your
Oracle Grid Infrastructure
L or Oracle
single-instance database
n s fein an enterprise grid architecture. The Oracle Grid Infrastructure
r e n -tra
home includes Restart and Oracle Automatic Storage Management (Oracle ASM)
a non
software.
K
When you install Oracle Grid Infrastructure for a standalone server, the Oracle Universal
Installer (OUI) configures a single-node version of Oracle Cluster Synchronization Services
(CSS). CSS is a daemon process that enables synchronization between an Oracle ASM
instance and the database instances that rely on it for database file storage. The CSS
daemon is installed in and runs from the Oracle Grid Infrastructure home.
Y should
You h ld iinstall
t ll O
Oracle
l GGrid
id IInfrastructure
f t t ffor a standalone
t d l server b
before
f you iinstall
t ll and
d
create the Oracle database. Otherwise, you will need to manually register the database with
Oracle Restart.
Oracle Restart
n e n
N ara le lic
e n a ratobimprove the availability of your Oracle Database. It implements
Oracle Restart is designed
L or Cluster
a high availability fe for single instance (nonclustered) environments only. For Oracle
solution
n s
r e n -tra (Oracle RAC) environments, the functionality to automatically restart
Real Application
a nonis provided by Oracle Clusterware. Oracle Restart can monitor the health and
components
K
automatically restart the following components:
Database instances
Oracle Net listener
Database services
ASM instance
ASM disk groups
Oracle Notification Services (ONS/eONS): Service for sending Fast Application
Notification (FAN) events to integrated clients upon failover. The eONS is used by
Oracle Enterprise Manager to receive notification of change in status of components
managed by Oracle Restart.
Restarting an ASM disk group means mounting it. The ability to restart ONS is applicable only
i Oracle
in O l Data
D Guard
G d installations
i ll i ffor automatic
i ffailover
il off connections
i b
between primary
i and
d
standby databases through FAN.
Oracle Restart ensures that the components are started in the proper order, in accordance
with component dependencies. If a component must be shut down, it ensures that the
dependent components are cleanly shut down first.
p
Note: Oracle Restart runs out of the Oracle Grid Infrastructure home and is dependent on
Oracle Cluster Synchronization Services (CSS).
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
ASM
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
Oracle
ASM
Database ASM file
disk group
Data file
ASM
extent
s a
) ha
File system ASM allocation o m
unit a ilc e
ASM disk
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n b
a therarelationships
The diagram illustrates between an Oracle Database data file and the ASM
Lor radata
storage components.
n fe crows foot notation represents a one-to-many relationship. An
sThe
Oracle n
Database file has a one-to-one relationship with either a file stored on the
a re system
operating o n -t in a file system or an ASM file.
K n
An Oracle ASM disk group is a collection of one or more Oracle ASM disks managed as a
logical unit. The data structures in a disk group are self-contained using some of the space for
metadata needs. Oracle ASM disks are the storage devices provisioned to an Oracle ASM
disk group and can be physical disk or partitions, a Logical Unit Number (LUN) from a storage
array, a logical volume (LV), or a network-attached file. Each ASM disk is divided into many
ASM allocation units,
units the smallest contiguous amount of disk space that ASM allocates
allocates. When
you create an ASM disk group, you can set the ASM allocation unit size to 1, 2, 4, 8, 16, 32,
or 64 MB depending on the disk group compatibility level. One or more ASM allocation units
form an ASM extent. An Oracle ASM extent is the raw storage used to hold the contents of an
Oracle ASM file. An Oracle ASM file consists of one or more file extents. Variable extent sizes
of 1*AU size, 4*AU size, and 16*AU size are used for supporting very large ASM files.
n e n
N ara le lic
To identify the storage
e n r a b
a requirements for using Oracle ASM, you must determine the number of
devices andothe
L r amount
n s feof free disk space that you require. You need to determine whether
you want
r e n -tra ASM for Oracle Database files (data files, control files, and redo log
to use Oracle
K a recovery
files),
n o n files, or both. You need to choose the Oracle ASM redundancy level to use for
each Oracle ASM disk group that you create. The redundancy level determines how Oracle
ASM mirrors files in the disk group and determines the number of disks and amount of disk
space that is required.
In order to use a DAS or SAN disk in Oracle ASM, the disk must have a partition table. Oracle
recommends creating exactly one partition for each disk.
Oracle
O l recommends d th
thatt you use Oracle
O l A Automatic
t ti Storage
St Management
M t library
lib d
driver
i
(Oracle ASMLIB) for device persistence, where it is available. Oracle ASMLIB simplifies the
configuration and management of block disk devices by eliminating the need to rebind block
disk devices used with Oracle ASM each time the system is restarted. With Oracle ASMLIB,
you define the range of disks you want to have made available as Oracle ASM disks. Oracle
ASMLIB maintains permissions and disk labels that are persistent on the storage device, so
that the label is available even after an operating system upgrade.
Refer to the Oracle Database Installation Guide for detailed information about these
configuration tasks.
n e n
N ara le lic
A standard Oracle a
e n r a b
Grid Infrastructure for standalone server installation requires a minimum of
4 GB RAM. or
L n s fe
Theramount
a tra space required is dependent on the amount of RAM:
en nof-swap
no 4 GB and 16 GB: Swap space should be equal to the size of the RAM
K Between
More than 16 GB: 16 GB
At least 6.9 GB of disk space is required for the installation and at least 1 GB of space in the
/tmp directory is required.
role separation:
Groups:
Oracle Inventory group (oinstall)
Oracle Grid Infrastructure groups for job role
separation:
OSDBA (asmdba)
OSASM (asmadmin) a
OSOPER (asmoper) ha s
m )
Users (software owners): o
a ilc e
Oracle Grid Infrastructure/Oracle Restart: grid
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a software
When you install Oracle
r a b on a system for the first time, the Oracle Universal Installer
L o nsand fe oraInst.loc. This file identifies the Oracle Inventory group
(OUI) creates ra file named
r e n -tra
(typically, oinstall) the path of the Oracle Inventory directory.
K a have
If you n oann existing central Oracle Inventory, you should use that Oracle Inventory for all
Oracle software installations. Ensure that all Oracle software users that will perform
installations have permissions to write to this directory.
Create the following operating system groups:
OSDBA: Administrative access to Oracle ASM instances
OSASM: Granted SYSASM p privileges
g to administer Oracle ASM
OSOPER: Granted SYSOPER privileges (limited administrative privileges)
Oracle recommends that you create separate software owners for Oracle Database and
Oracle Grid Infrastructure for a standalone server. Typically, the owner for Oracle Grid
Infrastructure is named grid. The grid user must be a member of the Oracle Inventory
group (oinstall), the OSDBA (asmdba) group, and the OSDBA group for each database.
Types of Installations
Software-only installation
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
n e n
N ara le lic
You can perform the
e n a following
r a btypes of installations:
Software-only
L s fe to install the software binaries for Oracle Restart and
or ninstallation
n ra age Management.
nuto at -ctStorage
reAutomatic Sto a age e t Manual a ua co configuration
gu at o is s required
equ ed to e enable
ab e tthe
e
a no after this type of installation.
K software
Installation of Oracle Grid Infrastructure for a standalone server with a new database
installation. With this type of installation, the database is automatically added to the
Oracle Restart configuration and is automatically restarted when required. Perform the
following steps:
1. Install Oracle Grid Infrastructure for a standalone server to install Oracle Restart
anddOOraclel ASM
ASM.
2. Configure Oracle ASM with at least one disk group.
3. Install Oracle Database and use ASM disk groups for the database files.
Installation of Oracle Grid Infrastructure for a standalone server on a host with an
existing database. Perform the following steps:
1. Select Configure Oracle Grid Infrastructure for a Standalone Server as the
i t ll ti option
installation ti when
h you iinstallt ll O
Oracle
l GGrid
id IInfrastructure.
f t t
2. Manually add the database, the listener, the Oracle ASM instance, all Oracle ASM
disk groups, and any database services to the Oracle Restart configuration.
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
To install the Oracle
e n r a b
a Grid Infrastructure software by using the Oracle Universal Installer (OUI),
log on to your
L orcomputer
n s feas a member of the administrative group that is authorized to install
r e n -tra to create and manage the database. Enter ./runInstaller from
the Oracle software and
K arelevant
the
n o ndirectory on the Oracle Database 12c installation media or download directory to
start the OUI.
On the Download Software Updates page you can supply My Oracle Support credentials so
that the OUI can download updates for the installation. You can also specify that the OUI use
software updates that you have previously downloaded or skip the updates completely.
The next page that is displayed is the Select Installation Option page, as shown in the
screenshot.
h t Select
S l t the
th option
ti appropriate
i t tto your situation
it ti and d click
li k N
Nextt tto proceed
d with
ith your
installation.
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
If you have an Oracle
e n b
a ASMrainstallation from an earlier release installed on your server, or in
L orAssistant
an existing Oracle fe installation, you can use Oracle Automatic Storage Management
Restart
n s
r e n -tra (Oracle ASMCA) to upgrade the existing Oracle ASM instance to 12c,
Configuration
and
K n on configure disk groups, Oracle ASM volumes and Oracle ASM file systems.
a subsequently
After the installation of the Oracle Grid Infrastructure Software only, Oracle ASMCA detects
that there is a prior Oracle ASM version installed in another Oracle ASM home. After installing
the Oracle ASM 12c binaries, you can start Oracle ASMCA to upgrade the existing Oracle
ASM instance.
Note: An Oracle ASM instance should be upgraded by using OUI. OUI automatically defaults
t upgrade
to d moded when
h it ddetects
t t an OOracle
l ASM iinstance
t att a previous
i release
l llevel.l
Summary
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
O
Oracle
l Restart
R t t
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Aula Matriz SAS
Objectives
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Oracle Restart
Oracle Restart ensures that the components are started in the proper order, in accordance
with component dependencies. If a component must be shut down, it ensures that the
dependent components are cleanly shut down first.
p
Oracle Restart operates inside Oracle Grid Infrastructure home.
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
n e n
N ara le lic
The wrapper scripta
e n sets up the
r a b environment variables and then starts the Oracle Restart
daemons and
L orprocesses.
n s fe
When
a r eancommand
n - trais used to stop Oracle Restart, the daemons will be stopped, but the
K
wrapper n o process will remain running.
script
The wrapper script is started with the respawn action so it will be restarted whenever it is
terminated. In addition, the respawn action causes the init process to restart the daemons if
they fail.
Some of the Oracle Restart daemons will be running under the root user with real-time
priority, and others will be running under the Grid Infrastructure owner with user-mode
priorities after they are started. On a Windows platform, operating system services are used
instead of wrapper initialization scripts and the daemons are executable binaries.
Note: Executing the wrapper script directly is not supported.
n e n
N ara le lic
The CRSCTL utilityacan be used
e n r a b to control the state of Oracle Restart. It can be used to
determine ifo
L
the
n s fecapability is enabled or disabled as follows:
r autostart
ra configg has
ren on$CRS-4622:
-tcrsctl
K a n Oracle High Availability Services autostart is enabled.
The control files for ohas are used to control the state of ohas and determine if automatic
restart is enabled or disabled. These are known as SCLS_SCR files. For Linux, the location of
the control files is defined to be:
/etc/oracle/scls_scr/$HOST/<Oracle Restart owner> and
/etc/oracle/scls_scr/$HOST/root
If the CRSCTL utility is used to stop Oracle Restart, all components currently managed by
Oracle Restart will also be stopped.
$ crsctl stop has
CRS-4549: Stopping resources.
CRS-2673: Attempting to stop 'ora.diskmon' on 'host01'
CRS-2673: Attempting to stop 'ora.DATA.dg' on 'host01'
CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'host01'
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
n e n
N ara le lic
e n b
a theraSRVCTL
Oracle Restart includes utility that you use to start, stop, and manage Oracle
configuration.
Create operations and the Oracle Restart Automatically added to
configuration configuration?
Create a database by using OUI or DBCA YES
Create a database by using a SQL statement NO
Create an ASM instance by using OUI, DBCA, or YES
ASMCA
Create a disk group (any method) YES
s a
Add a listener by
y using
g NETCA YES
) ha
Create a database service by using SRVCTL YES o m
a ilc e
otm t Guid
Create a database service by modifying NO
SERVICE_NAMES initialization parameter h
@ eNO n
Create a database service by using
e n a d
DBMS_SERVICE.CREATE SERVICE
l or is St u
(n v
a s e th
i l l us All rights reserved.
egand/ortitsoaffiliates.
j o V se
Copyright 2013, Oracle
r a n icen
N a le l
e n a aralistbof all the components that it manages, and maintains
Oracle Restart maintains
configuration
L r
information
oRestart n s fefor each component. All of this information is collectively known as
r e n -tra
the Oracle configuration. When Oracle Restart is installed, many operations that
K a Oracle
create
n o ncomponents using Oracle utilities will automatically add the components to the
Oracle Restart configuration. If a component is created manually without using an Oracle
utility, then SRVCTL commands can be used to add it to the Oracle Restart configuration if
desired. The table in the slide shows which create operations automatically add the
component to the Oracle Restart configuration and which create operations do not update the
Oracle Restart configuration.
Note: The same principle applies to delete operations
operations.
n e n
N ara le lic
When Oracle Restart
e n a b it is strongly recommended that you use the SRVCTL utility to
a is in ruse,
managefe
Lor rreasons:
start, stop, and all Oracle Restart components. The SRVCTL utility is recommended
n s
e n-t a between components are maintained. This enables Oracle Restart to
for the n
following
ar All dependencies
K startnoor to stop any dependent components first.
Components are started according to their Oracle Restart configuration.
Environment variables stored in the Oracle Restart configuration for the components are
set.
Oracle Restart components can also be started with other utilities such as the listener control
(LSNRCTL) utility or SQL
SQL*Plus
Plus, but the benefits listed above may not be obtained with other
utilities.
The options that are allowed vary with each command and component combination. The
SRVCTL utility syntax is as follows:
srvctl command component options
where:
command is a verb such as start, stop or remove
start stop,
component is the object on which SRVCTL performs the command, such as a
database
options extend the use of the preceding command to include additional parameters
Oracle Database 12c: Admin, Install and Upgrade Accelerated E - 10
Aula Matriz SAS
n e n
N ara le lic
The SRVCTL utilityaprovides b detailed online help for its commands, components, and options.
e n r a
fe you use the help (-h) option to display usage information. If the
To display theronline Help,
L o is then s
r e n -tra
help (-h) option only parameter specified, SRVCTL displays a general outline of all
a nowith
commands
K n the most common options used for each command and component
combination. This will not be a complete list of all supported options. For more detailed and
complete information, the help (-h) option can be used for a specific command, or for a
specific command and component combination.
components.
Examples of starting individual components:
$ srvctl
tl start
t t d
database
t b d
d PROD o mount
t
$ srvctl start listener l crmlistener
$ srvctl start service d PROD s "service1,service2"
$ srvctl start diskgroup g "DATA,FRA"
$ srvctl start asm
$ srvctl start eons -v
s a
$ srvctl start ons
) ha
o m
a i lc e
Example of starting all Oracle Restart components tm Ginuiad
specified Oracle home: h o t
a @
n state_file e n
$ srvctl start home o oracle_home l o res S tud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
The SRVCTL utilityacan be used
e n r a b to start individual components, along with any dependent
L or also
components that
n s fe
are necessary. For example, the srvctl start database d PROD
command
r e n -tra
may start the listener, the ASM instance, and multiple disk groups if those
a nonhave been defined as being managed by Oracle Restart and are listed as
components
K
dependent components to the PROD database.
The SRVCTL utility can also be used to start all components that are associated with a
specified Oracle home and have been configured for Oracle Restart with the following
command:
srvctl start home o /u01/app/oracle/product/12.1.0/dbhome_1 s
/usr/local/bin/group state file
/usr/local/bin/group_state_file
The state file contains the current state information for the components in the Oracle home
and is created when the srvctl status home command is executed. It is indicated with
the state file option (-s), and must specify the complete path of the state file. The state file
can be created in any directory.
Note: The options shown in the slide represent the most common options and are not a
complete list. You can use the help option (-h) for a complete list of all available options for
each command.
components.
Examples of stopping individual components:
$ srvctl stop database d
d PROD o
o transactional
$ srvctl stop listener l crmlistener -f
$ srvctl stop service d PROD s "service1,service2"
$ srvctl stop diskgroup g "DATA,FRA" -f
$ srvctl stop asm o immediate -f
$ srvctl stop eons -v
s a
$ srvctl stop ons
)ha
m
co
i l
Example of stopping all Oracle Restart components
o t ma uinidae
specified Oracle home: @ h nt G
$ srvctl stop home o oracle_homeors e nastate_file
t u de -f
( n vl his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
The SRVCTL utilityacan be used
e n r a b to stop individual components, along with any dependent
components that
L r mustsbe
owill n festopped. For example, the srvctl stop diskgroup g "DATA -
r e n -tra
f" command force an unmount of the diskgroup even if files are open in it. It will also stop
alladatabase
K n oninstances that depend on the DATA disk group.
The SRVCTL utility can also be used to stop all components that are associated with a
specified Oracle home and have been configured for Oracle Restart with the following
command:
srvctl stop home o /u01/app/oracle/product/12.1.0/dbhome_1 s
/usr/local/bin/group_state_file -f
This can b
Thi be very useful
f l when
h it iis necessary tto stop
t allll components
t such
h as when
h you need
d
to apply a patch to the software binaries.
Note: The options shown in the slide represent the most common options and are not a
complete list. You can use the help option (-h) for a complete list of all available options for
each command.
n e n
N ara le lic
e n a rutility
You can use the SRVCTL
a b to view the running status (running or not running) for any
component o
L r
managed
n
by
s feOracle Restart. Additional information is displayed for some
a r en n-tra
components.
K noof the command is as follows:
The format
srvctl status object [options]
object can be one of the following:
asm: ASM instance
database (db): Database instance
diskgroup (dg): Oracle ASM disk group
filesystem: Oracle ASM file system
home: Oracle home or Oracle Clusterware home
listener(lsnr): Oracle Net listener
ons, eons: Oracle Notification Services
service (serv): Database service
Refer to the Oracle Database Administrators Guide for a list of options for each of the listed
objects.
r a n icen
N a le l
e n a rutility
You can use the SRVCTL
a b to display the Oracle Restart configuration of a component
L or command.
with the config
n s fe The config command is valid for the database, service,
n -tra
asm, listener,
r e ons, and eons components.
K
The n on for an Oracle Restart component can be modified with the SRVCTL utility
a configuration
modify command. The following syntax shows an example of how to modify the database
with the unique name of orcl to use a different, nonstandard directory for the server
parameter file (SPFILE).
srvctl modify database d orcl p
/usr/local/oracle/spfileorcl.ora
n e n
N ara le lic
The SRVCTL utilityacan be used
e n r a b to manually add components to the Oracle Restart
L or the
configuration with
n fe command. If the component was created with an Oracle utility such
add
s
r e n -tra
as NetCA, DBCA, ASMCA, or OUI, it would have been automatically added to the Oracle
K n on
a configuration
Restart and it would not be necessary to manually add it.
The slide illustrates manually adding a new listener called MYLISTENER to the Oracle Restart
configuration. The listener will use the software binaries of the Grid home installation, but will
depend on a nonstandard location for the networking files. For this example, it is assumed
that the listener.ora networking file has been created in the /usr/local/oracle
directory. The setenv command of the srvctl utility is used to define environment variables
that may be needed for specific components
components. The TNS_ADMIN
TNS ADMIN environment variable is set to
the nondefault location of the listener.ora file, and is defined only for the listener named
MYLISTENER. This will not have an impact on any other listeners that may already exist and
that use different directories for the networking files.
The SRVCTL utility includes a remove command to manually delete a component from the
Oracle Restart configuration. To delete the listener created above, use the following syntax:
srvctl remove listener l mylistener f
This will also remove the environment variable that was associated with the listener.
Quiz
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
Answer: a, b, d na
e r a b
r
Lo ransf e
n
re on-t
K a n
Summary
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
W ki
Working with
ith Oracle
O l Support
S t
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
Aula Matriz SAS
Objectives
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
support.
Support is delivered in the following ways:
My Oracle Support website
Telephone
Oracle Direct Connect (ODC) remote diagnostic tool
The Customer Support Identifier (CSI) number is used to
track the software and support that are licensed to each a
customer.
customer ) has
i l com
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a (OSS)
Oracle Support Services
r a b provides 247 solution support to all Oracle customers
L oisrrequired,
throughout the fe has support centers around the globe to provide this coverage
world. OSS
n s
whenever
r e n -tra 365 days a year.
it
K
Support n
a nis odelivered to Oracle customers through the My Oracle Support Web site, on the
telephone, and by using the Oracle Direct Connect (ODC) remote diagnostic tool.
After purchasing Oracle software, customers are provided with a Customer Support Identifier
(CSI) number. This number is used to track the software and support licensed to each
customer. The CSI number provides access to all the available patches, documentation, and
troubleshooting information on My Oracle Support. The CSI number enables customers to log
a service
i requestt (SR) with
ith OSS.
OSS
Note: Service requests were formerly called technical assistance requests (TARs).
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a Support,
To register for My Oracle
r a b go to http://myoraclesupport.oracle.com/ and click the
L r
New User?oRegister
n s fe link. At the prompt, enter your CSI number and answer a few
here
r e n -tra
basic questions. After registering, you are ready to use My Oracle Support. Note that each
K a number
CSI
n o nhas an administrator designated by the customer who controls new-user access
to My Oracle Support. Customers must designate this individual, and then new users must
work with this individual to create new accounts and grant appropriate My Oracle Support
access.
My Oracle Support has a variety of tools and methods available for researching problems.
Searching for answers on My Oracle Support through the standard and advanced search
engines
i iis relatively
l ti l straightforward.
t i htf d A common problem
bl iis th
thatt ttoo many results
lt are returned.
t d
The following are some simple steps that can improve the quality and relevance of search
results:
Use full and exact error text when performing your search. For example, ORA-1400:
mandatory (NOT NULL) column returns more relevant answers than ORA-1400.
When researching errors in Oracle E-Business Suite, enter the name of the code as part
p , APXINWKB ORA-1400: mandatory
of the search criteria. For example, y (
(NOT
NULL) column returns fewer and better results than if you supply only the error
message.
You can use the Knowledge tab to access the Knowledge Browser if you prefer a drilldown
method of searching for information rather than searching by keyword. The Knowledge Browser
provides easy-to-use access to OSSs most frequently used technical content.
g Browser is organized
The Knowledge g to p
provide up-to-date
p information at y
your fingertips:
g p
Recent announcements and information in the Featured News and Articles section
Information by product category
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
Case studies
Tools and training
Online documentation
Electronic technical reference manuals (eTRMs)
Oracle Integration Repository
Customer Knowledge Exchange
My Oracle Support Forums (Forums) enables you to interact with other Oracle customers to
share ideas and discuss Oracle products. You can use My Oracle Support Forums to find out
how other customers perform complex tasks or meet various business requirements with Oracle s a
products You should not use Forums as a substitute for logging an SR
products. SR. )h a
Customers can use the patch engine to search for patches by using a varietyof
m
comethods. The
i l
following are the most common patch searches:
o t ma uide
Patch Number: If you know the patch number, you can enter
@ h it. nt G
Latest Consolidated Patch: You can use this when e a
nupgradingdtoe determine the latest
r t u
patches for the products you are using.
( n vlo his S
Includes File: When a problem is encountered
g a s sine at specific piece of code code, a patch is often
e
available to fix the issue. For thisllreason, u
support representatives often recommend that
ttoothe most current version available for the
Vi code
customers apply a patch tooupdate
j s e
release. You can findra n apply
and c e n latest versions of Oracle software by identifying the
the
Naof thebcodel i
name and version
n a a le and then using the patch search utility to find out whether a
o r e sfer
more current version of the code is available.
Note: Forn Ldetailedr n
ainformation about performing these searches, refer to My Oracle Support
r
a no e
Technical - t
n 166650.1 (Working Effectively with Global Customer Support).
Note
K
You can use the BUGs link to search the BUG database when researching issues. A variety of
methods are available for searching the BUG database.
Researching an Issue
following steps:
1. Perform a keyword search.
2 Review the documentation
2. documentation.
3. Use the self-service toolkits.
4. Use the automated diagnostic tests and business flows.
5. Search for applicable patches.
6. Log a service request (SR). s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n r a b
My Oracle Supportaprovides several resources that can be used to research an issue. The
L or outline
following steps
n s fe troubleshooting techniques that use My Oracle Support
basic
a r en n-tra
resources:
no search: Most issues can be resolved quickly and easily by using the keyword
K1. Keyword
search utility on My Oracle Support. Effective searches can provide much information
about a specific problem and its solutions.
2. Documentation: If keyword searching fails to yield a solution, you should review the
documentation to ensure that setup problems are not the root cause. Setup issues
account for more than one-third of all service requests; it is always good to review
setups early in the troubleshooting process.
process Documentation consists of user guides and
implementation manuals published in PDF format as well as product README files and
installation notes published in HTML. Both of these document types are available on My
Oracle Support and can be accessed through the self-service toolkits for each product.
in the area of automated diagnostic tests and business flows. Tests and flows have been
created for you to check the setup of your system or gather information about a problem.
In the case of diagnostic tests, this can be done by running a Java or SQL script. The
output
p of these tests can helpp yyou in resolving
g issues and can also help
p Oracle Support
pp
Services identify the cause of your problem if it becomes necessary to log a service
request.
5. Patches and BUGs: There are times when BUGs are found in Oracle products, and
patches are required to correct the problem. When troubleshooting a problem, you should
review your system to see whether patches are available to provide you with a more
a
recent release of the product. With the patch search tool, you can search for patches that
s
contain specific files. ha
files Searching for the latest code and patching your environment to the
)
o m
most recent version improves the troubleshooting process by eliminating existing BUGs
a ilc e
that could be possible candidates for the problem. You should also leverage the BUG
otm t Guid
search engine to see whether a BUG has been logged for your issue but not yet fixed.
h
a @ en
6. Logging a service request (SR): When all self-service options fail, it may become
n
l o re Stud
necessary to engage a support representative to assist in resolving your issue.
( n v his
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
n e n
N ara le lic
You may research a
e n an issue on
r a b My Oracle Support, but may be unable to locate a solution. In
this case, you
L orshould
n s fea service request (SR) through My Oracle Support. You can log an
log
r e n -tra
SR by clicking the Service Request tab on the My Oracle Support home page.
K
The onin creating an SR is the selection of a CSI number and SR profile. After the
a first nstep
required profile information has been submitted, My Oracle Support gathers some specifics
about the problem, including the problem type, error message, brief summary of the issue,
and language preference. My Oracle Support performs a search by using this information and
attempts to find a solution.
The search conducted during this phase may provide different results than the searches you
h
have performed
f d earlier.
li B Both
th searches
h retrieve
ti notes
t and d BUGs
BUG ffrom th
the same d
database;
t b
however, the search engines and weighting are slightly different. Because the search results
can differ, it is important that the search results are reviewed during the SR creation process,
even if previous searches have been conducted by using the My Oracle Support search
engine.
If the search results fail to resolve the issue, the SR creation process continues with a series of
questions and requests for information. After the questions are answered, the SR is submitted
electronically and routed to a support representative who analyzes the issue further. Any files,
screenshots, or other additional information must be uploaded immediately after the SR is
logged by using the upload utility provided in the SR section of My Oracle Support.
You must ensure that the following items are clearly documented in the SR. By providing the
following information, you can equip the support representative effectively to prioritize and work
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
on the issue:
Clear explanation of the problem, including exact error messages
Explanation of the steps taken to troubleshoot the problem and the findings
Exact versions of the software
Steps required to reproduce the problem
Business impact of this issue, including milestones, dates, and costs
Each SR is assigned a unique identifier called an SR number. When you log an SR, My Oracle
Support provides you with the SR number (or your support representative advises you about the
s
SR number if you log the SR by telephone). The support representative subsequently receives
a
th SR iin hi
the his or h
her queue th
throughh an automated
t t d allocation
ll ti process th
thatt O )
Oracle
l Sh a
Supportt
o m
a ilc e
Services uses to distribute all phone- and web-sourced service requests. This automated
process ensures that all SRs are assigned to the support representative who is best able to
work on the specific issue that is being reported. h otm t Guid
n a @ Notee166650.1
n
Note: For more information, refer to My Oracle Support Technical
r e t u d (Working
Effectively with Global Customer Support).
( n vlo his S
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
My Oracle SupportaCommunity
e n r a b is a multi-channel interactive community for sharing
information,o
L
posting
n s fe and answers, and providing suggestions about Oracle
r questions
products,
r e n -tra related technologies.
services, and
K a have
If you n n to My Oracle Support you are automatically a member. There is no
oaccess
additional registration required.
Managing Patches
Kinds of patches
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
Interim patches
For specific issues
No regression testing
Security Patch Updates (SPUs)
Critical security issues
Regression testing
Does not advance version number s a
)h a
Patch
P hS Set U Updates
d (PSU
(PSUs)) m
Patch releases i l co
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a kinds
You can apply different
r a bof patches at different times for different reasons.
L r
Interimopatches
n s fe known as one-off or one-of patches) are created to solve a specific
(also
n e n
N ara le lic
Software management
e n a involves
r a b keeping your Oracle software up-to-date with the latest
product fixes.
L ofully n s fe Oracle issues patch releases (product fixes) for its software. Patch
rPeriodically,
releases
r e n -tra product fixes. Application of a patch release affects only the software
are tested
a ninoyour
residing
K n Oracle home, with no upgrade or change to the database.
Patches are individual bug fixes. Patch sets are a collection of bug fixes up to the time of the
patch set release. All patch and patch set releases carry version numbers. For example,
11.1.0.3 is an available patch set for Oracle Database 11g Release 11.1.0.2. Every patch or
patch set also has a patch number to identify it. Every patch release has an associated
README file that describes its bug fixes. The README also has instructions for manually
applying the patch.
patch
Enterprise Manager enables you to find the latest patch release on the My Oracle Support
website and download it to your Oracle home.
n e n
N ara le lic
a raCloud
Oracle Enterprise Manager
e n b Control significantly facilitates software patching with its
r Support
built-in My Oracle
Locritical n s fe integration. Enterprise Manager Cloud Control automatically alerts
users tonnew
r e - t r a patches and flags all systems that require a specific patch. You can
invoke
K n
a thenoEnterprise Manager Cloud Control patch wizard to determine what interim patches
are available for installation. Alternatively, you can use the patch wizard to select an interim
patch and determine whether any of your systems require that patch. You can review the
patch details and README patch notes directly from within Enterprise Manager Cloud
Control.
You can use the patch wizard to download interim patches from My Oracle Support into the
Enterprise Manager Cloud Control patch cache,
cache eliminating the need for repeated downloads.
downloads
You can stage appropriate patches on the destination system or systems for manual
application at a later time. To further automate the patching process, you can also provide a
customizable patch application script that is executed on the destination system at a user-
defined time by the resident Enterprise Manager Cloud Control agents. As patches are
applied to a system, the corresponding Oracle Universal Installer (OUI) inventory is
automatically updated to keep track of the systems correct patch level.
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
In Enterprise Manager
e n a Cloudr a bControl, you can access the Patches & Updates page by
L r
expanding Enterprise
othat n s fe selecting Patches & Updates in the Provisioning and Patching
and
r e n -tra
menu. Note this menu is at the Enterprise, not database target level.
In a
K the Patch
n onSearch section, you can search for patches by patch number and name, you can
search for all patches for a specific product, and you can invoke the Patch Advisor. The Patch
Advisor enables you to search for recommended patches for specified products and
combinations of products.
Refer to the Enterprise Manager Cloud Control documentation and online help for additional
information. You may also want to attend the Using Oracle Enterprise Manager Cloud Control
12 course for
12c f detailed
d t il d iinformation
f ti about
b t using
i E Enterprise
t i M Manager Cl
Cloud
dCControl.
t l
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a the
Online patching provides
r a bability to install, enable, and disable a bug fix or diagnostic patch
L n s feinstance. Using online patching is the recommended solution for
or timeOracle
on a live, running
avoiding
r e n -tra
down when applying online patches. Oracle provides the capability to perform
K a patching
online
n o n with any Oracle database using the opatch command-line utility. Online
patches can be provided when the changed code is small in scope and complexity (for
example, with diagnostic patches or small bug fixes).
n e n
N ara le lic
e n a b
a rmechanisms,
Unlike traditional patching applying an online patch does not require instance
L r
shutdown ororestart.
n s fe
a n - tra patching, you can use OPatch to install an online patch.
rento traditional
Similar
K
You can n o
determine whether a patch is an online patch by using the following commands:
opatch query -is_online_patch <patch location> or
opatch query <patch location> -all
Note: The patched code is shipped as a dynamic/shared library, which is then mapped to
memory by each Oracle process.
n e n
N ara le lic
You do not have toashut downbyour database instance while you apply the online patch.
r en patching,
Unlike conventional
o f e ra online patching enables fast installation and uninstallation.
Becausen L patching
online
t r a ns uses OPatch, you get all the benefits that you already have with
e -
ar nonpatching
conventional that uses OPatch. It does not matter how long or how many times you
K
shut down your databasean online patch always persists across instance shutdown and
startup.
n e n
N ara le lic
Conventional patching
e n a basically
r a b requires a shutdown of your database instance.
or does
Online patching
L n s ferequire any down time. Applications can keep running while you
not
install
r n ra Similarly, online patches that have been installed can be uninstalled
n online-tpatch.
ean
K a no time.
with no down
n j o
e n se
N ara le lic
One operating system
e n b is typically 4 KB on Linux x86 and 8 KB on Solaris
a (OS)rapage
L fe of approximately one thousand Oracle processes running at the
or represents
SPARC64. With an average
n s
r e n -tra
same time, this around 4 MB of extra memory for a small online patch.
Aa
K on of diagnostic patches are available as online patches. For bug fixes, it really
vast majority
n
depends on their nature. Not every bug fix or diagnostic patch is available as an online patch.
But the long-term goal of the online-patching facility is to provide online-patching capabilities
for Critical Patch Updates.
Note: You must uninstall the online patch before applying the conventional patch.
Quiz
patches?
a. Can be installed using OPatch
b Require down time to apply
b.
c. Persist across instance startup and shutdown
d. Do not require down time to remove
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
Answer: a, c, d na
e r a b
r
Lo ransf e
n
re on-t
K a n
View critical
1 error alerts in
Unauthorized reproduction or distribution prohibited Copyright 2014, Oracle and/or its affiliates
Enterprise Manager.
n e n
N ara le lic
Using the Enterprise
e n a Managerr a bCloud Control Support Workbench, you can investigate, report,
and (in some
L s fe a problem by performing the following general steps:
orcases)nresolve
a
n the
r OOn
1. e
n - tra Home
t e Database
atabase o e page in Enterprise te p se Manager,
a age , review e e ccriticalt ca e
erroro a alerts.
e ts View
e
o by selecting an alert.
K thendetails
2. Examine the problem details and view a list of all incidents that were recorded for the
problem. Display findings from any health checks that were automatically run.
3. (Optional) Run additional health checks and invoke the SQL Test Case Builder, which
gathers all required data related to a SQL problem and packages the information in a
way that enables the problem to be reproduced at Oracle Support.
4. Create a service request with My Oracle Support and (optionally) record the service
request number with the problem information.
5. Invoke the Incident Packaging Service, which packages all gathered diagnostic data for
a problem and (optionally) uploads the data to Oracle Support. You can edit the data to
remove sensitive information before uploading.
6. You can maintain an activity log for the service request in the Support Workbench. Run
Oracle advisors to help repair SQL failures or corrupted data.
data
7. Set the status for one, some, or all incidents for the problem to be closed.
s a
)ha
Click to access the m
co
Problem Details page.
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n r a b
You can access theaSupport Workbench page directly by expanding the Oracle Database
L or selecting
menu, and then
n s feSupport Workbench in the Diagnostics submenu.
Note:
r n tasks
eThe - a
trdescribed in this section are all performed in Enterprise Manager Cloud
K a
Control. o
You
n n
can also accomplish all of these tasks with the ADRCI command-line utility. See
the Oracle Database Utilities guide for more information about the ADRCI utility.
s a
Click to access the ) ha
o m
ilc e
Incident Details page.
a
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a ron
On the Problems subpage
a bthe Support Workbench page, click the ID of the problem that
you want to o
L r
investigate.
n s feThis takes you to the corresponding Problem Details page.
a r - tracan see all incidents that are related to your problem. You can associate
enpage,nyou
On this
K o with a My Oracle Support service request and bug number. In the Investigate
your problem
n
and Resolve section of the page, you see a Self Service subpage that has direct links to the
operations that you can perform for this problem. In the same section, the Oracle Support
subpage has direct links to My Oracle Support.
The Activity Log subpage shows you the system-generated operations that have occurred on
your problem so far. This subpage enables you to add your own comments while investigating
th problem.
the bl
On the Incidents subpage, you can click a related incident ID to access the corresponding
Incident Details page.
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
When you access the
e n a Incident
r a bDetails page, the Dump Files subpage lists all corresponding
Loitsr various
dump files. You can then
n s feclick the eyeglass icon for a particular dump file to visualize the file
contentnwith
r e - t r a sections.
K n on Details page, click Checker Findings to view the Checker Findings subpage.
Onathe Incident
This page displays findings from any health checks that were automatically run when the
critical error was detected. You will usually have the opportunity to select one or more findings
and invoke an advisor to fix the issue.
s a
)ha
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a provides
The Support Workbench
r a b two methods for creating and uploading an incident
package: the
L oQuickn s fe method and the Advanced Packaging method. The example in
r Packaging
r e n -tra use Quick Packaging.
the slide shows how to
K
Quick n on is a more automated method with minimum steps. You select a single
a Packaging
problem, provide an incident package name and description, and then schedule the incident
package upload, either immediately or at a specified date and time. The Support Workbench
automatically places diagnostic data related to the problem into the incident package, finalizes
the incident package, creates the ZIP file, and then uploads the file. With this method, you do
not have the opportunity to add, edit, or remove incident package files or add other diagnostic
data such as SQL test cases.
cases
If you have not registered with My Oracle Support, a link will appear so that you can register.
You must register with My Oracle Support to send the package to Oracle Support.
s a
)h a
m
co
i l
o t ma uide
@ h nt G
r e na tude
( n vlo his S
g a s se t
ille and/or t o u
j o V
Copyright 2013, Oracle
se
its affiliates. All rights reserved.
n e n
N ara le lic
e n a b
a rinformation
After uploading diagnostic to Oracle Support, you can perform various activities to
L or request
track the service
n s feand implement repairs. Among these activities are the following:
r Add
e
n - rae bug number
ndd aan OOracle
tac u be to tthe epproblem
ob e information.
o at o O On tthe e Problem
ob e Details
eta s page,
a
K clicknothe Edit button that is adjacent to the Bug# label. This is for your reference only.
Add comments to the problem activity log:
1. Access the Problem Details page for the problem.
2. Click Activity Log to display the Activity Log subpage.
3. In the Comment field, enter a comment and then click Add Comment.
Your comment is recorded in the activity y log.
g
Respond to a request by Oracle Support to provide additional diagnostics. Your Oracle
Support representative can provide instructions for gathering and uploading additional
diagnostics.
Summary
n e n
N ara le lic
r e na ferab
n Lo rans
a re on-t
K n
s a
) ha
o m
a ilc e
h otm t Guid
n a @ en
l o re Stud
( n v his
g a s se t
V ille e to u
r a njo icens
N a le l
r e na ferab
n Lo rans
a re on-t
K n