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

Tài liệu Oracle Database Concepts ppt

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

Oracle® Database
Concepts
10g Release 1 (10.1)
Part No. B10743-01
December 2003
Oracle Database Concepts, 10g Release 1 (10.1)
Part No. B10743-01
Copyright © 1993, 2003 Oracle Corporation. All rights reserved.
Primary Author: Michele Cyran
Contributing Author: Paul Lane
Contributors: Omar Alonso, Penny Avril, Hermann Baer, Sandeepan Banerjee, Mark Bauer, Ruth
Baylis, Bill Bridge, Sandra Cheevers, Carol Colrain, Vira Goorah, Mike Hartstein, John Haydu, Wei Hu,
Ramkumar Krishnan, Vasudha Krishnaswamy, Bill Lee, Bryn Llewellyn, Phil Locke, Rich Long, Diana
Lorentz, Paul Manning, Krishna Mohan, Valarie Moore, Mughees Minhas, Tony Morales, Gopal
Mulagund, Muthu Olagappan, Kathy Rich, John Russell, Vivian Schupmann, Bob Thome, Randy
Urbano, Michael Verheij, Ron Weiss, Steve Wertheimer, Ramana Yerneni
The Programs (which include both the software and documentation) contain proprietary information of
Oracle Corporation; 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. Oracle Corporation does not warrant that this
document is 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, without the express written permission of Oracle Corporation.
If the Programs are delivered to the U.S. Government or anyone licensing or using the programs on
behalf of the U.S. Government, the following notice is applicable:
Restricted Rights Notice Programs delivered subject to the DOD FAR Supplement are "commercial
computer software" and use, duplication, and disclosure of the Programs, including documentation,
shall be subject to the licensing restrictions set forth in the applicable Oracle license agreement.


Otherwise, Programs delivered subject to the Federal Acquisition Regulations are "restricted computer
software" and use, duplication, and disclosure of the Programs shall be subject to the restrictions 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 Oracle Corporation disclaims liability for any damages caused by such use of the
Programs.
Oracle is a registered trademark, and Express, Oracle Store, Oracle8i, Oracle9i, PL/SQL, Pro*C,
Pro*C/C++, Pro*COBOL, Pro*FORTRAN, SQL*Net, and SQL*Plus are trademarks or registered
trademarks of Oracle Corporation. Other names may be trademarks of their respective owners.
iii
Contents
Send Us Your Comments
............................................................................................................ xxxiii
Preface
....................................................................................................................................................... xxxv
Audience ............................................................................................................................................ xxxv
Organization..................................................................................................................................... xxxvi
Related Documentation .................................................................................................................. xxxix
Conventions............................................................................................................................................ xl
Documentation Accessibility ............................................................................................................. xlv
Part I What Is Oracle?
1 Introduction to the Oracle Database
Oracle Database Architecture .......................................................................................................... 1-1
Overview of Oracle Grid Architecture - XXX........................................................................... 1-2
Oracle Technologies that Enable the Grid ......................................................................... 1-4
Managing the Grid................................................................................................................ 1-6
Overview of Application Architecture...................................................................................... 1-7

Client/Server Architecture .................................................................................................. 1-7
Multitier Architecture: Application Servers...................................................................... 1-8
Overview of Physical Database Structures............................................................................... 1-8
Datafiles ................................................................................................................................. 1-8
Control Files ........................................................................................................................... 1-9
Redo Log Files........................................................................................................................ 1-9
Archive Log Files................................................................................................................. 1-10
iv
Parameter Files..................................................................................................................... 1-10
Alert and Trace Log Files.................................................................................................... 1-10
Backup Files.......................................................................................................................... 1-11
Overview of Logical Database Structures............................................................................... 1-11
Tablespaces........................................................................................................................... 1-11
Oracle Data Blocks............................................................................................................... 1-12
Extents................................................................................................................................... 1-12
Segments ............................................................................................................................... 1-12
Overview of Schemas and Common Schema Objects........................................................... 1-14
Tables..................................................................................................................................... 1-14
Indexes ................................................................................................................................. 1-14
Views ..................................................................................................................................... 1-14
Clusters ................................................................................................................................. 1-15
Synonyms ............................................................................................................................. 1-15
Overview of the Oracle Data Dictionary................................................................................. 1-15
Overview of the Oracle Instance .............................................................................................. 1-16
Real Application Clusters: Multiple Instance Systems .................................................. 1-16
Instance Memory Structures ............................................................................................. 1-16
System Global Area............................................................................................................. 1-16
Program Global Area .......................................................................................................... 1-17
Oracle Background Processes............................................................................................ 1-18
Process Architecture............................................................................................................ 1-18

Overview of Accessing the Database....................................................................................... 1-19
Network Connections ......................................................................................................... 1-19
Starting Up the Database.................................................................................................... 1-20
How Oracle Works ............................................................................................................. 1-20
Overview of Oracle Utilities...................................................................................................... 1-21
Oracle Database Features ............................................................................................................... 1-21
Overview of Scalability and Performance Features............................................................... 1-22
Concurrency ........................................................................................................................ 1-22
Read Consistency ................................................................................................................ 1-23
Locking Mechanisms .......................................................................................................... 1-24
Quiesce Database................................................................................................................. 1-25
Real Application Clusters................................................................................................... 1-25
Portability ............................................................................................................................. 1-25
v
Overview of Manageability Features ...................................................................................... 1-26
Self-Managing Database..................................................................................................... 1-26
Oracle Enterprise Manager ................................................................................................ 1-26
SQL*Plus............................................................................................................................... 1-27
Automatic Storage Management ...................................................................................... 1-27
The Scheduler....................................................................................................................... 1-27
Database Resource Manager ............................................................................................. 1-27
Overview of Database Backup and Recovery Features ........................................................ 1-28
Types of Failures ................................................................................................................. 1-28
Structures Used for Recovery ........................................................................................... 1-29
Overview of High Availability Features................................................................................. 1-31
Overview of Business Intelligence Features........................................................................... 1-32
Data Warehousing............................................................................................................... 1-32
Extraction, Transformation, and Loading (ETL)............................................................. 1-32
Materialized Views ............................................................................................................. 1-32
Bitmap Indexes in Data Warehousing.............................................................................. 1-32

