Oracle DatabaseConcepts11g Release 2 (11.2)E40540-04May 2015
Oracle Database Concepts, 11g Release 2 (11.2)E40540-04Copyright 1993, 2015, Oracle and/or its affiliates. All rights reserved.Primary Authors: Lance Ashdown, Tom KyteContributors: Drew Adams, David Austin, Vladimir Barriere, Hermann Baer, David Brower, JonathanCreighton, Bjørn Engsig, Steve Fogel, Bill Habeck, Bill Hodak, Yong Hu, Pat Huey, Vikram Kapoor, FerozKhan, Jonathan Klein, Sachin Kulkarni, Paul Lane, Adam Lee, Yunrui Li, Bryn Llewellyn, Rich Long, BarbLundhild, Neil Macnaughton, Vineet Marwah, Mughees Minhas, Sheila Moore, Valarie Moore, GopalMulagund, Paul Needham, Gregory Pongracz, John Russell, Vivian Schupmann, Shrikanth Shankar, CathyShea, Susan Shepard, Jim Stenoish, Juan Tellez, Lawrence To, Randy Urbano, Badhri Varanasi, Simon Watt,Steve Wertheimer, Daniel WongThis software and related documentation are provided under a license agreement containing restrictions onuse and disclosure and are protected by intellectual property laws. Except as expressly permitted in yourlicense agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license,transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverseengineering, disassembly, or decompilation of this software, unless required by law for interoperability, isprohibited.The information contained herein is subject to change without notice and is not warranted to be error-free. Ifyou find any errors, please report them to us in writing.If this is software or related documentation that is delivered to the U.S. Government or anyone licensing iton behalf of the U.S. Government, then the following notice is applicable:U.S. GOVERNMENT END USERS: Oracle programs, including any operating system, integrated software,any programs installed on the hardware, and/or documentation, delivered to U.S. Government end usersare "commercial computer software" pursuant to the applicable Federal Acquisition Regulation andagency-specific supplemental regulations. As such, use, duplication, disclosure, modification, andadaptation of the programs, including any operating system, integrated software, any programs installed onthe hardware, and/or documentation, shall be subject to license terms and license restrictions applicable tothe programs. No other rights are granted to the U.S. Government.This software or hardware is developed for general use in a variety of information managementapplications. It is not developed or intended for use in any inherently dangerous applications, includingapplications that may create a risk of personal injury. If you use this software or hardware in dangerousapplications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and othermeasures to ensure its safe use. Oracle Corporation and its affiliates disclaim any liability for any damagescaused by use of this software or hardware in dangerous applications.Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks oftheir respective owners.Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarksare used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD,Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of AdvancedMicro Devices. UNIX is a registered trademark of The Open Group.This software or hardware and documentation may provide access to or information about content,products, and services from third parties. Oracle Corporation and its affiliates are not responsible for andexpressly disclaim all warranties of any kind with respect to third-party content, products, and servicesunless otherwise set forth in an applicable agreement between you and Oracle. Oracle Corporation and itsaffiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use ofthird-party content, products, or services, except as set forth in an applicable agreement between you andOracle.
ContentsPreface . xixAudience.Documentation Accessibility .Related Documentation .Conventions .xixxixxxxx1 Introduction to Oracle DatabaseAbout Relational Databases. 1-1Database Management System (DBMS) . 1-1Relational Model . 1-2Relational Database Management System (RDBMS). 1-2Brief History of Oracle Database . 1-3Schema Objects. 1-4Tables . 1-4Indexes . 1-4Data Access . 1-5Structured Query Language (SQL). 1-5PL/SQL and Java . 1-5Transaction Management . 1-6Transactions . 1-6Data Concurrency . 1-6Data Consistency. 1-7Oracle Database Architecture . 1-7Database and Instance . 1-7Database Storage Structures . 1-8Physical Storage Structures . 1-9Logical Storage Structures . 1-9Database Instance Structures. 1-9Oracle Database Processes. 1-10Instance Memory Structures . 1-10Application and Networking Architecture . 1-10Application Architecture . 1-10Networking Architecture. 1-11Oracle Database Documentation Roadmap . 1-12Basic Group . 1-12v
Intermediate Group . 1-12Advanced Group. 1-13Part IOracle Relational Data Structures2 Tables and Table ClustersIntroduction to Schema Objects . 2-1Schema Object Types . 2-2Schema Object Storage . 2-3Schema Object Dependencies. 2-4SYS and SYSTEM Schemas . 2-5Sample Schemas . 2-6Overview of Tables. 2-6Columns and Rows. 2-7Example: CREATE TABLE and ALTER TABLE Statements . 2-7Oracle Data Types . 2-9Character Data Types . 2-10Numeric Data Types. 2-11Datetime Data Types . 2-12Rowid Data Types. 2-13Format Models and Data Types. 2-14Integrity Constraints. 2-14Object Tables . 2-15Temporary Tables . 2-15Temporary Table Creation. 2-16Segment Allocation in Temporary Tables . 2-16External Tables . 2-16External Table Creation. 2-17External Table Access Drivers. 2-17Table Storage. 2-18Table Organization . 2-18Row Storage . 2-19Rowids of Row Pieces . 2-19Storage of Null Values. 2-19Table Compression . 2-19Basic and Advanced Row Compression. 2-19Hybrid Columnar Compression . 2-20Overview of Table Clusters. 2-22Overview of Indexed Clusters. 2-23Overview of Hash Clusters. 2-25Hash Cluster Creation . 2-25Hash Cluster Queries . 2-26Hash Cluster Variations . 2-26Hash Cluster Storage. 2-27vi
3 Indexes and Index-Organized TablesOverview of Indexes . 3-1Index Characteristics . 3-2Keys and Columns. 3-3Composite Indexes. 3-3Unique and Nonunique Indexes. 3-4Types of Indexes. 3-4B-Tree Indexes . 3-5Branch Blocks and Leaf Blocks. 3-5Index Scans . 3-6Reverse Key Indexes. 3-11Ascending and Descending Indexes . 3-11Key Compression . 3-12Bitmap Indexes . 3-13Bitmap Indexes on a Single Table. 3-14Bitmap Join Indexes . 3-15Bitmap Storage Structure . 3-17Function-Based Indexes . 3-17Uses of Function-Based Indexes . 3-18Optimization with Function-Based Indexes . 3-19Application Domain Indexes. 3-19Index Storage . 3-20Overview of Index-Organized Tables. 3-20Index-Organized Table Characteristics. 3-21Index-Organized Tables with Row Overflow Area . 3-23Secondary Indexes on Index-Organized Tables . 3-23Logical Rowids and Physical Guesses . 3-24Bitmap Indexes on Index-Organized Tables. 3-254 Partitions, Views, and Other Schema ObjectsOverview of Partitions . 4-1Partition Characteristics . 4-2Partition Key . 4-2Partitioning Strategies . 4-2Partitioned Tables . 4-7Partitioned Indexes . 4-7Local Partitioned Indexes . 4-8Global Partitioned Indexes . 4-10Partitioned Index-Organized Tables . 4-12Overview of Views. 4-12Characteristics of Views . 4-13Data Manipulation in Views . 4-13How Data Is Accessed in Views . 4-14Updatable Join Views . 4-15Object Views . 4-16Overview of Materialized Views . 4-16vii
Characteristics of Materialized Views.Refresh Methods for Materialized Views .Query Rewrite.Overview of Sequences.Sequence Characteristics .Concurrent Access to Sequences.Overview of Dimensions.Hierarchical Structure of a Dimension.Creation of Dimensions.Overview of Synonyms.4-174-184-194-204-204-204-214-214-214-225 Data IntegrityIntroduction to Data Integrity. 5-1Techniques for Guaranteeing Data Integrity . 5-1Advantages of Integrity Constraints . 5-1Types of Integrity Constraints. 5-2NOT NULL Integrity Constraints. 5-3Unique Constraints . 5-3Primary Key Constraints. 5-5Foreign Key Constraints. 5-6Self-Referential Integrity Constraints. 5-7Nulls and Foreign Keys. 5-8Parent Key Modifications and Foreign Keys . 5-8Indexes and Foreign Keys. 5-9Check Constraints . 5-10States of Integrity Constraints . 5-10Checks for Modified and Existing Data. 5-10Deferrable Constraints. 5-11Nondeferrable Constraints . 5-11Deferrable Constraints . 5-11Examples of Constraint Checking . 5-12Insertion of a Value in a Foreign Key Column When No Parent Key Value Exists. 5-12An Update of All Foreign Key and Parent Key Values. 5-136 Data Dictionary and Dynamic Performance ViewsOverview of the Data Dictionary .Contents of the Data Dictionary .Views with the Prefix DBA .Views with the Prefix ALL .Views with the Prefix USER .The DUAL Table .Storage of the Data Dictionary .How Oracle Database Uses the Data Dictionary .Public Synonyms for Data Dictionary Views .Cache the Data Dictionary for Fast Access.Other Programs and the Data Dictionary .Overview of the Dynamic Performance Views .viii6-16-26-36-36-46-46-46-46-56-56-56-5
Contents of the Dynamic Performance Views . 6-6Storage of the Dynamic Performance Views. 6-6Database Object Metadata. 6-6Part II Oracle Data Access7SQLIntroduction to SQL . 7-1SQL Data Access. 7-1SQL Standards . 7-2Overview of SQL Statements. 7-3Data Definition Language (DDL) Statements . 7-3Data Manipulation Language (DML) Statements . 7-4SELECT Statements . 7-5Joins. 7-6Subqueries and Implicit Queries . 7-7Transaction Control Statements. 7-8Session Control Statements. 7-8System Control Statement. 7-9Embedded SQL Statements . 7-9Overview of the Optimizer . 7-10Use of the Optimizer. 7-10Optimizer Components. 7-11Query Transformer . 7-11Estimator . 7-12Plan Generator. 7-12Access Paths . 7-12Optimizer Statistics . 7-13Optimizer Hints. 7-14Overview of SQL Processing .
viii Characteristics of Materialized Vi