Tải bản đầy đủ (.pdf) (753 trang)

OCP Oracle Database 11g: Administration II Exam Guide (Exam 1Z0053)

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (13.72 MB, 753 trang )


®

OCP Oracle Database 11g:
Administration II
Exam Guide
(Exam 1Z0-053)


ABOUT THE AUTHOR

Bob Bryla is an Oracle 9i, 10g, and 11g Certified Professional with more than
20 years of experience in database design, database application development,
training, and Oracle database administration. He is the primary Internet database
designer and an Oracle DBA at Lands’ End in Dodgeville, Wisconsin.
In his spare time, he is a technical editor for a number of Oracle Press and Apress
books, in addition to authoring several certification study guides for Oracle 10g
and 11g. He has also been known to watch science fiction movies and dabble in
videography in his spare time.

About the Technical Editor
Gavin Powell has a BSc. in Computer Science with 20 years of experience in the
IT industry. He does Oracle DBA and Internet marketing consulting work, is an
accomplished computer technical writer (more than 20 works in print), and is
also a semi-professional songwriter, performer, and recording artist. Gavin can be
reached at , , or http://oracledba
.ezpowell.com.


®


OCP Oracle Database 11g:
Administration II
Exam Guide
(Exam 1Z0-053)
Bob Bryla

McGraw-Hill is an independent entity from Oracle Corporation. This publication
and CD may be used in assisting students to prepare for the OCP 1Z0-053 exam.
Neither Oracle Corporation nor The McGraw-Hill Companies warrant that use of this
publication will ensure passing the relevant exam.

New York Chicago San Francisco Lisbon London Madrid
Mexico City Milan New Delhi San Juan Seoul Singapore Sydney Toronto


Copyright © 2009 by The McGraw-Hill Companies, Inc. All rights reserved. Except as permitted under the United States Copyright Act
of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval
system, without the prior written permission of the publisher.
ISBN: 978-0-07-164379-5
MHID: 0-07-164379-6
The material in this eBook also appears in the print version of this title: ISBN: 978-0-07-159709-8, MHID: 0-07-159709-3.
All trademarks are trademarks of their respective owners. Rather than put a trademark symbol after every occurrence of a trademarked
name, we use names in an editorial fashion only, and to the benefit of the trademark owner, with no intention of infringement of the
trademark. Where such designations appear in this book, they have been printed with initial caps.
McGraw-Hill eBooks are available at special quantity discounts to use as premiums and sales promotions, or for use in corporate
training programs. To contact a representative please visit the Contact Us page at www.mhprofessional.com.
Information has been obtained by Publisher from sources believed to be reliable. However, because of the possibility of human or
mechanical error by our sources, Publisher, or others, Publisher does not guarantee to the accuracy, adequacy, or completeness of any
information included in this work and is not responsible for any errors or omissions or the results obtained from the use of such
information.

TERMS OF USE
This is a copyrighted work and The McGraw-Hill Companies, Inc. (“McGraw-Hill”) and its licensors reserve all rights in and to the
work. Use of this work is subject to these terms. Except as permitted under the Copyright Act of 1976 and the right to store and retrieve
one copy of the work, you may not decompile, disassemble, reverse engineer, reproduce, modify, create derivative works based upon,
transmit, distribute, disseminate, sell, publish or sublicense the work or any part of it without McGraw-Hill’s prior consent. You may use
the work for your own noncommercial and personal use; any other use of the work is strictly prohibited. Your right to use the work may
be terminated if you fail to comply with these terms.
THE WORK IS PROVIDED “AS IS.” McGRAW-HILL AND ITS LICENSORS MAKE NO GUARANTEES OR WARRANTIES AS
TO THE ACCURACY, ADEQUACY OR COMPLETENESS OF OR RESULTS TO BE OBTAINED FROM USING THE WORK,
INCLUDING ANY INFORMATION THAT CAN BE ACCESSED THROUGH THE WORK VIA HYPERLINK OR OTHERWISE,
AND EXPRESSLY DISCLAIM ANY WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED
WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. McGraw-Hill and its licensors do not
warrant or guarantee that the functions contained in the work will meet your requirements or that its operation will be uninterrupted or
error free. Neither McGraw-Hill nor its licensors shall be liable to you or anyone else for any inaccuracy, error or omission, regardless
of cause, in the work or for any damages resulting therefrom. McGraw-Hill has no responsibility for the content of any information
accessed through the work. Under no circumstances shall McGraw-Hill and/or its licensors be liable for any indirect, incidental, special, punitive, consequential or similar damages that result from the use of or inability to use the work, even if any of them has been
advised of the possibility of such damages. This limitation of liability shall apply to any claim or cause whatsoever whether such claim
or cause arises in contract, tort or otherwise.