Table Compression.............................................................................................................. 1-33
Parallel Execution................................................................................................................ 1-33
Analytic SQL ........................................................................................................................ 1-33
OLAP Capabilities............................................................................................................... 1-33
Data Mining.......................................................................................................................... 1-34
Partitioning........................................................................................................................... 1-34
Overview of Content Management Features ......................................................................... 1-35
XML in Oracle...................................................................................................................... 1-35
LOBs ...................................................................................................................................... 1-35
Oracle Text ........................................................................................................................... 1-35
Oracle Ultra Search ............................................................................................................ 1-35
Oracle interMedia ................................................................................................................ 1-36
Oracle Spatial ....................................................................................................................... 1-36
Overview of Security Features ................................................................................................. 1-36
Security Mechanisms ......................................................................................................... 1-37
Overview of Data Integrity and Triggers................................................................................ 1-37
Integrity Constraints ........................................................................................................... 1-38
Keys ...................................................................................................................................... 1-38
Triggers ................................................................................................................................ 1-39
vi
Overview of Information Integration Features ...................................................................... 1-39
Distributed SQL .................................................................................................................. 1-39
Oracle Streams .................................................................................................................... 1-40
Oracle Transparent Gateways and Generic Connectivity ............................................. 1-42
Oracle Database Application Development ............................................................................... 1-42
Overview of Oracle SQL............................................................................................................ 1-43
SQL Statements.................................................................................................................... 1-43
Overview of PL/SQL ................................................................................................................. 1-44
PL/SQL Program Units...................................................................................................... 1-45
Overview of Java......................................................................................................................... 1-45

Overview of Application Programming Languages (APIs)................................................. 1-46
Overview of Transactions.......................................................................................................... 1-47
Commit and Undo Transactions ....................................................................................... 1-48
Savepoints............................................................................................................................. 1-48
Overview of Datatypes .............................................................................................................. 1-48
Overview of Globalization ....................................................................................................... 1-49
Part II Oracle Database Architecture
2 Data Blocks, Extents, and Segments
Introduction to Data Blocks, Extents, and Segments................................................................... 2-1
Overview of Data Blocks................................................................................................................... 2-3
Data Block Format ....................................................................................................................... 2-4
Header (Common and Variable)......................................................................................... 2-4
Table Directory....................................................................................................................... 2-4
Row Directory ........................................................................................................................ 2-4
Overhead................................................................................................................................. 2-5
Row Data................................................................................................................................. 2-5
Free Space ............................................................................................................................... 2-5
Free Space Management .............................................................................................................. 2-5
Availability and Optimization of Free Space in a Data Block......................................... 2-6
Row Chaining and Migrating ............................................................................................. 2-6
PCTFREE, PCTUSED, and Row Chaining ............................................................................... 2-7
The PCTFREE Parameter...................................................................................................... 2-7
The PCTUSED Parameter..................................................................................................... 2-8
vii
Overview of Extents ......................................................................................................................... 2-11
When Extents Are Allocated .................................................................................................... 2-11
Determine the Number and Size of Extents .......................................................................... 2-12
How Extents Are Allocated ...................................................................................................... 2-13
When Extents Are Deallocated ................................................................................................ 2-13
Extents in Nonclustered Tables......................................................................................... 2-14

Extents in Clustered Tables................................................................................................ 2-14
Extents in Materialized Views and Their Logs ............................................................... 2-14
Extents in Indexes................................................................................................................ 2-15
Extents in Temporary Segments ....................................................................................... 2-15
Extents in Rollback Segments............................................................................................ 2-15
Overview of Segments..................................................................................................................... 2-15
Introduction to Data Segments ................................................................................................ 2-16
Introduction to Index Segments .............................................................................................. 2-17
Introduction to Temporary Segments .................................................................................... 2-17
Operations that Require Temporary Segments ............................................................. 2-17
Segments in Temporary Tables and Their Indexes ....................................................... 2-18
How Temporary Segments Are Allocated ..................................................................... 2-18
Introduction to Automatic Undo Management..................................................................... 2-19
Undo Mode........................................................................................................................... 2-20
Undo Quota.......................................................................................................................... 2-21
Automatic Undo Retention................................................................................................ 2-21
External Views ..................................................................................................................... 2-21
3 Tablespaces, Datafiles, and Control Files
Introduction to Tablespaces, Datafiles, and Control Files.......................................................... 3-1
Oracle-Managed Files .................................................................................................................. 3-3
Allocate More Space for a Database .......................................................................................... 3-3
Overview of Tablespaces................................................................................................................... 3-6
Bigfile Tablespaces ....................................................................................................................... 3-7
Benefits of Bigfile Tablespaces............................................................................................. 3-8
Considerations with Bigfile Tablespaces ........................................................................... 3-8
The SYSTEM Tablespace ............................................................................................................ 3-9
The Data Dictionary.............................................................................................................. 3-9
PL/SQL Program Units Description .................................................................................. 3-9
viii
The SYSAUX Tablespace ........................................................................................................... 3-10

