Concepts 10g Release 2 (10.2) - Oracle

[Pages:100]Oracle? Database

Concepts 10g Release 2 (10.2)

B14220-02

October 2005

Oracle Database Concepts, 10g Release 2 (10.2)

B14220-02

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

Primary Author: Michele Cyran

Contributing Author: Paul Lane, JP Polk

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

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

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

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

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

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

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

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

Contents

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

Audience................................................................................................................................................... xxv Documentation Accessibility ................................................................................................................. xxv Related Documentation .......................................................................................................................... xxvi Conventions ............................................................................................................................................. xxvi

Part I What Is Oracle?

1 Introduction to the Oracle Database

Oracle Database Architecture ............................................................................................................... 1-1 Overview of Oracle Grid Architecture............................................................................................ 1-2 Grid Computing Defined........................................................................................................... 1-2 Grid Computing in Oracle Database 10g................................................................................. 1-5 Overview of Application Architecture ........................................................................................... 1-7 Client/Server Architecture........................................................................................................ 1-7 Multitier Architecture: Application Servers ........................................................................... 1-7 Overview of Physical Database Structures..................................................................................... 1-8 Datafiles ....................................................................................................................................... 1-8 Control Files................................................................................................................................. 1-8 Redo Log Files ............................................................................................................................. 1-9 Archive Log Files ........................................................................................................................ 1-9 Parameter Files ............................................................................................................................ 1-9 Alert and Trace Log Files ........................................................................................................... 1-9 Backup Files .............................................................................................................................. 1-10 Overview of Logical Database Structures ................................................................................... 1-10 Tablespaces ............................................................................................................................... 1-10 Oracle Data Blocks ................................................................................................................... 1-10 Extents ....................................................................................................................................... 1-11 Segments ................................................................................................................................... 1-11 Overview of Schemas and Common Schema Objects ............................................................... 1-12 Tables ......................................................................................................................................... 1-12 Indexes ...................................................................................................................................... 1-12 Views ......................................................................................................................................... 1-12 Clusters...................................................................................................................................... 1-13 Synonyms.................................................................................................................................. 1-13

iii

Overview of the Oracle Data Dictionary ..................................................................................... Overview of the Oracle Instance...................................................................................................

Real Application Clusters: Multiple Instance Systems....................................................... Instance Memory Structures ................................................................................................. System Global Area ................................................................................................................. Program Global Area............................................................................................................... Oracle Background Processes ................................................................................................ Process Architecture ................................................................................................................ Overview of Accessing the Database ........................................................................................... Network Connections.............................................................................................................. Starting Up the Database ........................................................................................................ How Oracle Works ................................................................................................................. Overview of Oracle Utilities .......................................................................................................... Oracle Database Features .................................................................................................................... Overview of Scalability and Performance Features ................................................................... Concurrency ............................................................................................................................. Read Consistency .................................................................................................................... Locking Mechanisms .............................................................................................................. Quiesce Database ..................................................................................................................... Real Application Clusters ....................................................................................................... Portability.................................................................................................................................. Overview of Manageability Features ........................................................................................... Self-Managing Database ......................................................................................................... Oracle Enterprise Manager..................................................................................................... SQL*Plus.................................................................................................................................... Automatic Storage Management ........................................................................................... The Scheduler ........................................................................................................................... Database Resource Manager ................................................................................................. Overview of Database Backup and Recovery Features............................................................. Types of Failures ..................................................................................................................... Structures Used for Recovery ................................................................................................ Overview of High Availability Features...................................................................................... Overview of Business Intelligence Features................................................................................ Data Warehousing ................................................................................................................... Extraction, Transformation, and Loading (ETL) ................................................................. Materialized Views .................................................................................................................. Bitmap Indexes in Data Warehousing .................................................................................. Table Compression .................................................................................................................. Parallel Execution .................................................................................................................... Analytic SQL............................................................................................................................. OLAP Capabilities ................................................................................................................... Data Mining .............................................................................................................................. Partitioning ............................................................................................................................... Overview of Content Management Features .............................................................................. XML in Oracle........................................................................................................................... LOBs........................................................................................................................................... Oracle Text ...............................................................................................................................