Disclaimer:
This eBook does not include the ancillary media that was
packaged with the original printed version of the book.


To the gang at home: I couldn’t have done it without you! And the nachos. And Metallica.


This page intentionally left blank



CONTENTS AT A GLANCE

1

Database Architecture and ASM

..............................

2

Configuring Database Recoverability

3

Creating and Maintaining an RMAN Catalog

4

Creating RMAN Backups

5

Recovering Using RMAN Backups

6

User-Managed Backup and Recovery

7


..........................

1
67

...................

105

...................................

159

............................

215

..........................

261

Miscellaneous RMAN Features

...............................

311

8

Monitoring and Tuning RMAN


..............................

343

9

Configuring and Using Flashback

.............................

369

10

Memory Management Techniques

.............................

427

11

Using Database Tuning Advisors

..............................

457

12


Disk Space and Resource Management

13

Configuring Database Diagnostics

14

Using the Scheduler for Task Automation

15

Database Globalization

.........................

491

.............................

555

......................

593

.....................................

635


vii


viii

OCP Oracle Database 11g: Administration II Exam Guide

A

About the CD

............................................

671

.................................................

675

....................................................

695

Glossary
Index


CONTENTS


Acknowledgments
....................................
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1

Database Architecture and ASM

xxiii
xxv

..................

1

Understanding Database Architecture and ASM . . . . . . . . . . . . . . . . .
Oracle Logical Storage Structures . . . . . . . . . . . . . . . . . . . . . .
Oracle Physical Storage Structures . . . . . . . . . . . . . . . . . . . . .
Oracle Memory Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Describe ASM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ASM Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise 1-1 Find New ASM-related Processes in
ASM and RDBMS Instances . . . . . . . . . . . . . . . . . . . . . . . .
Creating an ASM Instance . . . . . . . . . . . . . . . . . . . . . . . . . . .
Set Up Initialization Parameter Files for
ASM and Database Instances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ASM Instance Components . . . . . . . . . . . . . . . . . . . . . . . . . . .
ASM Dynamic Performance Views . . . . . . . . . . . . . . . . . . . . .
Exercise 1-2 Query Disk Groups and
Available Raw Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . .

ASM Filename Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ASM File Types and Templates . . . . . . . . . . . . . . . . . . . . . . . .
Start Up and Shut Down ASM Instances . . . . . . . . . . . . . . . . . . . . . . .
Exercise 1-3 Stop ASM Instance with
Active Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Administer ASM Disk Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Disk Group Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Disk Group Mirroring and Failure Groups . . . . . . . . . . . . . . . .
Disk Group Dynamic Rebalancing . . . . . . . . . . . . . . . . . . . . . .
Disk Group Fast Mirror Resync . . . . . . . . . . . . . . . . . . . . . . . .
Altering Disk Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2
3
6
11
18
19
20
23
26
26
29
30
31
33
36
37
38
39

39
40
43
44

ix


x

OCP Oracle Database 11g: Administration II Exam Guide

Enterprise Manager Database Control
and ASM Disk Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Using the asmcmd Command . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise 1-4 Use the asmcmd Utility to
Create a Backup of the SPFILE . . . . . . . . . . . . . . . . . . . . . .
✓ Two-Minute Drill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Q&A Self Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Lab Question . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Self Test Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Lab Answer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2

3

Configuring Database Recoverability

46

48
52
54
57
61
62
65

..............

67

Configuring for Database Recoverability . . . . . . . . . . . . . . . . . . . . . . . .
Logical Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Physical Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
RMAN Command Overview . . . . . . . . . . . . . . . . . . . . . . . . . .
Configure Multiple Archive Log File
Destinations to Increase Availability . . . . . . . . . . . . . . . . . . . . . . . . .
Configuring ARCHIVELOG Mode . . . . . . . . . . . . . . . . . . . . .
Leveraging Multiple Archive Destinations . . . . . . . . . . . . . . .
Exercise 2-1 Identify the Archive
Log File Destinations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Define, Apply, and Use a Retention Policy . . . . . . . . . . . . . . . . . . . . . .
Exercise 2-2 Query and Change the
Retention Policy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Configure the Flash Recovery Area . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Use the Flash Recovery Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise 2-3 Query the Location, Contents,
and Size of the Flash Recovery Area . . . . . . . . . . . . . . . . . .
✓ Two-Minute Drill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Q&A Self Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Lab Question . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Self Test Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Lab Answer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