Undo Tablespaces....................................................................................................................... 3-10
Creation of Undo Tablespaces........................................................................................... 3-11
Assignment of Undo Tablespaces..................................................................................... 3-11
Default Temporary Tablespace................................................................................................. 3-11
How to Specify a Default Temporary Tablespace .......................................................... 3-12
Using Multiple Tablespaces ...................................................................................................... 3-12
Managing Space in Tablespaces .............................................................................................. 3-13
Locally Managed Tablespaces .......................................................................................... 3-13
Segment Space Management in Locally Managed Tablespaces .................................. 3-14
Dictionary Managed Tablespaces .................................................................................... 3-15
Multiple Block Sizes ................................................................................................................... 3-15
Online and Offline Tablespaces................................................................................................ 3-16
Bringing Tablespaces Offline............................................................................................. 3-16
Use of Tablespaces for Special Procedures ...................................................................... 3-17
Read-Only Tablespaces ............................................................................................................. 3-17
Temporary Tablespaces for Sort Operations .......................................................................... 3-18
Sort Segments ...................................................................................................................... 3-18
Creation of Temporary Tablespaces ................................................................................ 3-19
Transport of Tablespaces Between Databases ....................................................................... 3-19
How to Move or Copy a Tablespace to Another Database .......................................... 3-20
Overview of Datafiles....................................................................................................................... 3-21
Datafile Contents ....................................................................................................................... 3-21
Size of Datafiles .......................................................................................................................... 3-22
Offline Datafiles ......................................................................................................................... 3-22
Temporary Datafiles .................................................................................................................. 3-22
Overview of Control Files............................................................................................................... 3-23
Control File Contents ................................................................................................................ 3-23
Multiplexed Control Files ......................................................................................................... 3-25
4 Transaction Management
Introduction to Transactions............................................................................................................. 4-1

Statement Execution and Transaction Control ........................................................................ 4-2
Statement-Level Rollback ........................................................................................................... 4-3
Resumable Space Allocation ....................................................................................................... 4-4
ix
Overview of Transaction Management .......................................................................................... 4-4
Commit Transactions .................................................................................................................. 4-5
Rollback of Transactions ............................................................................................................. 4-6
Savepoints In Transactions.......................................................................................................... 4-7
Transaction Naming..................................................................................................................... 4-8
How Transactions Are Named............................................................................................ 4-8
Commit Comment................................................................................................................. 4-8
The Two-Phase Commit Mechanism ........................................................................................ 4-9
Overview of Autonomous Transactions....................................................................................... 4-10
Autonomous PL/SQL Blocks .................................................................................................. 4-10
Transaction Control Statements in Autonomous Blocks .............................................. 4-11
5 Schema Objects
Introduction to Schema Objects ..................................................................................................... 5-1
Overview of Tables ............................................................................................................................ 5-4
How Table Data Is Stored ........................................................................................................... 5-5
Row Format and Size ........................................................................................................... 5-5
Rowids of Row Pieces .......................................................................................................... 5-7
Column Order ....................................................................................................................... 5-7
Table Compression....................................................................................................................... 5-8
Using Table Compression .................................................................................................... 5-8
Nulls Indicate Absence of Value ................................................................................................ 5-9
Default Values for Columns ..................................................................................................... 5-10
Default Value Insertion and Integrity Constraint Checking ........................................ 5-10
Partitioned Tables....................................................................................................................... 5-11
Nested Tables ............................................................................................................................. 5-12
Temporary Tables ...................................................................................................................... 5-12

Segment Allocation ............................................................................................................. 5-13
Parent and Child Transactions ......................................................................................... 5-13
External Tables............................................................................................................................ 5-14
The Access Driver................................................................................................................ 5-14
Data Loading with External Tables .................................................................................. 5-15
Parallel Access to External Tables..................................................................................... 5-15
Overview of Views ........................................................................................................................... 5-16
How Views are Stored ............................................................................................................... 5-17
x
How Views Are Used ................................................................................................................ 5-18
Mechanics of Views ................................................................................................................... 5-19
Globalization Support Parameters in Views ................................................................... 5-19
Use of Indexes Against Views ........................................................................................... 5-19
Dependencies and Views .......................................................................................................... 5-20
Updatable Join Views ................................................................................................................ 5-20
Object Views................................................................................................................................ 5-21
Inline Views ................................................................................................................................ 5-21
Overview of Materialized Views ................................................................................................... 5-22
Define Constraints on Views..................................................................................................... 5-23
Refresh Materialized Views ..................................................................................................... 5-24
Materialized View Logs ............................................................................................................ 5-24
Overview of Dimensions................................................................................................................. 5-24
Overview of the Sequence Generator........................................................................................... 5-25
Overview of Synonyms ................................................................................................................... 5-27
Overview of Indexes......................................................................................................................... 5-28
Unique and Nonunique Indexes ............................................................................................. 5-29
Composite Indexes ..................................................................................................................... 5-30
Indexes and Keys ....................................................................................................................... 5-30
Indexes and Nulls ...................................................................................................................... 5-31
Function-Based Indexes............................................................................................................. 5-31

Uses of Function-Based Indexes ....................................................................................... 5-32
Optimization with Function-Based Indexes ................................................................... 5-32
Dependencies of Function-Based Indexes ...................................................................... 5-33
How Indexes Are Stored ........................................................................................................... 5-34
Format of Index Blocks ....................................................................................................... 5-34
The Internal Structure of Indexes...................................................................................... 5-35
Index Properties................................................................................................................... 5-36
Advantages of B-tree Structure ......................................................................................... 5-36
Index Unique Scan...................................................................................................................... 5-37
Index Range Scan........................................................................................................................ 5-37
Key Compression ....................................................................................................................... 5-37
Prefix and Suffix Entries .................................................................................................... 5-37
Performance and Storage Considerations ....................................................................... 5-38
Uses of Key Compression .................................................................................................. 5-38
xi
Reverse Key Indexes ................................................................................................................. 5-39
Bitmap Indexes ........................................................................................................................... 5-40
Benefits for Data Warehousing Applications ................................................................. 5-40
Cardinality............................................................................................................................ 5-41
Bitmap Index Example ....................................................................................................... 5-42
Bitmap Indexes and Nulls ................................................................................................. 5-43
Bitmap Indexes on Partitioned Tables.............................................................................. 5-43
Bitmap Join Indexes.................................................................................................................... 5-44
Overview of Index-Organized Tables........................................................................................... 5-44
Benefits of Index-Organized Tables ........................................................................................ 5-46
Index-Organized Tables with Row Overflow Area............................................................... 5-46
Secondary Indexes on Index-Organized Tables..................................................................... 5-47
Bitmap Indexes on Index-Organized Tables .......................................................................... 5-48
Mapping Table..................................................................................................................... 5-48
Partitioned Index-Organized Tables........................................................................................ 5-49

