3-16 4 Managing Oracle Database Processes About Dedicated and Shared Server Processes.... 4-33 Part II Oracle Database Structure and Storage 5 Managing Control Files What Is a Control Fi
Trang 110g Release 1 (10.1)
Part No B10739-01
December 2003
Trang 2Copyright © 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
Trang 3Send 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
Trang 4Task 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
Trang 5Creating 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
Trang 6Some 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
Trang 7Managing 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
Trang 8Dropping 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
Trang 9Specifying 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
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
Trang 10Managing 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
Trang 11Taking 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
Trang 12Flashback 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
Trang 13Scenario 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
Trang 14Volume 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
Trang 15Using 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
Trang 16Adding 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
Trang 17About 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
Trang 18When 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
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
Trang 1917 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
Trang 20About Views 19-2
Creating Views 19-2
Replacing Views 19-4
Using Views in Queries 19-5
Updating a Join View 19-7
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
Trang 21Setting 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
Trang 2222 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
Trang 23Monitoring 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
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
Trang 24Job Slaves 26-14
Using the Scheduler in RAC Environments 26-14
27 Using the Scheduler
Scheduler Objects and Their Naming 27-1
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
Trang 25Administering 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
Trang 26How to Manage the Scheduler in a RAC Environment 28-22
Import/Export and the Scheduler 28-22
Examples of Using the Scheduler 28-23
Examples of Creating Jobs 28-23
Examples of Creating Job Classes 28-24
Examples of Creating Programs 28-25
Examples of Creating Windows 28-26
Example of Creating Window Groups 28-27
Examples of Setting Attributes 28-28
Part VII Distributed Database Management
29 Distributed Database Concepts
Distributed Database Architecture 29-1
Homogenous Distributed Database Systems 29-2
Heterogeneous Distributed Database Systems 29-5
Client/Server Database Architecture 29-6
Database Links 29-8
What Are Database Links? 29-8
What Are Shared Database Links? 29-10
Why Use Database Links? 29-11
Global Database Names in Database Links 29-12
Names for Database Links 29-14
Types of Database Links 29-15
Users of Database Links 29-16
Creation of Database Links: Examples 29-20
Schema Objects and Database Links 29-21
Database Link Restrictions 29-23
Distributed Database Administration 29-24
Site Autonomy 29-24
Distributed Database Security 29-25
Auditing Database Links 29-31
Trang 27Distributed SQL Statements 29-34
Shared SQL for Remote and Distributed Statements 29-35
Remote Transactions 29-35
Distributed Transactions 29-35
Two-Phase Commit Mechanism 29-36
Database Link Name Resolution 29-36
Schema Object Name Resolution 29-39
Global Name Resolution in Views, Synonyms, and Procedures 29-42
Distributed Database Application Development 29-44
Transparency in a Distributed Database System 29-45
Remote Procedure Calls (RPCs) 29-47
Distributed Query Optimization 29-47
Character Set Support for Distributed Environments 29-48
Client/Server Environment 29-49
Homogeneous Distributed Environment 29-49
Heterogeneous Distributed Environment 29-50
30 Managing a Distributed Database
Managing Global Names in a Distributed System 30-1
Understanding How Global Database Names Are Formed 30-2
Determining Whether Global Naming Is Enforced 30-2
Viewing a Global Database Name 30-3
Changing the Domain in a Global Database Name 30-4
Changing a Global Database Name: Scenario 30-4
Creating Database Links 30-8
Obtaining Privileges Necessary for Creating Database Links 30-8
Specifying Link Types 30-9
Specifying Link Users 30-11
Using Connection Qualifiers to Specify Service Names Within Link Names 30-13
Using Shared Database Links 30-14
Determining Whether to Use Shared Database Links 30-14
Creating Shared Database Links 30-15
Configuring Shared Database Links 30-16
Managing Database Links 30-18
Trang 28Limiting the Number of Active Database Link Connections 30-20
Viewing Information About Database Links 30-21
Determining Which Links Are in the Database 30-21
Determining Which Link Connections Are Open 30-24
Creating Location Transparency 30-26
Using Views to Create Location Transparency 30-26
Using Synonyms to Create Location Transparency 30-28
Using Procedures to Create Location Transparency 30-30
Managing Statement Transparency 30-32
Managing a Distributed Database: Examples 30-34
Example 1: Creating a Public Fixed User Database Link 30-34
Example 2: Creating a Public Fixed User Shared Database Link 30-35
Example 3: Creating a Public Connected User Database Link 30-35
Example 4: Creating a Public Connected User Shared Database Link 30-36
Example 5: Creating a Public Current User Database Link 30-37
31 Developing Applications for a Distributed Database System
Managing the Distribution of Application Data 31-1
Controlling Connections Established by Database Links 31-2
Maintaining Referential Integrity in a Distributed System 31-2
Tuning Distributed Queries 31-3
Using Collocated Inline Views 31-4
Using Cost-Based Optimization 31-4
Using Hints 31-7
Analyzing the Execution Plan 31-9
Handling Errors in Remote Procedures 31-11
32 Distributed Transactions Concepts
What Are Distributed Transactions? 32-1
DML and DDL Transactions 32-3
Transaction Control Statements 32-3
Session Trees for Distributed Transactions 32-4
Trang 29Commit Point Site 32-6
Two-Phase Commit Mechanism 32-10
Prepare Phase 32-11
Commit Phase 32-14
Forget Phase 32-15
In-Doubt Transactions 32-16
Automatic Resolution of In-Doubt Transactions 32-16
Manual Resolution of In-Doubt Transactions 32-19
Relevance of System Change Numbers for In-Doubt Transactions 32-19
Distributed Transaction Processing: Case Study 32-20
Stage 1: Client Application Issues DML Statements 32-20
Stage 2: Oracle Database Determines Commit Point Site 32-22
Stage 3: Global Coordinator Sends Prepare Response 32-22
Stage 4: Commit Point Site Commits 32-23
Stage 5: Commit Point Site Informs Global Coordinator of Commit 32-24
Stage 6: Global and Local Coordinators Tell All Nodes to Commit 32-24
Stage 7: Global Coordinator and Commit Point Site Complete the Commit 32-25
33 Managing Distributed Transactions
Specifying the Commit Point Strength of a Node 33-1
Naming Transactions 33-2
Viewing Information About Distributed Transactions 33-3
Determining the ID Number and Status of Prepared Transactions 33-3
Tracing the Session Tree of In-Doubt Transactions 33-5
Deciding How to Handle In-Doubt Transactions 33-7
Discovering Problems with a Two-Phase Commit 33-7
Determining Whether to Perform a Manual Override 33-8
Analyzing the Transaction Data 33-9
Manually Overriding In-Doubt Transactions 33-10
Manually Committing an In-Doubt Transaction 33-10
Manually Rolling Back an In-Doubt Transaction 33-11
Purging Pending Rows from the Data Dictionary 33-12
Executing the PURGE_LOST_DB_ENTRY Procedure 33-13
Determining When to Use DBMS_TRANSACTION 33-13
Trang 30Step 2: Query DBA_2PC_PENDING 33-15
Step 3: Query DBA_2PC_NEIGHBORS on Local Node 33-17
Step 4: Querying Data Dictionary Views on All Nodes 33-19
Step 5: Commit the In-Doubt Transaction 33-21
Step 6: Check for Mixed Outcome Using DBA_2PC_PENDING 33-22
Data Access Failures Due to Locks 33-22
Transaction Timeouts 33-23
Locks from In-Doubt Transactions 33-23
Simulating Distributed Transaction Failure 33-23
Forcing a Distributed Transaction to Fail 33-24
Disabling and Enabling RECO 33-25
Managing Read Consistency 33-25
Index
Trang 31Oracle Database Administrator’s Guide 10g Release 1 (10.1)
Part No B10739-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 title andpart number of the documentation and the chapter, section, and page number (if available) You cansend comments to us in the following ways:
■ Electronic mail: infodev_us@oracle.com
■ FAX: (650) 506-7227 Attn: Server Technologies Documentation Manager
■ Postal service:
Oracle Corporation
Server Technologies Documentation
500 Oracle Parkway, Mailstop 4op11
Trang 33This guide is for people who administer the operation of an Oracle Database
system Referred to as database administrators (DBAs), they are responsible forcreating Oracle Database, ensuring its smooth operation, and monitoring its use.This preface contains these topics:
Note: The Oracle Database Administrator's Guide contains
information that describes the features and functionality of the
Oracle Database Standard Edition, Oracle Database Enterprise
Edition, and Oracle Database Personal Edition products These
products have the same basic features However, several advanced
features are available only with the Oracle Database Enterprise
Edition or Oracle Database Personal Edition, and some of these are
optional For example, to create partitioned tables and indexes, you
must have the Oracle Database Enterprise Edition or Oracle
Database Personal Edition
For information about the differences between the various editions
of Oracle Database and the features and options that are available
to you, please refer to Oracle Database New Features.
Trang 34They are also assumed to be familiar with the operating system environment underwhich they are running Oracle Database.
Readers Interested in Installation and Upgrade Information
Administrators frequently participate in installing the Oracle Database serversoftware and upgrading an existing Oracle Database to newer formats (for example,
Oracle9i database to Oracle Database 10g format) This guide is not an installation
or upgrade manual
If your primary interest is installation, see your operating system specific Oracleinstallation guide
If your primary interest is upgrading a database or application, see the Oracle
Database Upgrade Guide.
Readers Interested in Application Design Information
In addition to administrators, experienced users of Oracle Database and advanceddatabase application designers might also find information in this guide useful
However, database application developers should also see the Oracle Database
Application Developer's Guide - Fundamentals and the documentation for the tool or
language product they are using to develop Oracle Database applications
Organization
This document contains:
Part I, "Basic Database Administration"
Chapter 1, "Overview of Administering an Oracle Database"
This chapter serves as a general introduction to typical tasks performed by databaseadministrators, such as installing software and planning a database
Chapter 2, "Creating an Oracle Database"
This chapter discusses considerations for creating a database and takes you throughthe steps of creating one Consult this chapter when in the database planning and
Trang 35shut it down Parameter files related to starting up and shutting down are alsodescribed here.
Chapter 4, "Managing Oracle Database Processes"
This chapter helps you to identify different Oracle Database processes, such asdedicated server processes and shared server processes Consult this chapter whenconfiguring, modifying, tracking and managing processes
Part II, "Oracle Database Structure and Storage"
Chapter 5, "Managing Control Files"
This chapter describes all aspects of managing control files: naming, creating,troubleshooting, and dropping control files
Chapter 6, "Managing the Redo Log"
This chapter describes all aspects of managing the online redo log: planning,
creating, renaming, dropping, or clearing redo log files
Chapter 7, "Managing Archived Redo Logs"
Consult this chapter for information about archive modes and tuning archiving
Chapter 8, "Managing Tablespaces"
This chapter provides guidelines to follow as you manage tablespaces, and
describes how to create, manage, alter, drop and move data between tablespaces
Chapter 9, "Managing Datafiles and Tempfiles"
This chapter provides guidelines to follow as you manage datafiles, and describeshow to create, change, alter, rename and view information about datafiles
Chapter 10, "Managing the Undo Tablespace"
Consult this chapter to learn how to manage undo space using an undo tablespace
Trang 36Chapter 11, "Using Oracle-Managed Files"
This chapter describes how you can direct the Oracle Database server to create andmanage your database files
Chapter 12, "Using Automatic Storage Management"
This chapter briefly discusses some of the concepts behind Automatic StorageManagement and describes how to use it
Part IV, "Schema Objects"
Chapter 13, "Managing Space for Schema Objects"
Consult this chapter for descriptions of common tasks, such as setting storageparameters, deallocating space and managing space
Chapter 14, "Managing Tables"
Consult this chapter for general table management guidelines, as well asinformation about creating, altering, maintaining and dropping tables
Chapter 15, "Managing Indexes"
Consult this chapter for general guidelines about indexes, including creating,altering, monitoring and dropping indexes
Chapter 16, "Managing Partitioned Tables and Indexes"
Consult this chapter to learn about partitioned tables and indexes and how to createand manage them
Chapter 17, "Managing Clusters"
Consult this chapter for general guidelines to follow when creating, altering, ordropping clusters
Chapter 18, "Managing Hash Clusters"
Consult this chapter for general guidelines to follow when creating, altering, ordropping hash clusters
Trang 37described in this chapter are not unique to any one type of schema objects Consultthis chapter for information about analyzing objects, truncation of tables andclusters, database triggers, integrity constraints, and object dependencies.
Chapter 21, "Detecting and Repairing Data Block Corruption"
This chapter describes methods for detecting and repairing data block corruption
Part V, "Database Security"
Chapter 22, "Managing Users and Securing the Database"
This chapter discusses the importance of establishing a security policy for yourdatabase and users
Part VI, "Database Resource Management and Task Scheduling"
Chapter 23, "Managing Automatic System Tasks Using the Maintenance Window"
This chapter describes how to take advantage of automatic system tasks
Chapter 24, "Using the Database Resource Manager"
This chapter describes how to use the Database Resource Manager to allocateresources
Chapter 25, "Moving from DBMS_JOB to DBMS_SCHEDULER"
This chapter describes how to take statements created withDBMS_JOB and rewritethem usingDBMS_SCHEDULER
Chapter 26, "Overview of Scheduler Concepts"
Oracle Database provides advanced scheduling capabilities through the databaseScheduler This chapter introduces you to its concepts
Chapter 27, "Using the Scheduler"
This chapter describes how to use the Scheduler
Trang 38users can schedule jobs using the Scheduler.
Part VII, "Distributed Database Management"
Chapter 29, "Distributed Database Concepts"
This chapter describes the basic concepts and terminology of Oracle Databasedistributed database architecture
Chapter 30, "Managing a Distributed Database"
This chapter describes how to manage and maintain a distributed database system
Chapter 31, "Developing Applications for a Distributed Database System"
This chapter describes considerations important when developing an application to
run in a distributed database system.
Chapter 32, "Distributed Transactions Concepts"
This chapter describes what distributed transactions are and how Oracle Databasemaintains their integrity
Chapter 33, "Managing Distributed Transactions"
This chapter describes how to manage and troubleshoot distributed transactions
Related Documentation
For more information, see these Oracle resources:
■ Oracle Database Concepts
This book is a starting point to become familiar with the concepts andterminology of the Oracle Database server, and is recommended reading before
attempting the tasks described in the Oracle Database Administrator's Guide.
■ Oracle Database Backup and Recovery Basics
This book provides an overview of backup and recovery and discusses backupand recovery strategies It provides instructions for basic backup and recovery
of your database using Recovery Manager (RMAN)
Trang 39not to use RMAN.
■ Oracle Database Performance Tuning Guide
This book exposes important considerations in setting up a database systemand can help you understand tuning your database It is mainly conceptual,defining terms, architecture, and design principles, and then outlines proactiveand reactive tuning methods
■ Oracle Database Performance Tuning Guide
This book can be used as a reference guide for tuning your Oracle Databasesystem
■ Oracle Database Application Developer's Guide - Fundamentals
Many of the tasks done by DBAs are shared by application developers In somecases, descriptions of tasks seemed better located in an application level book,and in those cases, this fundamentals book is the primary reference
Many of the examples in this book use the sample schemas of the seed database,
which is installed by default when you install Oracle Database Refer to Oracle
Database Sample Schemas for information on how these schemas were created and
how you can use them yourself
Printed documentation is available for sale in the Oracle Store at
http://oraclestore.oracle.com/
To download free release notes, installation documentation, white papers, or othercollateral, please visit the Oracle Technology Network (OTN) You must registeronline before using OTN; registration is free and can be done at
Trang 40■ Conventions for Windows Operating Systems
Conventions in Text
We use various conventions in text to help you more quickly identify special terms.The following table describes those conventions and provides examples of their use
Bold Bold typeface indicates terms that are
defined in the text or terms that appear in
Oracle Database Concepts
Ensure that the recovery catalog and target
database do not reside on the same disk.
You can specify this clause only for a NUMBER column.
You can back up the database by using the BACKUP command.
Query the TABLE_NAME column in the USER_ TABLES data dictionary view.
Use the DBMS_STATS GENERATE_STATS procedure.
Note:Some programmatic elements use a mixture of UPPERCASE and lowercase.
Enter these elements as shown.
Enter sqlplus to open SQL*Plus.
The password is specified in the orapwd file Back up the datafiles and control files in the /disk1/oracle/dbs directory.
The department_id , department_name , and location_id columns are in the hr.departments table.
Set the QUERY_REWRITE_ENABLED initialization parameter to true.
Connect as oe user.
The JRepUtil class implements these methods.