68
69
70
73

Creating and Maintaining an RMAN Catalog

78
78
80
80
83
84
85
89
90
93
96
99
100
103

. . . . . . . . 105

Identify Situations that Require RMAN Recovery Catalog . . . . . . . . .

Using the Control File for RMAN Metadata . . . . . . . . . . . . .
Using a Recovery Catalog for RMAN Metadata . . . . . . . . . . .

106
107
107


Contents

Create and Configure a Recovery Catalog . . . . . . . . . . . . . . . . . . . . . .
Configure the Recovery Catalog Database . . . . . . . . . . . . . . .
Create the Recovery Catalog Owner . . . . . . . . . . . . . . . . . . . .
Create the Recovery Catalog . . . . . . . . . . . . . . . . . . . . . . . . . .
Synchronize the Recovery Catalog . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Registering a Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Changing the DBID of a Database . . . . . . . . . . . . . . . . . . . . . .
Unregistering a Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Cataloging Additional Backup Files . . . . . . . . . . . . . . . . . . . .
Exercise 3-1 Cataloging Additional Backup Files . . . . . . . .
Manually Resynchronize the Recovery Catalog . . . . . . . . . . .
Create and Use RMAN Stored Scripts . . . . . . . . . . . . . . . . . . . . . . . . .
Creating RMAN Stored Scripts . . . . . . . . . . . . . . . . . . . . . . . .
Executing RMAN Stored Scripts . . . . . . . . . . . . . . . . . . . . . . .
Exercise 3-2 Creating a Parameterized
Stored Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Retrieving RMAN Stored Script Metadata . . . . . . . . . . . . . . .
Managing RMAN Stored Scripts . . . . . . . . . . . . . . . . . . . . . . .
Back Up the Recovery Catalog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Backing Up the Recovery Catalog . . . . . . . . . . . . . . . . . . . . . .

Recovering from a Lost Recovery Catalog . . . . . . . . . . . . . . . .
Exporting and Importing the Recovery Catalog . . . . . . . . . . .
Dropping a Recovery Catalog . . . . . . . . . . . . . . . . . . . . . . . . .
Upgrading the Recovery Catalog . . . . . . . . . . . . . . . . . . . . . . .
Create and Use a Virtual Private Catalog . . . . . . . . . . . . . . . . . . . . . . .
Understanding Virtual Private Catalogs . . . . . . . . . . . . . . . . .
Creating and Managing a Virtual Private Catalog . . . . . . . . .
Configure Backup Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Types of RMAN Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
RMAN Backup Destinations . . . . . . . . . . . . . . . . . . . . . . . . . .
Persisting RMAN Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Control File Autobackups . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Allocate Channels to Use in Backing Up . . . . . . . . . . . . . . . . . . . . . . .
Configure Backup Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
✓ Two-Minute Drill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Q&A Self Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Self Test Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

xi
108
109
110
111
112
112
113
117
118
118
120

121
121
121
122
123
124
125
125
126
127
128
128
129
129
130
134
134
136
137
140
141
141
144
148
154


xii

OCP Oracle Database 11g: Administration II Exam Guide


4

Creating RMAN Backups

. . . . . . . . . . . . . . . . . . . . . . . . . 159

Using RMAN to Create Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Create Image File Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Creating Backupsets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise 4-1 Create a Compressed Backupset . . . . . . . . . . .
Creating Image Copies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Create a Whole Database Backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Whole Database Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Full Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise 4-2 Perform a Full Backup
of Two Tablespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Incremental Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Enable Fast Incremental Backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Understanding Block Change Tracking . . . . . . . . . . . . . . . . . .
Enabling Fast Incremental Backup . . . . . . . . . . . . . . . . . . . . . .
Exercise 4-3 Relocate the Block
Change Tracking File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Monitoring Block Change Tracking . . . . . . . . . . . . . . . . . . . .
Create Duplex Backup and Back Up Backupsets . . . . . . . . . . . . . . . . .
Creating Duplexed Backupsets . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise 4-4 Configuring Multiple Disk Locations
for a Duplexed Disk Backup . . . . . . . . . . . . . . . . . . . . . . . . .
Creating Backups of Backupsets . . . . . . . . . . . . . . . . . . . . . . . .
Backing Up Read-Only Tablespaces . . . . . . . . . . . . . . . . . . . .