B-tree Indexes on UROWID Columns for Heap- and Index-Organized Tables ............... 5-49
Index-Organized Table Applications ...................................................................................... 5-49
Overview of Application Domain Indexes.................................................................................. 5-50
Overview of Clusters ....................................................................................................................... 5-50
Overview of Hash Clusters............................................................................................................. 5-52
6 Dependencies Among Schema Objects
Introduction to Dependency Issues ................................................................................................ 6-1
Resolution of Schema Object Dependencies ................................................................................ 6-4
Compilation of Views and PL/SQL Program Units .............................................................. 6-4
Views and Base Tables.......................................................................................................... 6-5
Program Units and Referenced Objects ............................................................................. 6-5
Data Warehousing Considerations..................................................................................... 6-6
Session State and Referenced Packages ............................................................................. 6-6
Security Authorizations........................................................................................................ 6-7
Object Name Resolution ................................................................................................................... 6-7
Shared SQL Dependency Management ......................................................................................... 6-8
Local and Remote Dependency Management............................................................................... 6-8
Management of Local Dependencies......................................................................................... 6-8
Management of Remote Dependencies..................................................................................... 6-9
xii
Dependencies Among Local and Remote Database Procedures.................................... 6-9
Dependencies Among Other Remote Schema Objects ................................................. 6-11
Dependencies of Applications .......................................................................................... 6-11
7 The Data Dictionary
Introduction to the Data Dictionary ............................................................................................... 7-1
Structure of the Data Dictionary ................................................................................................ 7-2
Base Tables.............................................................................................................................. 7-2
User-Accessible Views.......................................................................................................... 7-2
SYS, Owner of the Data Dictionary ........................................................................................... 7-2
How the Data Dictionary Is Used ................................................................................................... 7-3

How Oracle Uses the Data Dictionary ...................................................................................... 7-3
Public Synonyms for Data Dictionary Views.................................................................... 7-3
Cache the Data Dictionary for Fast Access ........................................................................ 7-4
Other Programs and the Data Dictionary.......................................................................... 7-4
How to Use the Data Dictionary ............................................................................................... 7-4
Views with the Prefix USER................................................................................................. 7-5
Views with the Prefix ALL................................................................................................... 7-5
Views with the Prefix DBA .................................................................................................. 7-5
The DUAL Table.................................................................................................................... 7-6
Dynamic Performance Tables .......................................................................................................... 7-6
Database Object Metadata ................................................................................................................ 7-7
8 Memory Architecture
Introduction to Oracle Memory Structures ................................................................................... 8-1
Overview of the System Global Area ............................................................................................. 8-2
The SGA_MAX_SIZE Initialization Parameter ........................................................................ 8-4
Automatic Shared Memory Management................................................................................. 8-5
The SGA_TARGET Initialization Parameter ..................................................................... 8-6
Automatically Managed SGA Components ...................................................................... 8-6
Manually Managed SGA Components .............................................................................. 8-7
Persistence of Automatically Tuned Values...................................................................... 8-8
Adding Granules and Tracking Component Size.................................................................... 8-8
Database Buffer Cache ................................................................................................................. 8-9
Organization of the Database Buffer Cache ...................................................................... 8-9
xiii
The LRU Algorithm and Full Table Scans ...................................................................... 8-10
Size of the Database Buffer Cache..................................................................................... 8-10
Multiple Buffer Pools ......................................................................................................... 8-12
Redo Log Buffer ......................................................................................................................... 8-13
Shared Pool ................................................................................................................................. 8-13
Library Cache....................................................................................................................... 8-13

Shared SQL Areas and Private SQL Areas ...................................................................... 8-14
PL/SQL Program Units and the Shared Pool ................................................................. 8-14
Dictionary Cache ................................................................................................................. 8-15
Allocation and Reuse of Memory in the Shared Pool.................................................... 8-15
Large Pool.................................................................................................................................... 8-17
Java Pool....................................................................................................................................... 8-17
Streams Pool................................................................................................................................ 8-18
Control of the SGA’s Use of Memory...................................................................................... 8-18
Other SGA Initialization Parameters....................................................................................... 8-18
Physical Memory ................................................................................................................ 8-18
SGA Starting Address ........................................................................................................ 8-19
Extended Buffer Cache Mechanism ................................................................................. 8-19
Overview of the Program Global Areas....................................................................................... 8-19
Content of the PGA ................................................................................................................... 8-19
Private SQL Area................................................................................................................. 8-20
Session Memory................................................................................................................... 8-21
SQL Work Areas ......................................................................................................................... 8-21
PGA Memory Management for Dedicated Mode ................................................................. 8-22
Dedicated and Shared Servers ....................................................................................................... 8-23
Software Code Areas ....................................................................................................................... 8-24
9 Process Architecture
Introduction to Processes ................................................................................................................. 9-1
Multiple-Process Oracle Systems .............................................................................................. 9-2
Types of Processes ....................................................................................................................... 9-2
Overview of User Processes.............................................................................................................. 9-4
Connections and Sessions ........................................................................................................... 9-4
Overview of Oracle Processes .......................................................................................................... 9-4
Server Processes............................................................................................................................ 9-4
xiv
Background Processes.................................................................................................................. 9-5

