Documente Academic
Documente Profesional
Documente Cultură
ble
fe r a
ans
n - t r
a no
Oracle Database
h a s 11g:ฺ New
r ) e
Features
m uid
ฺa forGAdministrators
n ฺ co ent
@ ao Stud
z i l le thVolume
is II • Student Guide
c e loฺ use
a r to
m e
i l l e ( icens
e loZ l
Marc
D50081GC21
Edition 2.1
September 2010
D63698
Authors Copyright © 2009, 2010, Oracle and/or it affiliates. All rights reserved.
license, post, transmit, or distribute this document in whole or in part without the
Donna Keesling express authorization of Oracle.
Deidre Matishak
James Spiller The information contained in this document is subject to change without notice. If you
Jenny Tsai 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
Jean-Francois Verrier warranted to be error-free.
James Womack
Marcie Young Restricted Rights Notice
n ฺ
Jacco Draaijer
Al Flournoy
@ ao Stud
Steve Fogel
z i l le this
Andy Fortunak
c e loฺ use
Gerlinde Frenzen
a r to
Greg Gagnon m e
GP Gongloor
i l l e ( icens Technical Contributors
oZ
Joel Goodman
e l
Hansen Han
l and Reviewers
arc
Tim Shetler
Uwe Hesse Eric Siglin
M Sunil Hingorani Ranbir Singh
Magnus Isaksson Jeff Skochil
Susan Jang George Spears
Martin Jensen Kesavan Srinivasan
Dominique Jeunot Birgitte Taagholt
Pete Jones Glenn Tripp
Yash Kapani Branislav Valny
Pierre Labrousse Anthony Woodell
Richard.W.Lewis
Hakan Lindfors Editors
Russ Lowenthal
Aju Kumar
Kurt Lysy
Amitha Narayan
Isabelle Marchand
Silvia Marrone
Publishers
Heejin Park
Srinivas Putrevu Sujatha Nagendra
Jagannath Poosarla Michael Sebastian Almeida
Surya Rekha Jobi Varghese
Contents
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
I Introduction
Overview I-2
Oracle Database Innovation I-3
Enterprise Grid Computing I-4
Oracle Database 11g: Focus Areas I-5
Management Automation I-7
Self-Managing Database: The Next Generation I-8 ble
Suggested Additional Courses I-9 fe r a
ans
Further Information I-10
n - t r
Suggested Schedule I-11 o
s an
1 Oracle Grid Infrastructure r ) ha deฺ
Objectives 1-2 m ฺa Gui
Oracle Grid Infrastructure 1-3 n ฺ co ent
Automatic Storage Management Technology
@ ao Stack S tud1-4
z
Oracle Grid Infrastructure and i l le Database
Oracle t h is Installation: System
Requirements 1-5cel
oฺ use
a r System
to 1-6
Preparing the Operating
m e
l l e ( iceVariables
Setting iEnvironment ns 1-7
Z l
lo the System Requirements 1-8
r c eChecking
Ma Defining Ownership of OS Devices for ASM 1-9
Installation Scenario 1-10
Part One: Installing the Oracle Grid Infrastructure for Stand-Alone Server 1-11
Selecting Product Languages 1-12
Creating an ASM Disk Group 1-13
Defining ASM Passwords 1-14
Defining Privileged Operating System Groups 1-15
Specifying Installation Location 1-16
Creating Inventory 1-17
Performing Prerequisite Checks 1-18
Verifying Installation Summary Data 1-19
Monitoring Installation Progress 1-20
Executing root Configuration Scripts 1-21
Executing Configuration Assistants 1-22
Finishing the Installation 1-23
iii
Configuring the FRA Disk Group 1-24
Oracle Local Registry 1-25
Quiz 1-27
Practice 1-1: Overview 1-28
ASM Files and Volumes 1-29
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
e oZ
Quiz 1-51
l l
Marc Summary 1-52
Practice 1-2: Overview 1-53
2 Installation Enhancements
Objectives 2-2
Oracle Database 11g Installation: Changes 2-3
Part Two: Installing the Oracle Database Software 2-6
Choosing the Type of Installation 2-7
Choosing Grid Installation Options 2-8
Choosing Language Settings 2-9
Choosing the Database Edition 2-10
Specifying Installation Location 2-11
Choosing Operating System Groups 2-12
Performing Prerequisite Checks 2-13
Installation Summary Page 2-14
Install Product Page 2-15
iv
Installation Finish Page 2-16
Quiz 2-17
Practice 2-1: Overview 2-18
Oracle Database 11g Release 2 Upgrade Paths 2-19
Deprecated Features in Oracle Database 11g Release 1 and Release 2 2-20
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
4 ASM Enhancements
Objectives 4-2
Without ASM Fast Mirror Resync 4-3
v
ASM Fast Mirror Resync: Overview 4-4
Using Enterprise Manager to Perform Fast Mirror Resync 4-5
Setting Up ASM Fast Mirror Resync 4-7
ASM Preferred Mirror Read: Overview 4-9
ASM Preferred Mirror Read: Setup 4-10
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
5 Storage Enhancements
Objectives 5-2
Supporting 4 KB Sector Disks 5-3
vi
Using 4 KB Sector Disks 5-4
Specifying the Disk Sector Size 5-5
Using the SECTOR_SIZE Clause 5-6
Creating a Database with 4 KB Sector Disks 5-7
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
vii
Considerations and Usage Notes 6-12
Quiz 6-13
Review: Degree of Parallelism (DOP) 6-14
Review: PARALLEL Clause 6-16
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
7 Oracle SecureFiles
Objectives 7-2
Managing Enterprise Information 7-3
viii
Issues with Existing LOB Implementation 7-4
Oracle SecureFiles 7-5
Enabling SecureFiles Storage 7-6
SecureFiles: Storage Options 7-7
SecureFiles: Advanced Features 7-8
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
ix
Managing Fine-Grained Access to External Network Services 8-21
Supporting IPv6 Address Notification 8-23
Connecting to the Oracle Database 8-24
IPv6 Supported in Java Interfaces 8-25
Summary 8-26
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
e oZ l
Using Enterprise Manager to Access SQL Performance Analyzer 9-18
l
Marc SQL Performance Analyzer: PL/SQL Example 9-19
Tuning Regressed SQL Statements 9-21
Testing Database Upgrades: Oracle9i Database and Oracle Database 10g
Release 1 9-22
Testing Database Upgrades: Oracle Database 10g Release 2 and
Later Releases 9-25
SQL Performance Analyzer: Data Dictionary Views 9-28
Summary 9-29
Practice 9: Overview 9-30
x
Viewing Important Baseline SQL Plan Attributes 10-8
Important Baseline SQL Plan Attributes 10-9
SQL Plan Selection 10-10
Quiz 10-12
Possible SQL Plan Manageability Scenarios 10-13
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
xi
Automatic SQL Tuning in Oracle Database 11g 12-4
Summary of Automation in Oracle Database 11g 12-5
Selecting Potential SQL Statements for Tuning 12-6
Maintenance Window Timeline 12-7
Automatic Tuning Process 12-8
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
xii
I/O Calibration and Enterprise Manager 13-27
I/O Calibration and the PL/SQL Interface 13-28
I/O Statistics: Overview 13-30
I/O Statistics and Enterprise Manager 13-32
Practices 13-2 and 13-3: Overview 13-34
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
xiii
Track the SR and Implement Repairs 14-24
Creating User-Reported Problems 14-25
Enterprise Manager Support Workbench for ASM 14-26
Invoking IPS Using ADRCI 14-27
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
Quiz 14-29
Health Monitor: Overview 14-30
Running Health Checks Manually: Enterprise Manager Example 14-32
Running Health Checks Manually: PL/SQL Example 14-33
Viewing HM Reports Using the ADRCI Utility 14-34
SQL Repair Advisor: Overview 14-35
Accessing the SQL Repair Advisor Using Enterprise Manager 14-36
Viewing, Disabling, or Removing a SQL Patch 14-37 ble
Using SQL Repair Advisor from PL/SQL: Example 14-38 fe r a
ans
Using the SQL Test Case Builder 14-39
n - t r
Quiz 14-40 o
Summary 14-41 s an
Practice 14: Overview 14-42
r ) ha deฺ
m ฺa Gui
15 Real-Time SQL Monitoring n ฺ co ent
Objectives 15-2
@ ao Stud
SQL Monitoring 15-3 z i l le this
ฺ
loDatabase e Release 2 15-5
s11g
SQL Monitoring in Oracle
c e
r Enterprise u
SQL Monitoring with
m a e to Manager Database Control 15-6
Monitored
i l l eSQL( Executions
c e ns 15-7
SQL
l o Z
Monitoring li 15-8
List
e
Marc Monitored SQL Execution Details 15-9
SQL Execution Details for Parallel Queries 15-10
Details for Parallel Execution 15-11
Activity Details for Parallel Execution 15-12
Viewing Session Details 15-13
SQL Details 15-14
Viewing the SQL Monitoring Report 15-15
Quiz 15-16
Summary 15-17
Practice 15-1: Overview 15-18
16 Performance Enhancements
Objectives 16-2
Using the DBMS_ADDM Package 16-3
Advisor Named Findings and Directives 16-6
xiv
Modified Advisor Views 16-7
New ADDM Views 16-8
Quiz 16-9
Review: Oracle Database 10g SGA Parameters 16-10
Review: Oracle Database 10g PGA Parameters 16-11
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
e oZ l
Multicolumn Statistics: Overview 16-39
l
Marc Expression Statistics: Overview 16-41
Deferred Statistics Publishing: Overview 16-42
Deferred Statistics Publishing: Example 16-44
Quiz 16-45
Locking Enhancements 16-46
Identify Foreground and Background Process Events 16-47
Summary 16-48
Practice 16: Overview 16-49
xv
Usage Guidelines to Reduce Invalidation 17-9
Invisible Index: Overview 17-10
Invisible Indexes: Examples 17-11
Adaptive Cursor Sharing: Overview 17-12
Adaptive Cursor Sharing: Architecture 17-13
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
xvi
Parallel Backup and Restore for Very Large Files 18-13
Using RMAN Multisection Backups 18-14
Quiz 18-15
Duplicating a Database 18-16
Performing Active Database Duplication 18-17
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
xvii
Flashback Data Archive: Supporting Transparent Schema Evolution 19-17
Flashback Data Archive: Supporting Full Schema Evolution 19-18
Viewing Flashback Data Archives 19-19
Guidelines and Usage Tips 19-20
Quiz 19-21
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
xviii
Appendix A: Practices and Solutions
xix
Using Destination Groups for Multiple Destination Jobs B-40
Using CREATE_GROUP B-41
Using ADD_GROUP_MEMBER B-42
Using DROP_GROUP B-43
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
xx
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
Diagnosability Enhancements
ble
fe r a
ans
n - t r
o
s an
r ) ha deฺ
m ฺa Gui
n ฺ co ent
@ ao Stud
z i l le this
ฺ
loCopyright e
s2009,
r c e o u© Oracle. All rights reserved.
a t
l e (m ense
i l lic
el oZ
Marc
Objectives
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
Change assurance
and Automatic Proactive
Intelligent
Diagnostic patching
automatic health resolution
checks
Workflow
ble
fe r a
t r a ns
Diagnostic Solution
o n- Delivery
s an
Prevention Resolution
r ) ha deฺ
m ฺa Gui
n ฺ co ent
@ ao Stud
z i l le this
ฺ
loCopyright e
s2009,
r c e o u© Oracle. All rights reserved.
a t
l e (m ense
l
Zi 11glicFault Management
Oracle Database
l o
e of the fault diagnosability infrastructure are the following:
The
a rcgoals
M • Detecting problems proactively
• Limiting damage and interruptions after a problem is detected
• Reducing problem diagnostic time
• Reducing problem resolution time
• Simplifying customer interaction with Oracle Support
DBA
Alert DBA
Auto incident creation
1 2 Targeted health checks
First failure capture Assisted SR filling
ble
fe r a
No Known
ans
DBA -
bug?
n t r
a no
h a s ฺ Yes
EM Support Workbench:
ฺ a r) uide
4 Package incident info EM Support m nt G
coWorkbench:
Data Repair ฺ
Applynpatch/Data
o derepair 3
@ a S t u DBA
z i l le this
ฺ
loCopyright e
s2009,
r c e o u© Oracle. All rights reserved.
a t
l e (m ense
Ease Diagnosis:
l
Zi Automaticlic Diagnostic Workflow
e l o
An
a rcalways-on, in-memory tracing facility enables database components to capture diagnostic
Mdata upon first failure for critical errors. A special repository, called Automatic Diagnostic
Repository, is automatically maintained to hold diagnostic information about critical error
events. This information can be used to create incident packages to be sent to Oracle Support
Services for investigation.
Here is a possible workflow for a diagnostic session:
1. Incident causes an alert to be raised in Enterprise Manager.
2. The DBA can view the alert via the Enterprise Manager Alert page.
3. The DBA can drill down to incident and problem details.
4. DBA or Oracle Support Services can decide or ask for that information to be packaged
and sent to Oracle Support Services via My Oracle Support. The DBA can add files to the
data to be packaged automatically.
CORE_DUMP_DEST
USER_DUMP_DEST
$ORACLE_HOME/log
ADR
Base
diag
rdbms
DB
ble
Name
fe r a
ADR metadata
ans
Home
SID
n - t r
a no
alert cdump incpkg incident hm trace
h s ฺ
(others)
a
incdir_1 … incdir_n ฺ a r) uide
ADRCI ฺ c om ent G
log.xml
a on tud alert_SID.log
V$DIAG_INFO
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Automatic Z i l
Diagnostic lic Repository (ADR)
l o
ADR
a rceis a file-based repository for database diagnostic data such as traces, incident dumps and
M packages, the alert log, Health Monitor reports, core dumps, and more. It has a unified
directory structure across multiple instances and multiple products stored outside of any
database. It is, therefore, available for problem diagnosis when the database is down.
Beginning with Oracle Database 11g Release 1, the database server, Automatic Storage
Management (ASM), Cluster Ready Services (CRS), and other Oracle products or components
store all diagnostic data in ADR. Each instance of each product stores diagnostic data
underneath its own ADR home directory. For example, in a Real Application Clusters
environment with shared storage and ASM, each database instance and each ASM instance has
a home directory within ADR. ADR’s unified directory structure uses consistent diagnostic
data formats across products and instances. A unified set of tools enable customers and Oracle
Support to correlate and analyze diagnostic data across multiple instances.
previous releases of the Oracle database and is located under the trace directory of each
ADR home. In addition, an alert message file conforming to the XML standard is stored in the
alert subdirectory inside the ADR home. You can view the alert log in text format (with the
XML tags stripped) with Enterprise Manager and with the ADR Command Interpreter
(ADRCI) utility.
The graphic in the slide shows you the directory structure of an ADR home. The incident
directory contains multiple subdirectories, where each subdirectory is named for a particularle
incident, and where each contains dumps pertaining only to that incident. r a b
sf e
The hm directory contains the checker run reports generated by the Health Monitor. a n
There is also a metadata directory that contains important files for the o n -tr itself. You
repository
a n using ADRCI.
can compare this to a database dictionary. This dictionary can besqueried
In addition, you can use V$DIAG_INFO to list some important r ) haADR d e ฺ
locations.
aฺ u i
o m t G
o n ฺc den
@ a Stu
z i l l e t h is
c e loฺ use
a r to
m e
i l l e ( icens
e loZ l
M arc
NAME VALUE
------------------- ---------------------------------------------------------------
Diag Enabled TRUE
ADR Base /u01/app/oracle
ADR Home /u01/app/oracle/diag/rdbms/orcl/orcl
Diag Trace /u01/app/oracle/diag/rdbms/orcl/orcl/trace
Diag Alert /u01/app/oracle/diag/rdbms/orcl/orcl/alert
ble
Diag Incident
Diag Cdump
/u01/app/oracle/diag/rdbms/orcl/orcl/incident
/u01/app/oracle/diag/rdbms/orcl/orcl/cdump
fe r a
Health Monitor /u01/app/oracle/diag/rdbms/orcl/orcl/hm
ans
Default Trace File /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_11424.trc
n - t r
Active Problem Count 3
o
Active Incident Count 8
s an
r ) ha deฺ
m ฺa Gui
n ฺ co ent
@ ao Stud
z i l le this
ฺ
loCopyright e
s2009,
r c e o u© Oracle. All rights reserved.
a t
l e (m ense
V$DIAG_INFO Zi l lic
e l o
The
a rcV$DIAG_INFO view lists all important ADR locations including:
M • ADR Base: Path of ADR base
• ADR Home: Path of ADR home for the current database instance
• Diag Trace: Location of the text alert log and background/foreground process trace files
• Diag Alert: Location of an XML version of the alert log
• Default Trace File: Path to the trace file for your session. SQL Trace files are written
here.
ble
Core dumps CORE_DUMP_DEST $ADR_HOME/cdump
fe r a
ans
Incident dumps USER|BACKGROUND_DUMP_DEST
n - t r
$ADR_HOME/incident/incdir_n
a no
h a s ฺ
ฺ a r) uide
ADR trace = Oracle Database ฺ c om e n
10g trace t –G critical error trace
n
ao Stud
l @
le this
ฺ z i
e loCopyright u e
s2009,
a r c t o © Oracle. All rights reserved.
l e (m ense
Locationofor
l
ZiDiagnostic
lic Traces
l
e shown in the slide describes the different classes of trace data and dumps that reside
The
a rctable
M both in Oracle Database 10g and in Oracle Database 11g.
With Oracle Database 11g, there is no distinction between foreground and background trace
files. Both types of files go into the $ADR_HOME/trace directory.
All nonincident traces are stored inside the trace subdirectory. This is the main difference
compared with previous releases where critical error information is dumped into the
corresponding process trace files instead of incident dumps. Incident dumps are placed in files
separated from the normal process trace files starting with Oracle Database 11g.
Note: The main difference between a trace and a dump is that a trace is more of a continuous
output such as when SQL tracing is turned on, and a dump is a one-time output in response to
an event such as an incident. Also, a core dump is a binary memory dump that is port specific.
In the slide, $ADR_HOME is used to denote the ADR home directory. However, there is no
official environment variable called ADR_HOME.
ble
fe r a
ans
n - t r
a no
h a s ฺ
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Viewing o
l
i Log
theZAlert lic Using Enterprise Manager
l
e view the alert log with a text editor, with Enterprise Manager, or with the ADRCI
You
a rccan
M utility. To view the alert log with Enterprise Manager:
1. Access the Database Home page in Enterprise Manager.
2. Under Related Links, click Alert Log Contents.
The View Alert Log Contents page appears.
3. Select the number of entries to view, and then click Go.
…
Current log# 3 seq# 400 mem# 1: +DATA/orcl/onlinelog/group_3.267.618805047
ble
Thread 1 advanced to log sequence 401
fe r a
Current log# 1 seq# 401 mem# 0: +DATA/orcl/onlinelog/group_1.262.618804977
ans
-
Current log# 1 seq# 401 mem# 1: +DATA/orcl/onlinelog/group_1.263.618804993
n t r
DIA-48223: Interrupt Requested - Fetch Aborted - Return Code [1]
a no
adrci> SHOW ALERT -P "MESSAGE_TEXT LIKE '%ORA-600%'"
h a s ฺ
ADR Home = /u01/app/oracle/diag/rdbms/orcl/orcl: ฺar
)
u ide
c om ent G
*************************************************************************
ฺ
adrci>
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Viewing o
l
i Log
theZAlert lic Using ADRCI
l
e also use ADRCI to view the contents of your alert log file. Optionally, you can
You
a rccan
Mchange the current ADR home. Use the SHOW HOMES command to list all ADR homes, and
the SET HOMEPATH command to change the current ADRCI homepath.
If the ADRCI homepath is not set, some commands such as SHOW ALERT will prompt you for
the ADR home. Other commands such as SHOW ALERT -tail or SHOW ALERT -tail -f
will fail if the ADRCI homepath is not set.
Ensure that operating system environment variables such as ORACLE_HOME are set properly,
and then enter the following command at the operating system command prompt: adrci.
The utility starts and displays its prompt as shown in the slide.
To see the contents of the alert log, use the SHOW ALERT command to display the alert log in
the default editor. Use the -TAIL num option to display the last num entries in the alert log. If
you omit num, the last ten entries are displayed.
If you want to perform live monitoring of the alert log, use SHOW ALERT -TAIL -F. This
displays the last ten records of the alert log and waits for more messages to arrive. As each
message arrives, it is appended to the display. Press Ctrl + C to break out of this command and
return to the ADRCI prompt.
ble
fe r a
ans
n - t r
o
s an
r ) ha deฺ
m ฺa Gui
n ฺ co ent
@ ao Stud
z i l le this
c e loฺ use
a r to
m e
i l l e ( icens
e l oZ l
M arc
Error
Problem
Aut Key Incident Status
o ma
tica Collecting
Flood lly
control Automatic
Ready
Incident transition
Tracking
l ly Incident ID
nua Data-Purged
Ma
DBA Closed
ble
fe r a
Traces
ans
-
ADR
MMON Auto-purge
n t r
a no
h a s ฺ
Non-critical
Error ฺ a r) uide
Package to be
ฺ c om ent G
sent to
Oracle Support a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Problems and
l
Zi Incidents
lic
l o
To
a ce diagnosis and resolution of critical errors, the fault diagnosability infrastructure
rfacilitate
M introduces two concepts for the Oracle database: problems and incidents.
• A problem is a critical error in the database. Problems are tracked in ADR. Each problem
is identified by a unique problem ID and has a problem key, which is a set of attributes
that describe the problem. The problem key includes the ORA error number, error
parameter values, and other information. Here is a possible list of critical errors:
- All internal Errors – ORA-60x errors
- All system access violations – (SEGV, SIGBUS)
- ORA-4020 (Deadlock on library object), ORA-8103 (Object no longer exists),
ORA-1410 (Invalid ROWID), ORA-1578 (Data block corrupted), ORA-29740
(Node eviction), ORA-255 (Database is not mounted), ORA-376 (File cannot be
read at this time), ORA-4030 (Out of process memory), ORA-4031 (Unable to
allocate more bytes of shared memory), ORA-355 (The change numbers are out of
order), ORA-356 (Inconsistent lengths in change description), ORA-353 (Log
corruption), ORA-7445 (Operating System exception)
• An incident is a single occurrence of a problem. When a problem occurs multiple times,
as is often the case, an incident is created for each occurrence. Incidents are tracked in
ADR. Each incident is identified by a numeric incident ID, which is unique within an
ADR home.
Oracle Database 11g: New Features for Administrators 14 - 14
Problems and Incidents (continued)
When an incident occurs, the database server makes an entry in the alert log, gathers
diagnostic data about the incident (a stack trace, the process state dump, and other dumps of
important data structures), tags the diagnostic data with the incident ID, and stores the data in
an ADR subdirectory created for that incident. Each incident has a problem key and is mapped
to a single problem. Two incidents are considered to have the same root cause if their problem
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
keys match. Large amounts of diagnostic information can be created very quickly if a large
number of sessions stumble across the same critical error. Having the diagnostic information
for more than a small number of the incidents is not required. That is why ADR provides flood
control so that only a certain number of incidents under the same problem can be dumped in a
given time interval. Note that flood-controlled incidents still generate incidents; they only skip
the dump actions. By default, only five dumps per hour for a given problem are allowed.
You can view a problem as a set of incidents that are perceived to have the same symptoms.
The main reason to introduce this concept is to make it easier for users to manage errors a onbl
e
their systems. For example, a symptom that occurs 20 times should be reported to Oracle s f er only
once. Mostly, you will manage problems instead of incidents, using IPS to package - t r an a problem
to be sent to Oracle Support. Most commonly incidents are automatically n n
ocreated when a
critical error occurred. However, you are also allowed to createaan a
s incident manually, via the
h ฺ
GUI provided by the Enterprise Manager Support Workbench.
ฺ a u ide incident creation is
r) Manual
mostly done when you want to report problems that
ฺ c om n t G
are not accompanied by critical errors
raised inside the Oracle code.
a on tude
As time goes by, more and more incidents
l l e@ willisbeSaccumulated in ADR. A retention policy
allows you to specify how long
i
ฺtoz keepsthe h
tdiagnostic data. ADR incidents are controlled by
e l o u e
two different policies:ar c to
m
• The incident metadata s e
( enretention policy controls how long the metadata is kept around.
i l l e c
l o Z has alidefault setting of one year.
This policy
e incident files and dumps retention policy controls how long generated dump files are
• cThe
r kept
M a around. This policy has a default setting of one month.
You can change these settings by using the Incident Package Configuration link on the
Enterprise Manager Support Workbench page. Inside the RDBMS component, MMON is
responsible for purging automatically expired ADR data.
• Ready: The data collection phase has completed. The incident is now ready to be used for
analysis, or to be packaged to be sent to Oracle Support.
• Tracking: The DBA is working on the incident, and prefers the incident to be kept in the
repository indefinitely. You have to manually change the incident status to this value.
• Closed: The incident is now in a done state. In this state, ADR can elect the incident to be
purged after it passes its retention policy.
• Data-Purged: The associated files have been removed from the incident. In some cases,
even if the incident files may still be physically around, it is not advisable for users to ble
era
look at them because they can be in an inconsistent state. Note that the incidentsfmetadata
itself for the incident is still valid for viewing.
- t r an
You can view an incident status by using either ADRCI (show incident n on -mode
a
detail), or directly in Support Workbench.
h as ฺ e twice its retention
If an incident has been in either the Collecting or the Ready ฺ a r) stateufor
idover
length, the incident automatically moves to the Closed
ฺ c om state.
n t G can manually purge incident
You
files. a on tude
l e S
@ ismaintained
For simplicity, problem metadata is
ฺ z i l internally
t h by ADR. Problems are
automatically created whenethe e
lo first uincident
s (of the problem key) occurs. The Problem
metadata is removed after r c
a its last o
t incident is removed from the repository.
( m n s e
e
Note: It is notillpossible edisable
to automatic incident creation for critical errors.
l o Z lic
rce
Ma
incident package. DB
a b le
• By default, only the first and last er
Name
s f
three incidents of each
ADR
Home
SID
- t r an metadata
r )
• You can generate complete mฺapkg_1 …ui pkg_n
G
or incremental zip files. nฺco ent
@ ao Stud
z i l le this
ฺ
loCopyright e
s2009,
r c e o u© Oracle. All rights reserved.
a t
l e (m ense
Incident o Zi l
Packages lic
l
ce diagnostic data to Oracle Support Services, you first collect the data in an incident
To
a rupload
M package. When you create an incident package, you select one or more problems to add to the
incident package. The Support Workbench then automatically adds to the incident package the
incident information, trace files, and dump files associated with the selected problems.
Because a problem can have many incidents (many occurrences of the same problem), by
default only the first three and last three incidents for each problem are added to the incident
package. You can change this default number on the Incident Packaging Configuration page
accessible from the Support Workbench page.
After the incident package is created, you can add any type of external file to the incident
package, remove selected files from the incident package, or edit selected files in the incident
package to remove sensitive data. An incident package is a logical construct only, until you
create a physical file from the incident package contents. That is, an incident package starts
out as a collection of metadata in ADR. As you add and remove incident package contents,
only the metadata is modified. When you are ready to upload the data to Oracle Support
Services, you invoke either a Support Workbench or an ADRCI function that gathers all the
files referenced by the metadata, places them into a zip file, and then uploads the zip to My
Oracle Support.
ble
fe r a
ans
n - t r
o
s an
r ) ha deฺ
m ฺa Gui
n ฺ co ent
@ ao Stud
z i l le this
c e loฺ use
a r to
m e
i l l e ( icens
e l oZ l
M arc
l e (m ense
Enterprise i l
ZManager c
liSupport Workbench: Overview
e l o
The
a rcSupport Workbench is an Enterprise Manager wizard that helps you through the process
M of handling critical errors. It displays incident notifications, presents incident details, and
enables you to select incidents for further processing. Further processing includes running
additional health checks, invoking the IPS to package all diagnostic data about the incidents,
adding SQL test cases and selected user files to the package, filing a service request (SR) with
Oracle Support, shipping the packaged incident information to Oracle Support, and tracking
the SR through its life cycle.
You can perform the following tasks with the Support Workbench:
• View details on problems and incidents.
• Manually run health checks to gather additional diagnostic data for a problem.
• Generate additional dumps and SQL test cases to add to the diagnostic data for a problem.
• Run advisors to help resolve problems.
• Create and track a service request through My Oracle Support, and add the service request
number to the problem data.
• Collect all diagnostic data relating to one or more problems into an incident package and
then upload the incident package to Oracle Support Services.
• Close the problem when the problem is resolved.
Enterprise Manager.
ble
6 Track the SR and 3
Gather additional
diagnostic
fe r a
implement repairs.
information.
an s
n - t r
a no
4 h a s ฺ
Package and upload
diagnostic data ฺ a r) request.
Create a
u ide
to Oracle Support.
ฺ c om ent Gservice
5 a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Enterprise i l
ZManager c
liSupport Workbench Roadmap
l o
e gives a summary of the tasks that you complete to investigate, report, and in some
The
a rcgraphic
M cases, resolve a problem using Enterprise Manager Support Workbench:
1. Start by accessing the Database Home page in Enterprise Manager and reviewing critical
error alerts. Select an alert for which to view details.
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. Optionally, 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 by Oracle Support. The type of information that
the SQL Test Case Builder gathers includes query being executed, table and index
definitions (but no data), optimizer statistics, and initialization parameter settings.
4. Create a service request with My Oracle Support and optionally record the service request
number with the problem information.
5. Invoke a wizard that automatically packages all gathered diagnostic data for a problem
and uploads the data to Oracle Support. Optionally, edit the data to remove sensitive
information before uploading.
6. Optionally, maintain an activity log for the service request in the Support Workbench.
Run Oracle advisors to help repair SQL failures or corrupted data.
7. Set status for one, some, or all incidents for the problem to Closed.
Oracle Database 11g: New Features for Administrators 14 - 21
View Critical Error Alerts in Enterprise Manager
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
ble
fe r a
ans
n - t r
a no
h a s ฺ
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
View Critical
l
ZiError Alerts
lic in Enterprise Manager
l o
e the process of investigating problems (critical errors) by reviewing critical error
You
a rcbegin
Malerts on the Database Home page. To view critical error alerts, access the Database Home
page in Enterprise Manager. From the Home page, you can look at the Diagnostic Summary
section from where you can click the Active Incidents link if there are incidents. You can also
use the Alerts section and look for critical alerts flagged as Incidents.
When you click the Active Incidents link, you access the Support Workbench page on which
you can retrieve details about all problems and corresponding incidents. From there, you can
also retrieve all Health Monitor checker run and created packages.
ble
fe r a
ans
n - t r
a no
h a s ฺ
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Packageoand
l
Zi UploadlicDiagnostic Data to Oracle Support
e l
The
a rcSupport Workbench provides two methods for creating and uploading an incident
M package: the Quick Packaging method and the Custom Packaging method. The example in the
slide shows you how to use Quick Packaging.
Quick Packaging is a more automated method with a minimum of steps. You select a single
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. To package and upload diagnostic data to Oracle Support:
1. On the Problem Details page, in the Investigate and Resolve section, click Quick Package.
The Create New Package page of the Quick Packaging wizard appears.
2. Enter a package name and description.
3. Enter the service request number to identify your problem.
4. Click Next, and then proceed with the remaining pages of the Quick Packaging wizard.
Click Submit on the Review page to upload the package.
ble
fe r a
ans
n - t r
a no
h a s ฺ
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Track theoSR
l
Zi and Implement
lic Repairs
l
rceuploading diagnostic information to Oracle Support, you may perform various activities
After
a
Mto track the service request and implement repairs. Among these activities are the following:
Add an Oracle bug number to the problem information. To do so, on the Problem Details page,
click the Edit button that is adjacent to the Bug# label. This is for your reference only.
Add comments to the problem activity log. To do so, complete the following steps:
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 log.
Respond to a request by Oracle Support to provide additional diagnostics. Your Oracle
Support representative may provide instructions for gathering and uploading additional
diagnostics.
ble
fe r a
ans
n - t r
a no
h a s ฺ
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Zi l
CreatingoUser-Reportedlic Problems
l
rce errors generated internally to the database are automatically added to Automatic
Critical
a
M Diagnostic Repository (ADR) and tracked in the Support Workbench. However, there may be
a situation in which you want to manually add a problem that you noticed to the ADR so that
you can put that problem through the Support Workbench workflow. An example of such a
situation would be if the performance of the database or of a particular query suddenly
noticeably degraded. The Support Workbench includes a mechanism for you to create and
work with such a user-reported problem.
To create a user-reported problem, open the Support Workbench page and click the Create
User-Reported Problem link in the Related Links section. This takes you to the Create User-
Reported Problem page from where you are asked to run a corresponding advisor before
continuing. This is necessary only if you are not sure about your problem. However, if you
already know exactly what is going on, select the issue that describes most the type of problem
you are encountering and click “Continue with Creation of Problem.”
By clicking this button, you basically create a pseudo-problem inside the Support Workbench.
This allows you to manipulate this problem using the previously seen Support Workbench
workflow for handling critical errors. So, you end up on a Problem Details page for your issue.
Note that at first the problem does not have any diagnostic data associated with it. At this
point, you need to create a package and upload necessary trace files by customizing that
package.
Oracle Database 11g: New Features for Administrators 14 - 25
11.2
ble
fe r a
ans
n - t r
a no
h a s ฺ
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Enterprise i l
ZManager c
liSupport Workbench for ASM
l o
rceEnterprise Manager has been enhanced to help diagnose and package incidents to
Oracle
a
M Oracle Support Services for Oracle ASM instances.
Oracle Enterprise Manager provides Oracle ASM Support Workbench to monitor Oracle ASM
alerts and incidents.
To access Support Workbench for Oracle ASM:
1. Click the Software and Support tab on the database home page.
2. Click Support Workbench in the Support section of the Software and Support page.
3. Click Support Workbench (ASM_instance_name) under the Related Links section on the
Support Workbench page.
You can view information about current and past problems on the Problems page.
To create a package to send to Oracle Support Services, select an incident and click Package
on the Support Workbench Problems page. Support Workbench then guides you through the
packaging process.
PROBLEM | PROBLEMKEY
INCIDENT
Ø
NEW INCIDENTS IPS ADD
FILE
IN FILE
IPS COPY
ble
OUT FILE
fe r a
INCIDENT
an s
IPS REMOVE
n - t r
no
FILE
a
s ฺ
IPS FINALIZE PACKAGE h a
ฺ a r) uide
ฺ c om ent G
IPS GENERATE
a onPACKAGE tud
@
le this S
ฺ z i l
e loCopyright u e
s2009,
a r c t o © Oracle. All rights reserved.
l e (m ense
Invoking IPS
l
Zi Using lADRCI
ic
l o
rce a package is a two-step process: you first create the logical package, and then
Creating
a
M generate the physical package as a zip file. Both steps can be performed using ADRCI
commands. To create a logical package, the IPS CREATE PACKAGE command is used.
There are several variants of this command that allow you to choose the contents:
• IPS CREATE PACKAGE creates an empty package.
• IPS CREATE PACKAGE PROBLEMKEY creates a package based on problem key.
• IPS CREATE PACKAGE PROBLEM creates a package based on problem ID.
• IPS CREATE PACKAGE INCIDENT creates a package based on incident ID.
• IPS CREATE PACKAGE SECONDS creates a package containing all incidents
generated from seconds ago until now.
• IPS CREATE PACKAGE TIME creates a package based on the specified time range.
IPS COPY is essentially used to COPY OUT a file, edit it, and COPY IN it back into ADR.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
IPS FINALIZE is used to finalize a package for delivery, which means that other
components, such as the Health Monitor, are called to add their correlated files to the package.
Recent trace files and log files are also included in the package. If required, this step is run
automatically when a package is generated.
To generate the physical file, the IPS GENERATE PACKAGE command is used. The syntax
is:
IPS GENERATE PACKAGE IN [COMLPETE | INCREMENTAL]
a b le
It generates a physical zip file for an existing logical package. The file name containsfe r
either
COM for complete or INC for incremental, followed by a sequence number thatra
s
isnincremented
- t
each time a zip file is generated.
n on
IPS SET CONFIGURATION is used to set IPS rules. s a
) a
h deฺ about ADRCI.
Note: Refer to the Oracle Database Utilities guide for more r
ฺa Gui information
m
co ent
n ฺ
@ ao Stud
z i l le this
c e loฺ use
a r to
m e
i l l e ( icens
l o Z l
a rce
M
l e (m ense
Answers: Z3,
1,
l
i and 4lic
l o
a rce
M
V$HM_CHECK DB-offline
Critical
DB Structure Integrity Check
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
error ADRCI
Data Block Integrity Check V$HM_RUN
Redo Integrity Check DBMS_HM EM
hm
(reports)
Reactive
ADR
Manual Health
ble
EM or DBMS_HM Monitor
fe r a
ans
V$HM_CHECK
DB-online
n - t r
DBA
no
Transaction Integrity Check
a
h a s ฺ
Undo Segment Integrity Check
Dictionary Integrity Check
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
l
Zi Overview
Health Monitor: lic
l o
rce with Release 11g, the Oracle database server includes a framework called Health
Beginning
a
MMonitor for running diagnostic checks on various components of the database.
Health Monitor checkers examine various components of the database, including files,
memory, transaction integrity, metadata, and process usage. These checkers generate reports of
their findings as well as recommendations for resolving problems. Health Monitor checks can
be run in two ways:
• Reactive: The fault diagnosability infrastructure can run Health Monitor checks
automatically in response to critical errors.
• Manual: As a DBA, you can manually run Health Monitor checks by using either the
DBMS_HM PL/SQL package or the Enterprise Manager interface.
In the slide, you can see some of the checks that Health Monitor can run. For a complete
description of all possible checks, look at V$HM_CHECK. These health checks fall into one of
two categories:
• DB-online: These checks can be run while the database is open (that is, in OPEN mode or
MOUNT mode).
• DB-offline: In addition to being “runnable” while the database is open, these checks can
also be run when the instance is available and the database itself is closed (that is, in
NOMOUNT mode).
Oracle Database 11g: New Features for Administrators 14 - 30
Health Monitor: Overview (continued)
After a checker has run, it generates a report of its execution. This report contains information
about the checker’s findings, including the priorities (low, high, or critical) of the findings,
descriptions of the findings and their consequences, and basic statistics about the execution.
Health Monitor generates reports in XML and stores the reports in ADR. You can view these
reports by using V$HM_RUN, DBMS_HM, ADRCI, or Enterprise Manager.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
e l o Check
Log Group Y Checks all members of a log group Y
27 rows selected.
SQL>
ble
fe r a
ans
n - t r
a no
h a s ฺ
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
RunningoHealth
l
Zi Checks lic Manually: Enterprise Manager Example
l
rce Manager provides an interface for running Health Monitor checkers. You can find
Enterprise
a
M this interface in the Checkers tab on the Advisor Central page. The page lists each checker
type, and you can run a checker by clicking it and then OK on the corresponding checker page
after you have entered the parameters for the run. The slide shows how you can run the Data
Block Checker manually.
After a check is completed, you can view the corresponding checker run details by selecting
the checker run from the Results table and clicking Details. Checker runs can be reactive or
manual.
On the Findings subpage you can see the various findings and corresponding recommendations
extracted from V$HM_RUN, V$HM_FINDING, and V$HM_RECOMMENDATION.
If you click View Report on the Runs subpage, you can view the run report in XML format.
Viewing the XML report in Enterprise Manager generates the report for the first time if it is
not yet generated in your ADR. You can then view the report using ADRCI without needing to
generate it.
'DicoCheck',0,'TABLE_NAME=tab$');
DBMS_HM.GET_RUN_REPORT('DICOCHECK')
--------------------------------------------------------------------------------
Basic Run Information (Run Name,Run Id,Check Name,Mode,Status)
Input Paramters for the Run
TABLE_NAME=tab$
ble
CHECK_MASK=ALL
Run Findings And Recommendations
fe r a
Finding
ans
Finding Name : Dictionary Inconsistency
n - t r
Finding ID
Type
: 22
: FAILURE a no
Status : OPEN
h a s ฺ
Priority : CRITICAL
ฺ a r) uide
om ent G
Message : SQL dictionary health check: invalid column number 8 on
object TAB$ failed
ฺ c
Message
on tud
: Damaged rowid is AAAAACAABAAAS7PAAB - description: Object
a
l l e@ is S
SCOTT.TABJFV is referenced
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
l
Zi Checks
RunningoHealth lic Manually: PL/SQL Example
l
e use the DBMS_HM.RUN_CHECK procedure for running a health check. To call
You
a rccan
M RUN_CHECK, supply the name of the check found in V$HM_CHECK, the name for the run
(this is just a label used to retrieve reports later), and the corresponding set of input parameters
for controlling its execution. You can view these parameters by using V$HM_CHECK_PARAM.
In the example in the slide, you want to run a Dictionary Integrity Check for the TAB$ table.
You call this run DICOCHECK, and you do not want to set any timeout for this check.
After DICOCHECK is executed, you execute the DBMS_HM.GET_RUN_REPORT function to
get the report extracted from V$HM_RUN, V$HM_FINDING, and
V$HM_RECOMMENDATION. The output clearly shows you that a critical error was found in
TAB$. This table contains an entry for a table with an invalid number of columns.
Furthermore, the report gives you the name of the damaged table in TAB$.
When you call the GET_RUN_REPORT function, it generates the XML report file in the HM
directory of your ADR. For this example, the file is called HMREPORT_DicoCheck.hm.
Note: Refer to the Oracle Database PL/SQL Packages and Types Reference for more
information about DBMS_HM.
*************************************************************************
HM RUN RECORD 1
**********************************************************
RUN_ID 1
RUN_NAME HM_RUN_1
CHECK_NAME DB Structure Integrity Check
NAME_ID 2
MODE 2
START_TIME 2007-07-02 17:31:54.271917 +07:00
RESUME_TIME <NULL>
END_TIME 2007-07-02 17:31:57.579834 +07:00
ble
MODIFIED_TIME 2007-07-02 17:31:57.579834 +07:00
fe r a
TIMEOUT 0
ans
FLAGS
STATUS
0
5
n - t r
SRC_INCIDENT_ID 0
a no
NUM_INCIDENTS
ERR_NUMBER
0
0 h a s ฺ
REPORT_FILE <NULL>
ฺ a r) uide
…
ฺ c om ent G
on tud
adrci> create report hm_run HM_RUN_1
Adrci> show report hm_run HM_RUN_1
… a
@ is S
i l l e
l o ฺz se th
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Viewing HM i l
ZReports licUsing the ADRCI Utility
l o
e create and view Health Monitor checker reports using the ADRCI utility. To do that,
You
a rccan
M ensure that operating system environment variables such as ORACLE_HOME are set properly,
and then enter the following command at the operating system command prompt: adrci.
The utility starts and displays its prompt as shown in the slide. Optionally, you can change the
current ADR home. Use the SHOW HOMES command to list all ADR homes, and the SET
HOMEPATH command to change the current ADR home.
You can then enter the SHOW HM_RUN command to list all the checker runs registered in
ADR and visible from V$HM_RUN. Locate the checker run for which you want to create a
report and note the checker run name using the corresponding RUN_NAME field. The
REPORT_FILE field contains a file name if a report already exists for this checker run.
Otherwise, you can generate the report using the CREATE REPORT HM_RUN command as
shown in the slide. To view the report, use the SHOW REPORT HM_RUN command.
automatically
Trace files
bl e
DBA accept Statement
fe r
executes
a
SQL patch
ans
successfully
n - t r again
Execute
a no
h a s ฺ
ฺ a r) uide
SQL patch
ฺ c om ent G
generated
a on patched
SQL statement
tud
@
le this S
ฺ z i l
e loCopyright u e
s2009,
a r c t o © Oracle. All rights reserved.
l e (m ense
SQL Repair i l
ZAdvisor: licOverview
l o
e the SQL Repair Advisor after a SQL statement fails with a critical error that generates
You
a rcrun
Ma problem in ADR. The advisor analyzes the statement and in many cases recommends a patch
to repair the statement. If you implement the recommendation, the applied SQL patch
circumvents the failure by causing the query optimizer to choose an alternate execution plan
for future executions. This is done without changing the SQL statement itself.
Note: In case no workaround is found by the SQL Repair Advisor, you are still able to
package the incident files and send the corresponding diagnostic data to Oracle Support.
ble
fe r a
ans
n - t r
a no
h a s ฺ
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Accessing Zthel
i SQLlRepair
ic Advisor Using Enterprise Manager
l o
e easily access the SQL Repair Advisor from Enterprise Manager when you get alerted
You
a rccan
M in the Diagnostic Summary section of the database home page. Following a SQL statement
failure that generates an incident in ADR, you are automatically alerted through the Active
Incidents field. You can click the corresponding link to get to the Support Workbench
Problems page from where you can click the corresponding problem ID link. This takes you to
the Problem Details page from where you can click the SQL Repair Advisor link in the
“Investigate and Resolve” section of the page.
ble
fe r a
ans
n - t r
a no
h a s ฺ
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Zi l
Viewing,oDisabling, ic Removing a SQL Patch
lor
l
rceyou apply a SQL patch with the SQL Repair Advisor, you may want to view it to
After
a
M confirm its presence, disable it, or remove it. One reason to remove a patch is if you install a
later release of the Oracle database that fixes the problem that caused the failure in the
nonpatched SQL statement.
To view, disable/enable, or remove a SQL Patch, access the Server page in Enterprise
Manager and click the SQL Plan Control link in the Query Optimizer section of the page. This
takes you to the SQL Plan Control page. On this page, click the SQL Patch tab.
From the resulting SQL Patch subpage, locate the desired patch by examining the associated
SQL statement. Select it, and perform the corresponding task: Disable, Enable, or Delete.
declare
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
rep_out clob;
t_id varchar2(50);
begin
t_id := dbms_sqldiag.create_diagnosis_task(
sql_text => 'delete from t t1 where t1.a = ''a'' and rowid <> (select max(rowid)
from t t2 where t1.a= t2.a and t1.b = t2.b and t1.d=t2.d)',
task_name => 'sqldiag_bug_5869490',
problem_type => DBMS_SQLDIAG.PROBLEM_TYPE_COMPILATION_ERROR);
dbms_sqldiag.set_diagnosis_task_parameter(t_id,'_SQLDIAG_FINDING_MODE',
dbms_sqldiag.SQLDIAG_FINDINGS_FILTER_PLANS);
ble
dbms_sqldiag.execute_diagnosis_task (t_id);
fe r a
rep_out := dbms_sqldiag.report_diagnosis_task (t_id, DBMS_SQLDIAG.TYPE_TEXT);
ans
dbms_output.put_line ('Report : ' || rep_out);
n - t r
no
end;
/
a
s ฺ
h a
ฺ a r) uide
execute dbms_sqldiag.accept_sql_patch(task_name => 'sqldiag_bug_5869490',
task_ownerm
ฺ c o => e'SCOTT',
n t G replace => TRUE);
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Using the
l
Zi Repair
SQL lic Advisor from PL/SQL: Example
l o
e also invoke the SQL Repair Advisor directly from PL/SQL.
You
a rccan
M After you get alerted about an incident SQL failure, you can execute a SQL Repair Advisor
task by using the DBMS_SQLDIAG.CREATE_DIGNOSIS_TASK function as illustrated in
the slide. You need to specify the SQL statement for which you want the analysis to be done,
as well as a task name and a problem type you want to analyze (possible values are
PROBLEM_TYPE_COMPILATION_ERROR and PROBLEM_TYPE_EXECUTION_ERROR).
You can then give the created task parameters by using the
DBMS_SQLDIAG.SET_DIAGNOSIS_TASK_PARAMETER procedure.
When you are ready, you can execute the task by using the
DBMS_SQLDIAG.EXECUTE_DIAGNOSIS_TASK procedure.
Finally, you can get the task report by using the
DBMS_SQLDIAG.REPORT_DIAGNOSIS_TASK function.
In the example given in the slide, it is assumed that the report asks you to implement a SQL
Patch to fix the problem. You can then use the DBMS_SQLDIAG.ACCEPT_SQL_PATCH
procedure to implement the SQL Patch.
ble
fe r a
ans
n - t r
a no
h a s ฺ
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Using the
l
Zi TestliCase
SQL c Builder
l o
e Test Case Builder automates the somewhat difficult and time-consuming process of
rcSQL
The
a
Mgathering as much information as possible about a SQL-related problem and the environment
in which it occurred, so that the problem can be reproduced and tested by Oracle Support
Services. The information gathered by the SQL Test Case Builder includes the query being
executed, table and index definitions (but not the actual data), PL/SQL functions, procedures
and packages, optimizer statistics, and initialization parameter settings.
From the Support Workbench page, to access the SQL Test Case Builder:
1. Click the corresponding Problem ID to open the problem details page.
2. Click the Oracle Support tab.
3. Click “Generate Additional Dumps and Test Cases.”
4. On the “Additional Dumps and Test Cases” page, click the icon in the Go To Task
column to run the SQL Test Case Builder against your particular Incident ID.
The output of the SQL Test Case Builder is a SQL script that contains the commands required
to re-create all the necessary objects and the environment.
Note: You can also invoke the SQL Test Case Builder by using the
DBMS_SQLDIAG.EXPORT_SQL_TESTCASE_DIR_BY_INC function. This function takes
the incident ID as well as a directory object. It generates its output for the corresponding
incident in the specified directory.
Oracle Database 11g: New Features for Administrators 14 - 39
Quiz
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
ble
fe r a
ans
n - t r
o
s an
r ) ha deฺ
m ฺa Gui
n ฺ co ent
@ ao Stud
z i l le this
ฺ
loCopyright e
s2009,
r c e o u© Oracle. All rights reserved.
a t
l e (m ense
i l lic
el oZ
Marc
ble
fe r a
ans
n - t r
o
s an
r ) ha deฺ
m ฺa Gui
n ฺ co ent
@ ao Stud
z i l le this
ฺ
loCopyright e
s2009,
r c e o u© Oracle. All rights reserved.
a t
l e (m ense
i l lic
el oZ
Marc
Objectives
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
ble
fe r a
ans
n - t r
o
s an
r ) ha deฺ
m ฺa Gui
n ฺ co ent
@ ao Stud
z i l le this
ฺ
loCopyright e
s2009,
r c e o u© Oracle. All rights reserved.
a t
l e (m ense
i l lic
el oZ
Marc
+
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
CONTROL_MANAGEMENT_PACK_ACCESS=DIAGNOSTIC+TUNING
Every
SQL monitoring second V$SQL_MONITOR
V$SQL_PLAN_MONITOR
bl e
fe r a
ns
>5sec MONITOR
(CPU|IO) Parallel
hint
- t r a
o n
DBMS_SQLTUNE.REPORT_SQL_MONITOR
s an
r ) ha deฺManager
Enterprise
V$SQL
V$SQL_PLAN mฺ
a Gui Grid
co ent Control
NO_MONITOR
hint
n ฺ
V$ACTIVE_SESSION_HISTORY
ao
V$SESSION_LONGOPS
@ V$SESSIONS
tud
z i l le this
ฺ
loCopyright e
s2009,
r c e o u© Oracle. All rights reserved.
a t
l e (m ense
Zi
SQL Monitoring
l lic
e l o
a rcreal-time
The SQL monitoring feature on Oracle Database 11g enables you to monitor the
Mperformance of SQL statements while they are executing.
The real-time SQL monitoring feature is enabled by default when the STATISTICS_LEVEL
initialization parameter is either set to ALL or to TYPICAL, which is the default value.
Additionally, the CONTROL_MANAGEMENT_PACK_ACCESS parameter must be set to
DIAGNOSTIC+TUNING (the default value) because real-time SQL monitoring is a feature of
the Oracle Database Tuning Pack.
By default, real-time SQL monitoring is started when a SQL command runs in parallel, or
when it has consumed at least five seconds of the CPU or I/O time in a single execution.
As mentioned, real-time SQL monitoring is active by default. However, two command-level
hints are available to force or prevent a SQL command from being monitored. To force real-
time SQL monitoring, use the MONITOR hint. To prevent the hinted SQL command from
being monitored, use the NO_MONITOR hint.
other wait times. These statistics are refreshed in near real time as the command executes,
generally once every second.
After the execution ends, monitoring information is not deleted immediately, but is kept in the
V$SQL_MONITOR view for at least one minute. The entry is eventually deleted so its space
can be reclaimed as new commands are monitored.
The V$SQL_MONITOR and V$SQL_PLAN_MONITOR views can be used in conjunction with
the following views to get additional information about the execution that is monitored: ble
f e raand
V$SQL, V$SQL_PLAN, V$ACTIVE_SESSION_HISTORY, V$SESSION_LONGOPS,
V$SESSION t r a ns
n -
o of accessing the
You can use the SQL monitoring report to view SQL monitoring data n
instead
a
views. as
) h deฺ
r
ฺa Gui
m
co ent
n ฺ
@ ao Stud
z i l le this
c e loฺ use
a r to
m e
i l l e ( icens
e l oZ l
M arc
ble
... fe r a
ans
n - t r
a no
h a s ฺ
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
SQL Monitoring
l
Zi in Oracle
lic Database 11g Release 2
l o
In
a ce Database 11g Release 2, you can access the SQL Monitoring feature in Enterprise
rOracle
MManager Database Control by clicking the Performance tab. You can choose from Real Time
and Historical Settings. Scroll down to the Additional Monitoring Links area and click SQL
Monitoring, as shown in the slide.
Note: The COMPATIBLE initialization parameter must be set to 11.2.0.0 (or higher) to use
this feature.
Monitored
SQL Execution
SQL Execution e
Details r a bl
s fe
- t r an
n no
a
s ฺ
h a
Session ฺ a
SQL
r) Details
u ide
Details ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
l
Zi withlicEnterprise Manager Database Control
SQL Monitoring
l o
e shows just one possible work flow in Enterprise Manager Database Control. You
rcslide
This
a
Mcan navigate through the following pages:
• Monitored SQL Execution
• SQL Execution Details
• Session Details
• SQL Details
Status: Session ID, where the CPU Disk Start (and end)
ble
Executing SQL is executing time reads of execution
fe r a
Done
an s
Error Execution duration Degree of parallelism - t r
SQL command
n
(wall clock time)
no
being executed
a
h a s ฺ
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Monitored Z
SQL
l
i Executions
lic
l o
rceyou move the cursor over the values or symbols of each SQL execution, a relevant hint
When
a
M appears. The slide shows the actual SQL command being executed with the cursor on the SQL
ID link.
When you click the link that shows the SQL ID, you navigate to the Monitored SQL Execution
Details page, as shown in the following slide.
1
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
ble
fe r a
ans
n - t r
3
a no
h a s ฺ
ฺ 4r
a )
u ide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
l
Zi Listlic
SQL Monitoring
l o
e shows another example of monitored SQL executions.
rcslide
This
a
M 1. In the top left section, you see for each long-running SQL, the completion status (which
can be executing, done, or error), execution duration (wall clock time), SQL ID, and
Session ID where the SQL was executed.
2. Here you see the database time by wait class, and I/O read and write operations.
3. This detail shows you the degree of parallelism: the number of instances that are involved
in this parallel execution.
4. Here you see that the execution of the SQL command is completed.
Basic execution
attributes 4.5 minutes, mainly Little I/O Read/ write buffer gets
CPU time (green) time (blue) Wait event breakdown
bl e
ASH data on timeline
fe r a
an s
n - t r
a no
h a s ฺ
ฺ a r) uide
Current join operation produced 18,000 ฺ c omso e
rows farnt
G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Monitored Z
SQL
l
i Execution
lic Details
l o
e of the SQL execution are displayed on three different tabbed pages:
The
a rcdetails
M • Plan Statistics, as shown in the bottom part of the slide
• Parallel, displaying the distribution of work across the parallel servers (not part of the
example in the slide)
• Activity, displaying ASH data on a time line
When you click the Session link, you navigate to the Session Details page.
When you click the SQL ID link, you navigate to the SQL Details page.
ble
fe r a
ans
n - t r
a no
h a s ฺ
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
SQL Execution
l
Zi Detailslic for Parallel Queries
l o
e shows you the Plan Statistics tabbed page for the SQL execution of parallel queries.
rcslide
This
a
M
ble
fe r a
ans
n - t r
a no
h a s ฺ
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Details for Z i l
Parallel lic
Execution
l o
e shows you monitored SQL execution details for parallel queries (on the Parallel
rcslide
This
a
Mtabbed page).
bl e
fe r a
ans
n - t r
a no
h a s ฺ
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Activity Details
l
Zi for Parallel
lic Execution
e l o
a rcActivity
This tabbed page displays the activity graphs for parallel queries. You see the
Moscillation of CPU and direct reads over time.
ble
fe r a
ans
n - t r
a no
h a s ฺ
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Viewing o
l
Zi Details
Session lic
l
e shows you the session details for the MONI user, divided into the following sections:
rcpage
This
a
M • Server
• Client
• Application
• Contention
• Wait
• Other
When you click the Current SQL link, you navigate to the SQL Details page, as shown in the
following slide.
SQL Details
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
ble
fe r a
ans
n - t r
a no
h a s ฺ
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
SQL Details Zi l lic
l o
rceyou click the SQL Monitoring tab, you navigate to the Monitored SQL Execution page.
When
a
M
ble
fe r a
ans
n - t r
a no
h a s ฺ
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Viewing o
l
i Monitoring
theZSQL lic Report
l
e Monitoring Report shows the same information as the previous slides, but this time
The
a rcSQL
M in a textual, rather than a graphic way. It begins with the SQL Text, followed by global
information, and then the SQL Plan Monitoring details, which also indicates the current
operation with an arrow.
When you see the new Save and Mail buttons, you can also save the report in HTML format
and email the Active Report—for example, to a SQL Tuning expert, if your organization has
such a division of work.
ble
fe r a
ans
n - t r
o
s an
r ) ha deฺ
m ฺa Gui
n ฺ co ent
@ ao Stud
z i l le this
ฺ
loCopyright e
s2009,
r c e o u© Oracle. All rights reserved.
a t
l e (m ense
i l lic
el oZ
Marc
ble
fe r a
ans
n - t r
o
s an
r ) ha deฺ
m ฺa Gui
n ฺ co ent
@ ao Stud
z i l le this
ฺ
loCopyright e
s2009,
r c e o u© Oracle. All rights reserved.
a t
l e (m ense
i l lic
el oZ
Marc
Performance Enhancements
ble
fe r a
ans
n - t r
o
s an
r ) ha deฺ
m ฺa Gui
n ฺ co ent
@ ao Stud
z i l le this
ฺ
loCopyright e
s2009,
r c e o u© Oracle. All rights reserved.
a t
l e (m ense
i l lic
el oZ
Marc
Objectives
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
l e (m ense
Zi l
Using the DBMS_ADDM c
liPackage (continued)
l o
e use possible finding names to query the findings repository to get all occurrences of that
Yourccan
a
Mspecific finding.
In the slide, you see the creation of an instance ADDM task with a finding directive. When the task
name is NULL, it applies to all subsequent ADDM tasks. The finding name (“Undersized SGA”)
must exist in the DBA_ADVISOR_FINDING_NAMES view (which lists all the findings) and is case-
sensitive. The result of DBMS_ADDM.GET_REPORT shows the “Undersized SGA” finding only if
the finding is responsible for at least two (min_active_sessions) average active sessions
during the analysis period. This is at least 10% (min_perc_impact) of the total database time
during that period.
Found in:
a b le
• DBA_ADVISOR_FINDINGS er
s f
• USER_ADVISOR_FINDINGS - t r an
• DBA_ADVISOR_RECOMMENDATIONS n on
s a
• USER_ADVISOR_RECOMMENDATIONS ) a
h deฺ
r
ฺa Gui
• DBA_ADVISOR_ACTIONS m
co ent
n ฺ
ao
• USER_ADVISOR_ACTIONS tud @ is S
i l l e
l o ฺz se th
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
l
Zi Views
Modified Advisor lic
l o
ce containing advisor findings, recommendations, and actions have been enhanced by adding
Therviews
a
Mthe FILTERED column.
• PGA_AGGREGATE_TARGET:
– Specifies the target aggregate amount of PGA memory
available to the instance
– Can be dynamically modified at the instance level
– Examples: 100,000 KB, 2,500 MB, 50 GB
– Default: 10 MB or 20% of SGA size (whichever is greater) e
• WORKAREA_SIZE_POLICY: r a bl
ns fe
– Optional
n - tra
– Can be dynamically modified at the instance o session
nor
a
s ฺ
level h a
– Enables fallback to static SQLmmemory ide
ฺar) Gumanagement for a
o t
particular session nฺc en
ao Stud
l @
le this
ฺ z i
e loCopyright u e
s2009,
a r c t o © Oracle. All rights reserved.
l e (m ense
Review: Oracle
l
Zi Database
lic 10g PGA Parameters
l o
rce
PGA_AGGREGATE_TARGET
a specifies the target aggregate PGA memory that is available to all
Mserver processes attached to the instance.
Setting PGA_AGGREGATE_TARGET to a nonzero value automatically sets the
WORKAREA_SIZE_POLICY parameter to AUTO. This means that the SQL working areas used by
memory-intensive SQL operators are automatically sized. A nonzero value for this parameter is the
default because, unless you specify otherwise, Oracle sets it to 20% of the SGA or 10 MB, whichever
is greater.
Setting PGA_AGGREGATE_TARGET to 0 automatically sets the WORKAREA_SIZE_POLICY
parameter to MANUAL. This means that the SQL work areas are sized using the *_AREA_SIZE
parameters.
Keep in mind that PGA_AGGREGATE_TARGET is not a fixed value. It is used to help the system
better manage PGA memory, but the system will exceed this setting if necessary.
WORK_AREA_SIZE_POLICY can be altered per database session, allowing manual memory
management on a per-session basis if needed. For example, suppose that a session loads a large
import file and a rather large SORT_AREA_SIZE is needed. A logon trigger could be used to set
WORK_AREA_SIZE_POLICY for the account doing the import. If WORK_AREA_SIZE_POLICY
is AUTO and PGA_AGGREGATE_TARGET is set to 0, an ORA-04032 external error is returned at
startup.
ble
fe r a
ans
n - t r
o
s an
r ) ha deฺ
m ฺa Gui
n ฺ co ent
@ ao Stud
z i l le this
c e loฺ use
a r to
m e
i l l e ( icens
e loZ l
M arc
Free targe
t
Free PGA target PGA
SQL areas
SQL areas
SQL areas
SGA targ
et Buffer cache
SGA target
Buffer cache
Buffer cache
Large pool
Large pool ble
fe r a
SGA memory
Large pool
t r a ns
Shared pool Shared pool o
Sharedn - pool
a n
Java pool Java pool
h s
a eJavaฺ pool
r )
Streams pool Streams pool a
m ฺ G uidStreams pool
Other SGA OthernSGAฺ co ent Other SGA
a o t u d
OLTP
l l e@ is S
BATCH BATCH
i h
e l oฺz use t
a rc Copyright
t o © 2009, Oracle. All rights reserved.
l e (m ense
Automatic Memory
l
Zi Management:
lic Overview
e l o
With
a rcAutomatic Memory Management, the system causes an indirect transfer of memory from SGA
Mto PGA (and vice versa). It automates the sizing of PGA and SGA according to your workload.
This indirect memory transfer relies on the OS mechanism of freeing shared memory. After memory
is released to the OS, the other components can allocate memory by requesting memory from the OS.
Currently, this is implemented on Linux, Solaris, HP-UX, AIX, and Windows. Set your memory
target for the database instance and the system then tunes to the target memory size, redistributing
memory as needed between the system global area (SGA) and the aggregate program global area
(PGA).
The slide displays the differences between the Oracle Database 10g mechanism and the new
Automatic Memory Management with Oracle Database 11g.
11g 11g
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
350 MB 350 MB
Memory Memory
max target max target
300 MB
Memory target
250 MB
Memory target
ble
ALTER SYSTEM SET fe r a
ans
MEMORY_TARGET=300M;
n - t r
a no
h a s ฺ
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Automatic Memory
l
Zi Management:
lic Overview (continued)
l o
ce way to manage memory is to allow the database server to automatically manage and
Thersimplest
a
Mtune it for you. To do so (on most platforms), you have to set only a target memory size initialization
parameter (MEMORY_TARGET) and a maximum memory size initialization parameter
(MEMORY_MAX_TARGET). Because the target memory initialization parameter is dynamic, you can
change the target memory size at any time without restarting the database. The maximum memory
size serves as an upper limit so that you do not 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 also prevents you from setting the target memory size too low.
MEMORY_MAX_TARGET
SGA_MAX_SIZE
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
MEMORY_TARGET
SGA_TARGET PGA_AGGREGATE_TARGET
SHARED_POOL_SIZE
Others
ble
DB_CACHE_SIZE
fe r a
LARGE_POOL_SIZE
ans
JAVA_POOL_SIZE
n - t r
STREAMS_POOL_SIZE
a no
DB_KEEP_CACHE_SIZE h a s ฺ
DB_RECYCLE_CACHE_SIZE ฺ a u ide
r) LOG_BUFFER
DB_nK_CACHE_SIZE om t G
ฺ c n
RESULT_CACHE_MAX_SIZE
a on tude
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Oracle Database
l
Zi 11g lMemory
ic Parameters
l o
ce displays the memory initialization parameters hierarchy. Although you have to set only
Therslide
a
MMEMORY_TARGET to trigger Automatic Memory Management, you still have the ability to set
lower-bound values for various caches. So if the child parameters are set by the user, they will be the
minimum values below which that component is not auto-tuned.
N
MT=0 MMT>0
Y
ST>0 & PAT>0 ST+PAT<=MT<=MMT
Y
MT can be N
Minimum possible values
MT=0 dynamically
changed later. Y
ST>0 & PAT=0 PAT=MT-ST
r ) d e ฺ
SGA and PGA cannot PAT=40%MT
ฺa Gu i
grow and shrink automatically.
c o m n t
n ฺ e
d PGA can grow and shrink automatically.
@ aoBothSSGA tuand
z i l le this
ฺ
loCopyright e
s2009,
r c e o u© Oracle. All rights reserved.
a t
l e (m ense
Automatic Memory
l
Zi Parameter
lic Dependency
l o
ce illustrates the relationships among the various memory sizing parameters.
Therslide
a
M If MEMORY_TARGET is set to a nonzero value:
• If SGA_TARGET and PGA_AGGREGATE_TARGET are set, they will be considered to be
minimum values for the sizes of SGA and PGA, respectively. MEMORY_TARGET can take
values from SGA_TARGET + PGA_AGGREGATE_TARGET to MEMORY_MAX_TARGET.
• If SGA_TARGET is set and PGA_AGGREGATE_TARGET is not set, you still auto-tune both the
parameters. PGA_AGGREGATE_TARGET is initialized to a value of
(MEMORY_TARGET - SGA_TARGET).
• If PGA_AGGREGATE_TARGET is set and SGA_TARGET is not set, you still auto-tune both the
parameters. SGA_TARGET is initialized to a value of min(MEMORY_TARGET -
PGA_AGGREGATE_TARGET, SGA_MAX_SIZE (if set by the user)) and will auto-tune
subcomponents.
• If neither is set, they are auto-tuned without minimum or default values. There is a policy of
distributing the total server memory in a fixed ratio to the SGA and PGA during initialization.
The policy is to distribute 60% to SGA and 40% to PGA at startup.
parameters for some of the subcomponents must be set explicitly (for SGA_TARGET).
• If only MEMORY_MAX_TARGET is set, MEMORY_TARGET defaults to 0 in manual setup using
the text initialization file. Auto-tuning defaults to 10g Release 2 behavior for SGA and PGA.
• If SGA_MAX_SIZE is not user set, it is set internally to MEMORY_MAX_TARGET if user sets
MEMORY_MAX_TARGET (independent of SGA_TARGET being user set).
In a text initialization parameter file, if you omit the line for MEMORY_MAX_TARGET and include a
value for MEMORY_TARGET, the database automatically sets MEMORY_MAX_TARGET to the value
a b le
of MEMORY_TARGET. If you omit the line for MEMORY_TARGET and include a value for er
MEMORY_MAX_TARGET, the MEMORY_TARGET parameter defaults to zero. After startup,
a n sf you can
then dynamically change MEMORY_TARGET to a nonzero value if it does not exceed
o n -tr the value of
MEMORY_MAX_TARGET.
s an
If MEMORY_MAX_TARGET is not set and you want to change MEMORY_TARGET
r ) ha deฺ when using a
ฺa i
server parameter file, you must restart the instance to set MEMORY_MAX_TARGET.
u
m G
coabbreviations
n t to parameter names:
n ฺ
Legend: In the slide, use the following list to translate e
• MT = MEMORY_TARGET
@ ao Stud
• MMT = MEMORY_MAX_TARGETlle is
z i t h
• ST = SGA_TARGET
c e loฺ use
r
• PAT = PGA_AGGREGATE_TARGET
a to
(
• SMS = SGA_MAX_SIZEm ns e
ill e
lo Z lice
rc e
Ma
ble
fe r a
ans
n - t r
a no
h a s ฺ
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Zi l
Enabling Automatic lic
Memory Management
l o
e enable Automatic Memory Management by using Enterprise Manager, as shown in the
Yourccan
a
Mslide.
From the Database home page, click the Server tab. On the Server page, click the Memory Advisors
link in the Database Configuration section. This takes you to the Memory Advisors page. On this
page, you can click the Enable button to enable Automatic Memory Management.
The value in the “Total Memory Size for Automatic Memory Management” field is set by default to
the current SGA + PGA size. You can set it to anything more than this but less than the value in
Maximum Memory Size.
Note: On the Memory Advisors page, you can also specify the Maximum Memory Size. If you
change this field, the instance must be restarted for your change to take effect.
ble
fe r a
ans
n - t r
a no
h a s ฺ
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Zi l
Monitoring Automatic licMemory Management
l o
When
a rceAutomatic Memory Management is enabled, you see a new graphical representation of the
Mhistory of your memory size components in the Allocation History section of the Memory Parameters
page. The green part in the first graphic represents the PGA and the brownish orange part is all of the
SGA. The dark blue below in the lower histogram is the Shared Pool size; light blue corresponds to
Buffer Cache.
The change in the slide displays the possible repartition of memory after the execution of the various
demanding queries. Both SGA and PGA might therefore shrink. Note that with SGA shrink, its
subcomponents also shrink around the same time.
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: V$MEMORY_TARGET_ADVICE displays the tuning advice for the MEMORY_TARGET
initialization parameter.
ble
fe r a
ans
n - t r
a no
h a s ฺ
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Zi l
DBCA and Automatic c
liMemory Management
l o
e Database 11g, DBCA has new options to accommodate Automatic Memory
rcOracle
With
a
MManagement (AMM). Use the Memory tab of the Initialization Parameters page to set the
initialization parameters that control how the database manages its memory usage. You can choose
from two basic approaches to memory management:
• Typical: Requires very little configuration and allows the database server to manage how it uses
a percentage of your overall system memory. Select Typical to create a database with minimal
configuration or user input. This option is sufficient for most environments and for DBAs who
are inexperienced with advanced database creation procedures. Enter a value in megabytes in the
Memory Size field. To use AMM, select the corresponding option in the Typical section of the
page. Click Show Memory Distribution to see how much memory the DBCA assigns to both
SGA and PGA when you do not select the AMM option.
• Custom (uses ASMM or not): Requires more configuration but provides you with more control
over how the database server uses available system memory. To allocate specific amounts of
memory to the SGA and PGA, select Automatic. To customize how the SGA memory is
distributed among the SGA memory structures (buffer cache, shared pool, and so on), select
Manual and enter specific values for each SGA subcomponent. Review and modify these
initialization parameters later in DBCA.
Note: When you use DBUA or manual DB creation, the MEMORY_TARGET parameter defaults to 0.
• Benefits
– Better performance for the same price
– Easy to setup
– Fine-tune object-level granularity control of the LRU
mechanism
• Mainly for read-intensive OLTP workloads e
r a bl
s fe
- t r an
n no
a
s ฺ
h a
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Using DB Smart
l
Zi FlashlicCache
l o
e helps you to get better performance. In a database system when the buffer cache memory
Thisrc
feature
a
Mis maxed out and the I/O starts thrashing, your only option is to buy more memory. But the GB/$
ratio on main memory is not cheap and the system might not have enough DRAM slots. So you may
be forced to upgrade the machine.
Flash disks are the perfect middle ground in this situation. For the same price as main memory, you
can acquire 5X-10X flash disk in size. Using the flash cache feature, the flash disk can be configured
with the main memory buffer cache to provide a much larger combined buffer cache. If the whole
working set of the database can fit into the flash cache, after the flash cache has been warmed up,
there is very little cache I/Os to the magnetic disk besides for checkpoint writes and direct I/Os. The
response time and overall throughput for read-intensive OLTP workloads are expected to improve in
a system with the same amount of main memory but additional SSD flash devices configured.
The feature is also easy to use because only two initialization parameters need to be specified before
startup.
This feature also provides you with an interface to fine-tune the object-level granularity control of
the LRU in the flash cache. If needed, you can also specify object-level control over the flash cache
LRU mechanism by specifying two storage clause keywords.
bl e
fe r a
an s
Magnetic Disk
-
Flash Cache (20GB)
n t r
a no
(1 ms access time)
h a s ฺ
ฺ a r) uide
Buffer header
on tud
Pointer
i l l e
l o ฺz se th
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
DB SmartoFlash
l
Zi CachelicArchitecture Overview
l
When
a rcea process tries to access a block and the block does not exist in the buffer cache, it will first be
Mread from disk into the memory (physical read). After the in-memory buffer cache is getting full,
eventually a buffer will get evicted out of the memory based on an LRU mechanism.
With DB Flash Cache, when a clean in-memory buffer is aged out, the buffer content is written to the
flash cache in the background by the Database Writer (DBWR), and the buffer header is kept in
memory as metadata in either the flash DEFAULT or KEEP LRU list, depending on the value of the
FLASH_CACHE object attribute. The flash KEEP LRU list is used to maintained the buffer headers
on a separate list to prevent the regular buffer headers from replacing them. Therefore, the flash
buffer headers belonging to an object specified as KEEP tend to stay longer in the flash cache. If the
FLASH_CACHE object attribute is set to NONE, the system does not retain the corresponding buffers
in the flash cache or in memory.
When a buffer already aged out of memory is accessed again, the system checks to see whether the
buffer is in the flash cache. If so, it reads it back from the flash cache instead of reading it from the
disk, which takes only a fraction of the time. The consistency of flash cache buffers across RAC
clusters is maintained in the same way as by Cache Fusion. Because the flash cache is an extended
cache and direct I/O totally bypasses the buffer cache, this feature does not support direct I/O.
Note that the system does not put dirty buffers in flash cache because it may have to read buffers into
memory in order to checkpoint them because writing to flash cache does not count for checkpoint.
Note: A physical read from the magnetic disk typically takes about 10 MS, while flash cache has a
typical access time of 1MS.
Oracle Database 11g: New Features for Administrators 16 - 27
11.2
feature.
ble
fe r a
ans
n - t r
o
s an
r ) ha deฺ
m ฺa Gui
n ฺ co ent
@ ao Stud
z i l le this
c e loฺ use
a r to
m e
i l l e ( icens
e loZ l
M arc
tablespace tbs_1
storage (FLASH_CACHE KEEP|NONE|DEFAULT);
*_TABLES
*_INDEXES
FLASH_CACHE
*_CLUSTERS
…
ble
fe r a
ans
n - t r
V$SQL –> OPTIMIZED_PHY_READ_REQUESTS
V$SQLAREA –> OPTIMIZED_PHY_READ_REQUESTS a no
V$FILESTAT –> OPTIMIZED_PHYBLKRD h a s ฺ
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Specifying DB
l
Zi SmartlFlash
ic Cache for a Table
l o
The
a ce clause now has a new option: FLASH_CACHE. This option allows you to specify the
rstorage
Mfollowing attributes:
• DEFAULT: In-memory buffers for this object are put on the flash cache after they are aged out
of the main memory and become flash buffers. Such flash buffers are kept on a flash LRU list
and might be aged out with a standard LRU algorithm.
• KEEP: In-memory buffers for this object are put on the flash cache after they are aged out of the
main memory. Flash buffers for this object are kept on a separate LRU list from the other flash
buffers, and are not aged out of the flash cache as long as the flash cache size is large enough.
• NONE: In-memory buffers for this object are not put on the flash cache when they are aged out
of memory.
The slide shows you a CREATE TABLE example using the new storage clause option.
In addition, the slide shows you some of the dictionary views that have new columns to reflect the
flash information.
Note: For consistency, the system counts flash I/Os as physical I/O for all type of statistics. It also
provides corresponding flash-specific statistics to differentiate flash I/Os from disk I/Os. AWR
reports are updated to reflect these new statistics and wait events. Flash-related statistics are also
added to V$SESSTAT.
Database level
Global level
CASCADE DEGREE
ESTIMATE_PERCENT METHOD_OPT
NO_INVALIDATE GRANULARITY
PUBLISH INCREMENTAL
STALE_PERCENT
ble
set_global_prefs
fe r a
DB
ans
set_database_prefs
se
t|
MS
_S
TA
n - t r
no
TS
ex get
po | d
set_schema_prefs
rt | ele a
s ฺ
im te
set_table_prefs
h apo
rt
gather_*_stats ฺa
r) uide DBA
co entm G
n ฺ
@ ao Stud
z i l le this
ฺ
loCopyright e
s2009,
r c e o u© Oracle. All rights reserved.
a t
l e (m ense
Zi l
Statistic Preferences: c
liOverview
l o
a ce
Therautomated statistics-gathering feature was introduced in Oracle Database 10g, Release 1 to
Mreduce the burden of maintaining optimizer statistics. However, there were cases where you had to
disable it and run your own scripts instead. One reason was the lack of object-level control.
Whenever you found a small subset of objects for which the default gather statistics options did not
work well, you had to lock the statistics and analyze them separately by using your own options. For
example, the feature that automatically tries to determine adequate sample size
(ESTIMATE_PERCENT=AUTO_SAMPLE_SIZE) does not work well against columns that contain
data with very high frequency skews. The only way to get around this issue was to manually specify
the sample size in your own script.
Note: You can describe all the effective statistics preference settings for all relevant tables by using
the DBA_TAB_STAT_PREFS view.
ble
fe r a
ans
n - t r
a no
h a s ฺ
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Setting Global
l
Zi Preferences
lic with Enterprise Manager
l o
ce to control global preference settings by using Enterprise Manager. You do so on the
It isrpossible
a
MManage Optimizer Statistics page, which you access from the Database home page by clicking the
Server tab, then the Manage Optimizer Statistics link, and then the Global Statistics Gathering
Options link.
On the Global Statistics Gathering Options page, change the global preferences in the Gather
Optimizer Statistics 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.
bl e
fe r a
ans
n - t r
n o
… … a
s …ฺ
) h a e Global
Q1 1970 Q2 1970 Q1 2007 Q1 1970 Q2 1970 Q1 2007
r
ฺa Guid
Q1 1970 Q2 1970
statistics
Q1 2007
m
o ent
cINCREMENTAL=TRUE
n&ฺ
GRANULARITY=GLOBAL%
@ ao Stud
z i l le this
ฺ
loCopyright e
s2009,
r c e o u© Oracle. All rights reserved.
a t
l e (m ense
Partitioned Tables
l
Zi and licIncremental Statistics: Overview
e l o
Forracpartitioned table, the system maintains both the statistics on each partition and the overall
a
Mstatistics for the table. Generally, if the table is partitioned using a date range value, very few
partitions go through data modifications (DML). For example, suppose you have a table that stores
the sales transactions. You partition the table on sales date with each partition containing transactions
for a quarter. Most of the DML activity happens on the partition that stores the transactions of the
current quarter. The data in other partitions remains unchanged. The system currently keeps track of
DML monitoring information at the table and (sub)partition levels. Statistics are gathered only for
those partitions (in the example in the slide, the partition for the current quarter) that have
significantly changed (current threshold is 10%) since the last statistics gathering. However, global
statistics are gathered by scanning the entire table, which makes global statistics very expensive on
partitioned tables—especially when some partitions are stored in slow devices and not modified
often.
Oracle Database 11g can expedite the gathering of certain global statistics, such as the number of
distinct values. In contrast to the traditional way of scanning the entire table, there is a new
mechanism to define global statistics by scanning only those partitions that have been changed and
still make use of the statistics gathered before for those partitions that are unchanged. In short, these
global statistics can be maintained incrementally.
Note: The new mechanism does not incrementally maintain histograms and density global statistics.
ble
fe r a
ans
n - t r
o
s an
r ) ha deฺ
m ฺa Gui
n ฺ co ent
@ ao Stud
z i l le this
c e loฺ use
a r to
m e
i l l e ( icens
e loZ l
M arc
ble
fe r a
ans
n - t r
o
s an
r ) ha deฺ
m ฺa Gui
n ฺ co ent
@ ao Stud
z i l le this
c e loฺ use
a r to
m e
i l l e ( icens
e loZ l
M arc
S(MAKE Λ MODEL)=S(MAKE)xS(MODEL)
select
dbms_stats.create_extended_stats('jfv','vehicle','(make,model)') from
dual; 2
exec dbms_stats.gather_table_stats('jfv','vehicle',- bl e
r
fe 3a
method_opt=>'for all columns size 1 for columns (make,model) size 3');
an s
n - t r
DBA_STAT_EXTENSIONS VEHICLE a no
SYS_STUF3GLKIOP5F4B0BTTCFTMX0W
MAKE MODEL h a s ฺ
ฺ a r) uid4 e
ฺ c om ent G
S(MAKE Λ@ aon)=S(SMAKE,MODEL
MODEL tud )
l l e i s
l o ฺzi se th
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
i l
MulticolumnZStatistics: licOverview
l o
e Database 10g, the query optimizer takes into account correlation between columns when
rcOracle
With
a
Mcomputing the selectivity of multiple predicates in the following limited cases:
• If all the columns of a conjunctive predicate match all the columns of a concatenated index key,
and the predicates are equalities used in equijoins, then the optimizer uses the number of distinct
keys (NDK) in the index for estimating selectivity, as 1/NDK.
• When DYNAMIC_SAMPLING is set to level 4, the query optimizer uses dynamic sampling to
estimate the selectivity of complex predicates involving several columns from the same table.
However, the sample size is very small and increases parsing time. As a result, the sample is
likely to be statistically inaccurate and may cause more harm than good.
In all other cases, the optimizer assumes that the values of columns used in a complex predicate are
independent of each other. It estimates the selectivity of a conjunctive predicate by multiplying the
selectivity of individual predicates. This approach always results in under-estimation of the
selectivity. To circumvent this issue, Oracle Database 11g allows you to collect, store, and use the
following statistics to capture functional dependency between two or more columns (also called
groups of columns): number of distinct values, number of nulls, frequency histograms, and density.
Note
• The CREATE_EXTENDED_STATS function returns a virtual hidden column name such as
SYS_STUW_5RHLX443AN1ZCLPE_GLE4.
• Based on the example in the slide, the name can be determined by using the following SQL:
select
dbms_stats.show_extended_stats_name('jfv','vehicle','(make,model
)') from dual
a b le
• After creation, you can retrieve the statistics extensions by using the
s f er
ALL|DBA|USER_STAT_EXTENSIONS views.
a n
o n -tr
a n
a s
h deฺ
r )
ฺa Gui
m
co ent
n ฺ
@ ao Stud
z i l le this
c e loฺ use
a r to
m e
i l l e ( icens
e loZ l
M arc
VEHICLE
MODEL
VEHICLE
MODEL Still possible
Recommended
VEHICLE DBA_STAT_EXTENSIONS
bl e
S(upper( MODEL))=0.01 MODEL fe r a
an s
- t r
SYS_STU3FOQ$BDH0S_14NGXFJ3TQ50
n
a no
h a s ฺ
a r) uide
select dbms_stats.create_extended_stats('jfv','vehicle','(upper(model))')
ฺ
from
om ent G
dual;
ฺ c
on1 for tcolumns
exec dbms_stats.gather_table_stats('jfv','vehicle',-
method_opt=>'for all columns a
@
size
S ud (upper(model)) size 3');
z i l le this
ฺ
loCopyright e
s2009,
r c e o u© Oracle. All rights reserved.
a t
l e (m ense
Zi l
Expression Statistics: licOverview
l o
rce involving expressions on columns are a significant issue for the query optimizer. When
Predicates
a
Mcomputing selectivity on predicates of the form function(Column) = constant, the optimizer
assumes a static selectivity value of 1 percent. Obviously, this approach is wrong and causes the
optimizer to produce suboptimal plans.
The query optimizer has been extended to better handle such predicates in limited cases where
functions preserve the data distribution characteristics of the column and thus allow the optimizer to
use the columns statistics. An example of such a function is TO_NUMBER.
Further enhancements have been made to evaluate built-in functions during query optimization to
derive better selectivity using dynamic sampling. Finally, the optimizer collects statistics on virtual
columns created to support function-based indexes.
However, these solutions are either limited to a certain class of functions or work only for
expressions used to create function-based indexes. By using expression statistics in Oracle Database
11g, you can use a more general solution that includes arbitrary user-defined functions and does not
depend on the presence of function-based indexes. As shown in the example in the slide, this feature
relies on the virtual column infrastructure to create statistics on expressions of columns.
OPTIMIZER_USE_PENDING_STATISTICS=FALSE
Dictionary
Pending statistics
statistics
PUBLISH=FALSE
+
GATHER_*_STATS
DBA_TAB_PENDING_STATS
bl e
IMPORT_TABLE_STATS
fe r a
expdp/impdp
an s
- t r
PUBLISH_PENDING_STATS
n
a no
EXPORT_PENDING_STATS
h a s ฺ
ฺ a r) uide
ฺ c om ent G
a on tud TEST
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
l
Zi Publishing:
Deferred Statistics lic Overview
l o
ce the statistics-gathering operation automatically stores the new statistics in the data
By rdefault,
a
Mdictionary each time it completes the iteration for one object (table, partition, subpartition, or index).
The optimizer sees them as soon as they are written to the data dictionary, and these new statistics
are called current statistics. This automatic publishing can be frustrating to the DBA, who is never
sure of the aftermath of the new statistics—days or even weeks later. In addition, the statistics used
by the optimizer can be inconsistent if, for example, table statistics are published before the statistics
of its indexes, partitions or subpartitions.
To avoid these potential issues, in Oracle Database 11g Release 1, you can separate the gathering
step from the publication step for optimizer statistics. There are two benefits in separating the two
steps:
• Supports the statistics gathering operation as an atomic transaction. The statistics of all tables
and dependent objects (indexes, partitions, subpartitions) in a schema will be published at the
same time. This new model has two beneficial properties: The optimizer will always have a
consistent view of the statistics, and if for some reason the gathering step fails during the
gathering process, it will be able to resume from where it left off when it is restarted by using the
DBMS_STAT.RESUME_GATHER_STATS procedure.
• Allows DBAs to validate the new statistics by running all or part of the workload using the
newly gathered statistics on a test system and, when satisfied with the test results, to proceed to
the publishing step to make them current in the production environment.
exec dbms_stats.set_table_prefs('SH','CUSTOMERS','PUBLISH','false'); 1
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
exec dbms_stats.gather_table_stats('SH','CUSTOMERS'); 2
bl e
fe r a
ans
Execute your workload from the same session.
n - t r 4
a no
h a s ฺ
exec dbms_stats.publish_pending_stats('SH','CUSTOMERS'); ฺ a r) uide 5
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
l
Zi Publishing:
Deferred Statistics lic Example
l o
a ce the SET_TABLE_PREFS procedure to set the PUBLISH option to FALSE. This prevents
1.rUse
M the next statistics gathering operation from automatically publishing statistics as current.
According to the first statement, this is true for the SH.CUSTOMERS table only.
2. Gather statistics for the SH.CUSTOMERS table in the pending area of the dictionary.
3. Test the new set of pending statistics from your session by setting the
OPTIMIZER_USE_PENDING_STATISTICS to TRUE.
4. Issue queries against SH.CUSTOMERS.
5. If you are satisfied with the test results, use the PUBLISH_PENDING_STATS procedure to
render the pending statistics for SH.CUSTOMERS current.
Note: To analyze the differences between the pending statistics and the current ones, you could
export the pending statistics to your own statistics table and then use the new
DBMS_STAT.DIFF_TABLE_STATS function.
l e (m ense
Zi l
Locking Enhancements lic
l o
ce can limit the time that DDL commands wait for DML locks before failing by setting the
• rYou
a
M DDL_LOCK_TIMEOUT parameter at the system or session level. This initialization parameter is
set by default to 0, that is NOWAIT, which ensures backward compatibility. The range of values
is 0–1,000,000 (in seconds).
• The LOCK TABLE command has new syntax that you can use to specify the maximum number
of seconds the statement should wait to obtain a DML lock on the table. Use the WAIT clause to
indicate that the LOCK TABLE statement should wait up to the specified number of seconds to
acquire a DML lock. There is no limit on the value of the integer.
• In highly concurrent environments, the requirement of acquiring an exclusive lock—for
example, at the end of an online index creation and rebuild—could lead to a spike of waiting
DML operations and, therefore, a short drop and spike of system usage. While this is not an
overall problem for the database, this anomaly in system usage could trigger operating system
alarm levels. The commands listed in the slide no longer require exclusive locks.
V$SYSTEM_WAIT_CLASS has two new NUMBER columns that represent the statistics from purely
foreground sessions:
• TOTAL_WAITS_FG
• TIME_WAITED_FG
ble
fe r a
ans
n - t r
o
s an
r ) ha deฺ
m ฺa Gui
n ฺ co ent
@ ao Stud
z i l le this
ฺ
loCopyright e
s2009,
r c e o u© Oracle. All rights reserved.
a t
l e (m ense
i l lic
el oZ
Marc
ble
fe r a
ans
n - t r
o
s an
r ) ha deฺ
m ฺa Gui
n ฺ co ent
@ ao Stud
z i l le this
ฺ
loCopyright e
s2009,
r c e o u© Oracle. All rights reserved.
a t
l e (m ense
i l lic
el oZ
Marc
Marc
le
oZ
i l l l
m a r c e
e ( icens
e
z i
to
l @
loฺ use
n
le this
ฺ
m
ao Stud
r )
co ent
s
ฺa Gui
ha deฺ
an
on - t r an
s
fe r a bl
e
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
ble
fe r a
ans
n - t r
o
s an
r ) ha deฺ
m ฺa Gui
n ฺ co ent
@ ao Stud
z i l le this
ฺ
loCopyright e
s2009,
r c e o u© Oracle. All rights reserved.
a t
l e (m ense
i l lic
el oZ
Marc
Objectives
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
ble
fe r a
CREATE VIEW NEW_EMPLOYEES Dependent unit
t r a ns
AS SELECT LAST_NAME Cross-unit reference
o n -
FROM EMPLOYEES Parent unit s a
n
a eฺ
WHERE EMPLOYEE_ID > 20; r) h reference
Cross-unit d ฺa Gui
co entm
n ฺ
@ ao Stud
z i l le this
ฺ
loCopyright e
s2009,
r c e o u© Oracle. All rights reserved.
a t
l e (m ense
i l
Fine-GrainedZDependency lic Management
l o
rce Database 11g, you now have access to records that describe more precise dependency
In Oracle
a
Mmetadata. This is called fine-grained dependency and enables you to see when dependent objects are
not invalidated without logical requirement.
Oracle Database 11g dependencies are tracked at the element level within a unit. Element-based
dependency tracking covers the following:
• Dependency of a single-table view on its base table
• Dependency of a PL/SQL program unit (package specification, package body, or subprogram)
on the following:
- Other PL/SQL program units
- Tables
- Views
A cross-unit reference creates a dependency from the unit making the reference (the dependent
unit—for example, the NEW_EMPLOYEES view above) to the unit being referenced (the parent
unit—for example, the EMPLOYEES table). Dependencies are always tracked automatically by
PL/SQL and SQL compilers. This mechanism is available without any configuration.
Reducing the invalidation of dependent objects in response to changes to the objects on which they
depend increases application availability, both in the development environment and during online
application upgrade.
l l e @ is
ฺ z i t h
e loCopyright u e
s2009,
a r c t o © Oracle. All rights reserved.
l e (m ense
Zi l
Example of Dependency lic of a Single-Table View on Its Base Table
l o
e example in the slide, table T is created with three columns, COL_A, COL_B, and COL_C.
rcfirst
In the
a
MA view named V is created based on columns COL_A and COL_B of table T. The dictionary views
are queried; view V is dependent on table T and its status is valid.
In the second example in the slide, table T is altered. A new column named COL_D is added. The
dictionary views still report that the view V is dependent because element-based dependency tracking
realizes that the columns COL_A and COL_B are not modified and, therefore, the view does not need
to be invalidated.
PROCEDURE p1;
END pkg;
/
CREATE PROCEDURE p
IS
BEGIN
pkg.p1();
END;
/
CREATE OR REPLACE PACKAGE pkg
ble
IS
fe r a
PROCEDURE p1;
ans
PROCEDURE unheard_of;
END pkg; n - t r
/
a no
SELECT status FROM user_objects
h a s ฺ
WHERE object_name = 'P';
ฺ a r) uide
STATUS
ฺ c om ent G
--------
a on tud
VALID
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Zi l
Example of Dependency lic of a PL/SQL Program Unit on a PL/SQL Program Unit
e l o
a rcexample
In the in the slide, you create a package named PKG that has a call to procedure P1. Another
Mprocedure named P invokes PKG.P1. The definition of the package PKG is modified and another
subroutine is added to the package declaration. When you query the USER_OBJECTS dictionary
view for the status of the P package, it is still valid because the element you added to the definition
of PKG is not referenced through procedure P.
VISIBLE INVISIBLE
Index Index
OPTIMIZER_USE_INVISIBLE_INDEXES=FALSE
ble
fe r a
ans
Data view point n - t r
a no
h a s ฺ
ฺ a r) uide
Update index
ฺ c om eindex
Update
n tG
Update table
a on tud Update table
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Invisible Index:
l
Zi Overviewlic
l o
rce with Release 11g, you can create invisible indexes. An invisible index is an index that is
Beginning
a
Mignored by the optimizer unless you explicitly set the OPTIMIZER_USE_INVISIBLE_INDEXES
initialization parameter to TRUE at the session or system level. The default value for this parameter is
FALSE.
Making an index invisible is an alternative to making it unusable or dropping it. Using invisible
indexes, you can do the following:
• Test the removal of an index before dropping it.
• Use temporary index structures for certain operations or modules of an application without
affecting the overall application.
Unlike unusable indexes, an invisible index is maintained during DML statements.
l e (m ense
l
Zi Examples
Invisible Indexes: lic
l o
When
a rcean index is invisible, the optimizer generates plans that do not use the index. If there is no
Mdiscernible drop in performance, you can then drop the index. You can also create an index initially
as invisible, perform testing, and then determine whether to make the index visible.
You can query the VISIBILITY column of the *_INDEXES data dictionary views to determine
whether the index is VISIBLE or INVISIBLE.
Note: For all the statements given in the slide, it is assumed that
OPTIMIZER_USE_INVISIBLE_INDEXES is set to FALSE.
4 P 0.004 HJ HJ
P
r ) i d e HJ HJ
a
r
s Cubes merged
m ฺa Gu
a
r
s
e
ฺ c o e
e n t
n
tud& :2=F ⇒ S(:1)=0.3 ∧ S(:2)=0.009
0.28 0.3
ao S:1=E
:1=G & :2=H ⇒ S(:1)=0.28 ∧ S(:2)=0.004
@
z i l le this
ฺ
loCopyright e
s2009,
r c e o u© Oracle. All rights reserved.
a t
l e (m ense
Adaptive Cursor
l
Zi Sharing: lic Architecture
l o
rceAdaptive Cursor Sharing, the following steps take place in the scenario illustrated in the slide:
Using
a
M 1. The cursor starts its life with a hard parse, as usual. If bind peeking takes place, and a histogram
is used to compute selectivity of the predicate containing the bind variable, then the cursor is
marked as a bind-sensitive cursor. In addition, some information is stored about the predicate
containing the bind variables, including the predicate selectivity. In the slide example, the
predicate selectivity that would be stored is a cube centered around (0.15,0.0025). Because of
the initial hard parse, an initial execution plan is determined using the peeked binds. After the
cursor is executed, the bind values and the execution statistics of the cursor are stored in that
cursor.
During the next execution of the statement when a new set of bind values is used, the system
performs a usual soft parse, and finds the matching cursor for execution. At the end of
execution, execution statistics are compared with the ones currently stored in the cursor. The
system then observes the pattern of the statistics over all previous runs (see V$SQL_CS_…
views on next slide) and decides whether or not to mark the cursor as bind-aware.
2. On the next soft parse of this query, if the cursor is now bind-aware, bind-aware cursor matching
is used. Suppose that the selectivity of the predicate with the new set of bind values is now
(0.18,0.003). Because selectivity is used as part of bind-aware cursor matching, and because the
selectivity is within an existing cube, the statement uses the existing child cursor’s execution
plan to run.
4. On the next soft parse of this query, suppose that the selectivity of the predicate with the new set
of bind values is now (0.28,0.004). Because that selectivity is not within one of the existing
cubes, the system does a hard parse. Suppose that this time, the hard parse generates the same
execution plan as the first one. Because the plan is the same as the first child cursor, both child
cursors are merged. That is, both cubes are merged into a new bigger cube, and one of the child
cursors is deleted. The next time there is a soft parse, if the selectivity falls within the new cube,
the child cursor will match. e
a bl
f e r
ans
n - t r
o
s an
r ) ha deฺ
m ฺa Gui
n ฺ co ent
@ ao Stud
z i l le this
c e loฺ use
a r to
m e
i l l e ( icens
e loZ l
M arc
cShowsm
o eexecution n t
V$SQL_CS_STATISTICS
o n ฺ d
statistics of a cursor
z i l le this
ฺ
loCopyright e
s2009,
r c e o u© Oracle. All rights reserved.
a t
l e (m ense
Adaptive Cursor
l
Zi Sharing lic Views
l o
rceviews determine whether a query is bind-aware or not, and is handled automatically, without
These
a
Many user input. However, information about what is going on is exposed through V$ views so that the
DBA can diagnose any problems. Two new columns have been added to V$SQL:
• IS_BIND_SENSITIVE: Indicates if a cursor is bind-sensitive; value YES | NO. A query for
which the optimizer peeked at bind variable values when computing predicate selectivities and
where a change in a bind variable value may lead to a different plan is called bind-sensitive.
• IS_BIND_AWARE: Indicates if a cursor is bind-aware; value YES | NO. A cursor in the cursor
cache that has been marked to use bind-aware cursor sharing is called bind-aware.
V$SQL_CS_HISTOGRAM: Shows the distribution of the execution count across a three-bucket
execution history histogram.
V$SQL_CS_SELECTIVITY: Shows the selectivity cubes or ranges stored in a cursor for every
predicate containing a bind variable and whose selectivity is used in the cursor sharing checks. It
contains the text of the predicates and the selectivity range low and high values.
V$SQL_CS_STATISTICS: Adaptive Cursor Sharing monitors execution of a query and collects
information about it for a while, and uses this information to decide whether to switch to using bind-
aware cursor sharing for the query. This view summarizes the information that it collects to make this
decision: for a sample of executions, it keeps track of rows processed, buffer gets, and CPU time.
The PEEKED column has the value YES if the bind set was used to build the cursor, and NO
otherwise.
Oracle Database 11g: New Features for Administrators 17 - 15
Interacting with Adaptive Cursor Sharing
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
• CURSOR_SHARING:
– If CURSOR_SHARING <> EXACT, then statements
containing literals may be rewritten using bind variables.
– If statements are rewritten, Adaptive Cursor Sharing may
apply to them.
• SQL Plan Management (SPM):
le
– If OPTIMIZER_CAPTURE_SQL_PLAN_BASELINES is set toerab
TRUE, then only the first generated plan is used. ans
f
– As a workaround, set this parameter to FALSE, o n -tr run
and
your application until all plans are loaded s ainnthe cursor
cache. r ) ha deฺ
m ฺa Gui
– Manually load the cursor cache
n ฺ co into
e n t the corresponding
plan baseline. ao tud
@ is S
i l l e
l o ฺz se th
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
l
Zi Adaptive
Interacting with lic Cursor Sharing
l o
ce Cursor Sharing is independent of the CURSOR_SHARING parameter. The setting of
• rAdaptive
a
M this parameter determines whether literals are replaced by system-generated bind variables. If
they are, then Adaptive Cursor Sharing behaves just as it would if the user supplied binds to
begin with.
• When using the SPM automatic plan capture, the first plan captured for a SQL statement with
bind variables is marked as the corresponding SQL plan baseline. If another plan is found for
that same SQL statement (which may be the case with Adaptive Cursor Sharing), it is added to
the SQL statements plan history and marked for verification: It will not be used. So even though
Adaptive Cursor Sharing has come up with a new plan based on a new set of bind values, SPM
does not let it be used until the plan has been verified. Thus reverting back to10g behavior, only
the plan generated based on the first set of bind values will be used by all subsequent executions
of the statement. One possible workaround is to run the system for some time with automatic
plan capture set to false, and after the cursor cache has been populated with all of the plans a
SQL statement with bind will have, load the entire plan directly from the cursor cache into the
corresponding SQL plan baseline. By doing this, all the plans for a single SQL statement are
marked as SQL baseline plans by default.
a on tud 1
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
l
Zi Cache:
SQL Query Result lic Overview
l o
ce query result cache enables explicit caching of query result sets and query fragments in
TherSQL
a
Mdatabase memory. A dedicated memory buffer stored in the shared pool can be used for storing and
retrieving the cached results. The query results stored in this cache become invalid when data in the
database objects being accessed by the query is modified.
Although the SQL query cache can be used for any query, good candidate statements are the ones
that need to access a very high number of rows to return only a fraction of them. This is mostly the
case for data warehousing applications.
In the graphic shown in the slide, if the first session executes a query, it retrieves the data from the
database and then caches the result in the SQL query result cache. If a second session executes the
exact same query, it retrieves the result directly from the cache instead of using the disks.
Note
• Each node in a RAC configuration has a private result cache. Results cached on one instance
cannot be used by another instance. However, invalidations work across instances. To handle all
synchronization operations between RAC instances related to the SQL query result cache, the
special RCBG process is used on each instance.
• With parallel query, an entire result can be cached (in RAC it is cached on query coordinator
instance) but individual parallel query processes cannot use the cache.
ble
– Cannot be greater than 75% of shared pool
fe r a
• RESULT_CACHE_MAX_RESULT ans
n - t r
– Sets maximum cache memory for a single result o
n
– Defaults to 5% sa ha deฺ
• ar)
RESULT_CACHE_REMOTE_EXPIRATION
m ฺ G u i
– Sets the expiry time for cached
n ฺ coresults e n t
depending on remote
database objects
@ ao Stud
– Defaults to 0
z i l le this
ฺ
loCopyright e
s2009,
r c e o u© Oracle. All rights reserved.
a t
l e (m ense
Managing the
l
ZiSQL Querylic Results Cache
l o
e alter various parameter settings in the initialization parameter file to manage the SQL query
Yourccan
a
Mresult cache of your database.
By default, the database server allocates memory for the result cache in the Shared Pool inside the
SGA. The memory size allocated to the result cache depends on the memory size of the SGA as well
as the memory management system. You can change the memory allocated to the result cache by
setting the RESULT_CACHE_MAX_SIZE parameter. The result cache is disabled if you set its value
to 0. The value of this parameter is rounded to the largest multiple of 32 KB that is not greater than
the specified value. If the rounded value is 0, then the feature is disabled.
Use the RESULT_CACHE_MAX_RESULT parameter to specify the maximum amount of cache
memory that can be used by any single result. The default value is 5%, but you can specify any
percentage value between 1 and 100. This parameter can be implemented at the system and session
level.
Use the RESULT_CACHE_REMOTE_EXPIRATION parameter to specify the time (in number of
minutes) for which a result that depends on remote database objects remains valid. The default value
is 0, which implies that results using remote objects should not be cached. Setting this parameter to a
nonzero value can produce stale answers: for example, if the remote table used by a result is
modified at the remote database.
FROM employees
GROUP BY department_id;
--------------------------------------------------------------
| Id | Operation | Name |Rows
--------------------------------------------------------------
| 0 | SELECT STATEMENT | | 11
| 1 | RESULT CACHE | 8fpza04gtwsfr6n595au15yj4y | bl e
| 2 | HASH GROUP BY | fe
| s11
r a
a n
| 3 | TABLE ACCESS FULL| EMPLOYEES
o n -tr | 107
--------------------------------------------------------------
s an
SELECT /*+ NO_RESULT_CACHE */ department_id, r ) haAVG(salary)
d e ฺ
ฺa Gu i
FROM employees
c o m n t
n ฺ e
GROUP BY department_id;
@ ao Stud
z i l le this
ฺ
loCopyright e
s2009,
r c e o u© Oracle. All rights reserved.
a t
l e (m ense
Zi l
Using the Result_Cache lic Hint
l o
rcewant to use the query result cache and the RESULT_CACHE_MODE initialization parameter is
If you
a
Mset to MANUAL, you must explicitly specify the RESULT_CACHE hint in your query. This introduces
the ResultCache operator into the execution plan for the query. When you execute the query, the
ResultCache operator looks up the result cache memory to check whether the result for the query
already exists in the cache. If it exists, then the result is retrieved directly out of the cache. If it does
not yet exist in the cache, then the query is executed, the result is returned as output, and is also
stored in the result cache memory.
If the RESULT_CACHE_MODE initialization parameter is set to FORCE, and you do not want to store
the result of a query in the result cache, you must then use the NO_RESULT_CACHE hint in your
query. For example, when the RESULT_CACHE_MODE value equals FORCE in the initialization
parameter file, and you do not want to use the result cache for the EMPLOYEES table, then use the
NO_RESULT_CACHE hint.
Note: Use of the [NO_]RESULT_CACHE hint takes precedence over the parameter settings.
l e (m ense
Zi l lic
Using the DBMS_RESULT_CACHE Package
l o
a ce
TherDBMS_RESULT_CACHE package provides statistics, information, and operators that enable you
Mto manage memory allocation for the query result cache. You can use the DBMS_RESULT_CACHE
package to perform various operations such as viewing the status of the cache (OPEN or CLOSED),
retrieving statistics on the cache memory usage, and flushing the cache. For example, to view the
memory allocation statistics, use the following SQL procedure:
SQL> set serveroutput on
SQL> execute dbms_result_cache.memory_report
R e s u l t C a c h e M e m o r y R e p o r t
[Parameters]
Block Size = 1024 bytes
Maximum Cache Size = 720896 bytes (704 blocks)
Maximum Result Size = 35840 bytes (35 blocks)
[Memory]
Total Memory = 46284 bytes [0.036% of the Shared Pool]
... Fixed Memory = 10640 bytes [0.008% of the Shared Pool]
... State Object Pool = 2852 bytes [0.002% of the Shared Pool]
... Cache Memory = 32792 bytes (32 blocks) [0.025% of the Shared Pool]
....... Unused Memory = 30 blocks
....... Used Memory = 2 blocks
........... Dependencies = 1 blocks
........... Results = 1 blocks
............... SQL = 1 blocks
Note: For more information, refer to the PL/SQL Packages and Types Reference Guide.
Oracle Database 11g: New Features for Administrators 17 - 23
Viewing SQL Result Cache Dictionary Information
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
l e (m ense
i l lic
Note
oZ
elpurge works only if the cache is not in use; disable (close) the cache for flush to succeed.
c
• rThe
Ma• With bind variables, cached result is parameterized with variable values. Cached results can be
found only for the same variable values. That is, different values or bind variable names cause
cache miss.
• The result cache is also flushed when you flush the shared pool.
ble
— OCI_RESULT_CACHE_MAX_RSET_SIZE
fe r a
— OCI_RESULT_CACHE_MAX_RSET_ROWS
ans
n - t r
• Client result cache is then used dependingnon:
o
Tables result cache mode s ฺ a
—
h a
— r) ide
RESULT CACHE hints in your SQLastatements
ฺ u
o m t G
o n ฺc den
@ a Stu
z i l l e t h is
ฺ
loCopyright e
s2009,
r c e o u© Oracle. All rights reserved.
a t
l e (m ense
l
Zi Query
Using Client-Side lic Cache
l o
a ce
Therfollowing two parameters can be set in your initialization parameter file:
M • CLIENT_RESULT_CACHE_SIZE: A nonzero value enables the client result cache. This is the
maximum size of the client per-process result set cache in bytes. All OCI client processes get
this maximum size and can be overridden by the OCI_RESULT_CACHE_MAX_SIZE
parameter.
• CLIENT_RESULT_CACHE_LAG: Maximum time (in milliseconds) since the last round-trip to
the server, before which the OCI client query executes a round-trip to get any database changes
related to the queries cached on client.
A client configuration file is optional and overrides the cache parameters set in the server
initialization parameter file. Parameter values can be part of a sqlnet.ora file. When parameter
values shown in the slide are specified, OCI client caching is enabled for OCI client processes using
the configuration file. OCI_RESULT_CACHE_MAX_RSET_SIZE/ROWS denotes the maximum
size of any result set in bytes/rows in the per-process query cache. OCI applications can use
application hints to force result cache storage. This overrides the deployment time settings of ALTER
TABLE/ALTER VIEW. The application hints can be:
• SQL hints /*+ result_cache */, and /*+ no_result_cache */
• OCIStmtExecute() modes. These override SQL hints.
Note: To use this feature, your applications must be relinked with Release 11.1 or higher client
libraries and be connected to a Release 11.1 or higher server.
Cached
exec Calculate(…);
results
First ble
fe r a
query
ans
n - t r
no
BEGIN
exec Calculate(…); exec Calculate(…);
… a
s ฺ
SELECT … h a
FROM table; ฺ a r) uide
…
c m nt G
oSubsequent
END; ฺ
on tuqueries de
a
@ is S
i l l e
l o ฺz se th
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
PL/SQL Function
l
Zi Cache lic
l o
rcein Oracle Database 11g, you can use the PL/SQL cross-section function result caching
Starting
a
Mmechanism. This caching mechanism provides you with a language-supported and system-managed
means for storing the results of PL/SQL functions in a shared global area (SGA), which is available
to every session that runs your application. The caching mechanism is both efficient and easy to use,
and it relieves you of the burden of designing and developing your own caches and cache
management policies.
Oracle Database 11g provides the ability to mark a PL/SQL function to indicate that its result should
be cached to allow lookup, rather than recalculation, on the next access when the same parameter
values are called. This function result cache saves significant space and time. This is done
transparently using the input parameters as the lookup key. The cache is instancewide so that all
distinct sessions invoking the function benefit. If the result for a given set of parameters changes, you
can use constructs to invalidate the cache entry so that it will be properly recalculated on the next
access. This feature is especially useful when the function returns a value that is calculated from data
selected from schema-level tables. For such uses, the invalidation constructs are simple and
declarative. You can include syntax in the source text of a PL/SQL function to request that its results
be cached and, to ensure correctness, that the cache be purged when any of a list of tables
experiences DML. When a particular invocation of the result-cached function is a cache hit, then the
function body is not executed; instead, the cached value is returned immediately.
l e (m ense
i l lic
el oZ
Marc
• PL/SQL
– PLSQL_CODE_TYPE parameter: NATIVE/INTERPRETED
– No need for C compiler
– No file system DLLs
• Java
– JAVA_JIT_ENABLED parameter: TRUE/FALSE
ble
– JIT “on the fly” compilation fe r a
t r a ns
– Transparent to user (asynchronous, in background)
n -
o
– Code stored to avoid recompilations an s ฺ
h a
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
PL/SQL andZ
l
i Native
Java lic Compilation Enhancements
l o
rce Native Compilation (PLSQL_CODE_TYPE initialization parameter): The Oracle
PL/SQL
a
Mexecutable generates native dynamic linked libraries (DLLs) directly from the PL/SQL source code
without needing to use a third-party C compiler. In Oracle Database 10g, the DLL is stored
canonically in the database catalog. In Oracle Database 11g, when it is needed, the Oracle executable
loads it directly from the catalog without needing to stage it first on the file system.
The execution speed of natively compiled PL/SQL programs will never be slower than in Oracle
Database 10g and may be improved in some cases by as much as an order of magnitude. The
PL/SQL native compilation is automatically available with Oracle Database 11g. No third-party
software (neither a C compiler nor a DLL loader) is needed.
Java Native Compilation (JAVA_JIT_ENABLED initialization parameter): Enabled by default and
similar to the Java Development Kit JIT (just-in-time), this feature compiles Java in the database
natively and transparently without the need of a C compiler.
The JIT runs as an independent session in a dedicated Oracle server process. There is at most one
compiler session per database instance; it is Oracle RAC-aware and amortized over all Java sessions.
This feature brings two major benefits to Java in the database: increased performance of pure Java
execution in the database and ease of use as it is activated transparently, without the need of an
explicit command, when Java is executed in the database.
As this feature removes the need for a C compiler, there are cost and license savings.
previously shut down. To disable restricted session mode, use the following statement:
ALTER SYSTEM DISABLE RESTRICTED SESSION;
Note: During the conversion to native compilation, TYPE specifications are not recompiled to
NATIVE because these specifications do not contain executable code.
bl e
fe r a
ans
n - t r
o
s an
r ) ha deฺ
m ฺa Gui
n ฺ co ent
@ ao Stud
z i l le this
c e loฺ use
a r to
m e
i l l e ( icens
e loZ l
M arc
ble
fe r a
ans
n - t r
o
s an
r ) ha deฺ
m ฺa Gui
n ฺ co ent
@ ao Stud
z i l le this
ฺ
loCopyright e
s2009,
r c e o u© Oracle. All rights reserved.
a t
l e (m ense
i l lic
el oZ
Marc
ble
fe r a
ans
n - t r
o
s an
r ) ha deฺ
m ฺa Gui
n ฺ co ent
@ ao Stud
z i l le this
ฺ
loCopyright e
s2009,
r c e o u© Oracle. All rights reserved.
a t
l e (m ense
i l lic
el oZ
Marc
Objectives
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
Syntax Description
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
Element
%b Specifies the filename without the directory path *NEW*
%f Specifies the absolute file number of the datafile for which the
new name is generated
RUN
{
SET NEWNAME FOR DATABASE TO
ble
'/u01/app/oracle/oradata/dupldb/%b';
fe r a
DUPLICATE TARGET DATABASE TO dupldb
ans
LOGFILE
n - t r
GROUP 1 ('/u01/app/oracle/oradata/dupldb/redo01a.log',
a no
'/u01/app/oracle/oradata/dupldb/redo01b.log') SIZE 50M REUSE,
h a s ฺ
GROUP 2 ('/u01/app/oracle/oradata/dupldb/redo02a.log',
'/u01/app/oracle/oradata/dupldb/redo02b.log') SIZE 50M REUSE,ฺ a r) uide
ฺ c om ent G
GROUP 3 ('/u01/app/oracle/oradata/dupldb/redo03a.log',
on tud
'/u01/app/oracle/oradata/dupldb/redo03b.log') SIZE 50M REUSE;
a
}
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Zi l
Using SET NEWNAME lic DATABASE
FOR
l o
ceSET NEWNAME FOR DATABASE command to set default names for all datafiles in the
Userthe
a
Mdatabase.
Note: You cannot use this command to set default names for temporary datafiles (tempfiles).
RUN
{ ble
SET NEWNAME FOR DATAFILE 1 TO '/oradata1/system01.dbf'; fe r a
SET NEWNAME FOR DATAFILE 2 TO '/oradata2/sysaux01.dbf'; ans
SET NEWNAME FOR DATAFILE 3 TO '/oradata3/undotbs01.dbf'; n - t r
SET NEWNAME FOR DATAFILE 4 TO '/oradata4/users01.dbf';
a no
SET NEWNAME FOR TABLESPACE example TO '/oradata5/%b';
h a s ฺ
DUPLICATE TARGET DATABASE TO dupldb;
ฺ a r) uide
}
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Zi
Using SET NEWNAMEl lic TABLESPACE
FOR
l o
ceSET NEWNAME FOR TABLESPACE command to set default names for all datafiles in the
Userthe
a
Mspecified tablespace.
Target
Data files database Image copies
run {
SET COMPRESSION ALGORITHM 'HIGH/MEDIUM/LOW/DEFAULT';
ble
..
fe r a
}
ans
n - t r
a no
h a s ฺ
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Zi l
Using New Settings licBinary Compression of Backup Sets
for
l o
rce Database 11g Release 2, the values for the COMPRESSION ALGORITHM clause have
In Oracle
a
Mchanged to HIGH, MEDIUM, LOW, and DEFAULT. Additional information about each is provided on
the following page.
Note: In Oracle Database 11g Release 1, ZLIB and BZIP2 were the supported algorithms for binary
compression of backup sets. The algorithm names were supplied via the COMPRESSION
ALGORITHM clause.
Compression Option
LOW Less compression than MEDIUM
Consumes the least CPU
Target ble
Data files database Image copies
fe r a
ans
Archive X
Backup pieces
n - t r
Redundant
log files
Backup dataa no
archive log
h a s ฺ
files
r) uidArea
Flash Recovery
a e
ฺ
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Zi l
Optimized Backups lic
(continued)
l o
rce Archive Log Management in a Multiple-Component Environment
Simplified
a
MThis feature simplifies archive log management when used by multiple components. It also increases
availability when backing up archive logs, when an archive log in the Flash Recovery Area is
missing or inaccessible.
Enhanced Configuration of Deletion Policies
Archived redo logs are eligible for deletion only when not needed by any required components such
as Data Guard, Streams, Flashback Database, and so on.
In a Data Guard environment, all standby destinations are considered (instead of just mandatory
destinations), before marking archive logs to be deleted. This configuration is specified using the
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY command.
When you configure an archived log deletion policy, the configuration applies to all archiving
destinations, including the Flash Recovery Area. Both BACKUP ... DELETE INPUT and DELETE...
ARCHIVELOG use this configuration, as does the Flash Recovery Area.
When you back up the recovery area, RMAN can fail over to other archived redo log destinations if
the archived redo log in the Flash Recovery Area is inaccessible or corrupted.
Channel 1
Section 1
ble
Channel 2 fe r a
Section 2 ans
n - t r
Channel 3 a no
Section 3
h a s ฺ
Channel ฺ a r4) uide
Section 4
ฺ c om ent G
One large data a on tud
file
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
i l
Using RMANZMultisection lic Backups
l o
ce and VALIDATE DATAFILE commands accept a new option:
TherBACKUP
a
M SECTION SIZE <integer> [K|M|G]
Specify your planned size for each backup section. The option is both a backup-command and
backup-spec level option, so that you can apply different section sizes to different files in the same
backup job.
Viewing metadata about your multisection backup:
• The V$BACKUP_SET and RC_BACKUP_SET views have a MULTI_SECTION column, which
indicates whether this is a multisection backup or not.
• The V$BACKUP_DATAFILE and RC_BACKUP_DATAFILE views have a SECTION_SIZE
column, which specifies the number of blocks in each section of a multisection backup. Zero
means a whole-file backup.
ble
fe r a
Destination or
t r a ns
on-
AUXILIARY database
TCP/IP
s an
r ) ha deฺ
m ฺa Gui
Active source databaseonฺ
co ent
@ a Stud
z i l le this
ฺ
loCopyright e
s2009,
r c e o u© Oracle. All rights reserved.
a t
l e (m ense
Duplicating Z i l
a Database lic
l o
rctoeOracle Database 11g, you could create a database for testing or a standby database by using
Prior
a
Mthe RMAN duplicate database feature. It required the source database, a copy of a backup on the
destination system, and the destination database itself.
Oracle Database 11g greatly simplifies this process. You can instruct the source database server to
perform online image copies and archived log copies directly to the auxiliary instance, by using
Enterprise Manager or the FROM ACTIVE DATABASE clause of the RMAN DUPLICATE
command. Preexisting backups are no longer needed.
The database files are copied from the source to a destination or AUXILIARY instance via an inter-
instance network connection. RMAN then uses a “memory script” (one that is contained only in
memory) to complete recovery and open the database.
ble
fe r a
ans
n - t r
a no
h a s ฺ
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
l
Zi Database
Performing Active lic Duplication
l o
rceNotes for Active Database Duplication
Usage
a
M • Oracle Net must be aware of the source and destination databases. The FROM ACTIVE
DATABASE clause implies network action.
• If the source database is open, it must have archive logging enabled.
• If the source database is in mounted state (and not a standby), the source database must have
been shut down cleanly.
• Availability of the source database is not affected by active database duplication. But the source
database instance provides CPU cycles and network bandwidth.
Enterprise Manager Interface
In Enterprise Manager, select Data Movement > Clone Database.
Targetless DUPLICATE
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
Datafile backups
Archived
redo log files
ble
Auxiliary instance
fe
Recovery Catalog r a
n s
Target database n - tra
a no
CONNECT AUXILIARY ha
s ฺCONNECT CATALOG
ฺ a r) uide
ฺ c om ent G
a on tud RMAN client
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Zi l
Targetless DUPLICATE lic
l o
e use the DUPLICATE command without connecting to the target database. This feature is
Yourccan
a
Mapplicable for backup-based duplication. To use the targetless DUPLICATE feature, you must
connect to a recovery catalog and the auxiliary instance.
Option Purpose
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
ble
fe r a
ans
n - t r
a no
h a s ฺ
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Enhancements l
Zi to DUPLICATE
lic … [SKIP] TABLESPACE
l o
ce TABLESPACE tablespace_name option can be used to exclude the named tablespace
TherSKIP
a
Mfrom the database duplication. You can also use the TABLESPACE option to specifically name the
tablespaces that should be duplicated.
In Oracle Database 11g Release 2, RMAN automatically checks to determines if the set of
tablespaces specified is self-contained. RMAN executes the
DBMS_TTS.TRANSPORT_SET_CHECK procedure with the FULL option to ensure that the
database duplication will be successful. If rows are returned when RMAN queries
TRANSPORT_SET_VIOLATIONS, the duplication is stopped.
ble
fe r a
ans
n - t r
a no
h a s ฺ
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
l
Zi Backups
Creating Archival lic
l o
rce a backup for a longer period of time, perform the following steps in Enterprise Manager:
To keep
a
M 1. Select Availability > Schedule Backup > Schedule Customized Backup.
2. Follow the steps of the Schedule Customized Backup wizard until you are on the Settings page.
3. Click Override Current Settings > Policy. In the Override Retention Policy section, you can
select to keep a backup for a specified number of days. A restore point is generated based on the
backup job name.
ble
fe r a
an s
CREATE SPFILE [= 'spfile_name' ]
- t r
}n;
FROM { { PFILE [= 'pfile_name' ] } | MEMORY o
s an
r ) ha deฺ
m ฺa Gui
n ฺ co ent
@ ao Stud
z i l le this
ฺ
loCopyright e
s2009,
r c e o u© Oracle. All rights reserved.
a t
l e (m ense
Easier Recovery l
Zi fromliLoss
c of Server Parameter File
l o
rce Database 11g, the FROM MEMORY clause creates a text initialization parameter file
In Oracle
a
M(PFILE) or server parameter file (SPFILE) using the current systemwide parameter settings. In a
RAC environment, the created file contains the parameter settings from each instance.
During instance startup, all parameter settings are logged to the alert.log file. As of Oracle
Database 11g, the alert.log parameter dump text is written in valid parameter syntax. This
facilitates cutting and pasting of parameters into a separate file, and then using as a PFILE for a
subsequent instance. The name of the PFILE or SPFILE is written to the alert.log at instance
startup time. In cases when an unknown client-side PFILE is used, the alert log indicates this as well.
To support this additional functionality, the COMPATIBLE initialization parameter must be set to
11.0.0.0 or higher.
SELECT *
FROM SYS.TS_PITR_CHECK
WHERE (
TS1_NAME IN ('USERS','EXAMPLE')
AND TS2_NAME NOT IN ('USERS','EXAMPLE'))
OR (
TS1_NAME NOT IN ('USERS','EXAMPLE')
AND TS2_NAME IN ('USERS','EXAMPLE')); bl e
fe r a
t r a ns
Use DBMS_TTS.TRANSPORT_SET_CHECK to ensuren-that
TSPITR will be successful: a no
h a s ฺ
ฺ a r) uide
DBMS_TTS.TRANSPORT_SET_CHECK ('USERS',
c o m nt G 'EXAMPLE');
SELECT * FROM TRANSPORT_SET_VIOLATIONS;
a onฺ tude
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Zi l
Identifying Relationships lic Between Objects that Span the Recovery Set Boundaries
l o
rceperforming TSPITR, you must determine the recovery set. If objects in the tablespaces you
Before
a
Mneed to recover have relationships with objects in other tablespaces, you need to make provisions for
those objects.
Prior to Oracle Database 11g Release 2, you used the SYS.TS_PITR_CHECK view to identify
relationships between objects that span the recovery set boundaries. Now, you should use the
DBMS_TTS.TRANSPORT_SET_CHECK procedure and query the
TRANSPORT_SET_VIOLATIONS view.
Note: RMAN TSPITR automatically executes the DBMS_TTS.TRANSPORT_SET_CHECK
procedure for the recovery set tablespaces and verifies that the query against
TRANSPORT_SET_VIOLATIONS returns no rows. If the query returns rows, RMAN stops TSPITR
processing and any tablespace containment violations must be resolved before TSPITR can proceed.
You can execute the procedure and query the view as described above as a precautionary measure.
'$ORACLE_BASE/oradata/orcl/users01.dbf'
TO '/backup/users01.dbf';
l e (m ense
i
Creating andZUsing
l lic Private Catalogs (VPCs)
Virtual
l o
e allows a consolidation of RMAN repositories and maintains a separation of
Thisrc
feature
a
Mresponsibilities, which is a basic security requirement.
The RMAN catalog has been enhanced to create virtual private RMAN catalogs for groups of
databases and users. The catalog owner creates the base catalog and grants the
RECOVERY_CATALOG_OWNER privilege to the owner of the virtual catalog. The catalog owner can
either grant access to a registered database or grant the REGISTER privilege to the virtual catalog
owner. The virtual catalog owner can then connect to the catalog for a particular target or register a
target database. After this configuration, the VPC owner uses the virtual private catalog just like a
standard base catalog.
As catalog owner, you can access all the registered database information in the catalog. You can list
all databases registered with the SQL*Plus command:
SELECT DISTINCT db_name FROM DBINC;
As virtual catalog owner, you can see only the databases to which you have been granted access.
l e (m ense
i l
Using RMANZVirtual lic Catalogs
Private
l o
e virtual private RMAN catalogs for groups of databases and users.
Yourc
create
a
M 1. The catalog owner creates the base catalog.
2. The DBA on the catalog database creates the user that will own the virtual private catalog (VPC)
and grants him or her the RECOVERY_CATALOG_OWNER privilege.
3. The base catalog owner can grant access for previously registered databases to the VPC owner
by using the GRANT CATALOG command:
GRANT CATALOG FOR DATABASE prod1, prod2 TO vpcowner;
The GRANT CATALOG command can also be used as follows when there is more than one
database with the same name registered in the catalog:
GRANT CATALOG FOR DATABASE integer TO vpcowner;
where integer is the DBID.
If the database is not registered in the catalog, grant REGISTER DATABASE to the VPC owner
as follows:
GRANT REGISTER DATABASE TO vpcowner;
When you grant REGISTER DATABASE, RMAN implicitly grants CATALOG FOR DATABASE
for any database registered by the user.
ble
fe r a
ans
n - t r
o
s an
r ) ha deฺ
m ฺa Gui
n ฺ co ent
@ ao Stud
z i l le this
ฺ
loCopyright e
s2009,
r c e o u© Oracle. All rights reserved.
a t
l e (m ense
Answer: 2 Zi
l lic
l o
a rce
M
ble
fe r a
ans
n - t r
o
s an
r ) ha deฺ
m ฺa Gui
n ฺ co ent
@ ao Stud
z i l le this
ฺ
loCopyright e
s2009,
r c e o u© Oracle. All rights reserved.
a t
l e (m ense
i l lic
el oZ
Marc
Undo data
Original
data in
buffer cache
DML operations
bl e
fe r a
ans
FBDA
n - t r
a no
h a s flashback
Example: Three
ฺ
data
a r)
archives e
with retention
1 year uid
of:
ฺ
ฺ c om e2 nyears tG
Flashback data archives
stored in tablespaces a
on tud 5 years
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Flashback Z l
i Archive:
Data lic Overview (continued)
l o
rce data archive is a historical data store. Oracle Database 11g automatically tracks
Aaflashback
M and archives the data in tables enabled for Flashback Data Archive with a new Flashback Data
Archive background process, FBDA. You use this feature to satisfy retention requirements that
exceed the undo retention. Flashback data archives ensure that flashback queries obtain SQL-
level access to the versions of database objects without getting a "snapshot too old error."
A flashback data archive consists of one or more tablespaces or parts thereof. You can have
multiple flashback data archives. Each is configured with a specific retention duration. Based
on your retention duration requirements, you should create different flashback data archives—
for example, one for all records that must be kept for one year, another for all records that
must be kept for two years, and so on.
FBDA asynchronously collects and writes original data to a flashback data archive. It does not
include the original indexes, because your retrieval pattern of historical information might be
quite different than your retrieval pattern of current information.
Note: You might want to create appropriate indexes just for the duration of historical queries.
DML changes
used by FBDA
Old values
Undo
Buffer cache
1 2
ble
fe r a
FBDA
ans
n - t r
3 a no
History or archive tables: h a s ฺ
- Compressed storage ฺ a r) uide
- With automatic digital ฺ c om ent G
shredding a on tud
l l e@ is S Flashback data archives
ฺ z i t h
e loCopyright u e
s2009,
a r c t o © Oracle. All rights reserved.
l e (m ense
Flashback Z l
i Archive:
Data lic Architecture
e l o
a rcFlashback
The Data Archive background process, FBDA, starts with the database.
M 1. FBDA operates first on the undo in the buffer cache.
2. In case the undo has already left the buffer cache, FBDA could also read the required
values from the undo segments.
3. FBDA consolidates the modified rows of flashback archive–enabled tables and writes
them into the appropriate history tables, which make up the flashback data archive.
You can find the internally assigned names of the history tables by querying the
*_FLASHBACK_ARCHIVE_TABLES view. History tables are compressed and internally
partitioned.
The database automatically purges all historical information on the day after the retention
period expires. (It deletes the data, but does not destroy the flashback data archive.) For
example, if the retention period is 10 days, then every day after the tenth day, the oldest
information is deleted; thus leaving only 10 days of information in the archive. This is a way
to implement digital shredding.
To allow a specific user the use of a specific flashback data archive, grant the FLASHBACK
ARCHIVE object privilege on that flashback data archive to the archive user. The archive user
can then enable flashback archive on tables, by using the specific flashback data archive.
Example executed as archive administrator:
GRANT FLASHBACK ARCHIVE ON FLA1 TO HR;
Most likely, your users will use other Flashback functionality. To allow access to specific
objects during queries, grant the FLASHBACK and SELECT privileges on all objects involved
in the query.
ble
fe r a
ans
n - t r
o
s an
r ) ha deฺ
m ฺa Gui
n ฺ co ent
@ ao Stud
z i l le this
c e loฺ use
a r to
m e
i l l e ( icens
e l oZ l
M arc
• Configuring undo:
– Create an undo tablespace (default: automatically
extensible tablespace)
– Enable Automatic Undo Management (11g default) e
r a bl
– Understand automatic tuning of undo:
ns fe
—
n - tra
Fixed-size tablespace: Automatic tuning for best retention
—
a no
Automatically extensible undo tablespace: Automatic tuning
for longest-running query as h eฺ
– Recommendation for Flashback:
ฺ a r) uid undo
Fixed-size
m nt G
tablespace ฺco on tude
a
@ is S
i l l e
l o ฺz se th
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Preparing
l
Zi Database
Your lic (continued)
l o
rceDatabase 11g uses the following defaults database initialization parameters:
Oracle
a
M • UNDO_MANAGEMENT='AUTO'
• UNDO_TABLESPACE='UNDOTBS1'
• UNDO_RETENTION=900
In other words, Automatic Undo Management is now enabled by default. If needed, enable
Automatic Undo Management, as explained in the Oracle Database Administrator’s Guide.
An automatically extensible undo tablespace is created upon database installation.
• For a fixed-size undo tablespace, the Oracle database automatically tunes the system to
give the undo tablespace the best possible undo retention.
• For an automatically extensible undo tablespace (default), the Oracle database retains
undo data to satisfy at a minimum, the retention periods needed by the longest-running
query and the threshold of undo retention, specified by the UNDO_RETENTION
parameter.
Automatic tuning of undo retention generally achieves better results with a fixed-size
undo tablespace. If you want to change the undo tablespace to fixed size for this or other
reasons, the Undo Advisor can help you determine the proper fixed size to allocate.
3. Collect undo block information with the V$UNDO_STAT view, calculate your space
requirements, and use them to create an appropriately sized fixed undo tablespace. (The
calculation formula is given in the Oracle Database Administrator’s Guide.)
4. You can query V$UNDOSTAT.TUNED_UNDORETENTION to determine the amount of
time for which undo is retained for the current undo tablespace. Setting the
UNDO_RETENTION parameter does not guarantee that unexpired undo data is not
overwritten. If the system needs more space, the Oracle database can overwrite unexpired
undo with more recently generated undo data.
a b le
- Specify the RETENTION GUARANTEE clause for the undo tablespace to ensure
s f er that
unexpired undo data is not discarded.
- t r an
on create a
- To satisfy long-retention requirements that exceed the undo retention,
n
flashback data archive. sa
ha deฺ
r )
ฺa Gui
m
co ent
n ฺ
@ ao Stud
z i l le this
c e loฺ use
a r to
m e
i l l e ( icens
e loZ l
M arc
ble
fe r a
ans
n - t r
a no
h a s ฺ
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Flashback Z l
i Archive:
Data lic Workflow
l o
e step is to create a flashback data archive. A flashback data archive consists of one or
rcfirst
The
a
M more tablespaces. You can have multiple flashback data archives.
Second, you can optionally specify a default flashback data archive for the system. A
flashback data archive is configured with retention time. Data archived in the flashback data
archive is retained for the retention time.
Third, you can enable flashback archiving (and then disable it again) for a table. While
flashback archiving is enabled for a table, some DDL statements are not allowed on that table.
By default, flashback archiving is off for any table.
Fourth, when you query data past your possible undo retention, your query is transparently
rewritten to use historical tables in the flashback data archive.
z i l l e t h is
ฺ
loCopyright e
s2009,
r c e o u© Oracle. All rights reserved.
a t
l e (m ense
Configuring
l
Zia DefaultlicFlashback Data Archive
l o
In
a ceFLASHBACK ARCHIVE clause, you can specify the flashback data archive where the
rthe
M historical data for the table will be stored. By default, the system has no flashback data
archive. In the preceding example, the default flashback data archive is specified for the
system.
You can create a default flashback archive in one of two ways:
• Specify the name of an existing flashback data archive in the SET DEFAULT clause of the
ALTER FLASHBACK ARCHIVE statement.
• Include DEFAULT in the CREATE FLASHBACK ARCHIVE statement when you create a
flashback data archive.
You enable and disable flashback archiving for a table with the ALTER TABLE command.
You can assign the internal archive table to a specific flashback data archive by specifying the
flashback data archive name. If the name is omitted, the default flashback data archive is used.
Specify NO FLASHBACK ARCHIVE to disable archiving of a table.
• Adding space:
ALTER FLASHBACK ARCHIVE fla1
ADD TABLESPACE tbs3 QUOTA 5G;
• Changing retention time:
ALTER FLASHBACK ARCHIVE fla1 MODIFY RETENTION 2 YEAR;
• Purging data: e
r a bl
ALTER FLASHBACK ARCHIVE fla1 PURGE BEFORE
s fe
TIMESTAMP(SYSTIMESTAMP - INTERVAL '1' day);
- t r an
n no
• Dropping a flashback data archive: a
h a s ฺ
DROP FLASHBACK ARCHIVE fla1;
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Maintaining i l
ZFlashback lic Data Archives
l o
rce 1 adds up to 5 GB of the TBS3 tablespace to the FLA1 flashback data archive. (The
Example
a
M archive administrator cannot exceed tablespace quota granted by the DBA.)
Example 2 changes the retention time for the FLA1 flashback data archive to two years.
Example 3 purges all historical data older than one day from the FLA1 flashback data archive.
Normally, purging is done automatically, on the day after your retention time expires. You can
also override this for ad hoc clean-up.
Example 4 drops the FLA1 flashback data archive and historical data, but not its tablespaces.
With the ALTER FLASHBACK ARCHIVE command, you can:
• Change the retention time of a flashback data archive
• Purge some or all of its data
• Add, modify, and remove tablespaces
Note: Removing all tablespaces of a flashback data archive causes an error.
Y
fe r a
Column
Z ans
Drop
Column
o n -tr
time
time
s an
r ) ha deฺ
• Flashback queries work across DDL
m ฺa changes:
G ui Output is
presented accordingly. nฺc o e n t
o
a Stu supported d
• All other DDL not automatically
l l e@ is
ฺ z i t h
e loCopyright u e
s2009,
a r c t o © Oracle. All rights reserved.
l e (m ense
Flashback Z l
i Archive:
Data lic Supporting Transparent Schema Evolution
l o
a rce TABLE ADD COLUMN was supported in Oracle Database 11g Release 1. In Oracle
ALTER
MDatabase 11g Release 2, the following DDL operations are supported:
• Dropping of columns and partitions
• Modifying and renaming columns
• Renaming tables
• Truncating tables and partitions
When a schema has evolved in any of these ways, Flashback Data Archive automatically
keeps track of the changes and Oracle Flashback Query will appropriately return the row or
rows with the corresponding schema.
DBMS_FLASHBACK_ARCHIVE.REASSOCIATE_FBA
• Disables Flashback Data Archive on specified tables,
allowing more complex DDL (upgrades, split tables)
• Enforces schema integrity after association
– Base table and history table schemas must be the same.
• Requires the FLASHBACK ARCHIVE ADMINISTER ble
fe r a
privilege
ans
n - t r
1 2
a no table
Base
DISASSOCIATE ALTER SCHEMA
h a s ฺ
History table
ฺ a r) uide History table
ASSOCIATE
c o m nt G ALTER SCHEMA
4 ฺ
on tude 3
a
@ is S
i l l e
l o ฺz se th
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Flashback Z l
i Archive:
Data lic Supporting Full Schema Evolution
l o
rcechanges not automatically supported by Flashback Data Archive may be accommodated
DDL
a
M through the DBMS_FLASHBACK_ARCHIVE PL/SQL package. The DISASSOCIATE_FBA
procedure can be used to disassociate the archive from the base table so that changes can be
made to both the base table and the corresponding archive. Use the REASSOCIATE_FBA
procedure to associate the table with the archive. The schemas must be the same for the base
table and the history table. Flashback Data Archive will validate that the schemas are the same
upon association.
Note: This operation should be used with the understanding that the archive can no longer be
guaranteed to be immutable, because the history could have been altered during the time of
disassociation.
ฺ c om ent primary G
Write-after-write (WAW),
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Flashback Z i l
Transaction lic Backout
l o
rce Transaction Backout is a logical recovery option to roll back a specific transaction
Flashback
a
M and dependent transactions while the database remains online. A dependent transaction is
related by a write-after-write (WAW) relationship, in which a transaction modifies the same
data that was changed by the target transaction, or a primary key constraint relationship, in
which a transaction reinserts the same primary key value that was deleted by the target
transaction. Flashback Transaction utilizes the redo generated for undo blocks to create and
execute a compensating transaction for reverting the affected data back to its original state.
bl e
fe r a
ans
n - t r
a no
h a s ฺ
ฺ a r) uide
… and database must be in ARCHIVELOG ฺ c om enmode tG
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
PrerequisitesZi l lic
l o
In
a ce to use this functionality, supplemental logging must be enabled and the correct
rorder
M privileges established. For example, the HR user in the HR schema decides to use Flashback
Transaction for the REGIONS table. The SYSDBA ensures that the database is in archive log
mode and performs the following setup steps in SQL*Plus:
ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
ALTER DATABASE ADD SUPPLEMENTAL LOG DATA (PRIMARY KEY) COLUMNS;
GRANT EXECUTE ON dbms_flashback TO hr;
GRANT select any transaction TO hr;
The HR user needs to either own the tables (as is the case in the preceding example) or have
the SELECT, UPDATE, DELETE, and INSERT privileges, to allow execution of the
compensating undo SQL code.
Note: In Oracle Database 11g Release 2, you can also track foreign key dependencies by
enabling foreign key supplemental logging:
ALTER DATABASE ADD SUPPLEMENTAL LOG DATA (FOREIGN KEY) COLUMNS;
If you have a number of foreign key constraints, consider the performance impact before
enabling foreign key supplemental logging.
ble
fe r a
ans
n - t r
a no
h a s ฺ
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Using the Zi l
Flashback licTransaction Wizard
l o
In
a ce
rEnterprise Manager, select Schema > Tables > <table>, then select “Flashback
MTransaction” from the Actions drop-down list, and click Go. This invokes the Flashback
Transaction Wizard for your selected table. The Flashback Transaction: Perform Query page is
displayed.
Select the appropriate time range and add query parameters. (The more specific you can be,
the shorter is the search of the Flashback Transaction Wizard.)
In Enterprise Manager, Flashback Transaction and LogMiner are seamlessly integrated (as this
page demonstrates).
ble
fe r a
ans
n - t r
no
SQL> SELECT * FROM DBA_FLASHBACK_TXN_STATE;
COMPENSATING_XID XID DEPENDENT_XID a
s ฺ
BACKOUT_MODE USERNAME
h a
---------------- ---------------- ----------------
ฺ a r) uide ------------ --------
06001D00930C0000 03001300970C0000 0A001E00EE0B0000
c o m nt GCASCADE SYS
02000500D70D0000 02001A00D40D0000 o
a nฺ ude CASCADE
09001C00D40D0000 SYS
@ is S t
i l l e
l o ฺz se th
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Viewing o Zi l
Flashback ic
lTransaction Metadata
l
e use the data dictionary views to view information about Flashback Transaction
You
a rccan
M Backouts.
Sample content of DBA_FLASHBACK_TXN_REPORT (formatted for legibility):
COMPENSATING_XID COMPENSATING_TXN_NAME COMMIT_TIME
---------------- --------------------- -------------- -----------
02000500D70D0000 _SYS_COMP_TXN_3473453_TIM_1255423650 13-OCT-09
XID_REPORT
---------------------------------------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?> <COMP_XID_REPORT
XID="02000500D70D00
USERNAME
--------
SYS
ble
fe r a
ans
n - t r
a no
h a s ฺ
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Flashback Z i l
Database licEnhancements
l o
In
a ce Database 11g Release 2 you can enable Flashback Database while the database is
rOracle
M open. In previous releases, the database had to be in MOUNT mode to enable Flashback
Database.
You can monitor Flashback Database progress by using the V$SESSION_LONGOPS view.
Progress percentage can be found by querying the SOFAR and TOTALWORK columns.
expdp Database
client link
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
Source Target
l e (m ense
Review: o Data
l
Zi PumpliExport
c and Import
l
a rce
Data Pump Export is a utility for unloading data and metadata into a set of operating system
M files called “dump file sets.” Data Pump Import is used to load metadata and data stored in an
export dump file set into a target system.
The Data Pump API accesses its files on the server rather than on the client.
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 when exporting 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 user’s 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 Pump’s 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.
ble
fe r a
ans
n - t r
o
s an
r ) ha deฺ
m ฺa Gui
n ฺ co ent
@ ao Stud
z i l le this
ฺ
loCopyright e
s2009,
r c e o u© Oracle. All rights reserved.
a t
l e (m ense
i l lic
el oZ
Marc
Marc
le
oZ
i l l l
m a r c e
e ( icens
e
z i
to
l @
loฺ use
n
le this
ฺ
m
ao Stud
r )
co ent
s
ฺa Gui
ha deฺ
an
on - t r an
s
fe r a bl
e
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
ble
fe r a
ans
n - t r
o
s an
r ) ha deฺ
m ฺa Gui
n ฺ co ent
@ ao Stud
z i l le this
ฺ
loCopyright e
s2009,
r c e o u© Oracle. All rights reserved.
a t
l e (m ense
i l lic
el oZ
Marc
Objectives
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
...
2 error link
3 Problem Details
ble
fe r a
ans
n - t r
a no
h a s ฺ
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Assessing
l
i Failures
ZData lic
l o
e illustrates different access routes, which you can use to navigate between the Health
rcslide
This
a
M Monitor and the Data Recovery Advisor. It also demonstrates the interaction of Health
Monitor and Data Recovery Advisor.
ble
fe r a
ans
n - t r
a no
h a s ฺ
ฺ a r) uide
ฺ c om ent G
a on tud
l l e@ is S
i
ฺz se th
l o
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Zi
Data Failures
l lic
e l o
a rcfailures
Data are detected by checks, which are diagnostic procedures that assess the health of
Mthe database or its components. Each check can diagnose one or more failures, which are
mapped to a repair.
Checks can be reactive or proactive. When an error occurs in the database, “reactive checks”
are automatically executed. You can also initiate “proactive checks”, for example, by
executing the VALIDATE DATABASE command.
In Enterprise Manager, select Availability > Perform Recovery, or click the Perform Recovery
button, if you find your database in a “down” or “mounted” state.
Syntax: ble
fe r a
LIST FAILURE
ans
n - t r
[ ALL | CRITICAL | HIGH | LOW | CLOSED |
a no
failnum[,failnum,…] ]
h a s ฺ
[ EXCLUDE FAILURE failnum[,failnum,…]
ฺ a r) ] uide
ฺ c om ent G
on tud
[ DETAIL ]
a
@ is S
i l l e
l o ฺz se th
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Listing Data
l
ZiFailureslic
l o
e LIST FAILURE command lists failures. If the target instance uses a recovery
The
a rcRMAN
Mcatalog, it can be in STARTED mode, otherwise it must be in MOUNTED mode. The LIST
FAILURE command does not initiate checks to diagnose new failures; rather, it lists the
results of previously executed assessments. Repeatedly executing the LIST FAILURE
command revalidates all existing failures. If the database diagnoses new ones (between
command executions), they are displayed. If a user manually fixes failures, or if transient
failures disappear, then the Data Recovery Advisor removes these failures from the LIST
FAILURE output.
The following is a description of the syntax:
• failnum: Number of the failure to display repair options for
• ALL: List failures of all priorities.
• CRITICAL: List failures of CRITICAL priority and OPEN status. These failures require
immediate attention, because they make the whole database unavailable (for example, a
missing control file).
• HIGH: List failures of HIGH priority and OPEN status. These failures make a database
partly unavailable or unrecoverable; so they should be repaired quickly (for example,
missing archived redo logs).
• EXCLUDE FAILURE: Exclude the specified list of failure numbers from the list.
• DETAIL: List failures by expanding the consolidated failure. For example, if there are
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
multiple block corruptions in a file, the DETAIL option lists each one of them.
See the Oracle Database Backup and Recovery Reference for details of the command syntax.
ble
fe r a
ans
n - t r
o
s an
r ) ha deฺ
m ฺa Gui
n ฺ co ent
@ ao Stud
z i l le this
c e loฺ use
a r to
m e
i l l e ( icens
e l oZ l
M arc
on tud
NO)? yes
changed 1 failures to LOW priority a
@ is S
i l l e
l o ฺz se th
a rce Copyright
t o u© 2009, Oracle. All rights reserved.
l e (m ense
Classifying
l
i Closing)
Z(and lic Failures
e l o
The
a rcCHANGE FAILURE command is used to change the failure priority or close one or more
M failures.
Syntax
CHANGE FAILURE
{ ALL | CRITICAL | HIGH | LOW | failnum[,failnum,…] }
[ EXCLUDE FAILURE failnum[,failnum,…] ]
{ PRIORITY {CRITICAL | HIGH | LOW} |
CLOSE } – change status of the failure(s) to closed
[ NOPROMPT ] – do not ask user for a confirmation
A failure priority can be changed only from HIGH to LOW and from LOW to HIGH. It is an
error to change the priority level of CRITICAL. (One reason why you may want to change a
failure from HIGH to LOW is to avoid seeing it on the default output list of the LIST
FAILURE command. For example, if a block corruption has HIGH priority, you may want to
temporarily change it to LOW if the block is in a little-used tablespace.)
Open failures are closed implicitly when a failure is repaired. However, you can also explicitly
close a failure. This involves a reevaluation of all other open failures, because some of them
may become irrelevant as the result of the closure of the failure.
By default, the command asks the user to confirm a requested change.
Oracle Database 11g: New Features for Administrators 20 - 15
Quiz
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2013, Oracle and/or its affiliatesฺ
...
Detect I/O storage, disk corruption
ble
fe r a
ans
n - t r
...
a
Detect non-persistent writes on physical standby
no
h a s ฺ
New
ฺ a r) uide
... om ent G
Specify ฺ c
n udfor corruption detection
a odefaults t Parameters
Enterprise Manager > Server e @ S
> Initialization
s
ฺ z ill t hi
eloCopyright e
u©s2009, Oracle. All rights reserved.
a r c t o
l e (m ense
Zi l
Setting Parameters ic Detect Corruption
lto
l o
e use the DB_ULTRA_SAFE parameter for easy manageability. It affects the default
You
a rccan
M values of the following parameters:
• DB_BLOCK_CHECKING, which initiates checking of database blocks. This check can
often prevent memory and data corruption (default: FALSE, recommended: FULL).
• DB_BLOCK_CHECKSUM, which initiates the calculation and storage of a checksum in the
cache header of every data block when writing it to disk. Checksums assist in detecting
corruption caused by underlying disks, storage systems, or I/O systems (default:
TYPICAL, recommended: TYPICAL).
• DB_LOST_WRITE_PROTECT, which initiates checking for “lost writes.” Data block lost
writes occur on a physical standby database, when the I/O subsystem signals the
completion of a block write, which has not yet been completely written in persistent
storage. Of course, the write operation has been completed on the primary database
(default: TYPICAL, recommended: TYPICAL).
If you set any of these parameters explicitly, your values remain in effect. The
DB_ULTRA_SAFE parameter (which is new in Oracle Database 11g) changes only the default
values for these parameters.