Oracle8
Concepts
Release 8.0
December, 1997
Part No. A58227-01
Oracle8 Concepts
Part No. A58227-01
Release 8.0
Copyright © 1997 Oracle Corporation. All rights reserved.
Primary Author: Lefty Leverenz
Contributors: Richard Allen, David Anderson, Andre Bakker, Steve Bobrowski, Bill Bridge, Atif
Chaudry, Cynthia Chin-Lee, Cindy Closkey, Jeff Cohen, Benoit Dageville, Sandy Dreskin, Jason Durbin,
Ahmed Ezzat, Diana Foch-Lorentz, John Frazzini, Anurag Gupta, Gary Hallmark, Michael Hartstein,
Terry Hayes, Alex Ho, Chin Hong, Ken Jacobs, Sandeep Jain, Amit Jasuja, Hakan Jakobsson, Robert
Jenkins, Jr., Ashok Joshi, Jonathan Klein, R. Kleinro, Robert Kooi, Vishu Krishnamurthy, Andre Kruglikov,
Tirthankar Lahiri, Juan Loaiza, Brom Mahbod, Richard Mateosian, William Maimone, Andrew Mendel-
sohn, Reza Monajjemi, Mark Moore, Rita Moran, Denise Oertel, Mark Porter, Maria Pratt, Tuomas
Pystynen, Patrick Ritto, Hasan Rizvi, Sriram Samu, Hari Sankar, Gordon Smith, Danny Sokolsky, Leng
Leng Tan, Lynne Thieme, Alvin To, Alex Tsukerman, William Waddington, Joyo Wijaya, Linda Willis,
Andrew Witkowski, Mohamed Zait
Graphic Designer: Valarie Moore
The programs are not intended for use in any nuclear, aviation, mass transit, medical, or other inher-
ently dangerous applications. It shall be licensee's responsibility to take all appropriate fail-safe, back
up, redundancy and other measures to ensure the safe use of such applications if the Programs are
used for such purposes, and Oracle disclaims liability for any damages caused by such use of the Pro-
grams.
This Program contains proprietary information of Oracle Corporation; it is provided under a license
agreement containing restrictions on use and disclosure and is also protected by copyright patent and
other intellectual property law. Reverse engineering of the software 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.
If this Program is delivered to a U.S. Government Agency of the Department of Defense, then it is deliv-
ered with Restricted Rights and the following legend is applicable:
Restricted Rights Legend Programs delivered subject to the DOD FAR Supplement are 'commercial
computer software' and use, duplication and disclosure of the Programs 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 disclo-
sure of the Programs shall be subject to the restrictions in FAR 52..227-14, Rights in Data -- General,
including Alternate III (June 1987). Oracle Corporation, 500 Oracle Parkway, Redwood City, CA 94065.
Oracle SQL*Loader, SQL*Net and SQL*Plus are registered trademarks of Oracle Corporation, Redwood
City, California.
Net8, Oracle Call Interface, Oracle7, Oracle8, Oracle Forms, Oracle Enterprise Manager, Oracle Parallel
Server, Oracle Server Manager, PL/SQL, Pro*C, Pro*C/C++, and Trusted Oracle are trademarks of Oracle
Corporation, Redwood City, California.
All other products or company names are used for identification purposes only, and may be trademarks
of their respective owners.
iii
Contents
Send Us Your Comments
............................................................................................................... xxiii
Preface
......................................................................................................................................................... xxv
Part I What Is Oracle?
1 Introduction to the Oracle Server
Databases and Information Management...................................................................................... 1-2
The Oracle Server ......................................................................................................................... 1-4
Oracle Databases........................................................................................................................... 1-8
Database Structure and Space Management................................................................................. 1-8
Logical Database Structures........................................................................................................ 1-8
Physical Database Structures.................................................................................................... 1-11
Memory Structure and Processes................................................................................................... 1-13
Memory Structures..................................................................................................................... 1-13
Process Architecture................................................................................................................... 1-16
The Program Interface ............................................................................................................... 1-19
An Example of How Oracle Works.......................................................................................... 1-19
Data Concurrency and Consistency .............................................................................................. 1-20
Concurrency ................................................................................................................................ 1-20
Read Consistency........................................................................................................................ 1-21
Locking Mechanisms.................................................................................................................. 1-22
Distributed Processing and Distributed Databases................................................................... 1-23
Client/Server Architecture: Distributed Processing ............................................................. 1-23
iv
Distributed Databases ................................................................................................................ 1-24
Table Replication ........................................................................................................................ 1-26
Oracle and Net8 .......................................................................................................................... 1-26
Startup and Shutdown Operations................................................................................................ 1-27
Database Security.............................................................................................................................. 1-27
Security Mechanisms.................................................................................................................. 1-28
Trusted Oracle............................................................................................................................. 1-34
Database Backup and Recovery..................................................................................................... 1-34
Why Is Recovery Important? .................................................................................................... 1-34
Types of Failures......................................................................................................................... 1-35
Structures Used for Recovery ................................................................................................... 1-37
Basic Recovery Steps .................................................................................................................. 1-39
The Recovery Manager .............................................................................................................. 1-40
The Object-Relational Model for Database Management........................................................ 1-40
The Relational Model ................................................................................................................. 1-41
The Object-Relational Model..................................................................................................... 1-41
Schemas and Schema Objects.................................................................................................... 1-42
The Data Dictionary ................................................................................................................... 1-47
Data Access......................................................................................................................................... 1-48
SQL — The Structured Query Language ................................................................................ 1-48
Transactions................................................................................................................................. 1-49
PL/SQL ........................................................................................................................................ 1-52
Data Integrity............................................................................................................................... 1-54
Part II Database Structures
2 Data Blocks, Extents, and Segments
The Relationships Among Data Blocks, Extents, and Segments............................................... 2-2
Data Blocks........................................................................................................................................... 2-3
Data Block Format ........................................................................................................................ 2-3
An Introduction to PCTFREE, PCTUSED, and Row Chaining.............................................. 2-5
Extents ................................................................................................................................................. 2-10
When Extents Are Allocated..................................................................................................... 2-11
Determining the Number and Size of Extents........................................................................ 2-11
v
How Extents Are Allocated....................................................................................................... 2-11
When Extents Are Deallocated................................................................................................. 2-13
Segments............................................................................................................................................. 2-15
Data Segments............................................................................................................................. 2-15
Index Segments........................................................................................................................... 2-15
Temporary Segments ................................................................................................................. 2-16
Rollback Segments...................................................................................................................... 2-17
3 Tablespaces and Datafiles
An Introduction to Tablespaces and Datafiles .............................................................................. 3-2
Tablespaces........................................................................................................................................... 3-3
The SYSTEM Tablespace ............................................................................................................. 3-4
Allocating More Space for a Database....................................................................................... 3-4
Bringing Tablespaces Online and Offline ................................................................................. 3-7
Read-Only Tablespaces................................................................................................................ 3-9
Temporary Tablespaces............................................................................................................. 3-10
Datafiles .............................................................................................................................................. 3-11
Datafile Contents ........................................................................................................................ 3-12
Size of Datafiles........................................................................................................................... 3-12
Offline Datafiles.......................................................................................................................... 3-12
4 The Data Dictionary
An Introduction to the Data Dictionary ......................................................................................... 4-2
The Structure of the Data Dictionary.............................................................................................. 4-2
SYS, the Owner of the Data Dictionary.......................................................................................... 4-3
How the Data Dictionary Is Used.................................................................................................... 4-3
How Oracle Uses the Data Dictionary ...................................................................................... 4-3
How Oracle Users Can Use the Data Dictionary..................................................................... 4-5
The Dynamic Performance Tables................................................................................................... 4-7
vi
Part III The Oracle Instance
5 Database and Instance Startup and Shutdown
Overview of an Oracle Instance....................................................................................................... 5-2
The Instance and the Database ................................................................................................... 5-2
Connecting with Administrator Privileges............................................................................... 5-3
Parameter Files.............................................................................................................................. 5-4
Instance and Database Startup......................................................................................................... 5-5
Starting an Instance ...................................................................................................................... 5-5
Mounting a Database ................................................................................................................... 5-6
Opening a Database...................................................................................................................... 5-7
Database and Instance Shutdown ................................................................................................... 5-8
Closing a Database ....................................................................................................................... 5-8
Dismounting a Database.............................................................................................................. 5-8
Shutting Down an Instance ......................................................................................................... 5-9
6 Memory Structures
Introduction to Oracle Memory Structures.................................................................................... 6-2
System Global Area (SGA) ............................................................................................................... 6-2
The Database Buffer Cache.......................................................................................................... 6-3
The Redo Log Buffer..................................................................................................................... 6-6
The Shared Pool ............................................................................................................................ 6-6
Size of the SGA............................................................................................................................ 6-11
Controlling the SGA’s Use of Memory.................................................................................... 6-12
Program Global Areas (PGA) ......................................................................................................... 6-13
Contents of a PGA ...................................................................................................................... 6-13
Size of a PGA............................................................................................................................... 6-14
Sort Areas............................................................................................................................................ 6-15
Sort Direct Writes........................................................................................................................ 6-16
Virtual Memory................................................................................................................................. 6-16
Software Code Areas........................................................................................................................ 6-16
vii
7 Process Structure
Introduction to Processes .................................................................................................................. 7-2
Single-Process Oracle......................................................................................................................... 7-2
Multiple-Process Oracle .................................................................................................................... 7-3
User Processes............................................................................................................................... 7-4
Oracle Processes............................................................................................................................ 7-5
Trace Files and the ALERT File ................................................................................................ 7-14
Variations in Oracle Configuration ............................................................................................... 7-16
Single-Task Configuration ........................................................................................................ 7-16
Dedicated Server (Two-Task) Configuration ......................................................................... 7-18
The Multithreaded Server ......................................................................................................... 7-20
Examples of How Oracle Works .................................................................................................... 7-24
An Example of Oracle Using Dedicated Server Processes ................................................... 7-25
An Example of Oracle Using the Multithreaded Server....................................................... 7-26
The Program Interface ..................................................................................................................... 7-27
Program Interface Structure...................................................................................................... 7-27
The Program Interface Drivers ................................................................................................. 7-27
Operating System Communications Software....................................................................... 7-28
Part IV The Object-Relational DBMS
8 Schema Objects
Overview of Schema Objects ........................................................................................................... 8-2
Tables..................................................................................................................................................... 8-3
How Table Data Is Stored............................................................................................................ 8-4
Nulls ............................................................................................................................................... 8-7
Default Values for Columns........................................................................................................ 8-8
Nested Tables................................................................................................................................ 8-9
Views................................................................................................................................................... 8-10
Storage for Views........................................................................................................................ 8-11
How Views Are Used ................................................................................................................ 8-11
The Mechanics of Views ............................................................................................................ 8-12
Dependencies and Views .......................................................................................................... 8-13
viii
Updatable Join Views................................................................................................................. 8-13
Object Views................................................................................................................................ 8-14
The Sequence Generator ................................................................................................................. 8-14
Synonyms ........................................................................................................................................... 8-15
Indexes ................................................................................................................................................ 8-17
Unique and Non-Unique Indexes ............................................................................................ 8-17
Composite Indexes ..................................................................................................................... 8-18
Indexes and Keys........................................................................................................................ 8-19
How Indexes Are Stored............................................................................................................ 8-19
Reverse Key Indexes................................................................................................................... 8-22
Bitmap Indexes............................................................................................................................ 8-23
Index-Organized Tables................................................................................................................... 8-28
Benefits of Index-Organized Tables......................................................................................... 8-29
Index-Organized Tables with Row Overflow Area............................................................... 8-29
Applications of Interest for Index-Organized Tables............................................................ 8-30
Clusters ............................................................................................................................................... 8-32
Performance Considerations..................................................................................................... 8-34
Format of Clustered Data Blocks.............................................................................................. 8-34
The Cluster Key........................................................................................................................... 8-35
The Cluster Index........................................................................................................................ 8-35
Hash Clusters..................................................................................................................................... 8-36
How Data Is Stored in a Hash Cluster..................................................................................... 8-37
Hash Key Values......................................................................................................................... 8-39
Hash Functions............................................................................................................................ 8-40
Allocation of Space for a Hash Cluster.................................................................................... 8-41
9 Partitioned Tables and Indexes
Introduction to Partitioning.............................................................................................................. 9-2
What Is Partitioning?.................................................................................................................... 9-2
Advantages of Partitioning ............................................................................................................... 9-4
Very Large Databases (VLDBs) .................................................................................................. 9-4
Reducing Downtime for Scheduled Maintenance................................................................... 9-6
Reducing Downtime Due to Data Failures............................................................................... 9-7
DSS Performance .......................................................................................................................... 9-7
I/O Performance........................................................................................................................... 9-8
ix
Disk Striping: Performance versus Availability....................................................................... 9-8
Partition Transparency ................................................................................................................ 9-9
Manual Partitioning with Partition Views.............................................................................. 9-10
Basic Partitioning Model................................................................................................................. 9-11
Range Partitioning...................................................................................................................... 9-12
Partition Names .......................................................................................................................... 9-14
Partition Bounds and Partitioning Keys ................................................................................. 9-14
Equipartitioning.......................................................................................................................... 9-18
Rules for Partitioning Tables and Indexes................................................................................... 9-21
Table Partitioning ....................................................................................................................... 9-21
Index Partitioning....................................................................................................................... 9-22
DML Partition Locks........................................................................................................................ 9-30
Performance Considerations for Oracle Parallel Server ....................................................... 9-31
Maintenance Operations ................................................................................................................. 9-31
Partition Maintenance Operations ........................................................................................... 9-32
Managing Indexes ...................................................................................................................... 9-38
Privileges for Partitioned Tables and Indexes........................................................................ 9-41
Auditing for Partitioned Tables and Indexes ......................................................................... 9-42
SQL Extension: Partition-Extended Table Name........................................................................ 9-42
Examples of Partition-Extended Table Names....................................................................... 9-43
10 Built-In Datatypes
Oracle Datatypes............................................................................................................................... 10-2
Character Datatypes................................................................................................................... 10-2
NUMBER Datatype.................................................................................................................... 10-5
DATE Datatype........................................................................................................................... 10-7
LOB Datatypes ............................................................................................................................ 10-9
RAW and LONG RAW Datatypes......................................................................................... 10-11
ROWID Datatype...................................................................................................................... 10-12
MLSLABEL Datatype............................................................................................................... 10-16
Summary of Oracle Datatype Information ........................................................................... 10-17
ANSI, DB2, and SQL/DS Datatypes ........................................................................................... 10-19
Data Conversion.............................................................................................................................. 10-20
x
11 User-Defined Datatypes (Objects Option)
Introduction ....................................................................................................................................... 11-2
Complex Data Models................................................................................................................ 11-2
Multimedia Datatypes ............................................................................................................... 11-3
User-Defined Datatypes................................................................................................................... 11-3
Object Types ................................................................................................................................ 11-4
Collection Types.......................................................................................................................... 11-9
Application Interfaces.................................................................................................................... 11-11
SQL.............................................................................................................................................. 11-12
PL/SQL ...................................................................................................................................... 11-12
Pro*C/C++................................................................................................................................. 11-12
OCI.............................................................................................................................................. 11-13
OTT ............................................................................................................................................. 11-14
12 Using User-Defined Datatypes
References and Name Resolution.................................................................................................. 12-2
Table Aliases................................................................................................................................ 12-2
Method Calls without Arguments ........................................................................................... 12-3
Storage of User-Defined Types....................................................................................................... 12-4
Leaf-Level Attributes.................................................................................................................. 12-4
Row Objects ................................................................................................................................. 12-4
Column Objects........................................................................................................................... 12-5
REFs .............................................................................................................................................. 12-5
Nested Tables .............................................................................................................................. 12-5
VARRAYs .................................................................................................................................... 12-5
Properties of Object Attributes ...................................................................................................... 12-6
Nulls.............................................................................................................................................. 12-6
Defaults ........................................................................................................................................ 12-7
Constraints................................................................................................................................... 12-8
Indexes.......................................................................................................................................... 12-9
Triggers ........................................................................................................................................ 12-9
Privileges on User-Defined Types and Their Methods ........................................................... 12-10
System Privileges...................................................................................................................... 12-10
Schema Object Privileges......................................................................................................... 12-10
Using Types in New Types or Tables .................................................................................... 12-11
xi
Example...................................................................................................................................... 12-11
Privileges on Type Access and Object Access ...................................................................... 12-12
Dependencies and Incomplete Types......................................................................................... 12-13
Completing Incomplete Types ............................................................................................... 12-14
Type Dependencies of Tables ................................................................................................. 12-15
Import/Export of User-Defined Types......................................................................................... 12-15
13 Object Views
Introduction ....................................................................................................................................... 13-2
Advantages of Object Views..................................................................................................... 13-2
Defining Object Views..................................................................................................................... 13-2
Using Object Views.......................................................................................................................... 13-4
Updating Object Views ................................................................................................................... 13-4
Part V Data Access
14 SQL and PL/SQL
Structured Query Language (SQL)................................................................................................ 14-2
SQL Statements........................................................................................................................... 14-3
Identifying Nonstandard SQL.................................................................................................. 14-6
Recursive SQL............................................................................................................................. 14-6
Cursors ......................................................................................................................................... 14-6
Shared SQL.................................................................................................................................. 14-7
Parsing.......................................................................................................................................... 14-7
SQL Processing.................................................................................................................................. 14-8
Overview of SQL Statement Execution................................................................................... 14-8
DML Statement Processing ..................................................................................................... 14-10
DDL Statement Processing...................................................................................................... 14-14
Controlling Transactions ......................................................................................................... 14-14
PL/SQL.............................................................................................................................................. 14-15
How PL/SQL Executes............................................................................................................ 14-15
Language Constructs for PL/SQL ......................................................................................... 14-17
Stored Procedures..................................................................................................................... 14-18
External Procedures ................................................................................................................. 14-19
xii
15 Transaction Management
Introduction to Transactions........................................................................................................... 15-2
Statement Execution and Transaction Control....................................................................... 15-3
Statement-Level Rollback .......................................................................................................... 15-4
Oracle and Transaction Management............................................................................................ 15-4
Committing Transactions .......................................................................................................... 15-5
Rolling Back Transactions ......................................................................................................... 15-6
Savepoints.................................................................................................................................... 15-7
The Two-Phase Commit Mechanism....................................................................................... 15-7
Discrete Transaction Management ................................................................................................ 15-8
16 Advanced Queuing
Introduction to Message Queuing................................................................................................. 16-3
Synchronous Communication .................................................................................................. 16-3
Asynchronous Communication................................................................................................ 16-3
Oracle Advanced Queuing.............................................................................................................. 16-4
Queuing Entities ......................................................................................................................... 16-4
Features of Advanced Queuing................................................................................................ 16-6
17 Procedures and Packages
An Introduction to Stored Procedures and Packages................................................................. 17-2
Stored Procedures and Functions............................................................................................. 17-2
Packages....................................................................................................................................... 17-4
Procedures and Functions ............................................................................................................... 17-6
Procedure Guidelines................................................................................................................. 17-7
Benefits of Procedures................................................................................................................ 17-7
Anonymous PL/SQL Blocks vs. Stored Procedures ............................................................. 17-8
Standalone Procedures............................................................................................................... 17-9
Dependency Tracking for Stored Procedures......................................................................... 17-9
External Procedures.................................................................................................................... 17-9
Packages............................................................................................................................................ 17-10
Benefits of Packages ................................................................................................................. 17-13
Dependency Tracking for Packages....................................................................................... 17-14
xiii
How Oracle Stores Procedures and Packages ........................................................................... 17-15
Compiling Procedures and Packages .................................................................................... 17-15
Storing the Compiled Code in Memory................................................................................ 17-15
Storing Procedures or Packages in Database........................................................................ 17-15
How Oracle Executes Procedures and Packages....................................................................... 17-16
Verifying User Access.............................................................................................................. 17-16
Verifying Procedure Validity.................................................................................................. 17-16
Executing a Procedure ............................................................................................................. 17-17
18 Database Triggers
An Introduction to Triggers ............................................................................................................ 18-2
How Triggers Are Used............................................................................................................. 18-3
Some Cautionary Notes about Triggers.................................................................................. 18-3
Triggers vs. Declarative Integrity Constraints ....................................................................... 18-5
Parts of a Trigger ............................................................................................................................... 18-5
Triggering Event or Statement.................................................................................................. 18-6
Trigger Restriction...................................................................................................................... 18-7
Trigger Action ............................................................................................................................. 18-7
Types of Triggers............................................................................................................................... 18-7
Row Triggers and Statement Triggers..................................................................................... 18-7
BEFORE and AFTER Triggers .................................................................................................. 18-8
Trigger Combinations................................................................................................................ 18-9
INSTEAD OF Triggers............................................................................................................. 18-11
Trigger Execution ............................................................................................................................ 18-14
The Execution Model for Triggers and Integrity Constraint Checking............................ 18-14
Data Access for Triggers.......................................................................................................... 18-16
Storage of Triggers ................................................................................................................... 18-17
Execution of Triggers ............................................................................................................... 18-17
Dependency Maintenance for Triggers................................................................................. 18-18
19 Oracle Dependency Management
An Introduction to Dependency Issues........................................................................................ 19-2
Resolving Schema Object Dependencies .................................................................................... 19-4
Compiling Views and PL/SQL Program Units ..................................................................... 19-5
Dependency Management and Nonexistent Schema Objects................................................. 19-7
xiv
Shared SQL Dependency Management ....................................................................................... 19-8
Local and Remote Dependency Management............................................................................. 19-8
Managing Local Dependencies................................................................................................. 19-9
Managing Remote Dependencies............................................................................................. 19-9
20 The Optimizer
What Is Optimization?..................................................................................................................... 20-2
Execution Plans ........................................................................................................................... 20-2
Execution Order.......................................................................................................................... 20-5
Cost-Based and Rule-Based Optimization................................................................................... 20-6
The Cost-Based Approach......................................................................................................... 20-6
Overview of Optimizer Operations ............................................................................................ 20-12
Optimizer Operations .............................................................................................................. 20-12
Types of SQL Statements......................................................................................................... 20-13
Evaluation of Expressions and Conditions................................................................................ 20-14
Constants.................................................................................................................................... 20-14
LIKE Operator........................................................................................................................... 20-15
IN Operator................................................................................................................................ 20-15
ANY or SOME Operator.......................................................................................................... 20-15
ALL Operator ............................................................................................................................ 20-16
BETWEEN Operator................................................................................................................. 20-17
NOT Operator ........................................................................................................................... 20-17
Transitivity................................................................................................................................. 20-17
Transforming and Optimizing Statements ................................................................................ 20-19
Transforming ORs into Compound Queries ........................................................................ 20-19
Transforming Complex Statements into Join Statements................................................... 20-22
Optimizing Statements That Access Views .......................................................................... 20-24
Optimizing Compound Queries............................................................................................. 20-36
Optimizing Distributed Statements ....................................................................................... 20-39
Choosing an Optimization Approach and Goal....................................................................... 20-40
The OPTIMIZER_MODE Initialization Parameter.............................................................. 20-40
Statistics in the Data Dictionary.............................................................................................. 20-41
The OPTIMIZER_GOAL Parameter of the ALTER SESSION Command........................ 20-41
The FIRST_ROWS, ALL_ROWS, CHOOSE, and RULE Hints........................................... 20-42
PL/SQL and the Optimizer Goal ........................................................................................... 20-42
xv
Choosing Access Paths................................................................................................................... 20-42
Access Methods ........................................................................................................................ 20-43
Access Paths .............................................................................................................................. 20-45
Choosing Among Access Paths.............................................................................................. 20-58
Optimizing Join Statements ......................................................................................................... 20-63
Join Operations ......................................................................................................................... 20-63
Choosing Execution Plans for Join Statements .................................................................... 20-69
Views in Outer Joins................................................................................................................. 20-72
Optimizing Anti-Joins and Semi-Joins ...................................................................................... 20-74
Optimizing “Star” Queries ........................................................................................................... 20-75
Star Query Example ................................................................................................................. 20-75
Tuning Star Queries ................................................................................................................. 20-75
Star Transformation ................................................................................................................. 20-76
Part VI Parallel SQL and Direct-Load INSERT
21 Direct-Load INSERT
Introduction to Direct-Load INSERT............................................................................................ 21-2
Advantages of Direct-Load INSERT........................................................................................ 21-2
INSERT ... SELECT Statements................................................................................................. 21-3
Varieties of Direct-Load INSERT Statements ............................................................................. 21-3
Serial and Parallel INSERT........................................................................................................ 21-3
Logging Mode............................................................................................................................. 21-5
Additional Considerations for Direct-Load INSERT ................................................................ 21-8
Index Maintenance ..................................................................................................................... 21-8
Space Considerations ................................................................................................................. 21-8
Locking Considerations............................................................................................................. 21-9
Restrictions on Direct-Load INSERT............................................................................................ 21-9
22 Parallel Execution
Overview of Parallel Execution...................................................................................................... 22-2
Operations That Can Be Parallelized....................................................................................... 22-2
How Oracle Parallelizes Operations........................................................................................ 22-3
xvi
Process Architecture for Parallel Execution................................................................................. 22-5
The Parallel Server Pool............................................................................................................. 22-7
Parallelizing SQL Statements.................................................................................................... 22-9
Setting the Degree of Parallelism................................................................................................ 22-13
Determining the Degree of Parallelism for Operations ...................................................... 22-13
Balancing the Work Load ........................................................................................................ 22-16
Parallelization Rules for SQL Statements.............................................................................. 22-17
Parallel DDL .................................................................................................................................... 22-25
DDL Statements That Can Be Parallelized............................................................................ 22-25
CREATE TABLE ... AS SELECT in Parallel........................................................................... 22-26
Recoverability and Parallel DDL............................................................................................ 22-27
Space Management for Parallel DDL..................................................................................... 22-27
Parallel DML.................................................................................................................................... 22-29
Advantages of Parallel DML over Manual Parallelism ...................................................... 22-30
When to Use Parallel DML...................................................................................................... 22-31
Enabling Parallel DML............................................................................................................. 22-32
Transaction Model for Parallel DML ..................................................................................... 22-33
Recovery for Parallel DML...................................................................................................... 22-34
Space Considerations for Parallel DML ................................................................................ 22-35
Lock and Enqueue Resources for Parallel DML................................................................... 22-36
Restrictions on Parallel DML .................................................................................................. 22-37
Affinity.............................................................................................................................................. 22-40
Other Types of Parallelism............................................................................................................ 22-42
Part VII Data Protection
23 Data Concurrency and Consistency
Data Concurrency and Consistency in a Multiuser Environment .......................................... 23-2
Preventable Phenomena and Transaction Isolation Levels.................................................. 23-2
Locking Mechanisms.................................................................................................................. 23-3
How Oracle Manages Data Concurrency and Consistency...................................................... 23-4
Multiversion Concurrency Control.......................................................................................... 23-4
Statement-Level Read Consistency .......................................................................................... 23-5
Transaction-Level Read Consistency....................................................................................... 23-6
Oracle Isolation Levels............................................................................................................... 23-6
xvii
Setting the Isolation Level ......................................................................................................... 23-7
Comparing Read Committed and Serializable Isolation...................................................... 23-9
Choosing an Isolation Level.................................................................................................... 23-12
How Oracle Locks Data ................................................................................................................. 23-14
Transactions and Data Concurrency ..................................................................................... 23-15
Deadlocks................................................................................................................................... 23-16
Types of Locks........................................................................................................................... 23-18
DML (Data) Locks .................................................................................................................... 23-19
DDL Locks (Dictionary Locks) ............................................................................................... 23-26
Latches and Internal Locks...................................................................................................... 23-28
Explicit (Manual) Data Locking.............................................................................................. 23-29
Oracle Lock Management Services ........................................................................................ 23-40
24 Data Integrity
Definition of Data Integrity............................................................................................................ 24-2
Types of Data Integrity .............................................................................................................. 24-2
How Oracle Enforces Data Integrity........................................................................................ 24-4
An Introduction to Integrity Constraints..................................................................................... 24-5
Advantages of Integrity Constraints ....................................................................................... 24-5
The Performance Cost of Integrity Constraints ..................................................................... 24-7
Types of Integrity Constraints........................................................................................................ 24-7
NOT NULL Integrity Constraints............................................................................................ 24-7
UNIQUE Key Integrity Constraints......................................................................................... 24-8
PRIMARY KEY Integrity Constraints.................................................................................... 24-10
FOREIGN KEY (Referential) Integrity Constraints ............................................................. 24-12
CHECK Integrity Constraints................................................................................................. 24-16
The Mechanisms of Constraint Checking ................................................................................. 24-17
Default Column Values and Integrity Constraint Checking.............................................. 24-19
Deferred Constraint Checking..................................................................................................... 24-19
Constraint Attributes ............................................................................................................... 24-20
SET CONSTRAINTS Mode..................................................................................................... 24-20
Unique Constraints and Indexes............................................................................................ 24-21
Enabled, Disabled, and Enable Novalidate Constraints......................................................... 24-21
xviii
25 Controlling Database Access
Database Security.............................................................................................................................. 25-2
Schemas, Database Users, and Security Domains...................................................................... 25-2
User Authentication.......................................................................................................................... 25-3
Authentication by the Operating System................................................................................ 25-3
Authentication by the Network................................................................................................ 25-4
Authentication by the Oracle Database................................................................................... 25-4
Database Administrator Authentication................................................................................. 25-6
User Tablespace Settings and Quotas ........................................................................................... 25-8
Default Tablespace...................................................................................................................... 25-8
Temporary Tablespace............................................................................................................... 25-8
Tablespace Access and Quotas ................................................................................................. 25-8
The User Group PUBLIC................................................................................................................. 25-9
User Resource Limits and Profiles............................................................................................... 25-10
Types of System Resources and Limits ................................................................................. 25-10
Profiles........................................................................................................................................ 25-13
Licensing........................................................................................................................................... 25-14
Concurrent Usage Licensing................................................................................................... 25-14
Named User Licensing............................................................................................................. 25-15
26 Privileges and Roles
Privileges ............................................................................................................................................ 26-2
System Privileges........................................................................................................................ 26-2
Schema Object Privileges........................................................................................................... 26-3
Roles .................................................................................................................................................. 26-10
Common Uses for Roles........................................................................................................... 26-11
The Mechanisms of Roles ........................................................................................................ 26-13
Granting and Revoking Roles................................................................................................. 26-13
Who Can Grant or Revoke Roles?.......................................................................................... 26-13
Naming Roles ............................................................................................................................ 26-14
Security Domains of Roles and Users.................................................................................... 26-14
Named PL/SQL Blocks and Roles ......................................................................................... 26-14
Data Definition Language Statements and Roles................................................................. 26-14
Predefined Roles ....................................................................................................................... 26-16
xix
The Operating System and Roles ........................................................................................... 26-16
Roles in a Distributed Environment ...................................................................................... 26-16
27 Auditing
Introduction to Auditing................................................................................................................. 27-2
Auditing Features....................................................................................................................... 27-2
Auditing Mechanisms................................................................................................................ 27-4
Statement Auditing .......................................................................................................................... 27-7
Privilege Auditing ............................................................................................................................ 27-7
Schema Object Auditing ................................................................................................................. 27-8
Schema Object Audit Options for Views and Procedures.................................................... 27-8
Focusing Statement, Privilege, and Schema Object Auditing................................................. 27-9
Auditing Successful and Unsuccessful Statement Executions............................................. 27-9
Auditing BY SESSION versus BY ACCESS .......................................................................... 27-10
Auditing By User...................................................................................................................... 27-12
28 Database Recovery
An Introduction to Database Recovery ........................................................................................ 28-2
Errors and Failures ..................................................................................................................... 28-2
Structures Used for Database Recovery ....................................................................................... 28-7
Database Backups....................................................................................................................... 28-7
The Redo Log .............................................................................................................................. 28-7
Rollback Segments...................................................................................................................... 28-8
Control Files ................................................................................................................................ 28-8
Rolling Forward and Rolling Back................................................................................................ 28-8
The Redo Log and Rolling Forward ........................................................................................ 28-9
Rollback Segments and Rolling Back....................................................................................... 28-9
Recovery Manager .......................................................................................................................... 28-10
Recovery Catalog...................................................................................................................... 28-10
Parallelization............................................................................................................................ 28-12
Report Generation .................................................................................................................... 28-12
Performing Recovery in Parallel.................................................................................................. 28-13
Situations That Benefit from Parallel Recovery ................................................................... 28-14
Recovery Processes................................................................................................................... 28-14
xx
Database Archiving Modes........................................................................................................... 28-16
NOARCHIVELOG Mode (Media Recovery Disabled)....................................................... 28-16
ARCHIVELOG Mode (Media Recovery Enabled)............................................................... 28-16
Control Files..................................................................................................................................... 28-19
Control File Contents ............................................................................................................... 28-19
Multiplexed Control Files........................................................................................................ 28-20
Database Backups........................................................................................................................... 28-21
Whole Database Backups......................................................................................................... 28-21
Partial Database Backups ........................................................................................................ 28-22
The Export and Import Utilities.............................................................................................. 28-23
Read-Only Tablespaces and Backup...................................................................................... 28-23
Survivability .................................................................................................................................... 28-24
Planning for Disaster Recovery .............................................................................................. 28-24
Standby Database ..................................................................................................................... 28-24
Part VIII Distributed Processing and Distributed Databases
29 Distributed Processing
Oracle Client/Server Architecture.................................................................................................. 29-2
Distributed Processing..................................................................................................................... 29-2
Net8...................................................................................................................................................... 29-5
How Net8 Works ........................................................................................................................ 29-5
30 Distributed Databases
Oracle’s Distributed Database Architecture................................................................................ 30-2
Clients and Servers..................................................................................................................... 30-2
The Network................................................................................................................................ 30-4
Databases and Database Links.................................................................................................. 30-4
Database Links ............................................................................................................................ 30-6
Schema Object Name Resolution.............................................................................................. 30-6
Connecting Between Oracle Server Versions ......................................................................... 30-7
Distributed Databases and Distributed Processing............................................................... 30-7
Distributed Databases and Database Replication.................................................................. 30-7
Heterogeneous Distributed Databases......................................................................................... 30-8
xxi
Transparent SQL Access............................................................................................................ 30-8
Procedural Access....................................................................................................................... 30-8
Gateway Features ....................................................................................................................... 30-9
Version 8 Gateways.................................................................................................................. 30-10
Version 4 Gateways.................................................................................................................. 30-10
Developing Distributed Database Applications...................................................................... 30-10
Remote and Distributed SQL Statements ............................................................................. 30-10
Remote Procedure Calls (RPCs) ............................................................................................. 30-11
Remote and Distributed Transactions................................................................................... 30-11
Transparency in a Distributed Database System................................................................. 30-13
Administering an Oracle Distributed Database System ........................................................ 30-15
Site Autonomy .......................................................................................................................... 30-15
Distributed Database Security ................................................................................................ 30-16
Tools for Administering Oracle Distributed Databases...................................................... 30-17
Oracle Enterprise Manager ..................................................................................................... 30-18
Third-Party Administration Tools ......................................................................................... 30-18
SNMP Support .......................................................................................................................... 30-19
National Language Support.......................................................................................................... 30-19
31 Database Replication
What Is Replication? ........................................................................................................................ 31-2
Basic Replication......................................................................................................................... 31-2
Advanced (Symmetric) Replication......................................................................................... 31-3
Basic Replication Concepts............................................................................................................. 31-4
Uses of Basic Replication........................................................................................................... 31-4
Read-Only Table Snapshots ...................................................................................................... 31-6
Snapshot Refreshes..................................................................................................................... 31-8
Other Basic Replication Options ............................................................................................ 31-10
Advanced Replication Concepts.................................................................................................. 31-11
Uses for Advanced Replication .............................................................................................. 31-12
Advanced Replication Configurations.................................................................................. 31-13
Advanced Replication and the Oracle Replication Manager............................................. 31-17
Replication Objects, Groups, Sites, and Catalogs ................................................................ 31-17
Oracle’s Advanced Replication Architecture ....................................................................... 31-19
Replication Administrators, Propagators, and Receivers................................................... 31-22
xxii
Replication Conflicts ................................................................................................................ 31-22
Unique Advanced Replication Options................................................................................. 31-26
Part IX Appendix
A Operating System-Specific Information
Index
xxiii
Send Us Your Comments
Oracle8 Concepts, Release 8.0
Part No. A58227-01
Oracle Corporation welcomes your comments and suggestions on the quality and usefulness of this
publication. Your input is an important part of the information used for revision.
■
Did you find any errors?
■
Is the information clearly presented?
■
Do you need more information? If so, where?
■
Are the examples correct? Do you need more examples?
■
What features did you like most about this manual?
If you find any errors or have any other suggestions for improvement, please indicate the chapter,
section, and page number (if available). You can send comments to us in the following ways:
■
electronic mail -
■
FAX - (650) 506-7200 Attn: Oracle Server Documentation
■
postal service:
Oracle Corporation
Oracle Server Documentation Manager
500 Oracle Parkway
Redwood Shores, CA 94065
USA
If you would like a reply, please give your name, address, and telephone number below.
xxiv
xxv
Preface
This manual describes all features of the Oracle server, an object-relational database
management system. It describes how the Oracle server functions and lays a con-
ceptual foundation for much of the practical information contained in other Oracle
server manuals. Information in this manual applies to the Oracle server running on
all operating systems.
Oracle8 and Oracle8 Enterprise Edition
Oracle8 Concepts contains information that describes the features and functionality
of the Oracle8 and the Oracle8 Enterprise Edition products. Oracle8 and Oracle8
Enterprise Edition have the same basic features. However, several advanced
features are available only with the Enterprise Edition, and some of these are
optional. For example, to use object functionality, you must have the Enterprise
Edition and the Objects Option.
For information about the differences between Oracle8 and the Oracle8 Enterprise
Edition and the features and options that are available to you, see Getting to Know
Oracle8 and the Oracle8 Enterprise Edition.