Database Writer Process (DBWn) ....................................................................................... 9-8
Log Writer Process (LGWR) ................................................................................................ 9-9
Checkpoint Process (CKPT) .............................................................................................. 9-11
System Monitor Process (SMON) ..................................................................................... 9-11
Process Monitor Process (PMON) .................................................................................... 9-12
Recoverer Process (RECO) ................................................................................................ 9-12
Job Queue Processes............................................................................................................ 9-12
Archiver Processes (ARCn) ............................................................................................... 9-13
Queue Monitor Processes (QMNn) .................................................................................. 9-14
Other Background Processes ............................................................................................. 9-14
Trace Files and the Alert Log ................................................................................................... 9-15
Shared Server Architecture ............................................................................................................ 9-16
Dispatcher Request and Response Queues ............................................................................ 9-17
Dispatcher Processes (Dnnn).............................................................................................. 9-20
Shared Server Processes (Snnn)......................................................................................... 9-20
Restricted Operations of the Shared Server ........................................................................... 9-21
Dedicated Server Configuration .................................................................................................... 9-22
The Program Interface ..................................................................................................................... 9-23
Program Interface Structure ..................................................................................................... 9-24
Program Interface Drivers ........................................................................................................ 9-24
Communications Software for the Operating System .......................................................... 9-25
10 Application Architecture
Introduction to Client/Server Architecture.................................................................................. 10-1
Overview of Multitier Architecture ............................................................................................. 10-5
Clients........................................................................................................................................... 10-6
Application Servers .................................................................................................................... 10-6
Database Servers......................................................................................................................... 10-6
Overview of Oracle Net Services................................................................................................... 10-6
How Oracle Net Services Works .............................................................................................. 10-7
The Listener ................................................................................................................................ 10-8

Service Information Registration....................................................................................... 10-8
xv
11 Oracle Utilities
Introduction to Oracle Utilities ..................................................................................................... 11-1
Overview of Data Pump Export and Import ............................................................................... 11-2
Data Pump Export...................................................................................................................... 11-2
Data Pump Import...................................................................................................................... 11-2
Overview of the Data Pump API................................................................................................... 11-3
Overview of the Metadata API....................................................................................................... 11-3
Overview of SQL*Loader................................................................................................................ 11-4
Overview of External Tables........................................................................................................... 11-4
Overview of LogMiner .................................................................................................................... 11-5
Overview of DBVERIFY Utility..................................................................................................... 11-6
Overview of DBNEWID Utility..................................................................................................... 11-6
12 Database and Instance Startup and Shutdown
Introduction to an Oracle Instance ............................................................................................... 12-1
The Instance and the Database ................................................................................................ 12-2
Connection with Administrator Privileges ............................................................................ 12-3
Initialization Parameter Files and Server Parameter Files.................................................... 12-3
How Parameter Values Are Changed.............................................................................. 12-4
Overview of Instance and Database Startup .............................................................................. 12-5
How an Instance Is Started........................................................................................................ 12-5
Restricted Mode of Instance Startup ................................................................................ 12-6
Forced Startup in Abnormal Situations ........................................................................... 12-6
How a Database Is Mounted..................................................................................................... 12-6
How a Database Is Mounted with Real Application Clusters...................................... 12-6
How a Standby Database Is Mounted.............................................................................. 12-7
How a Clone Database Is Mounted.................................................................................. 12-7
What Happens When You Open a Database.......................................................................... 12-8
Instance Recovery................................................................................................................ 12-8

Undo Space Acquisition and Management..................................................................... 12-8
Resolution of In-Doubt Distributed Transaction............................................................ 12-8
Open a Database in Read-Only Mode ............................................................................. 12-9
Overview of Database and Instance Shutdown ......................................................................... 12-9
Close a Database ...................................................................................................................... 12-10
Close the Database by Terminating the Instance.......................................................... 12-10
xvi
Unmount a Database ............................................................................................................... 12-10
Shut Down an Instance ........................................................................................................... 12-10
Abnormal Instance Shutdown......................................................................................... 12-10
Part III Oracle Database Features
13 Data Concurrency and Consistency
Introduction to Data Concurrency and Consistency in a Multiuser Environment.............. 13-1
Preventable Phenomena and Transaction Isolation Levels ................................................. 13-2
Overview of Locking Mechanisms........................................................................................... 13-3
How Oracle Manages Data Concurrency and Consistency...................................................... 13-3
Multiversion Concurrency Control ......................................................................................... 13-4
Statement-Level Read Consistency ......................................................................................... 13-5
Transaction-Level Read Consistency ...................................................................................... 13-6
Read Consistency with Real Application Clusters ................................................................ 13-6
Oracle Isolation Levels .............................................................................................................. 13-6
Set the Isolation Level ........................................................................................................ 13-7
Read Committed Isolation ................................................................................................. 13-8
Serializable Isolation ........................................................................................................... 13-8
Comparison of Read Committed and Serializable Isolation ............................................... 13-9
Transaction Set Consistency............................................................................................. 13-10
Row-Level Locking............................................................................................................ 13-11
Referential Integrity .......................................................................................................... 13-11
Distributed Transactions .................................................................................................. 13-12
Choice of Isolation Level ......................................................................................................... 13-12

