logo

Oracle Database 11g DBA Handbook P1


® Oracle Database 11g DBA Handbook About the Authors Bob Bryla is an Oracle 9i and 10g 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 Oracle 11g. He has also been known to watch science fiction movies and read science fiction novels in his spare time. Kevin Loney, Director of Data Management for a major financial institution, is an internationally recognized expert in the design, development, administration, and tuning of Oracle databases. An Oracle developer and DBA since 1987, he has implemented large-scale transaction processing systems and data warehouses. He is the author of numerous technical articles and the lead author or coauthor of such best-selling books as Oracle: The Complete Reference. He regularly presents at Oracle user conferences in North America and Europe, and in 2002 was named Consultant of the Year by ORACLE Magazine. About the Technical Editor Scott Gossett is a Technical Director for Oracle Corporation’s Advanced Technology Solutions organization specializing in RAC, performance tuning and high availability databases. Prior to becoming a technical director, Scott was a Senior Principal Instructor for Oracle Education for over twelve years, primarily teaching Oracle Internals, performance tuning, RAC and database administration classes. In addition, Scott is one of the architects and primary authors of the Oracle Certified Masters exam. ® Oracle Database 11g DBA Handbook Bob Bryla Kevin Loney New York Chicago San Francisco Lisbon London Madrid Mexico City Milan New Delhi San Juan Seoul Singapore Sydney Toronto Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Manufactured in the United States of America. 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. 0-07-159579-1 The material in this eBook also appears in the print version of this title: 0-07-149663-7. 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. For more information, please contact George Hoare, Special Sales, at [email protected] or (212) 904-4069. 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. DOI: 10.1036/0071496637 Professional Want to learn more? We hope you enjoy this McGraw-Hill eBook! If you’d like more information about this book, its author, or related books and websites, please click here. To the gang at home: I couldn’t have done it without you! And the pizzas. —B.B. This page intentionally left blank Contents at a Glance PART I Database Architecture 1 Getting Started with the Oracle Architecture ............................ 3 2 Upgrading to Oracle Database 11g ................................... 49 3 Planning and Managing Tablespaces ................................... 61 4 Physical Database Layouts and Storage Management ...................... 75 PART II Database Management 5 Developing and Implementing Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 6 Monitoring Space Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 7 Managing Transactions with Undo Tablespaces . . . . . . . . . . . . . . . . . . . . . . . . . . 207 8 Database Tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 9 Database Security and Auditing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277 PART III High Availability 10 Real Application Clusters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349 11 Backup and Recovery Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391 12 Using Recovery Manager (RMAN) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417 13 Oracle Data Guard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475 14 Miscellaneous High Availability Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495 vii viii Oracle Database 11g DBA Handbook PART IV Networked Oracle 15 Oracle Net ...................................................... 511 16 Managing Large Databases .......................................... 543 17 Managing Distributed Databases ..................................... 599 Appendix: Installation and Configuration ............................... 635 Index .......................................................... 653 For more information about this title, click here Contents Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi PART I Database Architecture 1 Getting Started with the Oracle Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 An Overview of Databases and Instances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Instances ..................................................... 5 Oracle Logical Storage Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Tablespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Blocks ....................................................... 7 Extents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Segments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Oracle Logical Database Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Users and Schemas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Synonyms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 PL/SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 External File Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 Database Links and Remote Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Oracle Physical Storage Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Datafiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 Redo Log Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Control Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Archived Log Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 Initialization Parameter Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 ix x Oracle Database 11g DBA Handbook Alert and Trace Log Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 Backup Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 Oracle Managed Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Password Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Multiplexing Database Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Automatic Storage Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Manual Multiplexing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 Oracle Memory Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 System Global Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Program Global Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Software Code Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Background Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Backup/Recovery Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 Export/Import . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 Offline Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 Online Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 RMAN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 Security Capabilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 Privileges and Roles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 Auditing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 Fine-grained Auditing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 Virtual Private Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 Label Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 Real Application Clusters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 Oracle Streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 Oracle Enterprise Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 Oracle Initialization Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 Basic Initialization Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 Advanced Initialization Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 2 Upgrading to Oracle Database 11g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 Choosing an Upgrade Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 Before Upgrading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 Using the Database Upgrade Assistant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Performing a Manual Direct Upgrade . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 Using Export and Import . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 Export and Import Versions to Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 Performing the Upgrade . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 Using the Data-Copying Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 After Upgrading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 3 Planning and Managing Tablespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 Tablespace Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 Tablespace Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 Optimal Flexible Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 Oracle Installation Tablespaces .......................................... 72 SYSTEM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 SYSAUX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 Contents xi TEMP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 UNDOTBS1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 USERS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 EXAMPLE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 Segment Segregation .................................................. 73 4 Physical Database Layouts and Storage Management . . . . . . . . . . . . . . . . . . . . . . . . . 75 Traditional Disk Space Storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 Resizing Tablespaces and Datafiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 Moving Datafiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 Moving Online Redo Log Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 Moving Control Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 Automatic Storage Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 ASM Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 Creating an ASM Instance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 ASM Instance Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 ASM Dynamic Performance Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 ASM Filename Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 ASM File Types and Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 Administering ASM Disk Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 PART II Database Management 5 Developing and Implementing Applications ................................ 123 Tuning by Design: Best Practices ......................................... 124 Do As Little As Possible . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 Do It As Simply As Possible . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 Tell the Database What It Needs to Know . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 Maximize the Throughput in the Environment . . . . . . . . . . . . . . . . . . . . . . . . . 129 Divide and Conquer Your Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 Test Correctly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 Standard Deliverables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 Resource Management and Stored Outlines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 Implementing the Database Resource Manager . . . . . . . . . . . . . . . . . . . . . . . . 136 Implementing Stored Outlines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 Sizing Database Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 Using Temporary Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 Supporting Tables Based on Abstract Datatypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 Using Object Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 Security for Abstract Datatypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 Indexing Abstract Datatype Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 Quiescing and Suspending the Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 Supporting Iterative Development ........................................ 158 Iterative Column Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 Forcing Cursor Sharing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 Managing Package Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 Generating Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 xii Oracle Database 11g DBA Handbook Space Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 Tuning Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 Security Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 Data Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 Version Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 Execution Plans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 Acceptance Test Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 The Testing Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 6 Monitoring Space Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 Common Space Management Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 Running Out of Free Space in a Tablespace . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 Insufficient Space for Temporary Segments . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 Too Much or Too Little Undo Space Allocated . . . . . . . . . . . . . . . . . . . . . . . . . 165 Fragmented Tablespaces and Segments .............................. 166 Oracle Segments, Extents, and Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 Data Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 Extents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 Segments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 Data Dictionary Views and Dynamic Performance Views . . . . . . . . . . . . . . . . . . . . . . . 171 DBA_TABLESPACES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 DBA_SEGMENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 DBA_EXTENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 DBA_FREE_SPACE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 DBA_LMT_FREE_SPACE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 DBA_THRESHOLDS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 DBA_OUTSTANDING_ALERTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 DBA_ALERT_HISTORY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 V$ALERT_TYPES ............................................... 174 V$UNDOSTAT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 V$OBJECT_USAGE ............................................. 175 V$SORT_SEGMENT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 V$TEMPSEG_USAGE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 Space Management Methodologies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 Locally Managed Tablespaces ..................................... 176 Using OMF to Manage Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 Bigfile Tablespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 Automatic Storage Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 Undo Management Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 SYSAUX Monitoring and Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 Archived Redo Log File Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 Built-in Space Management Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 Segment Advisor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 Undo Advisor and the Automatic Workload Repository . . . . . . . . . . . . . . . . . . 187 Index Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 Space Usage Warning Levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 Resumable Space Allocation ...................................... 192 Managing Alert and Trace Files with ADR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 OS Space Management .......................................... 197 Contents xiii Space Management Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197 Segments That Cannot Allocate Additional Extents . . . . . . . . . . . . . . . . . . . . . . 197 Used and Free Space by Tablespace and Datafile . . . . . . . . . . . . . . . . . . . . . . . 198 Automating and Streamlining the Notification Process . . . . . . . . . . . . . . . . . . . . . . . . . 199 Using DBMS_SCHEDULER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 OEM Job Control and Monitoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 7 Managing Transactions with Undo Tablespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 Transaction Basics .................................................... 208 Undo Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 Rollback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 Read Consistency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 Database Recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 Flashback Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 Managing Undo Tablespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 Creating Undo Tablespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 Undo Tablespace Dynamic Performance Views . . . . . . . . . . . . . . . . . . . . . . . . 216 Undo Tablespace Initialization Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 Multiple Undo Tablespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217 Sizing and Monitoring the Undo Tablespace .......................... 220 Read Consistency vs. Successful DML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222 Flashback Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 Flashback Query ............................................... 223 DBMS_FLASHBACK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 Flashback Transaction Backout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 Flashback Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 Flashback Version Query . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 Flashback Transaction Query . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 Flashback Data Archive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 Flashback and LOBs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 Migrating to Automatic Undo Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 8 Database Tuning ..................................................... 241 Tuning Application Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 Effective Table Design ........................................... 243 Distribution of CPU Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244 Effective Application Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 Tuning SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 Impact of Order on Load Rates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 Additional Indexing Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 Generating Explain Plans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 Tuning Memory Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252 Specifying the Size of the SGA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 Using the Cost-Based Optimizer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 Implications of the COMPUTE STATISTICS Option . . . . . . . . . . . . . . . . . . . . . . 257 Tuning Data Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257 Locally Managed Tablespaces ..................................... 257 Identifying Chained Rows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 Increasing the Oracle Block Size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 xiv Oracle Database 11g DBA Handbook Using Index-Organized Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260 Tuning Issues for Index-Organized Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261 Tuning Data Manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262 Bulk Inserts: Using the SQL*Loader Direct Path Option . . . . . . . . . . . . . . . . . . 262 Bulk Data Moves: Using External Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263 Bulk Inserts: Common Traps and Successful Tricks . . . . . . . . . . . . . . . . . . . . . . 264 Bulk Deletes: The truncate Command ............................... 265 Using Partitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 Tuning Physical Storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267 Using Raw Devices ............................................. 267 Using Automatic Storage Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267 Reducing Network Traffic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268 Replication of Data Using Materialized Views . . . . . . . . . . . . . . . . . . . . . . . . . 268 Using Remote Procedure Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270 Using the Automatic Workload Repository . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270 Managing Snapshots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271 Managing Baselines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271 Generating AWR Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272 Running the Automatic Database Diagnostic Monitor Reports . . . . . . . . . . . . . 272 Using the Automatic SQL Tuning Advisor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272 Tuning Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 9 Database Security and Auditing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277 Non-Database Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279 Database Authentication Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279 Database Authentication ......................................... 280 Database Administrator Authentication .............................. 280 Operating System Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 Network Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284 3-Tier Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286 Client-Side Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286 Oracle Identity Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286 User Accounts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288 Database Authorization Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292 Profile Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292 System Privileges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299 Object Privileges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302 Creating, Assigning, and Maintaining Roles . . . . . . . . . . . . . . . . . . . . . . . . . . . 306 Using a VPD to Implement Application Security Policies . . . . . . . . . . . . . . . . . 313 Auditing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 Auditing Locations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 Statement Auditing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332 Privilege Auditing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336 Schema Object Auditing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337 Fine-Grained Auditing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338 Auditing-Related Data Dictionary Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339 Protecting the Audit Trail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340 Enabling Enhanced Auditing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340 Contents xv Data Encryption Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342 DBMS_CRYPTO Package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342 Transparent Data Encryption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342 PART III High Availability 10 Real Application Clusters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349 Overview of Real Application Clusters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350 Hardware Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351 Software Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351 Network Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351 Disk Storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352 Installation and Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 Operating System Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354 Software Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360 RAC Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378 Server Parameter File Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379 RAC-related Initialization Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380 Dynamic Performance Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380 RAC Maintenance .................................................... 382 Starting Up a RAC .............................................. 382 Redo Logs in a RAC Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383 Undo Tablespaces in a RAC Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383 Failover Scenarios and TAF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383 RAC Node Failure Scenario . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385 Tuning a RAC Node . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389 Tablespace Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390 11 Backup and Recovery Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391 Capabilities ......................................................... 392 Logical Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392 Physical Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393 Offline Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393 Online Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394 Using Data Pump Export and Import ...................................... 395 Creating a Directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395 Data Pump Export Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396 Starting a Data Pump Export Job . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399 Data Pump Import Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403 Starting a Data Pump Import Job . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406 Comparing Data Pump Export/Import to Export/Import . . . . . . . . . . . . . . . . . . . 410 Implementing Offline Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411 Implementing Online Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411 Integration of Backup Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414 Integration of Logical and Physical Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . 415 Integration of Database and Operating System Backups . . . . . . . . . . . . . . . . . . 416 xvi Oracle Database 11g DBA Handbook 12 Using Recovery Manager (RMAN) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417 RMAN Features and Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418 RMAN Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419 RMAN vs. Traditional Backup Methods .............................. 420 Backup Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421 Overview of RMAN Commands and Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423 Frequently Used Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423 Setting Up a Repository . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423 Registering a Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428 Persisting RMAN Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428 Initialization Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 432 Data Dictionary and Dynamic Performance Views . . . . . . . . . . . . . . . . . . . . . . 433 Backup Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434 Full Database Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435 Tablespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439 Datafiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442 Image Copies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442 Control File, SPFILE Backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444 Archived Redo Logs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444 Incremental Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445 Incrementally Updated Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447 Incremental Backup Block Change Tracking . . . . . . . . . . . . . . . . . . . . . . . . . . . 450 Backup Compression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451 Using a Flash Recovery Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452 Validating Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453 Recovery Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455 Block Media Recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455 Restoring a Control File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456 Restoring a Tablespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456 Restoring a Datafile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459 Restoring an Entire Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 Validating Restore Operations ..................................... 464 Point in Time Recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465 Data Recovery Advisor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465 Miscellaneous Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470 Cataloging Other Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470 Catalog Maintenance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471 REPORT and LIST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472 13 Oracle Data Guard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475 Data Guard Architecture ............................................... 476 Physical vs. Logical Standby Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477 Data Protection Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477 LOG_ARCHIVE_DEST_n Parameter Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 478 Creating the Standby Database Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479 Preparing the Primary Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480 Creating Logical Standby Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484 Using Real-Time Apply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 486 Managing Gaps in Archive Log Sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 486 Managing Roles—Switchovers and Failovers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487 Switchovers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487 Contents xvii Switchovers to Physical Standby Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . 487 Switchovers to Logical Standby Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489 Failovers to Physical Standby Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490 Failovers to Logical Standby Databases .............................. 490 Administering the Databases ............................................ 491 Startup and Shutdown of Physical Standby Databases ................... 491 Opening Physical Standby Databases in Read-Only Mode . . . . . . . . . . . . . . . . 491 Managing Datafiles in Data Guard Environments . . . . . . . . . . . . . . . . . . . . . . . 492 Performing DDL on a Logical Standby Database ....................... 492 14 Miscellaneous High Availability Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495 Recovering Dropped Tables Using Flashback Drop . . . . . . . . . . . . . . . . . . . . . . . . . . . 496 The Flashback Database Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498 Using LogMiner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500 How LogMiner Works ........................................... 500 Extracting the Data Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501 Analyzing One or More Redo Log Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 502 LogMiner Features Introduced in Oracle Database 10g .................. 504 LogMiner Features Introduced in Oracle Database 11g . . . . . . . . . . . . . . . . . . . 505 Online Object Reorganization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 506 Creating Indexes Online . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 506 Rebuilding Indexes Online . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 506 Coalescing Indexes Online . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 506 Rebuilding Index-Organized Tables Online . . . . . . . . . . . . . . . . . . . . . . . . . . . 506 Redefining Tables Online . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 507 PART IV Networked Oracle 15 Oracle Net . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511 Overview of Oracle Net . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512 Connect Descriptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515 Net Service Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 516 Replacing tnsnames.ora with Oracle Internet Directory . . . . . . . . . . . . . . . . . . 517 Listeners . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517 Using the Oracle Net Configuration Assistant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 520 Configuring the Listener . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521 Using the Oracle Net Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525 Starting the Listener Server Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527 Controlling the Listener Server Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528 The Oracle Connection Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531 Using Connection Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531 Directory Naming with Oracle Internet Directory . . . . . . . . . . . . . . . . . . . . . . . 534 Using Easy Connect Naming ............................................ 537 Using Database Links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 538 Tuning Oracle Net . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540 Limiting Resource Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541 Debugging Connection Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541 16 Managing Large Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543 Creating Tablespaces in a VLDB Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545 Bigfile Tablespace Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545 xviii Oracle Database 11g DBA Handbook Creating and Modifying Bigfile Tablespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . 546 Bigfile Tablespace ROWID Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546 DBMS_ROWID and Bigfile Tablespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547 Using DBVERIFY with Bigfile Tablespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . 550 Bigfile Tablespace Initialization Parameter Considerations . . . . . . . . . . . . . . . . 551 Bigfile Tablespace Data Dictionary Changes . . . . . . . . . . . . . . . . . . . . . . . . . . . 552 Advanced Oracle Table Types ........................................... 552 Index-Organized Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553 Global Temporary Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553 External Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 555 Partitioned Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557 Materialized Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589 Using Bitmap Indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589 Understanding Bitmap Indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589 Using Bitmap Indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 590 Using Bitmap Join Indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 590 Oracle Data Pump . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591 Data Pump Export .............................................. 592 Data Pump Import . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 592 Using Transportable Tablespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 593 17 Managing Distributed Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 599 Remote Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 601 Remote Data Manipulation: Two-Phase Commit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 602 Dynamic Data Replication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 603 Managing Distributed Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 604 The Infrastructure: Enforcing Location Transparency . . . . . . . . . . . . . . . . . . . . . 604 Managing Database Links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 609 Managing Database Triggers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 610 Managing Materialized Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 612 Using DBMS_MVIEW and DBMS_ADVISOR . . . . . . . . . . . . . . . . . . . . . . . . . . 616 What Kind of Refreshes Can Be Performed? . . . . . . . . . . . . . . . . . . . . . . . . . . . 625 Using Materialized Views to Alter Query Execution Paths ................ 629 Managing Distributed Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 630 Resolving In-Doubt Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 631 Commit Point Strength . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 631 Monitoring Distributed Databases ........................................ 632 Tuning Distributed Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 632 Appendix: Installation and Configuration .................................. 635 Software Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 636 Overview of Licensing and Installation Options . . . . . . . . . . . . . . . . . . . . . . . . 637 Using OUI to Install the Oracle Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 638 Using the DBCA to Create a Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 638 Manually Creating a Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 649 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 653
DMCA.com Protection Status Copyright by webtailieu.net