Tải bản đầy đủ (.pdf) (1,078 trang)

Oracle® Database Administrator''''s Guide pdf

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

Oracle® Database
Administrator's Guide
10g Release 1 (10.1)
Part No. B10739-01
December 2003
Oracle Database Administrator’s Guide, 10g Release 1 (10.1)
Part No. B10739-01
Copyright © 2001, 2003 Oracle. All rights reserved.
Primary Author: Ruth Baylis
Contributing Authors: Paul Lane, Diana Lorentz
Contributors: David Austin, Mark Bauer, Eric Belden, Allen Brumm, Mark Dilman, Harvey Eneman,
Amit Ganesh, Carolyn Gray, Joan Gregoire, Daniela Hansell, Wei Huang, Robert Jenkins, Sushil Kumar,
Bill Lee, Yunrui Li, Rich Long, Catherine Luu, Mughees Minhas, Valarie Moore, Sujatha Muthulingam,
Gary Ngai, Waleed Ojeil, Rod Payne, Ananth Raghavan, Ann Rhee, Jags Srinivasan, Anh-Tuan Tran,
Vikarm Shukla, Deborah Steiner, Janet Stern, Michael Stewart, Alex Tsukerman, Kothanda
Umamageswaran, Daniel Wong, Wanli Yang
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 is a registered trademark 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.
iii
Contents
Send Us Your Comments xxxi
Preface xxxiii
Audience xxxiv
Organization xxxiv
Related Documentation xxxviii
Conventions xxxix
Documentation Accessibility xliv
What's New in the Oracle Database 10g Administrator's Guide? xlvii
Oracle Database 10g Release 1 (10.1) New Features xlvii

Volume 1
Part I Basic Database Administration
1 Overview of Administering an Oracle Database
Types of Oracle Database Users 1-1
Database Administrators 1-2
Security Officers 1-3
Network Administrators 1-3
Application Developers 1-3
Application Administrators 1-4
Database Users 1-4
iv
Tasks of a Database Administrator 1-4
Task 1: Evaluate the Database Server Hardware 1-5
Task 2: Install the Oracle Database Software 1-5
Task 3: Plan the Database 1-5
Task 4: Create and Open the Database 1-6
Task 5: Back Up the Database 1-7
Task 6: Enroll System Users 1-7
Task 7: Implement the Database Design 1-7
Task 8: Back Up the Fully Functional Database 1-7
Task 9: Tune Database Performance 1-7
Identifying Your Oracle Database Software Release 1-8
Release Number Format 1-8
Checking Your Current Release Number 1-9
Database Administrator Security and Privileges 1-10
The Database Administrator's Operating System Account 1-10
Database Administrator Usernames 1-10
Database Administrator Authentication 1-12
Administrative Privileges 1-12
Selecting an Authentication Method 1-15

Using Operating System Authentication 1-17
Using Password File Authentication 1-18
Creating and Maintaining a Password File 1-20
Using ORAPWD 1-20
Setting REMOTE_LOGIN_ PASSWORDFILE 1-22
Adding Users to a Password File 1-22
Maintaining a Password File 1-24
Server Manageability 1-26
Automatic Manageability Features 1-26
Data Utilities 1-28
2 Creating an Oracle Database
Deciding How to Create an Oracle Database 2-2
Manually Creating an Oracle Database 2-2
Considerations Before Creating the Database 2-3
Creating the Database 2-5
Understanding the CREATE DATABASE Statement 2-14
v
Protecting Your Database: Specifying Passwords for Users SYS and SYSTEM 2-15
Creating a Locally Managed SYSTEM Tablespace 2-15
Creating the SYSAUX Tablespace 2-17
Using Automatic Undo Management: Creating an Undo Tablespace 2-19
Creating a Default Permanent Tablespace 2-20
Creating a Default Temporary Tablespace 2-20
Specifying Oracle-Managed Files at Database Creation 2-21
Supporting Bigfile Tablespaces During Database Creation 2-23
Specifying the Database Time Zone and Time Zone File 2-25
Specifying FORCE LOGGING Mode 2-26
Initialization Parameters and Database Creation 2-27
Determining the Global Database Name 2-28
Specifying a Flash Recovery Area 2-29

Specifying Control Files 2-30
Specifying Database Block Sizes 2-31
Managing the System Global Area (SGA) 2-32
Specifying the Maximum Number of Processes 2-42
Specifying the Method of Undo Space Management 2-42
The COMPATIBLE Initialization Parameter and Irreversible Compatibility 2-43
Setting the License Parameter 2-44
Troubleshooting Database Creation 2-44
Dropping a Database 2-45
Managing Initialization Parameters Using a Server Parameter File 2-45
What Is a Server Parameter File? 2-46
Migrating to a Server Parameter File 2-46
Creating a Server Parameter File 2-47
The SPFILE Initialization Parameter 2-49
Using ALTER SYSTEM to Change Initialization Parameter Values 2-49
Exporting the Server Parameter File 2-51
Backing Up the Server Parameter File 2-52
Errors and Recovery for the Server Parameter File 2-52
Viewing Parameter Settings 2-53
Defining Application Services for Oracle Database 10g 2-53
Deploying Services 2-54
Configuring Services 2-55
vi
Using Services 2-56
Considerations After Creating a Database 2-57
Some Security Considerations 2-57
Installing the Oracle Database Sample Schemas 2-60
Viewing Information About the Database 2-60
3 Starting Up and Shutting Down
Starting Up a Database 3-1

Options for Starting Up a Database 3-2
Preparing to Start an Instance 3-3
Using SQL*Plus to Start Up a Database 3-3
Starting an Instance: Scenarios 3-5
Altering Database Availability 3-9
Mounting a Database to an Instance 3-9
Opening a Closed Database 3-9
Opening a Database in Read-Only Mode 3-10
Restricting Access to an Open Database 3-10
Shutting Down a Database 3-11
Shutting Down with the NORMAL Clause 3-11
Shutting Down with the IMMEDIATE Clause 3-12
Shutting Down with the TRANSACTIONAL Clause 3-12
Shutting Down with the ABORT Clause 3-13
Quiescing a Database 3-14
Placing a Database into a Quiesced State 3-15
Restoring the System to Normal Operation 3-16
Viewing the Quiesce State of an Instance 3-16
Suspending and Resuming a Database 3-16
4 Managing Oracle Database Processes
About Dedicated and Shared Server Processes 4-1
Dedicated Server Processes 4-2
Shared Server Processes 4-3
Configuring Oracle Database for Shared Server 4-5
Initialization Parameters for Shared Server 4-6
Enabling Shared Server 4-6
Configuring Dispatchers 4-9
vii
Monitoring Shared Server 4-16
About Oracle Database Background Processes 4-17

Managing Processes for Parallel SQL Execution 4-19
About Parallel Execution Servers 4-20
Altering Parallel Execution for a Session 4-21
Managing Processes for External Procedures 4-22
Terminating Sessions 4-23
Identifying Which Session to Terminate 4-23
Terminating an Active Session 4-24
Terminating an Inactive Session 4-24
Monitoring the Operation of Your Database 4-25
Server-Generated Alerts 4-25
Monitoring the Database Using Trace Files and the Alert File 4-29
Monitoring Locks 4-32
Monitoring Wait Events 4-33
Process and Session Views 4-33
Part II Oracle Database Structure and Storage
5 Managing Control Files
What Is a Control File? 5-1
Guidelines for Control Files 5-2
Provide Filenames for the Control Files 5-2
Multiplex Control Files on Different Disks 5-3
Back Up Control Files 5-3
Manage the Size of Control Files 5-4
Creating Control Files 5-4
Creating Initial Control Files 5-4
Creating Additional Copies, Renaming, and Relocating Control Files 5-5
Creating New Control Files 5-5
Troubleshooting After Creating Control Files 5-9
Checking for Missing or Extra Files 5-9
Handling Errors During CREATE CONTROLFILE 5-10
Backing Up Control Files 5-10

Recovering a Control File Using a Current Copy 5-10
viii
Recovering from Control File Corruption Using a Control File Copy 5-10
Recovering from Permanent Media Failure Using a Control File Copy 5-11
Dropping Control Files 5-11
Displaying Control File Information 5-12
6 Managing the Redo Log
What Is the Redo Log? 6-1
Redo Threads 6-2
Redo Log Contents 6-2
How Oracle Database Writes to the Redo Log 6-3
Planning the Redo Log 6-5
Multiplexing Redo Log Files 6-5
Placing Redo Log Members on Different Disks 6-9
Setting the Size of Redo Log Members 6-9
Choosing the Number of Redo Log Files 6-9
Controlling Archive Lag 6-10
Creating Redo Log Groups and Members 6-12
Creating Redo Log Groups 6-12
Creating Redo Log Members 6-13
Relocating and Renaming Redo Log Members 6-14
Dropping Redo Log Groups and Members 6-15
Dropping Log Groups 6-16
Dropping Redo Log Members 6-17
Forcing Log Switches 6-18
Verifying Blocks in Redo Log Files 6-18
Clearing a Redo Log File 6-19
Viewing Redo Log Information 6-20
7 Managing Archived Redo Logs
What Is the Archived Redo Log? 7-1

Choosing Between NOARCHIVELOG and ARCHIVELOG Mode 7-2
Running a Database in NOARCHIVELOG Mode 7-3
Running a Database in ARCHIVELOG Mode 7-3
Controlling Archiving 7-5
Setting the Initial Database Archiving Mode 7-5
Changing the Database Archiving Mode 7-5
ix
Performing Manual Archiving 7-6
Adjusting the Number of Archiver Processes 7-7
Specifying the Archive Destination 7-7
Specifying Archive Destinations 7-8
Understanding Archive Destination Status 7-11
Specifying the Mode of Log Transmission 7-12
Normal Transmission Mode 7-12
Standby Transmission Mode 7-13
Managing Archive Destination Failure 7-14
Specifying the Minimum Number of Successful Destinations 7-14
Rearchiving to a Failed Destination 7-17
Controlling Trace Output Generated by the Archivelog Process 7-18
Viewing Information About the Archived Redo Log 7-19
Dynamic Performance Views 7-19
The ARCHIVE LOG LIST Command 7-20
8 Managing Tablespaces
Guidelines for Managing Tablespaces 8-2
Using Multiple Tablespaces 8-2
Assigning Tablespace Quotas to Users 8-3
Creating Tablespaces 8-3
Locally Managed Tablespaces 8-4
Bigfile Tablespaces 8-9
Dictionary-Managed Tablespaces 8-11

Temporary Tablespaces 8-17
Multiple Temporary Tablespaces: Using Tablespace Groups 8-21
Specifying Nonstandard Block Sizes for Tablespaces 8-23
Controlling the Writing of Redo Records 8-24
Altering Tablespace Availability 8-25
Taking Tablespaces Offline 8-25
Bringing Tablespaces Online 8-27
Using Read-Only Tablespaces 8-27
Making a Tablespace Read-Only 8-28
Making a Read-Only Tablespace Writable 8-30
Creating a Read-Only Tablespace on a WORM Device 8-31
Delaying the Opening of Datafiles in Read-Only Tablespaces 8-31
x
Renaming Tablespaces 8-32
Dropping Tablespaces 8-33
Managing the SYSAUX Tablespace 8-34
Monitoring Occupants of the SYSAUX Tablespace 8-35
Moving Occupants Out Of or Into the SYSAUX Tablespace 8-35
Controlling the Size of the SYSAUX Tablespace 8-36
Diagnosing and Repairing Locally Managed Tablespace Problems 8-36
Scenario 1: Fixing Bitmap When Allocated Blocks are Marked Free (No Overlap) 8-38
Scenario 2: Dropping a Corrupted Segment 8-38
Scenario 3: Fixing Bitmap Where Overlap is Reported 8-38
Scenario 4: Correcting Media Corruption of Bitmap Blocks 8-39
Scenario 5: Migrating from a Dictionary-Managed to a Locally Managed Tablespace 8-39
Migrating the SYSTEM Tablespace to a Locally Managed Tablespace 8-40
Transporting Tablespaces Between Databases 8-40
Introduction to Transportable Tablespaces 8-41
About Transporting Tablespaces Across Platforms 8-42
Limitations on Transportable Tablespace Use 8-43

Compatibility Considerations for Transportable Tablespaces 8-44
Transporting Tablespaces Between Databases: A Procedure and Example 8-45
Using Transportable Tablespaces: Scenarios 8-54
Moving Databases Across Platforms Using Transportable Tablespaces 8-58
Viewing Tablespace Information 8-59
Example 1: Listing Tablespaces and Default Storage Parameters 8-60
Example 2: Listing the Datafiles and Associated Tablespaces of a Database 8-60
Example 3: Displaying Statistics for Free Space (Extents) of Each Tablespace 8-61
9 Managing Datafiles and Tempfiles
Guidelines for Managing Datafiles 9-1
Determine the Number of Datafiles 9-2
Determine the Size of Datafiles 9-4
Place Datafiles Appropriately 9-5
Store Datafiles Separate from Redo Log Files 9-5
Creating Datafiles and Adding Datafiles to a Tablespace 9-5
Changing Datafile Size 9-6
Enabling and Disabling Automatic Extension for a Datafile 9-7
Manually Resizing a Datafile 9-8
xi
Altering Datafile Availability 9-8
Bringing Datafiles Online or Taking Offline in ARCHIVELOG Mode 9-9
Taking Datafiles Offline in NOARCHIVELOG Mode 9-10
Altering the Availability of All Datafiles or Tempfiles in a Tablespace 9-10
Renaming and Relocating Datafiles 9-11
Procedures for Renaming and Relocating Datafiles in a Single Tablespace 9-11
Procedure for Renaming and Relocating Datafiles in Multiple Tablespaces 9-14
Dropping Datafiles 9-15
Verifying Data Blocks in Datafiles 9-15
Copying Files Using the Database Server 9-15
Copying a File on a Local File System 9-16

Third-Party File Transfer 9-17
File Transfer and the DBMS_SCHEDULER Package 9-18
Advanced File Transfer Mechanisms 9-19
Mapping Files to Physical Devices 9-19
Overview of Oracle Database File Mapping Interface 9-20
How the Oracle Database File Mapping Interface Works 9-20
Using the Oracle Database File Mapping Interface 9-25
File Mapping Examples 9-29
Viewing Datafile Information 9-32
10 Managing the Undo Tablespace
What Is Undo? 10-1
Introduction to Automatic Undo Management 10-2
Overview of Automatic Undo Management 10-2
Undo Retention 10-4
Retention Guarantee 10-5
Sizing the Undo Tablespace 10-6
Using Auto-Extensible Tablespaces 10-6
Sizing Fixed-Size Undo Tablespaces 10-7
Managing Undo Tablespaces 10-8
Creating an Undo Tablespace 10-9
Altering an Undo Tablespace 10-10
Dropping an Undo Tablespace 10-11
Switching Undo Tablespaces 10-11
Establishing User Quotas for Undo Space 10-12
xii
Monitoring the Undo Tablespace 10-13
Flashback Features and Undo Space 10-15
Flashback Query 10-15
Flashback Versions Query 10-16
Flashback Transaction Query 10-16

Flashback Table 10-17
Migration to Automatic Undo Management 10-17
Best Practices 10-17
Part III Automated File and Storage Management
11 Using Oracle-Managed Files
What Are Oracle-Managed Files? 11-1
Who Can Use Oracle-Managed Files? 11-2
Benefits of Using Oracle-Managed Files 11-3
Oracle-Managed Files and Existing Functionality 11-4
Enabling the Creation and Use of Oracle-Managed Files 11-4
Setting the DB_CREATE_FILE_DEST Initialization Parameter 11-5
Setting the DB_RECOVERY_FILE_DEST Parameter 11-6
Setting the DB_CREATE_ONLINE_LOG_DEST_n Initialization Parameter 11-6
Creating Oracle-Managed Files 11-7
How Oracle-Managed Files Are Named 11-8
Creating Oracle-Managed Files at Database Creation 11-9
Creating Datafiles for Tablespaces Using Oracle-Managed Files 11-15
Creating Tempfiles for Temporary Tablespaces Using Oracle-Managed Files 11-18
Creating Control Files Using Oracle-Managed Files 11-19
Creating Redo Log Files Using Oracle-Managed Files 11-21
Creating Archived Logs Using Oracle-Managed Files 11-22
Behavior of Oracle-Managed Files 11-23
Dropping Datafiles and Tempfiles 11-23
Dropping Redo Log Files 11-24
Renaming Files 11-24
Managing Standby Databases 11-24
Scenarios for Using Oracle-Managed Files 11-24
Scenario 1: Create and Manage a Database with Multiplexed Redo Logs 11-25
xiii
Scenario 2: Create and Manage a Database with Database Area and Flash Recovery Area

11-29
Scenario 3: Adding Oracle-Managed Files to an Existing Database 11-31
12 Using Automatic Storage Management
What Is Automatic Storage Management? 12-1
Overview of the Components of Automatic Storage Management 12-2
Administering an ASM Instance 12-3
Installation of ASM 12-4
Authentication for Accessing an ASM Instance 12-4
Setting Initialization Parameters for an ASM Instance 12-5
Starting Up an ASM Instance 12-7
Shutting Down an ASM Instance 12-10
Disk Group Fixed Tables 12-10
Configuring the Components of Automatic Storage Management 12-10
Considerations and Guidelines for Configuring an ASM Instance 12-11
Creating a Disk Group 12-13
Altering the Disk Membership of a Disk Group 12-15
Mounting and Dismounting Disk Groups 12-20
Managing Disk Group Templates 12-21
Managing Disk Group Directories 12-23
Managing Alias Names for ASM Filenames 12-25
Dropping Files and Associated Aliases from a Disk Group 12-26
Checking Internal Consistency of Disk Group Metadata 12-27
Dropping Disk Groups 12-27
Using Automatic Storage Management in the Database 12-28
What Types of Files Does Automatic Storage Management Support? 12-29
About ASM Filenames 12-30
Starting the ASM and Database Instances 12-34
Creating and Referencing ASM Files in the Database 12-36
Creating a Database Using Automatic Storage Management 12-38
Creating Tablespaces Using Automatic Storage Management 12-39

Creating Redo Logs Using Automatic Storage Management 12-41
Creating a Control File Using Automatic Storage Management 12-41
Creating Archive Log Files Using Automatic Storage Management 12-43
Recovery Manager (RMAN) and Automatic Storage Management 12-43
xiv
Viewing Information About Automatic Storage Management 12-44
Volume 2
Part IV Schema Objects
13 Managing Space for Schema Objects
Managing Space in Data Blocks 13-1
Specifying the PCTFREE Parameter 13-2
Specifying the PCTUSED Parameter 13-5
Selecting Associated PCTUSED and PCTFREE Values 13-7
Specifying the INITRANS Parameter 13-7
Managing Space in Tablespaces 13-9
Managing Storage Parameters 13-10
Identifying the Storage Parameters 13-11
Setting Default Storage Parameters for Objects Created in a Tablespace 13-13
Specifying Storage Parameters at Object Creation 13-13
Setting Storage Parameters for Clusters 13-14
Setting Storage Parameters for Partitioned Tables 13-14
Setting Storage Parameters for Index Segments 13-14
Setting Storage Parameters for LOBs, Varrays, and Nested Tables 13-14
Changing Values of Storage Parameters 13-15
Understanding Precedence in Storage Parameters 13-15
Example of How Storage Parameters Effect Space Allocation 13-16
Managing Resumable Space Allocation 13-17
Resumable Space Allocation Overview 13-17
Enabling and Disabling Resumable Space Allocation 13-21
Using a LOGON Trigger to Set Default Resumable Mode 13-23

Detecting Suspended Statements 13-24
Operation-Suspended Alert 13-26
Resumable Space Allocation Example: Registering an AFTER SUSPEND Trigger 13-26
Reclaiming Unused Space 13-28
Segment Advisor 13-29
Shrinking Database Segments 13-32
Deallocating Unused Space 13-34
xv
Understanding Space Usage of Datatypes 13-34
Displaying Information About Space Usage for Schema Objects 13-35
Using PL/SQL Packages to Display Information About Schema Object Space Usage 13-35
Using Views to Display Information About Space Usage in Schema Objects 13-36
Capacity Planning for Database Objects 13-40
Estimating the Space Use of a Table 13-40
Estimating the Space Use of an Index 13-41
Obtaining Object Growth Trends 13-41
14 Managing Tables
About Tables 14-1
Guidelines for Managing Tables 14-2
Design Tables Before Creating Them 14-3
Consider Your Options for the Type of Table to Create 14-3
Specify How Data Block Space Is to Be Used 14-4
Specify the Location of Each Table 14-5
Consider Parallelizing Table Creation 14-6
Consider Using NOLOGGING When Creating Tables 14-6
Consider Using Table Compression when Creating Tables 14-6
Estimate Table Size and Plan Accordingly 14-7
Restrictions to Consider When Creating Tables 14-7
Creating Tables 14-8
Creating a Table 14-8

Creating a Temporary Table 14-9
Parallelizing Table Creation 14-10
Inserting Data Into Tables Using Direct-Path INSERT 14-11
Advantages of Using Direct-Path INSERT 14-13
Enabling Direct-Path INSERT 14-14
How Direct-Path INSERT Works 14-14
Specifying the Logging Mode for Direct-Path INSERT 14-15
Additional Considerations for Direct-Path INSERT 14-16
Automatically Collecting Statistics on Tables 14-17
Altering Tables 14-18
Reasons for Using the ALTER TABLE Statement 14-19
Altering Physical Attributes of a Table 14-20
Moving a Table to a New Segment or Tablespace 14-20
xvi
Manually Allocating Storage for a Table 14-21
Modifying an Existing Column Definition 14-21
Adding Table Columns 14-22
Renaming Table Columns 14-22
Dropping Table Columns 14-23
Redefining Tables Online 14-24
Features of Online Table Redefinition 14-25
The DBMS_REDEFINITION Package 14-25
Steps for Online Redefinition of Tables 14-26
Intermediate Synchronization 14-30
Terminate and Clean Up After Errors 14-30
Example of Online Table Redefinition 14-30
Restrictions for Online Redefinition of Tables 14-32
Auditing Table Changes Using Flashback Transaction Query 14-33
Recovering Tables Using the Flashback Table Feature 14-34
Dropping Tables 14-35

Using Flashback Drop and Managing the Recycle Bin 14-36
What Is the Recycle Bin? 14-36
Renaming Objects in the Recycle Bin 14-37
Viewing and Querying Objects in the Recycle Bin 14-38
Purging Objects in the Recycle Bin 14-38
Restoring Tables from the Recycle Bin 14-39
Managing Index-Organized Tables 14-40
What Are Index-Organized Tables? 14-41
Creating Index-Organized Tables 14-42
Maintaining Index-Organized Tables 14-47
Creating Secondary Indexes on Index-Organized Tables 14-49
Analyzing Index-Organized Tables 14-51
Using the ORDER BY Clause with Index-Organized Tables 14-52
Converting Index-Organized Tables to Regular Tables 14-52
Managing External Tables 14-53
Creating External Tables 14-54
Altering External Tables 14-58
Dropping External Tables 14-60
System and Object Privileges for External Tables 14-60
xvii
Viewing Information About Tables 14-60
15 Managing Indexes
About Indexes 15-1
Guidelines for Managing Indexes 15-2
Create Indexes After Inserting Table Data 15-3
Index the Correct Tables and Columns 15-3
Order Index Columns for Performance 15-4
Limit the Number of Indexes for Each Table 15-5
Drop Indexes That Are No Longer Required 15-5
Specify Index Block Space Use 15-5

Estimate Index Size and Set Storage Parameters 15-6
Specify the Tablespace for Each Index 15-6
Consider Parallelizing Index Creation 15-6
Consider Creating Indexes with NOLOGGING 15-7
Consider Costs and Benefits of Coalescing or Rebuilding Indexes 15-7
Consider Cost Before Disabling or Dropping Constraints 15-9
Creating Indexes 15-9
Creating an Index Explicitly 15-10
Creating a Unique Index Explicitly 15-10
Creating an Index Associated with a Constraint 15-11
Collecting Incidental Statistics when Creating an Index 15-12
Creating a Large Index 15-13
Creating an Index Online 15-13
Creating a Function-Based Index 15-14
Creating a Key-Compressed Index 15-16
Altering Indexes 15-16
Altering Storage Characteristics of an Index 15-17
Rebuilding an Existing Index 15-18
Monitoring Index Usage 15-18
Monitoring Space Use of Indexes 15-19
Dropping Indexes 15-20
Viewing Index Information 15-21
16 Managing Partitioned Tables and Indexes
About Partitioned Tables and Indexes 16-1
xviii
Partitioning Methods 16-3
When to Use Range Partitioning 16-3
When to Use Hash Partitioning 16-4
When to Use List Partitioning 16-5
When to Use Composite Range-Hash Partitioning 16-7

When to Use Composite Range-List Partitioning 16-8
Creating Partitioned Tables 16-10
Creating Range-Partitioned Tables and Global Indexes 16-11
Creating Hash-Partitioned Tables and Global Indexes 16-12
Creating List-Partitioned Tables 16-14
Creating Composite Range-Hash Partitioned Tables 16-15
Creating Composite Range-List Partitioned Tables 16-16
Using Subpartition Templates to Describe Composite Partitioned Tables 16-18
Using Multicolumn Partitioning Keys 16-20
Using Table Compression with Partitioned Tables 16-24
Using Key Compression with Partitioned Indexes 16-24
Creating Partitioned Index-Organized Tables 16-25
Partitioning Restrictions for Multiple Block Sizes 16-27
Maintaining Partitioned Tables 16-28
Updating Indexes Automatically 16-32
Adding Partitions 16-34
Coalescing Partitions 16-38
Dropping Partitions 16-40
Exchanging Partitions 16-43
Merging Partitions 16-45
Modifying Default Attributes 16-50
Modifying Real Attributes of Partitions 16-51
Modifying List Partitions: Adding Values 16-53
Modifying List Partitions: Dropping Values 16-54
Modifying a Subpartition Template 16-55
Moving Partitions 16-55
Rebuilding Index Partitions 16-57
Renaming Partitions 16-59
Splitting Partitions 16-59
Truncating Partitions 16-66

xix
Partitioned Tables and Indexes Example 16-69
Viewing Information About Partitioned Tables and Indexes 16-70
17 Managing Clusters
About Clusters 17-1
Guidelines for Managing Clusters 17-4
Choose Appropriate Tables for the Cluster 17-4
Choose Appropriate Columns for the Cluster Key 17-4
Specify Data Block Space Use 17-5
Specify the Space Required by an Average Cluster Key and Its Associated Rows 17-5
Specify the Location of Each Cluster and Cluster Index Rows 17-6
Estimate Cluster Size and Set Storage Parameters 17-6
Creating Clusters 17-7
Creating Clustered Tables 17-7
Creating Cluster Indexes 17-8
Altering Clusters 17-9
Altering Clustered Tables 17-10
Altering Cluster Indexes 17-10
Dropping Clusters 17-10
Dropping Clustered Tables 17-11
Dropping Cluster Indexes 17-12
Viewing Information About Clusters 17-12
18 Managing Hash Clusters
About Hash Clusters 18-1
When to Use Hash Clusters 18-2
Situations Where Hashing Is Useful 18-2
Situations Where Hashing Is Not Advantageous 18-3
Creating Hash Clusters 18-3
Creating a Sorted Hash Cluster 18-4
Creating Single-Table Hash Clusters 18-5

Controlling Space Use Within a Hash Cluster 18-6
Estimating Size Required by Hash Clusters 18-9
Altering Hash Clusters 18-9
Dropping Hash Clusters 18-10
Viewing Information About Hash Clusters 18-10
xx
19 Managing Views, Sequences, and Synonyms
Managing Views 19-1
About Views 19-2
Creating Views 19-2
Replacing Views 19-4
Using Views in Queries 19-5
Updating a Join View 19-7
Altering Views 19-16
Dropping Views 19-16
Managing Sequences 19-16
About Sequences 19-17
Creating Sequences 19-17
Altering Sequences 19-18
Using Sequences 19-18
Dropping Sequences 19-22
Managing Synonyms 19-23
About Synonyms 19-23
Creating Synonyms 19-23
Using Synonyms in DML Statements 19-24
Dropping Synonyms 19-24
Viewing Information About Views, Synonyms, and Sequences 19-25
20 General Management of Schema Objects
Creating Multiple Tables and Views in a Single Operation 20-1
Analyzing Tables, Indexes, and Clusters 20-2

Using DBMS_STATS to Collect Table and Index Statistics 20-3
Validating Tables, Indexes, Clusters, and Materialized Views 20-4
Listing Chained Rows of Tables and Clusters 20-5
Truncating Tables and Clusters 20-7
Using DELETE 20-7
Using DROP and CREATE 20-8
Using TRUNCATE 20-8
Enabling and Disabling Triggers 20-9
Enabling Triggers 20-11
Disabling Triggers 20-11
xxi
Managing Integrity Constraints 20-12
Integrity Constraint States 20-12
Setting Integrity Constraints Upon Definition 20-15
Modifying, Renaming, or Dropping Existing Integrity Constraints 20-16
Deferring Constraint Checks 20-18
Reporting Constraint Exceptions 20-19
Viewing Constraint Information 20-21
Renaming Schema Objects 20-21
Managing Object Dependencies 20-22
Manually Recompiling Views 20-24
Manually Recompiling Procedures and Functions 20-24
Manually Recompiling Packages 20-25
Managing Object Name Resolution 20-25
Switching to a Different Schema 20-27
Displaying Information About Schema Objects 20-28
Using a PL/SQL Package to Display Information About Schema Objects 20-28
Using Views to Display Information About Schema Objects 20-29
21 Detecting and Repairing Data Block Corruption
Options for Repairing Data Block Corruption 21-1

About the DBMS_REPAIR Package 21-2
DBMS_REPAIR Procedures 21-2
Limitations and Restrictions 21-3
Using the DBMS_REPAIR Package 21-3
Task 1: Detect and Report Corruptions 21-3
Task 2: Evaluate the Costs and Benefits of Using DBMS_REPAIR 21-5
Task 3: Make Objects Usable 21-6
Task 4: Repair Corruptions and Rebuild Lost Data 21-7
DBMS_REPAIR Examples 21-8
Using ADMIN_TABLES to Build a Repair Table or Orphan Key Table 21-8
Using the CHECK_OBJECT Procedure to Detect Corruption 21-10
Fixing Corrupt Blocks with the FIX_CORRUPT_BLOCKS Procedure 21-11
Finding Index Entries Pointing into Corrupt Data Blocks: DUMP_ORPHAN_KEYS 21-12
Rebuilding Free Lists Using the REBUILD_FREELISTS Procedure 21-13
Enabling or Disabling the Skipping of Corrupt Blocks: SKIP_CORRUPT_BLOCKS 21-13
xxii
Part V Database Security
22 Managing Users and Securing the Database
The Importance of Establishing a Security Policy for Your Database 22-1
Managing Users and Resources 22-2
Managing User Privileges and Roles 22-2
Auditing Database Use 22-3
Part VI Database Resource Management and Task Scheduling
23 Managing Automatic System Tasks Using the Maintenance Window
Maintenance Windows 23-1
Automatic Statistics Collection Job 23-2
Resource Management 23-3
24 Using the Database Resource Manager
What Is the Database Resource Manager? 24-2
What Problems Does the Database Resource Manager Address? 24-2

How Does the Database Resource Manager Address These Problems? 24-2
What Are the Elements of the Database Resource Manager? 24-3
Understanding Resource Plans 24-4
Administering the Database Resource Manager 24-8
Creating a Simple Resource Plan 24-10
Creating Complex Resource Plans 24-12
Using the Pending Area for Creating Plan Schemas 24-12
Creating Resource Plans 24-15
Creating Resource Consumer Groups 24-17
Specifying Resource Plan Directives 24-19
Managing Resource Consumer Groups 24-23
Assigning an Initial Resource Consumer Group 24-23
Changing Resource Consumer Groups 24-24
Managing the Switch Privilege 24-26
Automatically Assigning Resource Consumer Groups to Sessions 24-27
Enabling the Database Resource Manager 24-31
Putting It All Together: Database Resource Manager Examples 24-32
Multilevel Schema Example 24-32
xxiii
Example of Using Several Resource Allocation Methods 24-34
An Oracle-Supplied Plan 24-35
Monitoring and Tuning the Database Resource Manager 24-36
Creating the Environment 24-36
Why Is This Necessary to Produce Expected Results? 24-37
Monitoring Results 24-37
Interaction with Operating-System Resource Control 24-38
Guidelines for Using Operating-System Resource Control 24-38
Dynamic Reconfiguration 24-39
Viewing Database Resource Manager Information 24-39
Viewing Consumer Groups Granted to Users or Roles 24-41

Viewing Plan Schema Information 24-41
Viewing Current Consumer Groups for Sessions 24-42
Viewing the Currently Active Plans 24-42
25 Moving from DBMS_JOB to DBMS_SCHEDULER
Moving from DBMS_JOB to DBMS_SCHEDULER 25-1
Creating a Job 25-1
Altering a Job 25-2
Removing a Job from the Job Queue 25-3
26 Overview of Scheduler Concepts
Overview of the Scheduler 26-1
What Can the Scheduler Do? 26-2
Basic Scheduler Concepts 26-4
General Rules for all Database Objects 26-4
Programs 26-5
Schedules 26-5
Jobs 26-6
How Programs, Jobs, and Schedules are Related 26-6
Advanced Scheduler Concepts 26-8
Job Classes 26-8
Windows 26-9
Window Groups 26-11
Scheduler Architecture 26-12
The Job Table 26-12
xxiv
The Job Coordinator 26-13
How Jobs Execute 26-13
Job Slaves 26-14
Using the Scheduler in RAC Environments 26-14
27 Using the Scheduler
Scheduler Objects and Their Naming 27-1

Administering Jobs 27-2
Job Tasks and Their Procedures 27-2
Creating Jobs 27-3
Copying Jobs 27-6
Altering Jobs 27-6
Running Jobs 27-7
Stopping Jobs 27-9
Dropping Jobs 27-10
Disabling Jobs 27-11
Enabling Jobs 27-11
Administering Programs 27-12
Program Tasks and Their Procedures 27-12
Creating Programs 27-13
Altering Programs 27-15
Dropping Programs 27-15
Disabling Programs 27-16
Enabling Programs 27-16
Administering Schedules 27-17
Schedule Tasks and Their Procedures 27-17
Creating Schedules 27-18
Altering Schedules 27-18
Dropping Schedules 27-19
Setting the Repeat Interval 27-19
Administering Job Classes 27-24
Job Class Tasks and Their Procedures 27-24
Creating Job Classes 27-24
Altering Job Classes 27-25
Dropping Job Classes 27-25
Administering Windows 27-26
xxv

Window Tasks and Their Procedures 27-27
Creating Windows 27-27
Altering Windows 27-29
Opening Windows 27-29
Closing Windows 27-30
Dropping Windows 27-31
Disabling Windows 27-32
Enabling Windows 27-33
Overlapping Windows 27-33
Window Logging 27-37
Administering Window Groups 27-37
Window Group Tasks and Their Procedures 27-37
Creating Window Groups 27-38
Dropping Window Groups 27-38
Adding a Member to a Window Group 27-39
Dropping a Member from a Window Group 27-40
Enabling a Window Group 27-40
Disabling a Window Group 27-41
Allocating Resources Among Jobs 27-41
Allocating Resources Among Jobs Using Resource Manager 27-42
Example of Resource Allocation for Jobs 27-43
28 Administering the Scheduler
Configuring the Scheduler 28-1
Monitoring and Managing the Scheduler 28-7
How to View Scheduler Information 28-8
How to View the Currently Active Window and Resource Plan 28-9
How to View Scheduler Privileges 28-9
How to Find Information About Currently Running Jobs 28-10
How the Job Coordinator Works 28-11
How to Monitor and Manage Window and Job Logs 28-12

How to Manage Scheduler Privileges 28-16
How to Drop a Job 28-19
How to Drop a Running Job 28-19
Why Does a Job Not Run? 28-20
How to Change Job Priorities 28-21

×