Read Committed Isolation ............................................................................................... 13-12
Serializable Isolation ......................................................................................................... 13-13
Quiesce Database............................................................................................................... 13-15
How Oracle Locks Data ................................................................................................................. 13-17
Transactions and Data Concurrency ..................................................................................... 13-17
Modes of Locking .............................................................................................................. 13-17
Lock Duration .................................................................................................................... 13-18
Data Lock Conversion Versus Lock Escalation............................................................. 13-18
Deadlocks .................................................................................................................................. 13-19
Deadlock Detection ........................................................................................................... 13-19
xvii
Avoid Deadlocks ............................................................................................................... 13-20
Types of Locks .......................................................................................................................... 13-20
DML Locks ............................................................................................................................... 13-21
Row Locks (TX).................................................................................................................. 13-21
Table Locks (TM)............................................................................................................... 13-22
DML Locks Automatically Acquired for DML Statements ........................................ 13-26
DDL Locks ................................................................................................................................. 13-29
Exclusive DDL Locks........................................................................................................ 13-29
Share DDL Locks............................................................................................................... 13-29
Breakable Parse Locks....................................................................................................... 13-30
Duration of DDL Locks .................................................................................................... 13-30
DDL Locks and Clusters................................................................................................... 13-30
Latches and Internal Locks ..................................................................................................... 13-30
Latches ................................................................................................................................ 13-31
Internal Locks..................................................................................................................... 13-31
Explicit (Manual) Data Locking ............................................................................................. 13-31
Oracle Lock Management Services ........................................................................................ 13-32
Overview of Oracle Flashback Query......................................................................................... 13-33
Flashback Query Benefits ........................................................................................................ 13-34

Some Uses of Flashback Query............................................................................................... 13-36
14 Manageability
Installing Oracle and Getting Started........................................................................................... 14-2
Simplified Database Creation ................................................................................................... 14-2
Instant Client............................................................................................................................... 14-2
Automated Upgrades................................................................................................................. 14-3
Basic Initialization Parameters ................................................................................................. 14-3
Data Loading, Transfer, and Archiving .................................................................................. 14-3
Intelligent Infrastructure................................................................................................................. 14-4
Automatic Workload Repository ............................................................................................. 14-4
Automatic Maintenance Tasks ................................................................................................. 14-5
Server-Generated Alerts ............................................................................................................ 14-5
Advisor Framework ................................................................................................................... 14-6
Performance Diagnostic and Troubleshooting ........................................................................... 14-6
Application and SQL Tuning ......................................................................................................... 14-7
xviii
Memory Management...................................................................................................................... 14-9
Space Management......................................................................................................................... 14-12
Automatic Undo Management ............................................................................................... 14-12
Oracle-Managed Files............................................................................................................... 14-13
Free Space Management .......................................................................................................... 14-13
Proactive Space Management ................................................................................................. 14-13
Intelligent Capacity Planning ................................................................................................. 14-14
Transparent Space Reclamation ............................................................................................. 14-14
Storage Management...................................................................................................................... 14-15
Backup and Recovery..................................................................................................................... 14-16
Recovery Manager.................................................................................................................... 14-16
Mean Time to Recovery ........................................................................................................... 14-17
Self Service Error Correction................................................................................................... 14-18
Configuration Management.......................................................................................................... 14-19

Workload Management.................................................................................................................. 14-19
Overview of the Database Resource Manager ..................................................................... 14-19
Database Resource Manager Concepts .......................................................................... 14-21
Overview of Services................................................................................................................ 14-21
Workload Management with Services ........................................................................... 14-22
High Availability with Services....................................................................................... 14-23
Automatic Storage Management.................................................................................................. 14-25
Basic Automatic Storage Management Concepts ............................................................... 14-26
Disk Groups........................................................................................................................ 14-26
Automatic Storage Management Files............................................................................ 14-27
Automatic Storage Management Templates ................................................................. 14-27
Automatic Storage Management Disks.......................................................................... 14-28
Failure Groups ................................................................................................................... 14-29
Automatic Storage Management Instances ................................................................... 14-29
Benefits of Using Automatic Storage Management............................................................. 14-30
Job Scheduler................................................................................................................................... 14-31
What Can the Scheduler Do? .................................................................................................. 14-31
Schedule Job Execution Based on Time.......................................................................... 14-32
Reuse Scheduler Objects................................................................................................... 14-32
Schedule Job Processing that Models Business Requirements ................................... 14-32
Manage and Monitor Jobs ................................................................................................ 14-33
xix
Execute and Manage Jobs in a Clustered Environment .............................................. 14-33
Transfer Files...................................................................................................................... 14-33
Basic Scheduler Concepts........................................................................................................ 14-33
Programs............................................................................................................................. 14-34
Schedules ............................................................................................................................ 14-34
Jobs ...................................................................................................................................... 14-34
Advanced Scheduler Concepts............................................................................................... 14-34
Job Classes .......................................................................................................................... 14-34

Windows............................................................................................................................. 14-34
15 Backup and Recovery
Introduction to Backup.................................................................................................................... 15-1
Consistent and Inconsistent Backups ...................................................................................... 15-2
Overview of Consistent Backups ...................................................................................... 15-3
Overview of Inconsistent Backups ................................................................................... 15-3
Whole Database and Partial Database Backups..................................................................... 15-4
Whole Database Backups ................................................................................................... 15-5
Tablespace Backups ............................................................................................................ 15-5
Datafile Backups.................................................................................................................. 15-6
RMAN and User-Managed Backups ....................................................................................... 15-6
RMAN with Online Backups............................................................................................. 15-6
Control File Backups........................................................................................................... 15-7
Archived Redo Log Backups ............................................................................................. 15-8
Introduction to Recovery................................................................................................................. 15-8
Overview of Media Recovery ................................................................................................. 15-10
Complete Recovery ........................................................................................................... 15-10
Incomplete Recovery......................................................................................................... 15-11
Datafile Media Recovery .................................................................................................. 15-13
Block Media Recovery ...................................................................................................... 15-14
Overview of RMAN and User-Managed Restore and Recovery ...................................... 15-14
RMAN Restore and Recovery ......................................................................................... 15-15
User-Managed Restore and Recovery............................................................................ 15-15
Recovery Using Oracle Flashback Technology.................................................................... 15-16
Overview of Oracle Flashback Database ....................................................................... 15-16
Overview of Oracle Flashback Table.............................................................................. 15-17
xx
Other Types of Oracle Recovery............................................................................................. 15-18
Overview of Redo Application........................................................................................ 15-18
Overview of Instance and Crash Recovery.................................................................... 15-20

