concepts 10g release 2 (10.2) - stanford university...v oracle ultra search ..... 1-28 oracle...

542
Oracle® Database Concepts 10g Release 2 (10.2) B14220-02 October 2005

Upload: others

Post on 24-Oct-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

  • Oracle® DatabaseConcepts

    10g Release 2 (10.2)

    B14220-02

    October 2005

  • Oracle Database Concepts, 10g Release 2 (10.2)

    B14220-02

    Copyright © 1993, 2005, Oracle. All rights reserved.

    Primary Author: Michele Cyran

    Contributing Author: Paul Lane, JP Polk

    Contributor: Omar Alonso, Penny Avril, Hermann Baer, Sandeepan Banerjee, Mark Bauer, Bill Bridge, Sandra Cheevers, Carol Colrain, Vira Goorah, Mike Hartstein, John Haydu, Wei Hu, Ramkumar Krishnan, Vasudha Krishnaswamy, Bill Lee, Bryn Llewellyn, Rich Long, Diana Lorentz, Paul Manning, Valarie Moore, Mughees Minhas, Gopal Mulagund, Muthu Olagappan, Jennifer Polk, Kathy Rich, John Russell, Viv Schupmann, Bob Thome, Randy Urbano, Michael Verheij, Ron Weiss, Steve Wertheimer

    The Programs (which include both the software and documentation) contain proprietary information; they are provided under a license agreement containing restrictions on use and disclosure and are also protected by copyright, patent, and other intellectual and industrial property laws. Reverse engineering, disassembly, or decompilation of the Programs, except to the extent required to obtain interoperability with other independently created software or as specified by law, is prohibited.

    The information contained in this document is subject to change without notice. If you find any problems in the documentation, please report them to us in writing. This document is not warranted to be error-free. Except as may be expressly permitted in your license agreement for these Programs, no part of these Programs may be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose.

    If the Programs are delivered to the United States Government or anyone licensing or using the Programs on behalf of the United States Government, the following notice is applicable:

    U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical data delivered to U.S. Government customers are "commercial computer software" or "commercial technical data" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, use, duplication, disclosure, modification, and adaptation of the Programs, including documentation and technical data, shall be subject to the licensing restrictions set forth in the applicable Oracle license agreement, and, to the extent applicable, the additional rights set forth in FAR 52.227-19, Commercial Computer Software—Restricted Rights (June 1987). Oracle Corporation, 500 Oracle Parkway, Redwood City, CA 94065

    The Programs are not intended for use in any nuclear, aviation, mass transit, medical, or other inherently dangerous applications. It shall be the licensee's responsibility to take all appropriate fail-safe, backup, redundancy and other measures to ensure the safe use of such applications if the Programs are used for such purposes, and we disclaim liability for any damages caused by such use of the Programs.

    Oracle, JD Edwards, PeopleSoft, and Retek are registered trademarks of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

    The Programs may provide links to Web sites and access to content, products, and services from third parties. Oracle is not responsible for the availability of, or any content provided on, third-party Web sites. You bear all risks associated with the use of such content. If you choose to purchase any products or services from a third party, the relationship is directly between you and the third party. Oracle is not responsible for: (a) the quality of third-party products or services; or (b) fulfilling any of the terms of the agreement with the third party, including delivery of products or services and warranty obligations related to purchased products or services. Oracle is not responsible for any loss or damage of any sort that you may incur from dealing with any third party.

  • iii

    Contents

    Preface ............................................................................................................................................................. xxv

    Audience................................................................................................................................................... xxvDocumentation Accessibility ................................................................................................................. xxvRelated Documentation.......................................................................................................................... xxviConventions ............................................................................................................................................. xxvi

    Part I What Is Oracle?

    1 Introduction to the Oracle Database

    Oracle Database Architecture ............................................................................................................... 1-1Overview of Oracle Grid Architecture............................................................................................ 1-2

    Grid Computing Defined........................................................................................................... 1-2Grid Computing in Oracle Database 10g................................................................................. 1-5

    Overview of Application Architecture ........................................................................................... 1-7Client/Server Architecture........................................................................................................ 1-7Multitier Architecture: Application Servers ........................................................................... 1-7

    Overview of Physical Database Structures..................................................................................... 1-8Datafiles ....................................................................................................................................... 1-8Control Files................................................................................................................................. 1-8Redo Log Files ............................................................................................................................. 1-9Archive Log Files ........................................................................................................................ 1-9Parameter Files ............................................................................................................................ 1-9Alert and Trace Log Files ........................................................................................................... 1-9Backup Files .............................................................................................................................. 1-10

    Overview of Logical Database Structures ................................................................................... 1-10Tablespaces ............................................................................................................................... 1-10Oracle Data Blocks ................................................................................................................... 1-10Extents ....................................................................................................................................... 1-11Segments ................................................................................................................................... 1-11

    Overview of Schemas and Common Schema Objects ............................................................... 1-12Tables ......................................................................................................................................... 1-12Indexes ...................................................................................................................................... 1-12Views ......................................................................................................................................... 1-12Clusters...................................................................................................................................... 1-13Synonyms.................................................................................................................................. 1-13

  • iv

    Overview of the Oracle Data Dictionary ..................................................................................... 1-13Overview of the Oracle Instance................................................................................................... 1-13

    Real Application Clusters: Multiple Instance Systems....................................................... 1-13Instance Memory Structures ................................................................................................. 1-14System Global Area ................................................................................................................. 1-14Program Global Area............................................................................................................... 1-15Oracle Background Processes ................................................................................................ 1-15Process Architecture ................................................................................................................ 1-15

    Overview of Accessing the Database ........................................................................................... 1-16Network Connections.............................................................................................................. 1-16Starting Up the Database ........................................................................................................ 1-16How Oracle Works ................................................................................................................. 1-17

    Overview of Oracle Utilities .......................................................................................................... 1-17Oracle Database Features .................................................................................................................... 1-17

    Overview of Scalability and Performance Features ................................................................... 1-18Concurrency ............................................................................................................................. 1-18Read Consistency .................................................................................................................... 1-18Locking Mechanisms .............................................................................................................. 1-19Quiesce Database ..................................................................................................................... 1-20Real Application Clusters ....................................................................................................... 1-20Portability.................................................................................................................................. 1-20

    Overview of Manageability Features ........................................................................................... 1-21Self-Managing Database ......................................................................................................... 1-21Oracle Enterprise Manager..................................................................................................... 1-21SQL*Plus.................................................................................................................................... 1-21Automatic Storage Management ........................................................................................... 1-21The Scheduler ........................................................................................................................... 1-22Database Resource Manager ................................................................................................. 1-22

    Overview of Database Backup and Recovery Features............................................................. 1-22Types of Failures ..................................................................................................................... 1-22Structures Used for Recovery ................................................................................................ 1-23

    Overview of High Availability Features...................................................................................... 1-24Overview of Business Intelligence Features................................................................................ 1-25

    Data Warehousing ................................................................................................................... 1-25Extraction, Transformation, and Loading (ETL) ................................................................. 1-25Materialized Views .................................................................................................................. 1-25Bitmap Indexes in Data Warehousing .................................................................................. 1-26Table Compression .................................................................................................................. 1-26Parallel Execution .................................................................................................................... 1-26Analytic SQL............................................................................................................................. 1-26OLAP Capabilities ................................................................................................................... 1-26Data Mining .............................................................................................................................. 1-27Partitioning ............................................................................................................................... 1-27

    Overview of Content Management Features .............................................................................. 1-27XML in Oracle........................................................................................................................... 1-27LOBs........................................................................................................................................... 1-27Oracle Text ............................................................................................................................... 1-28

  • v

    Oracle Ultra Search ................................................................................................................. 1-28Oracle interMedia..................................................................................................................... 1-28Oracle Spatial............................................................................................................................ 1-28

    Overview of Security Features ...................................................................................................... 1-28Security Mechanisms .............................................................................................................. 1-29

    Overview of Data Integrity and Triggers .................................................................................... 1-29Integrity Constraints................................................................................................................ 1-30Keys ........................................................................................................................................... 1-30Triggers ..................................................................................................................................... 1-30

    Overview of Information Integration Features........................................................................... 1-31Distributed SQL ...................................................................................................................... 1-31Oracle Streams ......................................................................................................................... 1-31Oracle Transparent Gateways and Generic Connectivity ................................................. 1-33

    Oracle Database Application Development ................................................................................... 1-33Overview of Oracle SQL ................................................................................................................ 1-33

    SQL Statements ........................................................................................................................ 1-33Overview of PL/SQL...................................................................................................................... 1-34

    PL/SQL Program Units .......................................................................................................... 1-35Overview of Java ............................................................................................................................. 1-35Overview of Application Programming Languages (APIs) ..................................................... 1-35Overview of Transactions .............................................................................................................. 1-36

    Commit and Undo Transactions............................................................................................ 1-37Savepoints ................................................................................................................................. 1-37

    Overview of Datatypes................................................................................................................... 1-37Overview of Globalization ............................................................................................................ 1-38

    Part II Oracle Database Architecture

    2 Data Blocks, Extents, and Segments

    Introduction to Data Blocks, Extents, and Segments ........................................................................ 2-1Overview of Data Blocks ........................................................................................................................ 2-3

    Data Block Format ............................................................................................................................. 2-3Header (Common and Variable) .............................................................................................. 2-4Table Directory............................................................................................................................ 2-4Row Directory ............................................................................................................................. 2-4Overhead...................................................................................................................................... 2-4Row Data...................................................................................................................................... 2-4Free Space..................................................................................................................................... 2-4

    Free Space Management.................................................................................................................... 2-4Availability and Optimization of Free Space in a Data Block .............................................. 2-5Row Chaining and Migrating .................................................................................................. 2-5

    PCTFREE, PCTUSED, and Row Chaining .................................................................................... 2-6The PCTFREE Parameter ........................................................................................................... 2-6The PCTUSED Parameter .......................................................................................................... 2-7

    Overview of Extents.............................................................................................................................. 2-10When Extents Are Allocated ........................................................................................................ 2-10

  • vi

    Determine the Number and Size of Extents ............................................................................... 2-10How Extents Are Allocated .......................................................................................................... 2-11When Extents Are Deallocated .................................................................................................... 2-11

    Extents in Nonclustered Tables ............................................................................................. 2-12Extents in Clustered Tables .................................................................................................... 2-12Extents in Materialized Views and Their Logs.................................................................... 2-12Extents in Indexes .................................................................................................................... 2-13Extents in Temporary Segments ............................................................................................ 2-13Extents in Rollback Segments................................................................................................. 2-13

    Overview of Segments ......................................................................................................................... 2-13Introduction to Data Segments .................................................................................................... 2-13Introduction to Index Segments ................................................................................................... 2-14Introduction to Temporary Segments ......................................................................................... 2-14

    Operations that Require Temporary Segments .................................................................. 2-14Segments in Temporary Tables and Their Indexes ............................................................ 2-15How Temporary Segments Are Allocated .......................................................................... 2-15

    Introduction to Automatic Undo Management.......................................................................... 2-16Undo Mode ............................................................................................................................... 2-16Undo Quota .............................................................................................................................. 2-17Automatic Undo Retention..................................................................................................... 2-17External Views.......................................................................................................................... 2-17

    3 Tablespaces, Datafiles, and Control Files

    Introduction to Tablespaces, Datafiles, and Control Files ............................................................... 3-1Oracle-Managed Files ........................................................................................................................ 3-2Allocate More Space for a Database ............................................................................................... 3-2

    Overview of Tablespaces ........................................................................................................................ 3-4Bigfile Tablespaces ............................................................................................................................. 3-5

    Benefits of Bigfile Tablespaces .................................................................................................. 3-6Considerations with Bigfile Tablespaces................................................................................. 3-6

    The SYSTEM Tablespace .................................................................................................................. 3-6The Data Dictionary.................................................................................................................... 3-7PL/SQL Program Units Description........................................................................................ 3-7

    The SYSAUX Tablespace................................................................................................................... 3-7Undo Tablespaces .............................................................................................................................. 3-7

    Creation of Undo Tablespaces .................................................................................................. 3-8Assignment of Undo Tablespaces ............................................................................................ 3-8

    Default Temporary Tablespace ........................................................................................................ 3-8How to Specify a Default Temporary Tablespace.................................................................. 3-8

    Using Multiple Tablespaces.............................................................................................................. 3-9Managing Space in Tablespaces ...................................................................................................... 3-9

    Locally Managed Tablespaces ............................................................................................... 3-10Segment Space Management in Locally Managed Tablespaces ...................................... 3-10Dictionary Managed Tablespaces ......................................................................................... 3-11

    Multiple Block Sizes........................................................................................................................ 3-11Online and Offline Tablespaces .................................................................................................... 3-11

    Bringing Tablespaces Offline ................................................................................................. 3-12

  • vii

    Use of Tablespaces for Special Procedures .......................................................................... 3-12Read-Only Tablespaces ................................................................................................................. 3-13Temporary Tablespaces for Sort Operations............................................................................... 3-13

    Sort Segments .......................................................................................................................... 3-13Creation of Temporary Tablespaces ..................................................................................... 3-14

    Transport of Tablespaces Between Databases ........................................................................... 3-14Tablespace Repository............................................................................................................. 3-14How to Move or Copy a Tablespace to Another Database ............................................... 3-15

    Overview of Datafiles .......................................................................................................................... 3-15Datafile Contents ............................................................................................................................ 3-16Size of Datafiles .............................................................................................................................. 3-16Offline Datafiles .............................................................................................................................. 3-16Temporary Datafiles ...................................................................................................................... 3-16

    Overview of Control Files ................................................................................................................... 3-17Control File Contents ..................................................................................................................... 3-17Multiplexed Control Files ............................................................................................................. 3-18

    4 Transaction Management

    Introduction to Transactions .................................................................................................................. 4-1Statement Execution and Transaction Control ............................................................................. 4-3Statement-Level Rollback ................................................................................................................. 4-3Resumable Space Allocation............................................................................................................. 4-3

    Overview of Transaction Management ................................................................................................ 4-4Commit Transactions ........................................................................................................................ 4-4Rollback of Transactions .................................................................................................................. 4-5Savepoints In Transactions ............................................................................................................... 4-6Transaction Naming .......................................................................................................................... 4-7

    How Transactions Are Named ................................................................................................. 4-7Commit Comment ...................................................................................................................... 4-7

    The Two-Phase Commit Mechanism ............................................................................................. 4-8Overview of Autonomous Transactions .............................................................................................. 4-8

    Autonomous PL/SQL Blocks .......................................................................................................... 4-9Transaction Control Statements in Autonomous Blocks ..................................................... 4-9

    5 Schema Objects

    Introduction to Schema Objects ........................................................................................................... 5-1Overview of Tables ................................................................................................................................. 5-3

    How Table Data Is Stored ................................................................................................................ 5-4Row Format and Size ................................................................................................................ 5-5Rowids of Row Pieces ............................................................................................................... 5-6Column Order ............................................................................................................................ 5-6

    Table Compression ............................................................................................................................ 5-7Using Table Compression.......................................................................................................... 5-7

    Nulls Indicate Absence of Value...................................................................................................... 5-8Default Values for Columns ............................................................................................................ 5-8

    Default Value Insertion and Integrity Constraint Checking ............................................... 5-8

  • viii

    Partitioned Tables .............................................................................................................................. 5-9Nested Tables .................................................................................................................................. 5-10Temporary Tables .......................................................................................................................... 5-10

    Segment Allocation.................................................................................................................. 5-10Parent and Child Transactions .............................................................................................. 5-11

    External Tables ................................................................................................................................ 5-11The Access Driver .................................................................................................................... 5-11Data Loading with External Tables ....................................................................................... 5-12Parallel Access to External Tables ......................................................................................... 5-12

    Overview of Views................................................................................................................................ 5-13How Views are Stored.................................................................................................................... 5-13How Views Are Used .................................................................................................................... 5-14Mechanics of Views ....................................................................................................................... 5-14

    Globalization Support Parameters in Views........................................................................ 5-15Use of Indexes Against Views................................................................................................ 5-15

    Dependencies and Views .............................................................................................................. 5-15Updatable Join Views .................................................................................................................... 5-16Object Views .................................................................................................................................... 5-16Inline Views .................................................................................................................................... 5-16

    Overview of Materialized Views ....................................................................................................... 5-17Define Constraints on Views ......................................................................................................... 5-17Refresh Materialized Views .......................................................................................................... 5-18Materialized View Logs ................................................................................................................ 5-18

    Overview of Dimensions ..................................................................................................................... 5-19Overview of the Sequence Generator ............................................................................................... 5-19Overview of Synonyms........................................................................................................................ 5-20Overview of Indexes ............................................................................................................................. 5-21

    Unique and Nonunique Indexes .................................................................................................. 5-22Composite Indexes.......................................................................................................................... 5-22Indexes and Keys ........................................................................................................................... 5-23Indexes and Nulls .......................................................................................................................... 5-23Function-Based Indexes ................................................................................................................. 5-24

    Uses of Function-Based Indexes ........................................................................................... 5-24Optimization with Function-Based Indexes ....................................................................... 5-24Dependencies of Function-Based Indexes ........................................................................... 5-25

    How Indexes Are Stored ............................................................................................................... 5-26Format of Index Blocks............................................................................................................ 5-26The Internal Structure of Indexes .......................................................................................... 5-26Index Properties ....................................................................................................................... 5-27Advantages of B-tree Structure.............................................................................................. 5-28

    Index Unique Scan .......................................................................................................................... 5-28Index Range Scan ............................................................................................................................ 5-28Key Compression ........................................................................................................................... 5-28

    Prefix and Suffix Entries ........................................................................................................ 5-28Performance and Storage Considerations ........................................................................... 5-29Uses of Key Compression ...................................................................................................... 5-29

    Reverse Key Indexes ...................................................................................................................... 5-30

  • ix

    Bitmap Indexes ............................................................................................................................... 5-30Benefits for Data Warehousing Applications ..................................................................... 5-30Cardinality ................................................................................................................................ 5-31Bitmap Index Example ............................................................................................................ 5-32Bitmap Indexes and Nulls ..................................................................................................... 5-33Bitmap Indexes on Partitioned Tables .................................................................................. 5-33

    Bitmap Join Indexes ........................................................................................................................ 5-33Overview of Index-Organized Tables ............................................................................................... 5-34

    Benefits of Index-Organized Tables ............................................................................................ 5-35Index-Organized Tables with Row Overflow Area ................................................................... 5-35Secondary Indexes on Index-Organized Tables ......................................................................... 5-36Bitmap Indexes on Index-Organized Tables ............................................................................... 5-36

    Mapping Table ......................................................................................................................... 5-36Partitioned Index-Organized Tables ............................................................................................ 5-37B-tree Indexes on UROWID Columns for Heap- and Index-Organized Tables .................... 5-37Index-Organized Table Applications ........................................................................................... 5-37

    Overview of Application Domain Indexes ...................................................................................... 5-37Overview of Clusters ............................................................................................................................ 5-38Overview of Hash Clusters ................................................................................................................. 5-40

    6 Dependencies Among Schema Objects

    Introduction to Dependency Issues...................................................................................................... 6-1Resolution of Schema Object Dependencies...................................................................................... 6-3

    Compilation of Views and PL/SQL Program Units .................................................................... 6-4Views and Base Tables ............................................................................................................... 6-4Program Units and Referenced Objects................................................................................... 6-5Data Warehousing Considerations .......................................................................................... 6-5Session State and Referenced Packages ................................................................................... 6-5Security Authorizations ............................................................................................................. 6-6

    Object Name Resolution ......................................................................................................................... 6-6Shared SQL Dependency Management............................................................................................... 6-6Local and Remote Dependency Management .................................................................................... 6-7

    Management of Local Dependencies .............................................................................................. 6-7Management of Remote Dependencies .......................................................................................... 6-7

    Dependencies Among Local and Remote Database Procedures ......................................... 6-7Dependencies Among Other Remote Schema Objects ......................................................... 6-9Dependencies of Applications ................................................................................................. 6-9

    7 The Data Dictionary

    Introduction to the Data Dictionary .................................................................................................... 7-1Structure of the Data Dictionary ..................................................................................................... 7-2

    Base Tables ................................................................................................................................... 7-2User-Accessible Views ............................................................................................................... 7-2

    SYS, Owner of the Data Dictionary ................................................................................................ 7-2How the Data Dictionary Is Used ........................................................................................................ 7-2

    How Oracle Uses the Data Dictionary ........................................................................................... 7-2

  • x

    Public Synonyms for Data Dictionary Views ......................................................................... 7-3Cache the Data Dictionary for Fast Access.............................................................................. 7-3Other Programs and the Data Dictionary ............................................................................... 7-3

    How to Use the Data Dictionary ..................................................................................................... 7-3Views with the Prefix USER ...................................................................................................... 7-4Views with the Prefix ALL ........................................................................................................ 7-4Views with the Prefix DBA........................................................................................................ 7-4The DUAL Table ......................................................................................................................... 7-4

    Dynamic Performance Tables ............................................................................................................... 7-5Database Object Metadata...................................................................................................................... 7-5

    8 Memory Architecture

    Introduction to Oracle Memory Structures ........................................................................................ 8-1Overview of the System Global Area................................................................................................... 8-2

    The SGA_MAX_SIZE Initialization Parameter.............................................................................. 8-3Automatic Shared Memory Management ...................................................................................... 8-4

    The SGA_TARGET Initialization Parameter .......................................................................... 8-5Automatically Managed SGA Components ........................................................................... 8-5Manually Managed SGA Components.................................................................................... 8-6Persistence of Automatically Tuned Values ........................................................................... 8-6

    Adding Granules and Tracking Component Size ......................................................................... 8-6Database Buffer Cache....................................................................................................................... 8-7

    Organization of the Database Buffer Cache ........................................................................... 8-7The LRU Algorithm and Full Table Scans .............................................................................. 8-8Size of the Database Buffer Cache ............................................................................................ 8-8Multiple Buffer Pools ................................................................................................................. 8-9

    Redo Log Buffer .............................................................................................................................. 8-10Shared Pool ..................................................................................................................................... 8-10

    Library Cache ........................................................................................................................... 8-10Shared SQL Areas and Private SQL Areas........................................................................... 8-10PL/SQL Program Units and the Shared Pool...................................................................... 8-11Dictionary Cache...................................................................................................................... 8-11Allocation and Reuse of Memory in the Shared Pool......................................................... 8-11

    Large Pool......................................................................................................................................... 8-13Java Pool ........................................................................................................................................... 8-13Streams Pool..................................................................................................................................... 8-13Control of the SGA’s Use of Memory........................................................................................... 8-14Other SGA Initialization Parameters............................................................................................ 8-14

    Physical Memory .................................................................................................................... 8-14SGA Starting Address ............................................................................................................ 8-14Extended Buffer Cache Mechanism ..................................................................................... 8-14

    Overview of the Program Global Areas............................................................................................ 8-14Content of the PGA ........................................................................................................................ 8-15

    Private SQL Area...................................................................................................................... 8-15Session Memory ....................................................................................................................... 8-16

    SQL Work Areas.............................................................................................................................. 8-16PGA Memory Management for Dedicated Mode ...................................................................... 8-16

  • xi

    Dedicated and Shared Servers ............................................................................................................ 8-18Software Code Areas ........................................................................................................................... 8-18

    9 Process Architecture

    Introduction to Processes ....................................................................................................................... 9-1Multiple-Process Oracle Systems .................................................................................................... 9-1Types of Processes ............................................................................................................................. 9-2

    Overview of User Processes ................................................................................................................... 9-3Connections and Sessions ................................................................................................................ 9-3

    Overview of Oracle Processes................................................................................................................ 9-3Server Processes ................................................................................................................................. 9-3Background Processes ....................................................................................................................... 9-4

    Database Writer Process (DBWn) ............................................................................................ 9-6Log Writer Process (LGWR) ..................................................................................................... 9-6Checkpoint Process (CKPT) ..................................................................................................... 9-8System Monitor Process (SMON) ............................................................................................ 9-8Process Monitor Process (PMON) ........................................................................................... 9-8Recoverer Process (RECO) ........................................................................................................ 9-9Job Queue Processes ................................................................................................................... 9-9Archiver Processes (ARCn) ................................................................................................... 9-10Queue Monitor Processes (QMNn) ...................................................................................... 9-10Other Background Processes.................................................................................................. 9-10

    Trace Files and the Alert Log ........................................................................................................ 9-11Shared Server Architecture ................................................................................................................. 9-11

    Dispatcher Request and Response Queues ................................................................................ 9-12Dispatcher Processes (Dnnn) .................................................................................................. 9-14Shared Server Processes (Snnn) ............................................................................................. 9-14

    Restricted Operations of the Shared Server ............................................................................... 9-15Dedicated Server Configuration ....................................................................................................... 9-15The Program Interface ......................................................................................................................... 9-17

    Program Interface Structure ......................................................................................................... 9-17Program Interface Drivers ............................................................................................................ 9-17Communications Software for the Operating System .............................................................. 9-18

    10 Application Architecture

    Introduction to Client/Server Architecture ...................................................................................... 10-1Overview of Multitier Architecture .................................................................................................. 10-3

    Clients ............................................................................................................................................... 10-4Application Servers......................................................................................................................... 10-4Database Servers ............................................................................................................................. 10-4

    Overview of Oracle Net Services ....................................................................................................... 10-5How Oracle Net Services Works................................................................................................... 10-5The Listener ..................................................................................................................................... 10-6

    Service Information Registration........................................................................................... 10-6

  • xii

    11 Oracle Utilities

    Introduction to Oracle Utilities ......................................................................................................... 11-1Overview of Data Pump Export and Import .................................................................................... 11-2

    Data Pump Export........................................................................................................................... 11-2Data Pump Import .......................................................................................................................... 11-2

    Overview of the Data Pump API........................................................................................................ 11-2Overview of the Metadata API ........................................................................................................... 11-2Overview of SQL*Loader .................................................................................................................... 11-3Overview of External Tables ............................................................................................................... 11-3Overview of LogMiner ......................................................................................................................... 11-4Overview of DBVERIFY Utility ......................................................................................................... 11-4Overview of DBNEWID Utility ......................................................................................................... 11-5

    12 Database and Instance Startup and Shutdown

    Introduction to an Oracle Instance ................................................................................................... 12-1The Instance and the Database ..................................................................................................... 12-2Connection with Administrator Privileges ................................................................................ 12-2Initialization Parameter Files and Server Parameter Files ........................................................ 12-3

    How Parameter Values Are Changed................................................................................... 12-3Overview of Instance and Database Startup .................................................................................. 12-4

    How an Instance Is Started ............................................................................................................ 12-4Restricted Mode of Instance Startup ..................................................................................... 12-4Forced Startup in Abnormal Situations ................................................................................ 12-4

    How a Database Is Mounted ......................................................................................................... 12-4How a Database Is Mounted with Real Application Clusters .......................................... 12-5How a Standby Database Is Mounted .................................................................................. 12-5How a Clone Database Is Mounted....................................................................................... 12-5

    What Happens When You Open a Database .............................................................................. 12-6Instance Recovery .................................................................................................................... 12-6Undo Space Acquisition and Management.......................................................................... 12-6Resolution of In-Doubt Distributed Transaction................................................................. 12-6Open a Database in Read-Only Mode ................................................................................. 12-6

    Overview of Database and Instance Shutdown .............................................................................. 12-7Close a Database ............................................................................................................................. 12-7

    Close the Database by Terminating the Instance ................................................................ 12-7Unmount a Database ..................................................................................................................... 12-8Shut Down an Instance .................................................................................................................. 12-8

    Abnormal Instance Shutdown ............................................................................................... 12-8

    Part III Oracle Database Features

    13 Data Concurrency and Consistency

    Introduction to Data Concurrency and Consistency in a Multiuser Environment .................. 13-1Preventable Phenomena and Transaction Isolation Levels ..................................................... 13-2Overview of Locking Mechanisms ............................................................................................... 13-2

    How Oracle Manages Data Concurrency and Consistency .......................................................... 13-3

  • xiii

    Multiversion Concurrency Control ............................................................................................. 13-3Statement-Level Read Consistency ............................................................................................. 13-4Transaction-Level Read Consistency .......................................................................................... 13-4Read Consistency with Real Application Clusters..................................................................... 13-4Oracle Isolation Levels .................................................................................................................. 13-5

    Set the Isolation Level ............................................................................................................. 13-5Read Committed Isolation...................................................................................................... 13-5Serializable Isolation................................................................................................................ 13-6

    Comparison of Read Committed and Serializable Isolation ................................................... 13-7Transaction Set Consistency................................................................................................... 13-7Row-Level Locking.................................................................................................................. 13-8Referential Integrity................................................................................................................. 13-8Distributed Transactions......................................................................................................... 13-9

    Choice of Isolation Level ............................................................................................................... 13-9Read Committed Isolation...................................................................................................... 13-9Serializable Isolation.............................................................................................................. 13-10Quiesce Database ................................................................................................................... 13-11

    How Oracle Locks Data...................................................................................................................... 13-12Transactions and Data Concurrency ......................................................................................... 13-12

    Modes of Locking................................................................................................................... 13-13Lock Duration......................................................................................................................... 13-13Data Lock Conversion Versus Lock Escalation ................................................................. 13-13

    Deadlocks ...................................................................................................................................... 13-14Deadlock Detection................................................................................................................ 13-14Avoid Deadlocks.................................................................................................................... 13-15

    Types of Locks .............................................................................................................................. 13-15DML Locks .................................................................................................................................... 13-15

    Row Locks (TX) ...................................................................................................................... 13-16Table Locks (TM) ................................................................................................................... 13-16DML Locks Automatically Acquired for DML Statements ............................................. 13-19

    DDL Locks...................................................................................................................................... 13-21Exclusive DDL Locks............................................................................................................. 13-21Share DDL Locks.................................................................................................................... 13-22Breakable Parse Locks ........................................................................................................... 13-22Duration of DDL Locks ......................................................................................................... 13-22DDL Locks and Clusters ....................................................................................................... 13-22

    Latches and Internal Locks ......................................................................................................... 13-22Latches ..................................................................................................................................... 13-22Internal Locks ......................................................................................................................... 13-23

    Explicit (Manual) Data Locking ................................................................................................. 13-23Oracle Lock Management Services............................................................................................. 13-24

    Overview of Oracle Flashback Query ............................................................................................. 13-24Flashback Query Benefits............................................................................................................. 13-25Some Uses of Flashback Query ................................................................................................... 13-26

    14 Manageability

    Installing Oracle and Getting Started ............................................................................................... 14-1

  • xiv

    Simplified Database Creation........................................................................................................ 14-2Instant Client.................................................................................................................................... 14-2Automated Upgrades ..................................................................................................................... 14-2Basic Initialization Parameters ...................................................................................................... 14-2Data Loading, Transfer, and Archiving....................................................................................... 14-3

    Intelligent Infrastructure ..................................................................................................................... 14-3Automatic Workload Repository.................................................................................................. 14-3Automatic Maintenance Tasks ...................................................................................................... 14-4Server-Generated Alerts................................................................................................................. 14-4Advisor Framework........................................................................................................................ 14-4

    Performance Diagnostic and Troubleshooting ................................................................................ 14-5Application and SQL Tuning .............................................................................................................. 14-6Memory Management .......................................................................................................................... 14-7Space Management ............................................................................................................................... 14-9

    Automatic Undo Management ..................................................................................................... 14-9Oracle-Managed Files ................................................................................................................... 14-10Free Space Management............................................................................................................... 14-10Proactive Space Management...................................................................................................... 14-10Intelligent Capacity Planning...................................................................................................... 14-10Space Reclamation ........................................................................................................................ 14-11

    Storage Management .......................................................................................................................... 14-12Backup and Recovery ......................................................................................................................... 14-12

    Recovery Manager ........................................................................................................................ 14-13Mean Time to Recovery................................................................................................................ 14-14Self Service Error Correction ....................................................................................................... 14-14

    Configuration Management .............................................................................................................. 14-14Workload Management ...................................................................................................................... 14-15

    Overview of the Database Resource Manager.......................................................................... 14-15Database Resource Manager Concepts............................................................................... 14-16

    Overview of Services .................................................................................................................... 14-17Workload Management with Services................................................................................ 14-17High Availability with Services ........................................................................................... 14-18

    Automatic Storage Management ...................................................................................................... 14-19Basic Automatic Storage Management Concepts .................................................................... 14-20

    Disk Groups ............................................................................................................................ 14-20Automatic Storage Management Files ................................................................................ 14-20Automatic Storage Management Templates...................................................................... 14-21Automatic Storage Management Disks .............................................................................. 14-21Failure Groups........................................................................................................................ 14-22Automatic Storage Management Instances........................................................................ 14-22

    Benefits of Using Automatic Storage Management ................................................................. 14-23Oracle Scheduler ................................................................................................................................. 14-24

    What Can the Scheduler Do?....................................................................................................... 14-24Schedule Job Execution ......................................................................................................... 14-25Time-based scheduling ......................................................................................................... 14-25Event-Based Scheduling........................................................................................................ 14-25Define Multi-Step Jobs .......................................................................................................... 14-25

  • xv

    Schedule Job Processes that Model Business Requirements ........................................... 14-25Manage and Monitor Jobs .................................................................................................... 14-25Execute and Manage Jobs in a Clustered Environment ................................................... 14-26

    15 Backup and Recovery

    Introduction to Backup ........................................................................................................................ 15-1Consistent and Inconsistent Backups........................................................................................... 15-2

    Overview of Consistent Backups........................................................................................... 15-2Overview of Inconsistent Backups ........................................................................................ 15-3

    Whole Database and Partial Database Backups ......................................................................... 15-3Whole Database Backups........................................................................................................ 15-4Tablespace Backups ................................................................................................................. 15-4Datafile Backups....................................................................................................................... 15-4

    RMAN and User-Managed Backups............................................................................................ 15-5RMAN with Online Backups ................................................................................................. 15-5Control File Backups ............................................................................................................... 15-5Archived Redo Log Backups.................................................................................................. 15-6

    Introduction to Recovery ..................................................................................................................... 15-6Overview of Media Recovery........................................................................................................ 15-8

    Complete Recovery.................................................................................................................. 15-8Incomplete Recovery ............................................................................................................... 15-8Datafile Media Recovery....................................................................................................... 15-10Block Media Recovery........................................................................................................... 15-11

    Overview of RMAN and User-Managed Restore and Recovery ........................................... 15-11RMAN Restore and Recovery .............................................................................................. 15-11User-Managed Restore and Recovery................................................................................. 15-11

    Recovery Using Oracle Flashback Technology......................................................................... 15-12Overview of Oracle Flashback Database ............................................................................ 15-12Overview of Oracle Flashback Table .................................................................................. 15-13

    Other Types of Oracle Recovery ................................................................................................. 15-14Overview of Redo Application ............................................................................................ 15-14Overview of Instance and Crash Recovery........................................................................ 15-15

    Deciding Which Recovery Technique to Use................................................................................. 15-16When to Use Media Recovery ..................................................................................................... 15-16When to Use Oracle Flashback.................................................................................................... 15-17When to Use CREATE TABLE AS SELECT Recovery............................................................. 15-17When to Use Import/Export Utilities Recovery....................................................................... 15-18When to Use Tablespace Point-in-Time Recovery ................................................................... 15-18

    Flash Recovery Area............................................................................................................................ 15-18Flash Recovery Area Disk Limit ................................................................................................. 15-19

    16 Business Intelligence

    Introduction to Data Warehousing and Business Intelligence..................................................... 16-1Characteristics of Data Warehousing........................................................................................... 16-1

    Subject Oriented ....................................................................................................................... 16-2Integrated .................................................................................................................................. 16-2

  • xvi

    Nonvolatile ............................................................................................................................... 16-2Time Variant ............................................................................................................................. 16-2

    Differences Between Data Warehouse and OLTP Systems ...................................................... 16-2Workload................................................................................................................................... 16-2Data Modifications................................................................................................................... 16-2Schema Design ......................................................................................................................... 16-3Typical Operations................................................................................................................... 16-3Historical Data.......................................................................................................................... 16-3

    Data Warehouse Architecture ....................................................................................................... 16-3Data Warehouse Architecture (Basic) ................................................................................... 16-3Data Warehouse Architecture (with a Staging Area) ......................................................... 16-4Data Warehouse Architecture (with a Staging Area and Data Marts)............................. 16-5

    Overview of Extraction, Transformation, and Loading (ETL) ...................................................... 16-6Transportable Tablespaces............................................................................................................. 16-7Table Functions................................................................................................................................ 16-7External Tables ................................................................................................................................ 16-8Table Compression ......................................................................................................................... 16-8Change Data Capture ..................................................................................................................... 16-9

    Overview of Materialized Views for Data Warehouses................................................................. 16-9Overview of Bitmap Indexes in Data Warehousing ..................................................................... 16-10Overview of Parallel Execution ........................................................................................................ 16-11

    How Parallel Execution Works ................................................................................................... 16-11Overview of Analytic SQL ................................................................................................................ 16-12

    SQL for Aggregation..................................................................................................................... 16-13SQL for Analysis............................................................................................................................ 16-13SQL for Modeling.......................................................................................................................... 16-14

    Overview of OLAP Capabilities....................................................................................................... 16-14Benefits of OLAP and RDBMS Integration ............................................................................... 16-14

    Scalability ................................................................................................................................ 16-15Availability.............................................................................................................................. 16-15Manageability ......................................................................................................................... 16-15Backup and Recovery............................................................................................................ 16-15Security .................................................................................................................................... 16-16

    Overview of Data Mining.................................................................................................................. 16-16

    17 High Availability

    Introduction to High Availability ...................................................................................................... 17-1Overview of Unplanned Downtime .................................................................................................. 17-1

    Oracle Solutions to System Failures ............................................................................................. 17-1Overview of Fast-Start Fault Recovery ................................................................................ 17-2Overview of Real Application Clusters ................................................................................ 17-2

    Oracle Solutions to Data Failures.................................................................................................. 17-2Overview of Backup and Recovery Features for High Availability................................. 17-2Overview of Partitioning ....................................................................................................... 17-3Overview of Transparent Application Failover .................................................................. 17-4

    Oracle Solutions to Disasters ......................................................................................................... 17-5Overview of Oracle Data Guard............................................................................................ 17-5

  • xvii

    Oracle Solutions to Human Errors ............................................................................................... 17-6Overview of Oracle Flashback Features ............................................................................... 17-7Overview of LogMiner............................................................................................................ 17-7Overview of Security Features for High Availability......................................................... 17-8

    Overview of Planned Downtime ....................................................................................................... 17-8System Maintenance ....................................................................................................................... 17-8Data Maintenance ........................................................................................................................... 17-9Database Maintenance.................................................................................................................... 17-9

    18 Partitioned Tables and Indexes

    Introduction to Partitioning ................................................................................................................ 18-1Partition Key .................................................................................