Create an Archival Backup for Long-term Retention . . . . . . . . . . . . . .
Understanding Archival Backups . . . . . . . . . . . . . . . . . . . . . .
Performing an Archival Backup . . . . . . . . . . . . . . . . . . . . . . . .
Managing Archival Backups . . . . . . . . . . . . . . . . . . . . . . . . . .
Create a Multisection, Compressed, and Encrypted Backup . . . . . . . . .
Creating a Multisection Backup . . . . . . . . . . . . . . . . . . . . . . . .
Compressing Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Encrypting Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Report On and Maintain Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Using the LIST Command . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Using the REPORT Command . . . . . . . . . . . . . . . . . . . . . . . .
Using the DELETE Command . . . . . . . . . . . . . . . . . . . . . . . . .
Using the CROSSCHECK Command . . . . . . . . . . . . . . . . . .

161
163
163
164
166
167
167
168
169
170
173
174
175
176
178
178

179
180
182
182
183
183
184
185
186
187
190
190
194
195
196
199
200


Contents

✓ Two-Minute Drill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Q&A Self Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Self Test Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5

Recovering Using RMAN Backups

xiii

204
207
212

. . . . . . . . . . . . . . . . . 215

Perform Complete Recovery from a Critical or
Noncritical Data File Loss Using RMAN . . . . . . . . . . . . . . . . . . . . .
Using the RMAN RESTORE and
RECOVER Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Performing Complete Recovery of
a Noncritical Datafile . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise 5-1 Restore and Recover
the USERS Tablespace . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Performing Complete Recovery of a Critical Datafile . . . . . . .
Perform Incomplete Recovery Using RMAN . . . . . . . . . . . . . . . . . . . .
Creating Restore Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Performing Server-Managed Incomplete Recovery . . . . . . . . .
Exercise 5-2 Perform Incomplete Recovery
to Restore the USERS Tablespace . . . . . . . . . . . . . . . . . . . .
Recover Using Incrementally Updated Backups . . . . . . . . . . . . . . . . . .
Recovering Image Copies . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Implementing an Image Copy Strategy . . . . . . . . . . . . . . . . . .
Switch to Image Copies for Fast Recovery . . . . . . . . . . . . . . . . . . . . . .
Performing a Fast Switch to Image Copies . . . . . . . . . . . . . . .
Exercise 5-3 Use the SWITCH Command
to Recover a Datafile Quickly . . . . . . . . . . . . . . . . . . . . . . .
Exercise 5-4 Use the SWITCH Command after
Creating the USERS Tablespace’s Datafile in
the Original Location . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Using the RMAN SET NEWNAME with Fast Switch . . . . .
Restore a Database onto a New Host . . . . . . . . . . . . . . . . . . . . . . . . . . .
Understanding Restoration to a New Host . . . . . . . . . . . . . . .
Preparing the New Host . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Restoring and Recovering on the New Host . . . . . . . . . . . . . .
Recover Using a Backup Control File . . . . . . . . . . . . . . . . . . . . . . . . . .
Restoring the SPFILE from the Autobackup . . . . . . . . . . . . . .
Restoring the Control File from the Autobackup . . . . . . . . . .

216
217
217
219
220
221
221
223
224
227
227
227
229
229
230

233
236
237
237
237

238
241
241
241


xiv

OCP Oracle Database 11g: Administration II Exam Guide

Restore the Control File from
an Autobackup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Perform Disaster Recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Performing Recovery in NOARCHIVELOG Mode . . . . . . . .
Using Incremental Backups in NOARCHIVELOG Mode . . .
Performing Recovery of the Entire Database . . . . . . . . . . . . . .
✓ Two-Minute Drill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Q&A Self Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Self Test Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise 5-5

6

User-Managed Backup and Recovery

242
245
246
246
247

250
253
257

. . . . . . . . . . . . . . 261