Deciding Which Recovery Technique to Use ............................................................................ 15-21
When to Use Media Recovery................................................................................................. 15-21
When to Use Oracle Flashback ............................................................................................... 15-22
When to Use CREATE TABLE AS SELECT Recovery ........................................................ 15-23
When to Use Import/Export Utilities Recovery .................................................................. 15-23
When to Use Tablespace Point-in-Time Recovery............................................................... 15-24
Flash Recovery Area ....................................................................................................................... 15-24
Flash Recovery Area Disk Limit............................................................................................. 15-24
16 Business Intelligence
Introduction to Data Warehousing and Business Intelligence ................................................ 16-1
Characteristics of Data Warehousing ...................................................................................... 16-2
Subject Oriented................................................................................................................... 16-2
Integrated.............................................................................................................................. 16-2
Nonvolatile ........................................................................................................................... 16-2
Time Variant......................................................................................................................... 16-2
Differences Between Data Warehouse and OLTP Systems.................................................. 16-3
Workload .............................................................................................................................. 16-3
Data Modifications .............................................................................................................. 16-3
Schema Design..................................................................................................................... 16-3
Typical Operations .............................................................................................................. 16-3
Historical Data ..................................................................................................................... 16-4
Data Warehouse Architecture................................................................................................... 16-4
Data Warehouse Architecture (Basic)............................................................................... 16-4
Data Warehouse Architecture (with a Staging Area)..................................................... 16-5
Data Warehouse Architecture (with a Staging Area and Data Marts) ........................ 16-6
Overview of Extraction, Transformation, and Loading (ETL).................................................. 16-7
Transportable Tablespaces ........................................................................................................ 16-8
Table Functions ........................................................................................................................... 16-9
External Tables............................................................................................................................ 16-9
Table Compression................................................................................................................... 16-10

Change Data Capture............................................................................................................... 16-11
xxi
Overview of Materialized Views for Data Warehouses.......................................................... 16-11
Overview of Bitmap Indexes in Data Warehousing ................................................................ 16-12
Overview of Parallel Execution.................................................................................................... 16-13
How Parallel Execution Works............................................................................................... 16-14
Overview of Analytic SQL............................................................................................................ 16-15
SQL for Aggregation................................................................................................................ 16-16
SQL for Analysis....................................................................................................................... 16-17
SQL for Modeling ..................................................................................................................... 16-17
Overview of OLAP Capabilities.................................................................................................. 16-18
Benefits of OLAP and RDBMS Integration........................................................................... 16-18
Scalability............................................................................................................................ 16-19
Availability......................................................................................................................... 16-19
Manageability .................................................................................................................... 16-19
Backup and Recovery ....................................................................................................... 16-19
Security ............................................................................................................................... 16-20
Overview of Data Mining............................................................................................................. 16-20
17 High Availability
Introduction to High Availability.................................................................................................. 17-1
Overview of Unplanned Downtime ............................................................................................. 17-1
Oracle Solutions to System Failures......................................................................................... 17-2
Overview of Fast-Start Fault Recovery ........................................................................... 17-2
Overview of Real Application Clusters ........................................................................... 17-3
Oracle Solutions to Data Failures............................................................................................. 17-3
Overview of Backup and Recovery Features for High Availability ............................ 17-3
Overview of Partitioning ................................................................................................... 17-5
Overview of Transparent Application Failover.............................................................. 17-5
Oracle Solutions to Disasters .................................................................................................... 17-6
Overview of Oracle Data Guard ....................................................................................... 17-6

Oracle Solutions to Human Errors........................................................................................... 17-8
Overview of Oracle Flashback Features........................................................................... 17-8
Overview of LogMiner ....................................................................................................... 17-9
Overview of Security Features for High Availability .................................................... 17-9
Overview of Planned Downtime................................................................................................. 17-10
System Maintenance ................................................................................................................ 17-10
xxii
Data Maintenance..................................................................................................................... 17-10
Database Maintenance ............................................................................................................. 17-11
18 Partitioned Tables and Indexes
Introduction to Partitioning............................................................................................................ 18-1
Partition Key................................................................................................................................ 18-3
Partitioned Tables....................................................................................................................... 18-3
Partitioned Index-Organized Tables........................................................................................ 18-4
Overview of Partitioning Methods................................................................................................ 18-4
Range Partitioning...................................................................................................................... 18-6
Range Partitioning Example .............................................................................................. 18-6
List Partitioning........................................................................................................................... 18-6
List Partitioning Example................................................................................................... 18-7
Hash Partitioning........................................................................................................................ 18-8
Hash Partitioning Example................................................................................................ 18-8
Composite Partitioning.............................................................................................................. 18-8
Composite Partitioning Range-Hash Example ............................................................... 18-9
Composite Partitioning Range-List Example ................................................................ 18-10
When to Partition a Table........................................................................................................ 18-11
Overview of Partitioned Indexes................................................................................................. 18-11
Local Partitioned Indexes ........................................................................................................ 18-12
Global Partitioned Indexes...................................................................................................... 18-13
Global Range Partitioned Indexes................................................................................... 18-13
Global Hash Partitioned Indexes .................................................................................... 18-14

