Thư viện tri thức trực tuyến
Kho tài liệu với 50,000+ tài liệu học thuật
© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Oracle Database 12c DBA Handbook
Nội dung xem thử
Mô tả chi tiết
Oracle TIGHT / Oracle Database 12c DBA Handbook / Bob Bryla / 878-1/
Blind folio: i
®
Oracle Database 12c
DBA Handbook
00-FM.indd 1 27/04/15 11:13 AM
Oracle TIGHT / Oracle Database 12c DBA Handbook / Bob Bryla / 878-1 /
Blind folio: ii
About the Author
Bob Bryla is an Oracle 9i, 10g, 11g, and 12c Certified Professional with more than
20 years of experience in database design, database application development,
training, and Oracle database administration. He is the primary Oracle DBA and
database systems engineer at Epic in Verona, Wisconsin. He is a technical editor
for a number of Oracle Press books, including several certification study guides for
Oracle Database 10g, 11g, and 12c. He has also been known to watch science
fiction movies and tinker with Android devices in his spare time.
About the Technical Editor
Scott Gossett is a technical director in the Oracle Advanced Technologies Solutions
organization with more than 23 years of experience specializing in Oracle RAC,
performance tuning, and high-availability databases. Prior to becoming a technical
director, Scott was a senior principal instructor for Oracle Education for over 12 years,
primarily teaching Oracle internals, performance tuning, RAC, and database
administration. In addition, Scott is one of the architects and primary authors of
the Oracle Certified Master exam. Scott has been a technical editor for twelve
Oracle Press books.
00-FM.indd 2 27/04/15 11:13 AM
Oracle TIGHT / Oracle Database 12c DBA Handbook / Bob Bryla / 878-1/
Blind folio: iii
®
Oracle Database 12c
DBA Handbook
Bob Bryla
New York Chicago San Francisco
Athens London Madrid Mexico City
Milan New Delhi Singapore Sydney Toronto
00-FM.indd 3 27/04/15 11:13 AM
Copyright © 2015 by McGraw-Hill Education (Publisher). 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, with the exception that the program listings may be entered, stored, and executed in a computer system, but they
may not be reproduced for publication.
ISBN: 978-0-07-179879-2
MHID: 0-07-179879-X
The material in this eBook also appears in the print version of this title: ISBN: 978-0-07-179878-5,
MHID: 0-07-179878-1.
eBook conversion by codeMantra
Version 1.0
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 Education 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.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. All other trademarks are the property of their respective owners, and
McGraw-Hill Education makes no claim of ownership by the mention of products that contain these marks.
Screen displays of copyrighted Oracle software programs have been reproduced herein with the permission of Oracle Corporation and/or its affiliates.
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.
Oracle Corporation does not make any representations or warranties as to the accuracy, adequacy, or completeness of any information contained in this
Work, and is not responsible for any errors or omissions.
TERMS OF USE
This is a copyrighted work and McGraw-Hill Education 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 Education’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 EDUCATION 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 Education 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
Education 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 Education has no responsibility for the content of any information accessed through the work. Under
no circumstances shall McGraw-Hill Education 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.
Oracle TIGHT / Oracle Database 12c DBA Handbook / Bob Bryla / 878-1 /
Blind folio: v
To the gang at home: I couldn’t have done it
without you! And the pizzas. And the
heavy metal. And several shows on the BBC.
—BB
00-FM.indd 5 27/04/15 11:13 AM
This page intentionally left blank
Oracle TIGHT / Oracle Database 12c DBA Handbook / Bob Bryla / 878-1 Oracle TIGHT / Oracle Database 12c DBA Handbook / Bob Bryla / 878-1
Contents at a Glance
PART I
Database Architecture
1 Getting Started with the Oracle Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2 Upgrading to Oracle Database 12c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
3 Planning and Managing Tablespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
4 Physical Database Layouts and Storage Management . . . . . . . . . . . . . . . . . . . . . 77
PART II
Database Management
5 Developing and Implementing Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
6 Monitoring Space Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
7 Managing Transactions with Undo Tablespaces . . . . . . . . . . . . . . . . . . . . . . . . . . 209
8 Database Tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
9 In-Memory Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
10 Database Security and Auditing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
11 Multitenant Database Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
PART III
High Availability
12 Real Application Clusters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 441
13 Backup and Recovery Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453
14 Using Recovery Manager (RMAN) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
vii
00-FM.indd 7 27/04/15 11:13 AM
Oracle TIGHT / Oracle Database 12c DBA Handbook / Bob Bryla / 878-1 Oracle TIGHT / Oracle Database 12c DBA Handbook / Bob Bryla / 878-1
viii Oracle Database 12c DBA Handbook
15 Oracle Data Guard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 537
16 Miscellaneous High Availability Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559
PART IV
Networked Oracle
17 Oracle Net . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 577
18 Managing Large Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 611
19 Managing Distributed Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 657
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 697
00-FM.indd 8 27/04/15 11:13 AM
Oracle TIGHT / Oracle Database 12c DBA Handbook / Bob Bryla / 878-1 Oracle TIGHT / Oracle Database 12c DBA Handbook / Bob Bryla / 878-1
Contents
Acknowledgments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi
Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii
PART I
Database Architecture
1 Getting Started with the Oracle Architecture . . . . . . . . . . . . . . . . . . . . . . . . 3
An Overview of Databases and Instances. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Databases. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Instances. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Oracle Logical Storage Structures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Tablespaces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Blocks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Extents. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Segments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Oracle Logical Database Structures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Constraints. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Indexes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Users and Schemas. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Profiles. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Sequences. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Synonyms. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
PL/SQL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
External File Access. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Database Links and Remote Databases. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Oracle Physical Storage Structures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Datafiles. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Redo Log Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
ix
00-FM.indd 9 27/04/15 11:13 AM
Oracle TIGHT / Oracle Database 12c DBA Handbook / Bob Bryla / 878-1 Oracle TIGHT / Oracle Database 12c DBA Handbook / Bob Bryla / 878-1
x Oracle Database 12c DBA Handbook
Control Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Archived Log Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Initialization Parameter Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Alert and Trace Log Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Backup Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Oracle Managed Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Password Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Multiplexing Database Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Automatic Storage Management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Manual Multiplexing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Oracle Memory Structures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
System Global Area. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Program Global Area. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Software Code Area. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Background Processes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Backup/Recovery Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Export/Import. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Offline Backups. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Online Backups. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
RMAN. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Security Capabilities. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Privileges and Roles. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Auditing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Fine-Grained Auditing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Virtual Private Database. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Label Security. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Real Application Clusters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Oracle Streams. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Oracle Enterprise Manager. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Oracle Initialization Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Basic Initialization Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Advanced Initialization Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
2 Upgrading to Oracle Database 12c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Choosing an Upgrade Method. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Before Upgrading. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Using the Database Upgrade Assistant. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Performing a Manual Direct Upgrade. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Using Data Pump Export and Import. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Export and Import Versions to Use. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Performing the Upgrade. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Using the Data-Copying Method. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
After Upgrading. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
00-FM.indd 10 27/04/15 11:13 AM
Oracle TIGHT / Oracle Database 12c DBA Handbook / Bob Bryla / 878-1 Oracle TIGHT / Oracle Database 12c DBA Handbook / Bob Bryla / 878-1
x Oracle Database 12c DBA Handbook Contents xi
3 Planning and Managing Tablespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Tablespace Architecture. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Tablespace Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Optimal Flexible Architecture. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Oracle Installation Tablespaces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
SYSTEM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
SYSAUX. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
TEMP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
UNDOTBS1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
USERS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
EXAMPLE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Segment Segregation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
4 Physical Database Layouts and Storage Management . . . . . . . . . . . . . . . . . . 77
Traditional Disk Space Storage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Resizing Tablespaces and Datafiles. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Moving Datafiles. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Moving Online Redo Log Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Moving Control Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Automatic Storage Management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
ASM Architecture. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Creating an ASM Instance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
ASM Instance Components. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
ASM Dynamic Performance Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
ASM Filename Formats. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
ASM File Types and Templates. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
Administering ASM Disk Groups. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
PART II
Database Management
5 Developing and Implementing Applications . . . . . . . . . . . . . . . . . . . . . . . . . 117
Tuning by Design: Best Practices. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Do As Little As Possible. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Do It As Simply As Possible. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Tell the Database What It Needs to Know. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Maximize the Throughput in the Environment. . . . . . . . . . . . . . . . . . . . . . . . . 124
Divide and Conquer Your Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Test Correctly. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Standard Deliverables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
Resource Management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
Implementing the Database Resource Manager. . . . . . . . . . . . . . . . . . . . . . . . 130
Sizing Database Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
Using Global Temporary Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
00-FM.indd 11 27/04/15 11:13 AM
Oracle TIGHT / Oracle Database 12c DBA Handbook / Bob Bryla / 878-1 Oracle TIGHT / Oracle Database 12c DBA Handbook / Bob Bryla / 878-1
xii Oracle Database 12c DBA Handbook
Supporting Tables Based on Abstract Datatypes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
Using Object Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
Security for Abstract Datatypes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
Indexing Abstract Datatype Attributes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
Quiescing and Suspending the Database. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Supporting Iterative Development. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
Iterative Column Definitions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
Forcing Cursor Sharing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
Managing Package Development. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Generating Diagrams. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Space Requirements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Tuning Goals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Security Requirements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Data Requirements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Version Requirements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Execution Plans. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Acceptance Test Procedures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
The Testing Environment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
6 Monitoring Space Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Common Space Management Problems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
Running Out of Free Space in a Tablespace. . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Insufficient Space for Temporary Segments. . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Too Much or Too Little Undo Space Allocated. . . . . . . . . . . . . . . . . . . . . . . . . 159
Fragmented Tablespaces and Segments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Oracle Segments, Extents, and Blocks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
Data Blocks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
Extents. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Segments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
Data Dictionary Views and Dynamic Performance Views. . . . . . . . . . . . . . . . . . . . . . . 165
DBA_TABLESPACES. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
DBA_SEGMENTS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
DBA_EXTENTS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
DBA_FREE_SPACE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
DBA_LMT_FREE_SPACE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
DBA_THRESHOLDS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
DBA_OUTSTANDING_ALERTS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
DBA_OBJECT_USAGE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
DBA_ALERT_HISTORY. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
V$ALERT_TYPES. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
V$UNDOSTAT. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
V$SORT_SEGMENT. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
V$TEMPSEG_USAGE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
00-FM.indd 12 27/04/15 11:13 AM
Oracle TIGHT / Oracle Database 12c DBA Handbook / Bob Bryla / 878-1 Oracle TIGHT / Oracle Database 12c DBA Handbook / Bob Bryla / 878-1
xii Oracle Database 12c DBA Handbook Contents xiii
Space Management Methodologies. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
Locally Managed Tablespaces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
Using OMF to Manage Space. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
Bigfile Tablespaces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
Automatic Storage Management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
Undo Management Considerations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
SYSAUX Monitoring and Usage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
Archived Redo Log File Management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
Built-in Space Management Tools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
Segment Advisor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
Undo Advisor and the Automatic Workload Repository. . . . . . . . . . . . . . . . . . 182
Index Usage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
Space Usage Warning Levels. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Resumable Space Allocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
Managing Alert and Trace Files with ADR. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
OS Space Management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
Space Management Scripts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
Segments That Cannot Allocate Additional Extents. . . . . . . . . . . . . . . . . . . . . . 193
Used and Free Space by Tablespace and Datafile. . . . . . . . . . . . . . . . . . . . . . . 194
Automating and Streamlining the Notification Process. . . . . . . . . . . . . . . . . . . . . . . . . 195
Using DBMS_SCHEDULER. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
Cloud Control and Monitoring. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
7 Managing Transactions with Undo Tablespaces . . . . . . . . . . . . . . . . . . . . . . . 209
Transaction Basics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
Undo Basics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
Rollback. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
Read Consistency. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
Database Recovery. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Flashback Operations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Managing Undo Tablespaces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Creating Undo Tablespaces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Undo Tablespace Dynamic Performance Views. . . . . . . . . . . . . . . . . . . . . . . . 219
Undo Tablespace Initialization Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
Multiple Undo Tablespaces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
Sizing and Monitoring the Undo Tablespace. . . . . . . . . . . . . . . . . . . . . . . . . . . 223
Read Consistency vs. Successful DML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
Flashback Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
Flashback Query. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
DBMS_FLASHBACK. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
Flashback Transaction Backout. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
Flashback Table. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
Flashback Version Query. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
Flashback Transaction Query. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
00-FM.indd 13 27/04/15 11:13 AM
Oracle TIGHT / Oracle Database 12c DBA Handbook / Bob Bryla / 878-1 Oracle TIGHT / Oracle Database 12c DBA Handbook / Bob Bryla / 878-1
xiv Oracle Database 12c DBA Handbook
Flashback Data Archive. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
Flashback and LOBs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
Migrating to Automatic Undo Management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
8 Database Tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
Tuning Application Design. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
Effective Table Design. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
Distribution of CPU Requirements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
Effective Application Design. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
Tuning SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
Impact of Order on Load Rates. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
Additional Indexing Options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
Generating Explain Plans. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
Tuning Memory Usage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
Managing SGA Pools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
Specifying the Size of the SGA. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
Using the Cost-Based Optimizer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
Tuning Data Access. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
Identifying Chained Rows. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
Using Index-Organized Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
Tuning Issues for Index-Organized Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
Tuning Data Manipulation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
Bulk Inserts: Using the SQL*Loader Direct Path Option. . . . . . . . . . . . . . . . . . 265
Bulk Data Moves: Using External Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
Bulk Inserts: Common Traps and Successful Tricks. . . . . . . . . . . . . . . . . . . . . . 267
Bulk Deletes: The TRUNCATE Command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
Using Partitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
Reducing Network Traffic. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
Replication of Data Using Materialized Views. . . . . . . . . . . . . . . . . . . . . . . . . 270
Using Remote Procedure Calls. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
Using the Automatic Workload Repository. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
Managing Snapshots. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
Managing Baselines. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
Generating AWR Reports. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
Running the Automatic Database Diagnostic Monitor Reports. . . . . . . . . . . . . 275
Using Automatic SQL Tuning Advisor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
Performance Tuning in a Multitenant Environment. . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
Tuning Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
Sizing the CDB. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
Using Memory Advisors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
Leveraging AWR Reports. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
Using the SQL Tuning Advisor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
Managing Resource Allocation Within a PDB. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
Using Shares to Manage Inter-PDB Resources. . . . . . . . . . . . . . . . . . . . . . . . . . 284
Creating and Modifying Resource Manager Plans. . . . . . . . . . . . . . . . . . . . . . . 284
00-FM.indd 14 27/04/15 11:13 AM