1-13 1-13 1-13 1-14 1-14 1-15 1-15 1-15 1-16 1-16 1-16 1-17 1-17 1-17 1-18 1-18 1-18 1-19 1-20 1-20 1-20 1-21 1-21 1-21 1-21 1-21 1-22 1-22 1-22 1-22 1-23 1-24 1-25 1-25 1-25 1-25 1-26 1-26 1-26 1-26 1-26 1-27 1-27 1-27 1-27 1-27 1-28

iv

Oracle Ultra Search ................................................................................................................. Oracle interMedia..................................................................................................................... Oracle Spatial............................................................................................................................ Overview of Security Features ...................................................................................................... Security Mechanisms .............................................................................................................. Overview of Data Integrity and Triggers .................................................................................... Integrity Constraints................................................................................................................ Keys ........................................................................................................................................... Triggers ..................................................................................................................................... Overview of Information Integration Features........................................................................... Distributed SQL ...................................................................................................................... Oracle Streams ......................................................................................................................... Oracle Transparent Gateways and Generic Connectivity ................................................. Oracle Database Application Development ................................................................................... Overview of Oracle SQL ................................................................................................................ SQL Statements ........................................................................................................................ Overview of PL/SQL...................................................................................................................... PL/SQL Program Units .......................................................................................................... Overview of Java ............................................................................................................................. Overview of Application Programming Languages (APIs) ..................................................... Overview of Transactions .............................................................................................................. Commit and Undo Transactions............................................................................................ Savepoints ................................................................................................................................. Overview of Datatypes................................................................................................................... Overview of Globalization ............................................................................................................

1-28 1-28 1-28 1-28 1-29 1-29 1-30 1-30 1-30 1-31 1-31 1-31 1-33 1-33 1-33 1-33 1-34 1-35 1-35 1-35 1-36 1-37 1-37 1-37 1-38

Part II Oracle Database Architecture

2 Data Blocks, Extents, and Segments

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

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

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

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

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

v

Determine the Number and Size of Extents ............................................................................... How Extents Are Allocated .......................................................................................................... When Extents Are Deallocated ....................................................................................................

Extents in Nonclustered Tables ............................................................................................. Extents in Clustered Tables .................................................................................................... Extents in Materialized Views and Their Logs.................................................................... Extents in Indexes .................................................................................................................... Extents in Temporary Segments ............................................................................................ Extents in Rollback Segments................................................................................................. Overview of Segments ......................................................................................................................... Introduction to Data Segments .................................................................................................... Introduction to Index Segments ................................................................................................... Introduction to Temporary Segments ......................................................................................... Operations that Require Temporary Segments .................................................................. Segments in Temporary Tables and Their Indexes ............................................................ How Temporary Segments Are Allocated .......................................................................... Introduction to Automatic Undo Management.......................................................................... Undo Mode ............................................................................................................................... Undo Quota .............................................................................................................................. Automatic Undo Retention..................................................................................................... External Views..........................................................................................................................

2-10 2-11 2-11 2-12 2-12 2-12 2-13 2-13 2-13 2-13 2-13 2-14 2-14 2-14 2-15 2-15 2-16 2-16 2-17 2-17 2-17

3 Tablespaces, Datafiles, and Control Files

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

Overview of Tablespaces ........................................................................................................................ 3-4 Bigfile Tablespaces ............................................................................................................................. 3-5 Benefits of Bigfile Tablespaces .................................................................................................. 3-6 Considerations with Bigfile Tablespaces ................................................................................. 3-6 The SYSTEM Tablespace .................................................................................................................. 3-6 The Data Dictionary.................................................................................................................... 3-7 PL/SQL Program Units Description........................................................................................ 3-7 The SYSAUX Tablespace................................................................................................................... 3-7 Undo Tablespaces .............................................................................................................................. 3-7 Creation of Undo Tablespaces .................................................................................................. 3-8 Assignment of Undo Tablespaces ............................................................................................ 3-8 Default Temporary Tablespace ........................................................................................................ 3-8 How to Specify a Default Temporary Tablespace.................................................................. 3-8 Using Multiple Tablespaces.............................................................................................................. 3-9 Managing Space in Tablespaces ...................................................................................................... 3-9 Locally Managed Tablespaces ............................................................................................... 3-10 Segment Space Management in Locally Managed Tablespaces ...................................... 3-10 Dictionary Managed Tablespaces ......................................................................................... 3-11 Multiple Block Sizes........................................................................................................................ 3-11 Online and Offline Tablespaces .................................................................................................... 3-11 Bringing Tablespaces Offline ................................................................................................. 3-12