Recover from a Lost Tempfile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Losing a Tempfile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise 6-1 Create a Replacement Tempfile
for the TEMP tablespace . . . . . . . . . . . . . . . . . . . . . . . . . . .
Starting a Database Without a Tempfile . . . . . . . . . . . . . . . . .
Recover from a Lost Redo Log Group . . . . . . . . . . . . . . . . . . . . . . . . . .
Understanding Log Group Status . . . . . . . . . . . . . . . . . . . . . . .
Recovering from Log Group Member Failures . . . . . . . . . . . . .
Recovering from Loss of an Entire Log Group . . . . . . . . . . . . .
Recover from the Loss of the Password File . . . . . . . . . . . . . . . . . . . . . .
Review of Authentication Methods . . . . . . . . . . . . . . . . . . . . .
Re-creating a Password File . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise 6-2 Re-create the Password File after
Accidental Deletion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Perform User-Managed Complete Database Recovery . . . . . . . . . . . . .
Performing Complete Closed Database Recovery . . . . . . . . . .
Exercise 6-3 Perform a Complete
Database Recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Performing Complete Open Database Recovery . . . . . . . . . . .
Perform User-Managed Incomplete Database Recovery . . . . . . . . . . . .
Choosing the PITR Method . . . . . . . . . . . . . . . . . . . . . . . . . . .
Performing User-Managed, Time-Based
Incomplete Recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise 6-4 Perform Incomplete

Time-based Recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

263
263
264
265
265
265
266
268
271
271
273
275
276
277
280
283
284
285
286
287


7

Contents

xv


Perform User-Managed and Server-Managed Backups . . . . . . . . . . . . .
Identifying Files for Manual Backup . . . . . . . . . . . . . . . . . . . .
Backing Up a Database in NOARCHIVELOG Mode . . . . . .
Backing Up a Database in ARCHIVELOG Mode . . . . . . . . .
Identify the Need for Backup Mode . . . . . . . . . . . . . . . . . . . . . . . . . . .
Back up and Recover a Control File . . . . . . . . . . . . . . . . . . . . . . . . . . .
Backing Up the Control File in ARCHIVELOG mode . . . . .
Recovering the Control File . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise 6-5 Recover from the Loss
of All Control Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
✓ Two-Minute Drill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Q&A Self Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Self Test Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

289
290
291
292
293
294
294
296

Miscellaneous RMAN Features

. . . . . . . . . . . . . . . . . . . . 311

Creating a Duplicate Database Using RMAN . . . . . . . . . . . . . . . . . . . .
Using RMAN to Create a Duplicate Database . . . . . . . . . . . .
Using Enterprise Manager to Create

a Duplicate Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise 7-1 Clone a Running Database . . . . . . . . . . . . . . .
Using a Duplicate Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise 7-2 Recover a Dropped Table Using
a Cloned Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Identify the Situations that Require TSPITR . . . . . . . . . . . . . . . . . . . .
Perform Automated TSPITR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Verifying Tablespace Dependencies . . . . . . . . . . . . . . . . . . . . .
Identifying Objects Lost after TSPITR . . . . . . . . . . . . . . . . . .
Performing Automated TSPITR . . . . . . . . . . . . . . . . . . . . . . .
✓ Two-Minute Drill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Q&A Self Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Self Test Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8

Monitoring and Tuning RMAN

297
300
304
308

312
313
321
326
327
327
330

331
332
332
333
336
338
341

. . . . . . . . . . . . . . . . . . . . 343

Monitoring RMAN Sessions and Jobs . . . . . . . . . . . . . . . . . . . . . . . . . .
Using V$SESSION and V$PROCESS . . . . . . . . . . . . . . . . . .
Exercise 8-1 Monitor RMAN Channels . . . . . . . . . . . . . . . . . . . . . .

345
345
346


xvi

OCP Oracle Database 11g: Administration II Exam Guide

Monitor Multiple RMAN Jobs . . . . . . . . . . . .
Using V$SESSION_LONGOPS . . . . . . . . . . . . . . . . . . . . . . .
Leveraging RMAN Error Logs and Messages . . . . . . . . . . . . . .
Exercise 8-3 Debug Part of an RMAN Session . . . . . . . . . .
Tuning RMAN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Identifying Backup and Restore Steps . . . . . . . . . . . . . . . . . . .
Parallelizing Backup Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Understanding RMAN Multiplexing . . . . . . . . . . . . . . . . . . .
Tuning RMAN Channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Tuning the BACKUP Command . . . . . . . . . . . . . . . . . . . . . . .
Configuring LARGE_POOL_SIZE . . . . . . . . . . . . . . . . . . . . .
Configure RMAN for Asynchronous I/O . . . . . . . . . . . . . . . . . . . . . . .
Understanding Asynchronous and Synchronous I/O . . . . . . .
Monitoring Asynchronous I/O . . . . . . . . . . . . . . . . . . . . . . . . .
Monitoring Synchronous I/O . . . . . . . . . . . . . . . . . . . . . . . . . .
✓ Two-Minute Drill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Q&A Self Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Self Test Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise 8-2

