Oracle Database DBA Handbook - WordPress

Transcription

Oracle Database11g DBA Handbook

About the AuthorsBob Bryla is an Oracle 9i and 10g Certified Professional with more than 20 years of experience indatabase 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, inaddition to authoring several certification study guides for Oracle 10g and Oracle 11g. He hasalso 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 internationallyrecognized expert in the design, development, administration, and tuning of Oracle databases.An Oracle developer and DBA since 1987, he has implemented large-scale transaction processingsystems and data warehouses.He is the author of numerous technical articles and the lead author or coauthor of suchbest-selling books as Oracle: The Complete Reference. He regularly presents at Oracle userconferences in North America and Europe, and in 2002 was named Consultant of the Yearby ORACLE Magazine.About the Technical EditorScott Gossett is a Technical Director for Oracle Corporation’s Advanced Technology Solutionsorganization specializing in RAC, performance tuning and high availability databases. Prior tobecoming a technical director, Scott was a Senior Principal Instructor for Oracle Education forover twelve years, primarily teaching Oracle Internals, performance tuning, RAC and databaseadministration classes. In addition, Scott is one of the architects and primary authors of the OracleCertified Masters exam.

Oracle Database11g DBA HandbookBob BrylaKevin LoneyNew York Chicago San FranciscoLisbon London Madrid Mexico City MilanNew Delhi San Juan Seoul Singapore SydneyToronto

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 distributedin 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-1The 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 atrademarked name, we use names in an editorial fashion only, and to the benefit of the trademark owner, with no intention ofinfringement 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 corporatetraining programs. For more information, please contact George Hoare, Special Sales, at george hoare@mcgraw-hill.com or (212)904-4069.TERMS OF USEThis is a copyrighted work and The McGraw-Hill Companies, Inc. (“McGraw-Hill”) and its licensors reserve all rights in and tothe work. Use of this work is subject to these terms. Except as permitted under the Copyright Act of 1976 and the right to storeand retrieve one copy of the work, you may not decompile, disassemble, reverse engineer, reproduce, modify, create derivativeworks based upon, transmit, distribute, disseminate, sell, publish or sublicense the work or any part of it without McGraw-Hill’sprior consent. You may use the work for your own noncommercial and personal use; any other use of the work is strictlyprohibited. 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 ORWARRANTIES AS TO THE ACCURACY, ADEQUACY OR COMPLETENESS OF OR RESULTS TO BE OBTAINEDFROM USING THE WORK, INCLUDING ANY INFORMATION THAT CAN BE ACCESSED THROUGH THE WORK VIAHYPERLINK OR OTHERWISE, AND EXPRESSLY DISCLAIM ANY WARRANTY, EXPRESS OR IMPLIED, INCLUDINGBUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULARPURPOSE. McGraw-Hill and its licensors do not warrant or guarantee that the functions contained in the work will meet yourrequirements or that its operation will be uninterrupted or error free. Neither McGraw-Hill nor its licensors shall be liable to youor 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 shallMcGraw-Hill and/or its licensors be liable for any indirect, incidental, special, punitive, consequential or similar damages thatresult from the use of or inability to use the work, even if any of them has been advised of the possibility of such damages. Thislimitation of liability shall apply to any claim or cause whatsoever whether such claim or cause arises in contract, tort orotherwise.DOI: 10.1036/0071496637

ProfessionalWant to learn more?We hope you enjoy thisMcGraw-Hill eBook! Ifyou’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 GlancePART IDatabase Architecture1Getting Started with the Oracle Architecture.32Upgrading to Oracle Database 11g.493Planning and Managing Tablespaces.614Physical Database Layouts and Storage Management.75PART IIDatabase Management5Developing and Implementing Applications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1236Monitoring Space Usage7Managing Transactions with Undo Tablespaces8Database Tuning9Database Security and Auditing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163. . . . . . . . . . . . . . . . . . . . . . . . . . 207. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277PART IIIHigh Availability10Real Application Clusters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34911Backup and Recovery Options12Using Recovery Manager (RMAN)13Oracle Data Guard14Miscellaneous High Availability Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495vii

viiiOracle Database 11g DBA HandbookPART IVNetworked Oracle15Oracle Net.16Managing Large Databases17Managing Distributed Databases.Appendix: Installation and ConfigurationIndex511543599.635.653

For more information about this title, click hereContentsAcknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xixxxiPART IDatabase Architecture1Getting Started with the Oracle Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .An Overview of Databases and Instances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Instances.Oracle Logical Storage Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Tablespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Blocks.Extents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Segments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Oracle Logical Database Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Users and Schemas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Synonyms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .PL/SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .External File Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Database Links and Remote Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Oracle Physical Storage Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Datafiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Redo Log Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Control Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Archived Log Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Initialization Parameter Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .ix3445667778815171921212222222324242526262727

xOracle Database 11g DBA HandbookAlert and Trace Log Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Backup Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Oracle Managed Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Password Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Multiplexing Database Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Automatic Storage Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Manual Multiplexing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Oracle Memory Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .System Global Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Program Global Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Software Code Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Background Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Backup/Recovery Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Export/Import . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Offline Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Online Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .RMAN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Security Capabilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Privileges and Roles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Auditing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Fine-grained Auditing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Virtual Private Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Label Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Real Application Clusters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Oracle Streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Oracle Enterprise Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Oracle Initialization Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Basic Initialization Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Advanced Initialization Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2424343472U

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.