vi

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

Sort Segments .......................................................................................................................... Creation of Temporary Tablespaces ..................................................................................... Transport of Tablespaces Between Databases ........................................................................... Tablespace Repository............................................................................................................. How to Move or Copy a Tablespace to Another Database ............................................... Overview of Datafiles .......................................................................................................................... Datafile Contents ............................................................................................................................ Size of Datafiles .............................................................................................................................. Offline Datafiles .............................................................................................................................. Temporary Datafiles ...................................................................................................................... Overview of Control Files ................................................................................................................... Control File Contents ..................................................................................................................... Multiplexed Control Files .............................................................................................................

3-12 3-13 3-13 3-13 3-14 3-14 3-14 3-15 3-15 3-16 3-16 3-16 3-16 3-17 3-17 3-18

4 Transaction Management

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

Overview of Transaction Management ................................................................................................ 4-4 Commit Transactions ........................................................................................................................ 4-4 Rollback of Transactions .................................................................................................................. 4-5 Savepoints In Transactions ............................................................................................................... 4-6 Transaction Naming .......................................................................................................................... 4-7 How Transactions Are Named ................................................................................................. 4-7 Commit Comment ...................................................................................................................... 4-7 The Two-Phase Commit Mechanism ............................................................................................. 4-8

Overview of Autonomous Transactions .............................................................................................. 4-8 Autonomous PL/SQL Blocks .......................................................................................................... 4-9 Transaction Control Statements in Autonomous Blocks ..................................................... 4-9

5 Schema Objects

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

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

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

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

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

vii

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

Segment Allocation.................................................................................................................. 5-10 Parent and Child Transactions .............................................................................................. 5-11 External Tables ................................................................................................................................ 5-11 The Access Driver .................................................................................................................... 5-11 Data Loading with External Tables ....................................................................................... 5-12 Parallel Access to External Tables ......................................................................................... 5-12 Overview of Views................................................................................................................................ 5-13 How Views are Stored.................................................................................................................... 5-13 How Views Are Used .................................................................................................................... 5-14 Mechanics of Views ....................................................................................................................... 5-14 Globalization Support Parameters in Views........................................................................ 5-15 Use of Indexes Against Views................................................................................................ 5-15 Dependencies and Views .............................................................................................................. 5-15 Updatable Join Views .................................................................................................................... 5-16 Object Views .................................................................................................................................... 5-16 Inline Views .................................................................................................................................... 5-16 Overview of Materialized Views ....................................................................................................... 5-17 Define Constraints on Views ......................................................................................................... 5-17 Refresh Materialized Views .......................................................................................................... 5-18 Materialized View Logs ................................................................................................................ 5-18 Overview of Dimensions..................................................................................................................... 5-19 Overview of the Sequence Generator ............................................................................................... 5-19 Overview of Synonyms........................................................................................................................ 5-20 Overview of Indexes............................................................................................................................. 5-21 Unique and Nonunique Indexes .................................................................................................. 5-22 Composite Indexes.......................................................................................................................... 5-22 Indexes and Keys ........................................................................................................................... 5-23 Indexes and Nulls .......................................................................................................................... 5-23 Function-Based Indexes ................................................................................................................. 5-24 Uses of Function-Based Indexes ........................................................................................... 5-24 Optimization with Function-Based Indexes ....................................................................... 5-24 Dependencies of Function-Based Indexes ........................................................................... 5-25 How Indexes Are Stored ............................................................................................................... 5-26 Format of Index Blocks............................................................................................................ 5-26 The Internal Structure of Indexes .......................................................................................... 5-26 Index Properties ....................................................................................................................... 5-27 Advantages of B-tree Structure.............................................................................................. 5-28 Index Unique Scan .......................................................................................................................... 5-28 Index Range Scan ............................................................................................................................ 5-28 Key Compression ........................................................................................................................... 5-28 Prefix and Suffix Entries ........................................................................................................ 5-28 Performance and Storage Considerations ........................................................................... 5-29 Uses of Key Compression ...................................................................................................... 5-29 Reverse Key Indexes ...................................................................................................................... 5-30

viii

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download