9

Configuring and Using Flashback

347
348
350
351
352
353
353
354
356
356
357
358
358

359
359
361
363
366

. . . . . . . . . . . . . . . . . . 369

Restore Dropped Tables from the Recycle Bin . . . . . . . . . . . . . . . . . . .
Understanding the Recycle Bin . . . . . . . . . . . . . . . . . . . . . . . .
Querying the Recycle Bin . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise 9-1 Move Objects to the Recycle Bin . . . . . . . . . .
Restoring Tables from the Recycle Bin . . . . . . . . . . . . . . . . . .
Exercise 9-2 Restore a Table from the Recycle Bin,
Keeping the Original Dependent Object Names . . . . . . . .
Recycle Bin Space Reclamation . . . . . . . . . . . . . . . . . . . . . . . .
Bypassing the Recycle Bin . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Accessing Tables in the Recycle Bin . . . . . . . . . . . . . . . . . . . .
Perform Flashback Query . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Configuring Flashback Parameters . . . . . . . . . . . . . . . . . . . . . .
Using Flashback Query . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Using Flashback Version Query . . . . . . . . . . . . . . . . . . . . . . . .
Use Flashback Transaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Understanding Flashback Transaction Query . . . . . . . . . . . . .
Flashback Transaction Query Prerequisites . . . . . . . . . . . . . . .

371
371
372
373

375
376
378
380
380
382
382
383
385
389
389
390


Contents

Using Flashback Transaction Query . . . . . . . . . . . . . . . . . . . . .
Using EM with Flashback Transaction Query . . . . . . . . . . . . .
Choosing Transaction Back-out Options . . . . . . . . . . . . . . . . .
Perform Flashback Table Operations . . . . . . . . . . . . . . . . . . . . . . . . . . .
Understanding Flashback Table . . . . . . . . . . . . . . . . . . . . . . . .
Configuring Flashback Table . . . . . . . . . . . . . . . . . . . . . . . . . .
Using Flashback Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise 9-3 Use Flashback Table on a Table . . . . . . . . . . .
Set Up and Use a Flashback Data Archive . . . . . . . . . . . . . . . . . . . . . .
Understanding Flashback Data Archive . . . . . . . . . . . . . . . . .
Creating an Archive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Using Flashback Data Archive Data Dictionary Views . . . . . .
Assigning Flashback Data Archive Permissions . . . . . . . . . . .
Managing Flashback Data Archives . . . . . . . . . . . . . . . . . . . . .

Assigning a Table to a Flashback Data Archive . . . . . . . . . . .
Querying Flashback Data Archives . . . . . . . . . . . . . . . . . . . . .
Configure, Monitor Flashback Database and
Perform Flashback Database Operations . . . . . . . . . . . . . . . . . . . . . .
Understanding Flashback Database . . . . . . . . . . . . . . . . . . . . .
Configuring Flashback Database . . . . . . . . . . . . . . . . . . . . . . .
Using Flashback Database . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Monitoring Flashback Database . . . . . . . . . . . . . . . . . . . . . . . .
✓ Two-Minute Drill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Q&A Self Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Self Test Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10 Memory Management Techniques

xvii
391
392
396
398
398
399
399
400
401
401
402
403
404
404
404

405
406
406
407
407
410
414
419
423

. . . . . . . . . . . . . . . . . 427

Implement Automatic Memory Management . . . . . . . . . . . . . . . . . . . .
Understanding Oracle Memory Structures . . . . . . . . . . . . . . .
Configuring Automatic Memory Management . . . . . . . . . . . .
Exercise 10-1 Enable Automatic
Memory Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Monitoring Automatic Memory Management . . . . . . . . . . . .
Manually Configure SGA Parameters . . . . . . . . . . . . . . . . . . . . . . . . . .
Understanding Automatic Shared
Memory Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Switching to ASMM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

428
429
433
435
436
439
439

440


xviii

OCP Oracle Database 11g: Administration II Exam Guide

