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 tr
Trang 1Oracle8 Concepts
Release 8.0
December, 1997 Part No A58227-01
Trang 2Oracle8 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 ently dangerous applications It shall be licensee's responsibility to take all appropriate fail-safe, back
inher-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 ered with Restricted Rights and the following legend is applicable:
deliv-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.
Trang 3Send Us Your Comments xxiii
Preface xxv
Part I What Is Oracle?
1 Introduction to the Oracle Server
Databases and Information Management 1-2The Oracle Server 1-4Oracle Databases 1-8
Database Structure and Space Management 1-8Logical Database Structures 1-8Physical Database Structures 1-11
Memory Structure and Processes 1-13Memory Structures 1-13Process Architecture 1-16The Program Interface 1-19
An Example of How Oracle Works 1-19
Data Concurrency and Consistency 1-20Concurrency 1-20Read Consistency 1-21Locking Mechanisms 1-22
Distributed Processing and Distributed Databases 1-23Client/Server Architecture: Distributed Processing 1-23
Trang 4Distributed 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
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
Trang 5How Extents Are Allocated 2-11When Extents Are Deallocated 2-13
Segments 2-15Data Segments 2-15Index Segments 2-15Temporary Segments 2-16Rollback Segments 2-17
3 Tablespaces and Datafiles
An Introduction to Tablespaces and Datafiles 3-2
Tablespaces 3-3The SYSTEM Tablespace 3-4Allocating More Space for a Database 3-4Bringing Tablespaces Online and Offline 3-7Read-Only Tablespaces 3-9Temporary Tablespaces 3-10
Datafiles 3-11Datafile Contents 3-12Size of Datafiles 3-12Offline 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-3How Oracle Uses the Data Dictionary 4-3How Oracle Users Can Use the Data Dictionary 4-5
The Dynamic Performance Tables 4-7
Trang 6Part III The Oracle Instance
Overview of an Oracle Instance 5-2The Instance and the Database 5-2Connecting with Administrator Privileges 5-3Parameter Files 5-4
Instance and Database Startup 5-5Starting an Instance 5-5Mounting a Database 5-6Opening a Database 5-7
Database and Instance Shutdown 5-8Closing a Database 5-8Dismounting a Database 5-8Shutting Down an Instance 5-9
Introduction to Oracle Memory Structures 6-2
System Global Area (SGA) 6-2The Database Buffer Cache 6-3The Redo Log Buffer 6-6The Shared Pool 6-6Size of the SGA 6-11Controlling the SGA’s Use of Memory 6-12
Program Global Areas (PGA) 6-13Contents of a PGA 6-13Size of a PGA 6-14
Sort Areas 6-15Sort Direct Writes 6-16
Virtual Memory 6-16
Software Code Areas 6-16
Trang 77 Process Structure
Introduction to Processes 7-2
Single-Process Oracle 7-2
Multiple-Process Oracle 7-3User Processes 7-4Oracle Processes 7-5Trace Files and the ALERT File 7-14
Variations in Oracle Configuration 7-16Single-Task Configuration 7-16Dedicated Server (Two-Task) Configuration 7-18The 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-27Program Interface Structure 7-27The Program Interface Drivers 7-27Operating System Communications Software 7-28
Part IV The Object-Relational DBMS
Overview of Schema Objects 8-2
Tables 8-3How Table Data Is Stored 8-4Nulls 8-7Default Values for Columns 8-8Nested Tables 8-9
Views 8-10Storage for Views 8-11How Views Are Used 8-11The Mechanics of Views 8-12Dependencies and Views 8-13
Trang 8Updatable 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
Trang 9Disk 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
Trang 1011 User-Defined Datatypes (Objects Option)
Introduction 11-2Complex Data Models 11-2Multimedia Datatypes 11-3
User-Defined Datatypes 11-3Object Types 11-4Collection Types 11-9
Application Interfaces 11-11SQL 11-12PL/SQL 11-12Pro*C/C++ 11-12OCI 11-13OTT 11-14
References and Name Resolution 12-2Table Aliases 12-2Method Calls without Arguments 12-3
Storage of User-Defined Types 12-4Leaf-Level Attributes 12-4Row Objects 12-4Column Objects 12-5REFs 12-5Nested Tables 12-5VARRAYs 12-5
Properties of Object Attributes 12-6Nulls 12-6Defaults 12-7Constraints 12-8Indexes 12-9Triggers 12-9
Privileges on User-Defined Types and Their Methods 12-10System Privileges 12-10Schema Object Privileges 12-10Using Types in New Types or Tables 12-11
Trang 11Example 12-11Privileges on Type Access and Object Access 12-12
Dependencies and Incomplete Types 12-13Completing Incomplete Types 12-14Type Dependencies of Tables 12-15
Import/Export of User-Defined Types 12-15
Introduction 13-2Advantages of Object Views 13-2
Defining Object Views 13-2
Using Object Views 13-4
Updating Object Views 13-4
Structured Query Language (SQL) 14-2SQL Statements 14-3Identifying Nonstandard SQL 14-6Recursive SQL 14-6Cursors 14-6Shared SQL 14-7Parsing 14-7
SQL Processing 14-8Overview of SQL Statement Execution 14-8DML Statement Processing 14-10DDL Statement Processing 14-14Controlling Transactions 14-14
PL/SQL 14-15How PL/SQL Executes 14-15Language Constructs for PL/SQL 14-17Stored Procedures 14-18External Procedures 14-19
Trang 1215 Transaction Management
Introduction to Transactions 15-2Statement Execution and Transaction Control 15-3Statement-Level Rollback 15-4
Oracle and Transaction Management 15-4Committing Transactions 15-5Rolling Back Transactions 15-6Savepoints 15-7The Two-Phase Commit Mechanism 15-7
Discrete Transaction Management 15-8
Introduction to Message Queuing 16-3Synchronous Communication 16-3Asynchronous Communication 16-3
Oracle Advanced Queuing 16-4Queuing Entities 16-4Features of Advanced Queuing 16-6
An Introduction to Stored Procedures and Packages 17-2Stored Procedures and Functions 17-2Packages 17-4
Procedures and Functions 17-6Procedure Guidelines 17-7Benefits of Procedures 17-7Anonymous PL/SQL Blocks vs Stored Procedures 17-8Standalone Procedures 17-9Dependency Tracking for Stored Procedures 17-9External Procedures 17-9
Packages 17-10Benefits of Packages 17-13Dependency Tracking for Packages 17-14
Trang 13How Oracle Stores Procedures and Packages 17-15Compiling Procedures and Packages 17-15Storing the Compiled Code in Memory 17-15Storing Procedures or Packages in Database 17-15
How Oracle Executes Procedures and Packages 17-16Verifying User Access 17-16Verifying Procedure Validity 17-16Executing a Procedure 17-17
An Introduction to Triggers 18-2How Triggers Are Used 18-3Some Cautionary Notes about Triggers 18-3Triggers vs Declarative Integrity Constraints 18-5
Parts of a Trigger 18-5Triggering Event or Statement 18-6Trigger Restriction 18-7Trigger Action 18-7
Types of Triggers 18-7Row Triggers and Statement Triggers 18-7BEFORE and AFTER Triggers 18-8Trigger Combinations 18-9INSTEAD OF Triggers 18-11
Trigger Execution 18-14The Execution Model for Triggers and Integrity Constraint Checking 18-14Data Access for Triggers 18-16Storage of Triggers 18-17Execution of Triggers 18-17Dependency Maintenance for Triggers 18-18
An Introduction to Dependency Issues 19-2
Resolving Schema Object Dependencies 19-4Compiling Views and PL/SQL Program Units 19-5
Dependency Management and Nonexistent Schema Objects 19-7
Trang 14Shared SQL Dependency Management 19-8
Local and Remote Dependency Management 19-8Managing Local Dependencies 19-9Managing Remote Dependencies 19-9
What Is Optimization? 20-2Execution Plans 20-2Execution Order 20-5
Cost-Based and Rule-Based Optimization 20-6The Cost-Based Approach 20-6
Overview of Optimizer Operations 20-12Optimizer Operations 20-12Types of SQL Statements 20-13
Evaluation of Expressions and Conditions 20-14Constants 20-14LIKE Operator 20-15
IN Operator 20-15ANY or SOME Operator 20-15ALL Operator 20-16BETWEEN Operator 20-17NOT Operator 20-17Transitivity 20-17
Transforming and Optimizing Statements 20-19Transforming ORs into Compound Queries 20-19Transforming Complex Statements into Join Statements 20-22Optimizing Statements That Access Views 20-24Optimizing Compound Queries 20-36Optimizing Distributed Statements 20-39
Choosing an Optimization Approach and Goal 20-40The OPTIMIZER_MODE Initialization Parameter 20-40Statistics in the Data Dictionary 20-41The OPTIMIZER_GOAL Parameter of the ALTER SESSION Command 20-41The FIRST_ROWS, ALL_ROWS, CHOOSE, and RULE Hints 20-42PL/SQL and the Optimizer Goal 20-42
Trang 15Choosing Access Paths 20-42Access Methods 20-43Access Paths 20-45Choosing Among Access Paths 20-58
Optimizing Join Statements 20-63Join Operations 20-63Choosing Execution Plans for Join Statements 20-69Views in Outer Joins 20-72
Optimizing Anti-Joins and Semi-Joins 20-74
Optimizing “Star” Queries 20-75Star Query Example 20-75Tuning Star Queries 20-75Star Transformation 20-76
Part VI Parallel SQL and Direct-Load INSERT
Introduction to Direct-Load INSERT 21-2Advantages of Direct-Load INSERT 21-2INSERT SELECT Statements 21-3
Varieties of Direct-Load INSERT Statements 21-3Serial and Parallel INSERT 21-3Logging Mode 21-5
Additional Considerations for Direct-Load INSERT 21-8Index Maintenance 21-8Space Considerations 21-8Locking Considerations 21-9
Restrictions on Direct-Load INSERT 21-9
22 Parallel Execution
Overview of Parallel Execution 22-2Operations That Can Be Parallelized 22-2How Oracle Parallelizes Operations 22-3
Trang 16Process Architecture for Parallel Execution 22-5The Parallel Server Pool 22-7Parallelizing SQL Statements 22-9
Setting the Degree of Parallelism 22-13Determining the Degree of Parallelism for Operations 22-13Balancing the Work Load 22-16Parallelization Rules for SQL Statements 22-17
Parallel DDL 22-25DDL Statements That Can Be Parallelized 22-25CREATE TABLE AS SELECT in Parallel 22-26Recoverability and Parallel DDL 22-27Space Management for Parallel DDL 22-27
Parallel DML 22-29Advantages of Parallel DML over Manual Parallelism 22-30When to Use Parallel DML 22-31Enabling Parallel DML 22-32Transaction Model for Parallel DML 22-33Recovery for Parallel DML 22-34Space Considerations for Parallel DML 22-35Lock and Enqueue Resources for Parallel DML 22-36Restrictions on Parallel DML 22-37
Affinity 22-40
Other Types of Parallelism 22-42
Part VII Data Protection
Data Concurrency and Consistency in a Multiuser Environment 23-2Preventable Phenomena and Transaction Isolation Levels 23-2Locking Mechanisms 23-3
How Oracle Manages Data Concurrency and Consistency 23-4Multiversion Concurrency Control 23-4Statement-Level Read Consistency 23-5Transaction-Level Read Consistency 23-6Oracle Isolation Levels 23-6
Trang 17Setting the Isolation Level 23-7Comparing Read Committed and Serializable Isolation 23-9Choosing an Isolation Level 23-12
How Oracle Locks Data 23-14Transactions and Data Concurrency 23-15Deadlocks 23-16Types of Locks 23-18DML (Data) Locks 23-19DDL Locks (Dictionary Locks) 23-26Latches and Internal Locks 23-28Explicit (Manual) Data Locking 23-29Oracle Lock Management Services 23-40
24 Data Integrity
Definition of Data Integrity 24-2Types of Data Integrity 24-2How Oracle Enforces Data Integrity 24-4
An Introduction to Integrity Constraints 24-5Advantages of Integrity Constraints 24-5The Performance Cost of Integrity Constraints 24-7
Types of Integrity Constraints 24-7NOT NULL Integrity Constraints 24-7UNIQUE Key Integrity Constraints 24-8PRIMARY KEY Integrity Constraints 24-10FOREIGN KEY (Referential) Integrity Constraints 24-12CHECK Integrity Constraints 24-16
The Mechanisms of Constraint Checking 24-17Default Column Values and Integrity Constraint Checking 24-19
Deferred Constraint Checking 24-19Constraint Attributes 24-20SET CONSTRAINTS Mode 24-20Unique Constraints and Indexes 24-21
Enabled, Disabled, and Enable Novalidate Constraints 24-21
Trang 1825 Controlling Database Access
Database Security 25-2
Schemas, Database Users, and Security Domains 25-2
User Authentication 25-3Authentication by the Operating System 25-3Authentication by the Network 25-4Authentication by the Oracle Database 25-4Database Administrator Authentication 25-6
User Tablespace Settings and Quotas 25-8Default Tablespace 25-8Temporary Tablespace 25-8Tablespace Access and Quotas 25-8
The User Group PUBLIC 25-9
User Resource Limits and Profiles 25-10Types of System Resources and Limits 25-10Profiles 25-13
Licensing 25-14Concurrent Usage Licensing 25-14Named User Licensing 25-15
26 Privileges and Roles
Privileges 26-2System Privileges 26-2Schema Object Privileges 26-3
Roles 26-10Common Uses for Roles 26-11The Mechanisms of Roles 26-13Granting and Revoking Roles 26-13Who Can Grant or Revoke Roles? 26-13Naming Roles 26-14Security Domains of Roles and Users 26-14Named PL/SQL Blocks and Roles 26-14Data Definition Language Statements and Roles 26-14Predefined Roles 26-16
Trang 19The Operating System and Roles 26-16Roles in a Distributed Environment 26-16
Introduction to Auditing 27-2Auditing Features 27-2Auditing Mechanisms 27-4
Rolling Forward and Rolling Back 28-8The Redo Log and Rolling Forward 28-9Rollback Segments and Rolling Back 28-9
Recovery Manager 28-10Recovery Catalog 28-10Parallelization 28-12Report Generation 28-12
Performing Recovery in Parallel 28-13Situations That Benefit from Parallel Recovery 28-14Recovery Processes 28-14
Trang 20Database Archiving Modes 28-16NOARCHIVELOG Mode (Media Recovery Disabled) 28-16ARCHIVELOG Mode (Media Recovery Enabled) 28-16
Control Files 28-19Control File Contents 28-19Multiplexed Control Files 28-20
Database Backups 28-21Whole Database Backups 28-21Partial Database Backups 28-22The Export and Import Utilities 28-23Read-Only Tablespaces and Backup 28-23
Survivability 28-24Planning for Disaster Recovery 28-24Standby 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-5How Net8 Works 29-5
Oracle’s Distributed Database Architecture 30-2Clients and Servers 30-2The Network 30-4Databases and Database Links 30-4Database Links 30-6Schema Object Name Resolution 30-6Connecting Between Oracle Server Versions 30-7Distributed Databases and Distributed Processing 30-7Distributed Databases and Database Replication 30-7
Heterogeneous Distributed Databases 30-8
Trang 21Transparent SQL Access 30-8Procedural Access 30-8Gateway Features 30-9Version 8 Gateways 30-10Version 4 Gateways 30-10
Developing Distributed Database Applications 30-10Remote and Distributed SQL Statements 30-10Remote Procedure Calls (RPCs) 30-11Remote and Distributed Transactions 30-11Transparency in a Distributed Database System 30-13
Administering an Oracle Distributed Database System 30-15Site Autonomy 30-15Distributed Database Security 30-16Tools for Administering Oracle Distributed Databases 30-17Oracle Enterprise Manager 30-18Third-Party Administration Tools 30-18SNMP Support 30-19
National Language Support 30-19
What Is Replication? 31-2Basic Replication 31-2Advanced (Symmetric) Replication 31-3
Basic Replication Concepts 31-4Uses of Basic Replication 31-4Read-Only Table Snapshots 31-6Snapshot Refreshes 31-8Other Basic Replication Options 31-10
Advanced Replication Concepts 31-11Uses for Advanced Replication 31-12Advanced Replication Configurations 31-13Advanced Replication and the Oracle Replication Manager 31-17Replication Objects, Groups, Sites, and Catalogs 31-17Oracle’s Advanced Replication Architecture 31-19Replication Administrators, Propagators, and Receivers 31-22
Trang 22Replication Conflicts 31-22Unique Advanced Replication Options 31-26
Part IX Appendix
A Operating System-Specific Information
Index
Trang 23Send 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 thispublication 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 - infodev@us.oracle.com
■ FAX - (650) 506-7200 Attn: Oracle Server Documentation
Trang 25This manual describes all features of the Oracle server, an object-relational databasemanagement system It describes how the Oracle server functions and lays a con-ceptual foundation for much of the practical information contained in other Oracleserver manuals Information in this manual applies to the Oracle server running onall 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 Oracle8Enterprise Edition have the same basic features However, several advanced
features are available only with the Enterprise Edition, and some of these areoptional For example, to use object functionality, you must have the EnterpriseEdition 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.
Trang 26This manual is written for database administrators, system administrators, anddatabase application developers
What You Should Already Know
You should be familiar with relational database concepts and with the operatingsystem environment under which you are running Oracle
As a prerequisite, all readers should read Chapter 1, “Introduction to the Oracle
Server” That chapter is a comprehensive introduction to the concepts and ogy used throughout the remainder of this manual
terminol-If You’re Interested in Installation and Migration
This manual is not an installation or migration guide Therefore, if your primaryinterest is installation, refer to your operating system-specific Oracle documenta-tion, or if your primary interest is database and application migration, refer to
Oracle8 Migration.
If You’re Interested in Database Administration
While this manual describes the architecture, processes, structures, and other cepts of the Oracle server, it does not explain how to administer the Oracle server
con-For that information, see Oracle8 Administrator’s Guide.
If You’re Interested in Application Design
In addition to administrators, experienced users of Oracle and advanced databaseapplication designers will find information in this manual useful However, data-
base application developers should also refer to Oracle8 Application Developer’s Guide and to the documentation for the tool or language product they are using to
develop Oracle database applications
How This Manual Is Organized
This manual is divided into the following parts:
■ Part I: What Is Oracle?
■ Part II: Database Structures
■ Part III: The Oracle Instance
■ Part IV: The Object-Relational DBMS
Trang 27■ Part V: Data Access
■ Part VI: Parallel SQL and Direct-Load INSERT
■ Part VII: Data Protection
■ Part VIII: Distributed Processing and Distributed Databases
■ Part IX: Appendix
Part I: What Is Oracle?
Chapter 1: Introduction to the Oracle Server
This chapter provides an overview of the concepts and terminology you need forunderstanding the Oracle server You should read this overview before using thedetailed information in the remainder of this manual
Part II: Database Structures
Chapter 2: Data Blocks, Extents, and Segments
This chapter discusses how data is stored and how storage space is allocated forand consumed by various objects within an Oracle database The space manage-ment background information here supplements that in the following chapter and
in Chapter 8, “Schema Objects”
Chapter 3: Tablespaces and Datafiles
This chapter discusses how physical storage space in an Oracle database is dividedinto logical divisions called tablespaces The physical operating system files associ-ated with tablespaces, called datafiles, are also discussed
Chapter 4: The Data Dictionary
This chapter describes the data dictionary, which is a set of reference tables andviews that contain read-only information about an Oracle database
Part III: The Oracle Instance
Chapter 5: Database and Instance Startup and Shutdown
This chapter describes an Oracle instance and explains how the database trator can control the accessibility of an Oracle database system This chapter alsodescribes the parameters that control how the database operates
adminis-Chapter 6: Memory Structures
This chapter describes the memory structures used by an Oracle database system
Trang 28Chapter 7: Process StructureThis chapter describes the process structure of an Oracle instance and the differentprocess configurations available for Oracle.
Part IV: The Object-Relational DBMS
Chapter 8: Schema ObjectsThis chapter describes the database objects that can be created in the domain of aspecific user (a schema), including tables, views, numeric sequences, and syn-onyms Indexes and clusters, optional structures that make data retrieval more effi-cient, are also described
Chapter 9: Partitioned Tables and IndexesThis chapter describes how partitioning can be used to split large tables andindexes into more manageable pieces
Chapter 10: Built-In DatatypesThis chapter describes the types of relational data that can be stored in an Oracledatabase table, such as fixed- and variable-length character strings, numbers, dates,and binary large objects (BLOBs)
Chapter 11: User-Defined Datatypes (Objects Option)This chapter gives an overview of the object extensions provided by the Oracleobject-relational database management system (ORDBMS)
Chapter 12: Using User-Defined DatatypesThis chapter describes the user-defined object types that are available in the OracleORDBMS
Chapter 13: Object ViewsThis chapter describes the extensions to views provided by the Oracle ORDBMS
Part V: Data Access
Chapter 14: SQL and PL/SQLThis chapter briefly describes SQL (the Structured Query Language), the languageused to communicate with Oracle, as well as PL/SQL, the Oracle procedural lan-guage extension to SQL
Chapter 15: Transaction ManagementThis chapter defines the concept of transactions and explains the SQL statements
Trang 29used to control them Transactions are logical units of work that are executedtogether as a unit.
Chapter 16: Advanced Queuing
This chapter describes the Oracle Advanced Queuing feature, which allows users
to store messages in queues for deferred retrieval and processing by the Oracleserver
Chapter 17: Procedures and Packages
This chapter discusses the procedural language constructs called procedures, tions, and packages, which are PL/SQL program units that are stored in the data-base
func-Chapter 18: Database Triggers
This chapter describes the procedural language constructs called triggers, dures that are implicitly executed when anyone inserts rows into, updates, ordeletes rows from a database table
proce-Chapter 19: Oracle Dependency Management
This chapter explains how Oracle manages the dependencies for objects such asprocedures, packages, triggers, and views
Chapter 20: The Optimizer
This chapter explains how the optimizer works The optimizer is the part of Oraclethat chooses the most efficient way to execute each SQL statement
Part VI: Parallel SQL and Direct-Load INSERT
Chapter 21: Direct-Load INSERT
This chapter describes the direct-load insert path, which can be performed serially
or in parallel, and the NOLOGGING option
Chapter 22: Parallel Execution
This chapter describes parallel execution of SQL statements (queries, DML, andDDL statements) and explains the rules for parallelizing SQL statements
Part VII: Data Protection
Chapter 23: Data Concurrency and Consistency
This chapter explains how Oracle provides concurrent access to and maintains theaccuracy of shared information in a multiuser environment It describes the auto-
Trang 30matic mechanisms that Oracle uses to guarantee that the concurrent operations ofmultiple users do not interfere with each other.
Chapter 24: Data IntegrityThis chapter discusses data integrity and the declarative integrity constraints thatyou can use to enforce data integrity
Chapter 25: Controlling Database AccessThis chapter describes how to control user access to data and database resources.Chapter 26: Privileges and Roles
This chapter discusses security at the system and object levels
Chapter 27: AuditingThis chapter discusses how the Oracle auditing feature tracks database activity.Chapter 28: Database Recovery
This chapter describes the files and structures used for database recovery and cusses how to protect an Oracle database from possible failures
dis-Part VIII: Distributed Processing and Distributed Databases
Chapter 29: Distributed ProcessingThis chapter discusses distributed processing environments in which the Oracleserver can operate
Chapter 30: Distributed DatabasesThis chapter discusses distributed database architecture, remote data access, andtable replication
Chapter 31: Database ReplicationThis chapter discusses replication of Oracle databases in a distributed databasesystem
Part IX: Appendix
Appendix A: Operating System-Specific InformationThis appendix lists all of the operating system-specific references within thismanual
Trang 31How to Use This Manual
Every reader of this manual should read Chapter 1, “Introduction to the Oracle
Server” This overview of the concepts and terminology related to Oracle provides
a foundation for the more detailed information that follows in later chapters.Each part of this manual addresses a specific audience within the general audiencespreviously described For example, after reading Chapter 1, administrators who areinterested primarily in managing security should focus on the information pre-sented in Part VII, “Data Protection”, particularly Chapter 25, “Controlling Data-base Access”, Chapter 26, “Privileges and Roles”, and Chapter 27, “Auditing”
Conventions Used in This Manual
This manual uses different fonts to represent different types of information
Text of the Manual
The text of this manual uses the following conventions
INSERT INTO emp (empno, ename) VALUES (1000, ’SMITH’);
ALTER TABLESPACE users ADD DATAFILE ’users2.ora’ SIZE 50K;
Example statements may include punctuation, such as commas or quotation marks.All punctuation in example statements is required All example statements termi-
Trang 32nate with a semicolon (;) Depending on the application, a semicolon or other nator may or may not be required to end a statement.
termi-UPPERCASE in Code Examples
Uppercase words in example statements indicate the keywords within Oracle SQL.When you issue statements, however, keywords are not case sensitive
lowercase in Code Examples
Lowercase words in example statements indicate words supplied only for the text of the example For example, lowercase words may indicate the name of atable, column, or file
con-Your Comments Are Welcome
We value and appreciate your comment as an Oracle user and reader of our als As we write, revise, and evaluate our documentation, your opinions are themost important feedback we receive
manu-You can send comments and suggestions about this manual to the following e-mailaddress:
infodev@us.oracle.com
If you prefer, you can send letters or faxes containing your comments to:
Server Technologies Documentation ManagerOracle Corporation
500 Oracle ParkwayRedwood Shores, CA 94065Fax: (650) 506-7200
Trang 33Part I What Is Oracle?
Part I provides an overview of Oracle server concepts and terminology It containsone chapter:
■ Chapter 1, “Introduction to the Oracle Server”
The rest of this manual describes the concepts that are summarized in Chapter 1more thoroughly
Trang 351 Introduction to the Oracle Server
I am Sir Oracle,
And when I ope my lips, let no dog bark!
Shakespeare: The Merchant of Venice
This chapter provides an overview of the Oracle server The topics include:
■ Databases and Information Management
■ Database Structure and Space Management
■ Memory Structure and Processes
■ Data Concurrency and Consistency
■ Distributed Processing and Distributed Databases
■ Startup and Shutdown Operations
■ Database Security
■ Database Backup and Recovery
■ The Object-Relational Model for Database Management
■ Data Access
Attention: This chapter contains information relating to both
Oracle8 and the Oracle8 Enterprise Edition Some of the features
and options documented in this chapter are available only if you
have purchased the Oracle8 Enterprise Edition See Getting to Know
Oracle8 and the Oracle8 Enterprise Edition for information about the
differences between Oracle8 and the Oracle8 Enterprise Edition
Trang 36Databases and Information Management
Databases and Information Management
A database server is the key to solving the problems of information management
In general, a server must reliably manage a large amount of data in a multiuserenvironment so that many users can concurrently access the same data All thismust be accomplished while delivering high performance A database server mustalso prevent unauthorized access and provide efficient solutions for failure
recovery
The Oracle server provides efficient and effective solutions with the followingfeatures:
client/server uted processing) envi-ronments
(distrib-To take full advantage of a given computer tem or network, Oracle allows processing to besplit between the database server and the clientapplication programs The computer runningthe database management system handles all ofthe database server responsibilities while theworkstations running the database applicationconcentrate on the interpretation and display ofdata
sys-large databases andspace management
Oracle supports the largest of databases, tially terabytes in size To make efficient use ofexpensive hardware devices, it allows full con-trol of space usage
poten-many concurrent base users
data-Oracle supports large numbers of concurrentusers executing a variety of database applica-tions operating on the same data It minimizesdata contention and guarantees data concur-rency
high transaction ing performance
process-Oracle maintains the preceding features with ahigh degree of overall system performance Data-base users do not suffer from slow processingperformance
high availability At some sites, Oracle works 24 hours per day
with no down time to limit database put Normal system operations such as databasebackup and partial computer system failures donot interrupt database use
Trang 37through-Databases and Information Management
controlled availability Oracle can selectively control the availability of
data, at the database level and sub-databaselevel For example, an administrator can disal-low use of a specific application so that the appli-cation’s data can be reloaded, without affectingother applications
openness, industry
standards
Oracle adheres to industry accepted standardsfor the data access language, operating systems,user interfaces, and network communication pro-tocols It is an “open” system that protects a cus-tomer’s investment
Release 8.0 of the Oracle server has been fied by the U.S National Institute of Standardsand Technology as 100% compliant with EntryLevel of the ANSI/ISO SQL92 (StructuredQuery Language) standard Oracle fully satisfiesthe requirements of the U.S Government’sFIPS127-2 standard and includes a “flagger” tohighlight non-standard SQL usage
certi-Oracle also supports the Simple Network agement Protocol (SNMP) standard for systemmanagement This protocol allows administra-tors to manage heterogeneous systems with asingle administration interface
Man-manageable security To protect against unauthorized database access
and use, Oracle provides fail-safe security tures to limit and monitor data access These fea-tures make it easy to manage even the mostcomplex design for data access
fea-database enforced
integrity
Oracle enforces data integrity, “business rules”
that dictate the standards for acceptable data As
a result, the costs of coding and managingchecks in many database applications are elimi-nated
Trang 38Databases and Information Management
The following sections provide a comprehensive overview of the Oracle ture Each section describes a different part of the overall architecture
architec-The Oracle Server
The Oracle server is an object-relational database management system that vides an open, comprehensive, and integrated approach to information manage-ment An Oracle server consists of an Oracle database and an Oracle server
pro-distributed systems For networked, distributed environments,
Ora-cle combines the data physically located on ferent computers into one logical database thatcan be accessed by all network users Distrib-uted systems have the same degree of user trans-parency and data consistency as non-distributedsystems, yet receive the advantages of local data-base management
dif-Oracle also offers the heterogeneous option thatallows users to access data on some non-Oracledatabases transparently
portability Oracle software is ported to work under
differ-ent operating systems Applications developedfor Oracle can be ported to any operating systemwith little or no modification
compatibility Oracle software is compatible with industry
stan-dards, including most industry standard ing systems Applications developed for Oraclecan be used on virtually any system with little or
operat-no modification
connectibility Oracle software allows different types of
comput-ers and operating systems to share informationacross networks
replicated environments Oracle software lets you replicate groups of
tables and their supporting objects to multiplesites Oracle supports replication of both data-and schema-level changes to these sites Oracle’sflexible replication technology supports basic pri-mary site replication as well as advanced
dynamic and shared-ownership models
Trang 39Databases and Information Management
instance The following sections describe the relationship between the database andthe instance
Structured Query Language (SQL)
SQL (pronounced SEQUEL) is the programming language that defines and lates the database SQL databases are relational databases; this means simply thatdata is stored in a set of simple relations A database can have one or more tables.And each table has columns and rows A table that has an employee database, forexample, might have a column called employee number and each row in that col-umn would be an employee’s employee number
manipu-You can define and manipulate data in a table with SQL commands manipu-You use datadefinition language (DDL) commands to set up the data DDL commands includecommands to creating and altering databases and tables
You can update, delete, or retrieve data in a table with data manipulation mands (DML) DML commands include commands to alter and fetch data Themost common SQL command is the SELECT command, which allows you toretrieve data from the database
com-In addition to SQL commands, the Oracle server has a procedural language calledPL/SQL PL/SQL enables the programmer to program SQL statements It allowsyou to control the flow of a SQL program, to use variables, and to write error-han-dling procedures
Database Structure
An Oracle database has both a physical and a logical structure Because the cal and logical server structure are separate, the physical storage of data can bemanaged without affecting the access to logical storage structures
physi-Physical Database Structure An Oracle database’s physical structure is determined
by the operating system files that constitute the database Each Oracle database ismade of three types of files: one or more datafiles, two or more redo log files, andone or more control files The files of an Oracle database provide the actual physicalstorage for database information
Trang 40Databases and Information Management
Logical Database Structure An Oracle database’s logical structure is determined by:
■ one or more tablespaces
A tablespace is a logical area of storage explained later in this chapter.
■ the database’s schema objects
A schema is a collection of objects Schema objects are the logical structures that
directly refer to the database’s data Schema objects include such structures astables, views, sequences, stored procedures, synonyms, indexes, clusters, anddatabase links
The logical storage structures, including tablespaces, segments, and extents, dictatehow the physical space of a database is used The schema objects and the relation-ships among them form the relational design of a database
For more information about database structures, see “Database Structure and SpaceManagement” on page 1-8
An Oracle Instance
Every time a database is started, a system global area (SGA) is allocated and Oraclebackground processes are started The system global area is a an area of memoryused for database information shared by the database users The combination of
the background processes and memory buffers is called an Oracle instance.
An Oracle instance has two types of processes: user processes and Oracle processes
■ A user process executes the code of an application program (such as an Oracle
Forms application) or an Oracle Tool (such as Oracle Enterprise Manager)
■ Oracle processes are server processes that perform work for the user processes
and background processes that perform maintenance work for the Oracleserver
Figure 1–1 illustrates a multiple-process Oracle instance