Maintenance of Global Partitioned Indexes .................................................................. 18-14
Global Nonpartitioned Indexes .............................................................................................. 18-15
Miscellaneous Information about Creating Indexes on Partitioned Tables..................... 18-16
Using Partitioned Indexes in OLTP Applications................................................................ 18-16
Using Partitioned Indexes in Data Warehousing and DSS Applications......................... 18-16
Partitioned Indexes on Composite Partitions....................................................................... 18-16
Partitioning to Improve Performance ......................................................................................... 18-17
Partition Pruning ...................................................................................................................... 18-17
Partition Pruning Example............................................................................................... 18-18
Partition-wise Joins................................................................................................................... 18-18
Parallel DML.............................................................................................................................. 18-18
xxiii
19 Content Management
Introduction to Content Management.......................................................................................... 19-1
Overview of XML in Oracle............................................................................................................ 19-2
Overview of LOBs ............................................................................................................................ 19-3
Overview of Oracle Text.................................................................................................................. 19-4
Oracle Text Index Types............................................................................................................ 19-4
Oracle Text Document Services................................................................................................ 19-5
Oracle Text Query Package....................................................................................................... 19-5
Oracle Text Advanced Features ............................................................................................... 19-5
Overview of Oracle Ultra Search................................................................................................... 19-6
Overview of Oracle interMedia ..................................................................................................... 19-7
Overview of Oracle Spatial............................................................................................................. 19-7
20 Database Security
Introduction to Database Security................................................................................................. 20-1
Database Users and Schemas.................................................................................................... 20-2
Security Domain ................................................................................................................. 20-2
Privileges...................................................................................................................................... 20-2
Roles ............................................................................................................................................. 20-2

Storage Settings and Quotas ..................................................................................................... 20-2
Default Tablespace ............................................................................................................. 20-3
Temporary Tablespace ...................................................................................................... 20-3
Tablespace Quotas............................................................................................................... 20-3
Profiles and Resource Limits ............................................................................................. 20-3
Overview of Authentication Methods ......................................................................................... 20-4
Authentication by the Operating System ............................................................................... 20-4
Authentication by the Network ............................................................................................... 20-5
Third Party-Based Authentication Technologies............................................................ 20-5
Public-Key-Infrastructure-Based Authentication........................................................... 20-5
Remote Authentication....................................................................................................... 20-6
Authentication by the Oracle Database .................................................................................. 20-6
Password Encryption While Connecting......................................................................... 20-7
Account Locking ................................................................................................................. 20-7
Password Lifetime and Expiration .................................................................................. 20-7
Password Complexity Verification .................................................................................. 20-7
xxiv
Multitier Authentication and Authorization ......................................................................... 20-8
Authentication by the Secure Socket Layer Protocol............................................................. 20-8
Authentication of Database Administrators .......................................................................... 20-9
Overview of Authorization .......................................................................................................... 20-10
User Resource Limits and Profiles ......................................................................................... 20-10
Types of System Resources and Limits ......................................................................... 20-11
Profiles ................................................................................................................................ 20-13
Introduction to Privileges........................................................................................................ 20-13
System Privileges............................................................................................................... 20-14
Schema Object Privileges.................................................................................................. 20-14
Introduction to Roles................................................................................................................ 20-15
Common Uses for Roles .................................................................................................. 20-16
Role Mechanisms............................................................................................................... 20-17

The Operating System and Roles ................................................................................... 20-18
Secure Application Roles......................................................................................................... 20-18
Overview of Access Restrictions on Tables, Views, Synonyms, or Rows............................ 20-19
Fine-Grained Access Control .................................................................................................. 20-19
Dynamic Predicates .......................................................................................................... 20-20
Application Context ................................................................................................................. 20-20
Dynamic Contexts ............................................................................................................. 20-21
Fine-Grained Auditing............................................................................................................. 20-21
Overview of Security Policies ..................................................................................................... 20-22
System Security Policy ............................................................................................................. 20-22
Database User Management ............................................................................................ 20-22
User Authentication .......................................................................................................... 20-23
Operating System Security............................................................................................... 20-23
Data Security Policy ................................................................................................................. 20-23
User Security Policy.................................................................................................................. 20-24
General User Security ....................................................................................................... 20-24
End-User Security.............................................................................................................. 20-25
Administrator Security ..................................................................................................... 20-25
Application Developer Security ...................................................................................... 20-26
Application Administrator Security ............................................................................... 20-27
Password Management Policy................................................................................................ 20-27
Auditing Policy ......................................................................................................................... 20-27
xxv
Overview of Database Auditing.................................................................................................. 20-27
Types and Records of Auditing.............................................................................................. 20-28
Audit Records and the Audit Trails ............................................................................... 20-29
21 Data Integrity
Introduction to Data Integrity........................................................................................................ 21-1
Types of Data Integrity ............................................................................................................. 21-2
Null Rule............................................................................................................................... 21-2

Unique Column Values ...................................................................................................... 21-2
Primary Key Values ............................................................................................................ 21-3
Referential Integrity Rules ................................................................................................. 21-3
Complex Integrity Checking.............................................................................................. 21-3
How Oracle Enforces Data Integrity ....................................................................................... 21-3
Integrity Constraints Description ..................................................................................... 21-4
Database Triggers................................................................................................................ 21-4
Overview of Integrity Constraints ................................................................................................ 21-4
Advantages of Integrity Constraints ...................................................................................... 21-5
Declarative Ease................................................................................................................... 21-5
Centralized Rules ................................................................................................................ 21-5
Maximum Application Development Productivity ....................................................... 21-6
Immediate User Feedback.................................................................................................. 21-6
Superior Performance......................................................................................................... 21-6
Flexibility for Data Loads and Identification of Integrity Violations .......................... 21-6
The Performance Cost of Integrity Constraints .................................................................... 21-7
Types of Integrity Constraints........................................................................................................ 21-7
NOT NULL Integrity Constraints ........................................................................................... 21-7
UNIQUE Key Integrity Constraints ........................................................................................ 21-8
Unique Keys......................................................................................................................... 21-8
UNIQUE Key Constraints and Indexes ........................................................................... 21-9
Combine UNIQUE Key and NOT NULL Integrity Constraints ................................ 21-10
PRIMARY KEY Integrity Constraints ................................................................................... 21-10
Primary Keys...................................................................................................................... 21-11
PRIMARY KEY Constraints and Indexes ...................................................................... 21-11
Referential Integrity Constraints ........................................................................................... 21-12
Self-Referential Integrity Constraints............................................................................. 21-14

×