Enable Automatic Shared
Memory Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Tuning SGA Components . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Configure Automatic PGA Memory Management . . . . . . . . . . . . . . . .
Understanding PGA Components . . . . . . . . . . . . . . . . . . . . . .
Configuring PGA Memory Management . . . . . . . . . . . . . . . .
Managing PGA Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
✓ Two-Minute Drill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Q&A Self Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Self Test Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise 10-2

11 Using Database Tuning Advisors

440
443
443
443
444
445
449
451
454


. . . . . . . . . . . . . . . . . . . 457

Use the SQL Tuning Advisor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Overview of SQL Tuning Advisor . . . . . . . . . . . . . . . . . . . . . .
Using SQL Tuning Advisor . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise 11-1 Run SQL Tuning Advisor
for a SQL Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Use the SQL Access Advisor to Tune a Workload . . . . . . . . . . . . . . . .
Understanding the SQL Access Advisor . . . . . . . . . . . . . . . . .
Using the SQL Access Advisor with EM . . . . . . . . . . . . . . . . .
Using the SQL Access Advisor
with DBMS_ADVISOR . . . . . . . . . . . . . . . . . . . . . . . . . . .
Understand Database Replay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Database Replay Workload Capture . . . . . . . . . . . . . . . . . . . .
Database Replay Workload Preprocessing . . . . . . . . . . . . . . . .
Database Replay Workload Replay . . . . . . . . . . . . . . . . . . . . .
Database Replay Analysis and Reporting . . . . . . . . . . . . . . . .
✓ Two-Minute Drill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Q&A Self Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Self Test Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

12 Disk Space and Resource Management

459
459
460
467
470
470

471
477
479
480
481
482
483
485
487
489

. . . . . . . . . . . . 491

Manage Resumable Space Allocation . . . . . . . . . . . . . . . . . . . . . . . . . .
Understanding Resumable Space Allocation . . . . . . . . . . . . .
Configuring Resumable Space Allocation . . . . . . . . . . . . . . . .
Using Resumable Space Allocation . . . . . . . . . . . . . . . . . . . . .

493
493
494
496


Contents

Configure Resumable Space
Allocation for the HR User . . . . . . . . . . . . . . . . . . . . . . . . .
Describe the Concepts of Transportable
Tablespaces and Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Configuring Transportable Tablespaces . . . . . . . . . . . . . . . . . .
Transporting Tablespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise 12-2 Transport a Tablespace
Using SQL and PL/SQL . . . . . . . . . . . . . . . . . . . . . . . . . . .
Reclaim Wasted Space from Tables and Indexes
by Using the Segment Shrink Functionality . . . . . . . . . . . . . . . . . . .
Understanding Segment Shrink . . . . . . . . . . . . . . . . . . . . . . . .
Automating Segment Advisor . . . . . . . . . . . . . . . . . . . . . . . . .
Shrinking Segments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise 12-3 Perform Segment Analysis
and Shrink Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Understand the Database Resource Manager . . . . . . . . . . . . . . . . . . . .
Understanding Resource Manager Terminology . . . . . . . . . . .
Understanding Resource Manager
Allocation Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Create and Use Database Resource Manager Components . . . . . . . . .
Understanding DEFAULT_PLAN . . . . . . . . . . . . . . . . . . . . . .
Creating a New Resource Plan . . . . . . . . . . . . . . . . . . . . . . . . .
Creating and Assigning Consumer Groups . . . . . . . . . . . . . . .
Understanding Resource Allocation Methods . . . . . . . . . . . . .
Activating Resource Plans . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise 12-4 Create and Use a New
Resource Manager Plan . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Understanding Resource Manager Views . . . . . . . . . . . . . . . . .
Monitoring Resource Manager . . . . . . . . . . . . . . . . . . . . . . . . .
✓ Two-Minute Drill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Q&A Self Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Self Test Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

xix


Exercise 12-1

13 Configuring Database Diagnostics

497
500
501
504
513
517
518
520
520
522
529
529
531
531
532
535
536
537
538
539
541
543
546
550
553


. . . . . . . . . . . . . . . . . 555

Set Up Automatic Diagnostic Repository . . . . . . . . . . . . . . . . . . . . . . .
Understanding the ADR . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Using the ADRCI Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

556
557
559


xx

OCP Oracle Database 11g: Administration II Exam Guide

Using Support Workbench . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Understanding Alerts, Problems, and Incidents . . . . . . . . . . .
Managing Service Requests . . . . . . . . . . . . . . . . . . . . . . . . . . .
Using the Health Monitor . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Perform Block Media Recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Understanding Block Corruption . . . . . . . . . . . . . . . . . . . . . .
Using the DB_BLOCK_CHECKING Parameter . . . . . . . . . .
Using Block Media Recovery . . . . . . . . . . . . . . . . . . . . . . . . . .
Using the Data Recovery Advisor . . . . . . . . . . . . . . . . . . . . . .
Exercise 13-1 Use Data Recovery Advisor . . . . . . . . . . . . .
✓ Two-Minute Drill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Q&A Self Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Self Test Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


14 Using the Scheduler for Task Automation

562
563
565
571
574
575
575
576
579
581
587
589
591

. . . . . . . . . . 593

Create a Job, Program, and Schedule . . . . . . . . . . . . . . . . . . . . . . . . . . .
Understanding the Scheduler Architecture . . . . . . . . . . . . . . .
Jobs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Programs
.........................................
Schedules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Job Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Privileges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Use a Time-based or Event-based Schedule
for Executing Scheduler Jobs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Creating and Scheduling Time-based Jobs . . . . . . . . . . . . . . . .

Exercise 14-1 Creating a Job with the Scheduler API . . . .
Creating and Scheduling Event-based Jobs . . . . . . . . . . . . . . .
Using Programs and Schedules . . . . . . . . . . . . . . . . . . . . . . . . .
Create Lightweight Jobs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Understanding Lightweight Jobs . . . . . . . . . . . . . . . . . . . . . . .
Using Lightweight Jobs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise 14-2 Create and Run a Lightweight Job . . . . . . . .
Use Job Chains to Perform a Series of Related Tasks . . . . . . . . . . . . . .
Understanding Job Chains . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Creating Chain Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Defining Chain Steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

594
595
595
597
598
599
600
601
602
602
602
604
604
608
608
609
609
611

611
611
612


Contents

Defining Chain Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Starting the Chain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Monitoring Job Chains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Create Windows and Job Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Creating Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Creating Job Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Preconfigured Jobs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Use Advanced Scheduler Concepts to Prioritize Jobs . . . . . . . . . . . . . .
Using Classes, Windows, and the Resource Manager . . . . . . .
✓ Two-Minute Drill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Q&A Self Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Self Test Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

15 Database Globalization

About the CD

613
614
614
615
615
617

619
621
622
626
629
633

. . . . . . . . . . . . . . . . . . . . . . . . . . 635

Customize Language-Dependent Behavior for
the Database and Individual Sessions . . . . . . . . . . . . . . . . . . . . . . . .
Globalization Capabilities . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Using Globalization Support Features . . . . . . . . . . . . . . . . . . .
Exercise 15-1 Make Globalization and
Client Environment Settings . . . . . . . . . . . . . . . . . . . . . . . .
Exercise 15-2 Control Globalization
Within the Session . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Work with Database and NLS Character Sets . . . . . . . . . . . . . . . . . . .
Linguistic Sorting and Selection . . . . . . . . . . . . . . . . . . . . . . .
The Locale Builder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Using Time Zones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercise 15-3 Make Time Zone Adjustments . . . . . . . . . . .
✓ Two-Minute Drill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Q&A Self Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Self Test Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

A

xxi


636
637
644
650
651
654
654
656
658
659
662
664
668

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 671

System Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Installing and Running MasterExam . . . . . . . . . . . . . . . . . . . . . . . . . . .
MasterExam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Electronic Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

672
672
672
673


xxii

OCP Oracle Database 11g: Administration II Exam Guide


Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Removing Installation(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Technical Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
LearnKey Technical Support . . . . . . . . . . . . . . . . . . . . . . . . . .

Glossary
Index

673
673
673
673

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 675

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695


ACKNOWLEDGMENTS

M

any technical books need the expertise of more than one person, and this one is no
exception. Thanks to John Watson for providing some last-minute materials to help
me finish before the very last deadline!
Thanks also go out to the copy editors at International Typesetting and
Composition for filling in the gaps in my college English courses, Carly Stapleton
and Tim Green for (trying to) keep me on schedule, and Gavin Powell, who gave me
good advice when the theoretical met the practical.

Many of my professional colleagues at Lands’ End were a source of both
inspiration and guidance, especially Brook Swenson, Karen Shelton, and Dan
Schwickrath. In this case, the whole is truly greater than the sum of its parts.
If you have any questions or comments about any part of this book, please do not
hesitate to contact me at

xxiii


This page intentionally left blank


×