Tải bản đầy đủ (.pdf) (980 trang)

Tài liệu Oracle9i 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 (6.31 MB, 980 trang )

Oracle9
i
Database Administrator’s Guide
Release 1 (9.0.1)
June 2001
Part No. A90117-01
Oracle9i Database Administrator’s Guide, Release 1 (9.0.1)
Part No. A90117-01
Copyright © 2001, Oracle Corporation. All rights reserved.
Primary Author: Ruth Baylis
Contributing Authors: Kathy Rich, Joyce Fee
Graphic Designer: Valarie Moore
Contributors: Lance Ashdown, Mark Bauer, Allen Brumm, Michele Cyran, Mary Ann Davidson,
Harvey Eneman, Amit Ganesh, Carolyn Gray, Wei Huang, Robert Jenkins, Mark Kennedy, Jonathan
Klein, Sushil Kumar, Bill Lee, Nina Lewis, Phil Locke, Yunrui Li, Diana Lorentz, Sujatha Muthulingam,
Gary Ngai, Lois Price, Ananth Raghavan, Ann Rhee, John Russell, Rajiv Sinha, Vinay Srihari, Jags
Srinivasan, Anh-Tuan Tran, Deborah Steiner, Janet Stern, Michael Stewart, Ashwini Surpur, Alex
Tsukerman, Kothanda Umamageswaran, Randy Urbano, Steven Wertheimer, Daniel Wong
The Programs (which include both the software and documentation) contain proprietary information of
Oracle Corporation; 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 is prohibited.
The information contained in this document is subject to change without notice. If you find any problems
in the documentation, please report them to us in writing. Oracle Corporation does not warrant that this
document is error free. 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, without the express written permission of Oracle Corporation.
If the Programs are delivered to the U.S. Government or anyone licensing or using the programs on
behalf of the U.S. Government, the following notice is applicable:
Restricted Rights Notice Programs delivered subject to the DOD FAR Supplement are "commercial
computer software" and use, duplication, and disclosure of the Programs, including documentation,


shall be subject to the licensing restrictions set forth in the applicable Oracle license agreement.
Otherwise, Programs delivered subject to the Federal Acquisition Regulations are "restricted computer
software" and use, duplication, and disclosure of the Programs shall be subject to the restrictions 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 Oracle Corporation disclaims liability for any damages caused by such use of the
Programs.
Oracle is a registered trademark, and LogMiner, Oracle Call Interface, Oracle Database Configuration
Assistant, Oracle Enterprise Manager, Oracle Label Security, Real Application Clusters, Oracle OLAP
Services, Oracle Spatial, Oracle Text, PL/SQL, SQL*Plus are trademarks or registered trademarks of
Oracle Corporation. Other names may be trademarks of their respective owners.
iii
Contents
Send Us Your Comments
............................................................................................................... xxix
Preface
........................................................................................................................................................ xxxi
What’s New in Oracle9
i
?
................................................................................................................... xliii
Part I Basic Database Administration
1 The Oracle Database Administrator
Types of Oracle Users......................................................................................................................... 1-2
Database Administrators............................................................................................................. 1-2
Security Officers............................................................................................................................ 1-3
Network Administrators ............................................................................................................. 1-3

Application Developers............................................................................................................... 1-3
Application Administrators........................................................................................................ 1-4
Database Users.............................................................................................................................. 1-4
Tasks of a Database Administrator ................................................................................................. 1-4
Task 1: Evaluate the Database Server Hardware..................................................................... 1-5
Task 2: Install the Oracle 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
iv
Task 8: Back Up the Fully Functional Database ....................................................................... 1-7
Task 9: Tune Database Performance.......................................................................................... 1-8
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-9
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-14
Using Operating System (OS) Authentication ....................................................................... 1-16
Using Password File Authentication ....................................................................................... 1-17
Password File Administration........................................................................................................ 1-18
Using ORAPWD ......................................................................................................................... 1-19
Setting REMOTE_LOGIN_ PASSWORDFILE........................................................................ 1-20
Adding Users to a Password File ............................................................................................. 1-21
Maintaining a Password File..................................................................................................... 1-23

Database Administrator Utilities................................................................................................... 1-24
SQL*Loader ................................................................................................................................. 1-24
Export and Import ...................................................................................................................... 1-24
2 Creating an Oracle Database
Considerations Before Creating a Database.................................................................................. 2-2
Planning for Database Creation.................................................................................................. 2-2
Meeting Creation Prerequisites .................................................................................................. 2-4
Deciding How to Create an Oracle Database ........................................................................... 2-4
The Oracle Database Configuration Assistant.............................................................................. 2-5
Advantages of Using the Oracle Database Configuration Assistant .................................... 2-6
Creating a Database...................................................................................................................... 2-6
Configuring Database Options................................................................................................. 2-10
Deleting a Database.................................................................................................................... 2-10
Managing Templates.................................................................................................................. 2-10
Manually Creating an Oracle Database........................................................................................ 2-11
Step 1: Decide on Your Instance Identifier (SID).................................................................... 2-12
v
Step 2: Establish the Database Administrator Authentication Method.............................. 2-12
Step 3: Create the Initialization Parameter File...................................................................... 2-13
Step 4: Connect to the Instance................................................................................................. 2-15
Step 5: Start the Instance............................................................................................................ 2-15
Step 6: Issue the CREATE DATABASE Statement ................................................................ 2-16
Step 7: Create Additional Tablespaces .................................................................................... 2-18
Step 8: Run Scripts to Build Data Dictionary Views.............................................................. 2-19
Step 9: Run Scripts to Install Additional Options (Optional)............................................... 2-19
Step 10: Create a Server Parameter File (Recommended) .................................................... 2-19
Step 11: Back Up the Database.................................................................................................. 2-20
Oracle9i Features that Simplify Database Creation and Management.................................. 2-20
Creating an Undo Tablespace................................................................................................... 2-20
Creating a Default Temporary Tablespace ............................................................................. 2-21

Using Oracle-Managed Files..................................................................................................... 2-22
Setting and Managing the Time Zone ..................................................................................... 2-23
Troubleshooting Database Creation ............................................................................................. 2-24
Dropping a Database ....................................................................................................................... 2-24
Considerations After Creating a Database .................................................................................. 2-24
Some Security Considerations.................................................................................................. 2-25
Installing Oracle’s Sample Schemas......................................................................................... 2-26
Initialization Parameters and Database Creation....................................................................... 2-28
Determining the Global Database Name ................................................................................ 2-28
Specifying Control Files............................................................................................................. 2-29
Specifying Database Block Sizes............................................................................................... 2-30
Setting Initialization Parameters that Affect the Size of the SGA ...................................... 2-31
Specifying the Maximum Number of Processes.................................................................... 2-34
Specifying the Method of Undo Space Management............................................................ 2-34
Setting License Parameters........................................................................................................ 2-35
Managing Initialization Parameters Using a Server Parameter File ...................................... 2-36
What is a Server Parameter File?.............................................................................................. 2-37
Migrating to a Server Parameter File....................................................................................... 2-38
Creating a Server Parameter File.............................................................................................. 2-38
The SPFILE Initialization Parameter........................................................................................ 2-39
Using ALTER SYSTEM to Change Initialization Parameter Values................................... 2-40
Exporting the Server Parameter File........................................................................................ 2-42
vi
Errors and Recovery for the Server Parameter File ............................................................... 2-43
Viewing Parameters Settings .................................................................................................... 2-43
3 Using Oracle-Managed Files
What are Oracle-Managed Files? ..................................................................................................... 3-2
Who Can Use Oracle-Managed Files? ....................................................................................... 3-2
Benefits of Using Oracle-Managed Files ................................................................................... 3-3
Oracle-Managed Files and Existing Functionality................................................................... 3-4

Enabling the Creation and Use of Oracle-Managed Files........................................................... 3-4
Setting the DB_CREATE_FILE_DEST Initialization Parameter............................................. 3-5
Setting the DB_CREATE_ONLINE_LOG_DEST_n Initialization Parameter...................... 3-6
Creating Oracle-Managed Files........................................................................................................ 3-6
How Oracle-Managed Files are Named.................................................................................... 3-7
Creating Oracle-Managed Files at Database Creation ............................................................ 3-8
Creating Datafiles for Tablespaces........................................................................................... 3-13
Creating Tempfiles for Temporary Tablespaces .................................................................... 3-16
Creating Control Files ................................................................................................................ 3-17
Creating Online Redo Log Files................................................................................................ 3-19
Behavior of Oracle-Managed Files ................................................................................................ 3-20
Dropping Datafiles and Tempfiles........................................................................................... 3-21
Dropping Online Redo Log Files.............................................................................................. 3-21
Renaming Files............................................................................................................................ 3-21
Managing Standby Databases................................................................................................... 3-22
Scenarios for Using Oracle-Managed Files.................................................................................. 3-22
Scenario 1: Create and Manage a Database with Multiplexed Online Redo Logs............ 3-22
Scenario 2: Add Oracle-Managed Files to an Existing Database......................................... 3-27
4 Starting Up and Shutting Down
Starting Up a Database ...................................................................................................................... 4-2
Options for Starting Up a Database ........................................................................................... 4-2
Preparing to Start an Instance..................................................................................................... 4-3
Using SQL*Plus to Start Up a Database .................................................................................... 4-3
Starting an Instance: Scenarios.................................................................................................... 4-5
Altering Database Availability......................................................................................................... 4-9
Mounting a Database to an Instance.......................................................................................... 4-9
vii
Opening a Closed Database ........................................................................................................ 4-9
Opening a Database in Read-Only Mode ............................................................................... 4-10
Restricting Access to an Open Database ................................................................................. 4-10

Shutting Down a Database ............................................................................................................. 4-11
Shutting Down with the NORMAL Option ........................................................................... 4-11
Shutting Down with the IMMEDIATE Option...................................................................... 4-12
Shutting Down with the TRANSACTIONAL Option .......................................................... 4-12
Shutting Down with the ABORT Option................................................................................ 4-13
Quiescing a Database....................................................................................................................... 4-13
Placing a Database into a Quiesced State................................................................................ 4-14
Restoring the System to Normal Operation ........................................................................... 4-16
Viewing the Quiesce State of an Instance ............................................................................... 4-16
Suspending and Resuming a Database........................................................................................ 4-16
Part II Oracle Server Processes and Storage Structure
5 Managing Oracle Processes
Server Processes .................................................................................................................................. 5-2
Dedicated Server Processes......................................................................................................... 5-2
Shared Server Processes............................................................................................................... 5-3
Configuring Oracle for the Shared Server ..................................................................................... 5-5
Initialization Parameters for Shared Server.............................................................................. 5-5
Setting the Initial Number of Dispatchers (DISPATCHERS)................................................. 5-6
Setting the Initial Number of Shared Servers (SHARED_SERVERS) ................................... 5-8
Modifying Dispatcher and Server Processes............................................................................ 5-8
Monitoring Shared Server ......................................................................................................... 5-11
About Oracle Background Processes ............................................................................................ 5-11
Monitoring the Processes of an Oracle Instance......................................................................... 5-14
Process and Session Views........................................................................................................ 5-14
Monitoring Locks........................................................................................................................ 5-15
Trace Files and the Alert File .................................................................................................... 5-15
Managing Processes for Parallel Execution................................................................................. 5-18
Managing the Parallel Execution Servers ............................................................................... 5-18
Altering Parallel Execution for a Session ................................................................................ 5-19
Managing Processes for External Procedures.............................................................................. 5-20

viii
Setting up an Environment for Calling External Procedures............................................... 5-21
Example of tnsnames.ora Entry for External Procedure Listener ....................................... 5-22
Example of listener.ora Entry for External Procedures......................................................... 5-22
Terminating Sessions ....................................................................................................................... 5-22
Identifying Which Session to Terminate ................................................................................. 5-23
Terminating an Active Session ................................................................................................. 5-24
Terminating an Inactive Session............................................................................................... 5-24
6 Managing Control Files
What Is a Control File?....................................................................................................................... 6-2
Guidelines for Control Files............................................................................................................. 6-2
Provide Filenames for the Control Files.................................................................................... 6-2
Multiplex Control Files on Different Disks............................................................................... 6-3
Place Control Files Appropriately.............................................................................................. 6-3
Back Up Control Files................................................................................................................... 6-3
Manage the Size of Control Files................................................................................................ 6-4
Creating Control Files........................................................................................................................ 6-4
Creating Initial Control Files....................................................................................................... 6-4
Creating Additional Copies, Renaming, and Relocating Control Files................................ 6-5
Creating New Control Files......................................................................................................... 6-5
Troubleshooting After Creating Control Files .............................................................................. 6-9
Checking for Missing or Extra Files........................................................................................... 6-9
Handling Errors During CREATE CONTROLFILE.............................................................. 6-10
Backing Up Control Files ................................................................................................................ 6-10
Recovering a Control File Using a Current Copy....................................................................... 6-10
Recovering from Control File Corruption Using a Control File Copy ............................... 6-10
Recovering from Permanent Media Failure Using a Control File Copy ............................ 6-11
Dropping Control Files.................................................................................................................... 6-11
Displaying Control File Information............................................................................................ 6-12
7 Managing the Online Redo Log

What Is the Online Redo Log?.......................................................................................................... 7-2
Redo Threads................................................................................................................................. 7-2
Online Redo Log Contents .......................................................................................................... 7-2
How Oracle Writes to the Online Redo Log............................................................................. 7-3
ix
Planning the Online Redo Log......................................................................................................... 7-5
Multiplexing Online Redo Log Files.......................................................................................... 7-5
Placing Online Redo Log Members on Different Disks.......................................................... 7-9
Setting the Size of Online Redo Log Members......................................................................... 7-9
Choosing the Number of Online Redo Log Files................................................................... 7-10
Controlling Archive Lag............................................................................................................ 7-10
Creating Online Redo Log Groups and Members ..................................................................... 7-12
Creating Online Redo Log Groups .......................................................................................... 7-13
Creating Online Redo Log Members....................................................................................... 7-13
Relocating and Renaming Online Redo Log Members ............................................................ 7-14
Dropping Online Redo Log Groups and Members................................................................... 7-16
Dropping Log Groups................................................................................................................ 7-16
Dropping Online Redo Log Members..................................................................................... 7-17
Forcing Log Switches ....................................................................................................................... 7-18
Verifying Blocks in Redo Log Files............................................................................................... 7-18
Clearing an Online Redo Log File................................................................................................. 7-19
Viewing Online Redo Log Information ....................................................................................... 7-20
8 Managing Archived Redo Logs
What Is the Archived Redo Log? ..................................................................................................... 8-2
Choosing Between NOARCHIVELOG and ARCHIVELOG Mode......................................... 8-2
Running a Database in NOARCHIVELOG Mode................................................................... 8-2
Running a Database in ARCHIVELOG Mode ......................................................................... 8-3
Controlling the Archiving Mode..................................................................................................... 8-4
Setting the Initial Database Archiving Mode ........................................................................... 8-5
Changing the Database Archiving Mode.................................................................................. 8-5

Enabling Automatic Archiving................................................................................................... 8-6
Disabling Automatic Archiving ................................................................................................. 8-8
Performing Manual Archiving ................................................................................................... 8-9
Specifying the Archive Destination................................................................................................ 8-9
Specifying Archive Destinations ................................................................................................ 8-9
Understanding Archive Destination Status............................................................................ 8-12
Specifying the Mode of Log Transmission.................................................................................. 8-13
Normal Transmission Mode ..................................................................................................... 8-14
Standby Transmission Mode .................................................................................................... 8-14
x
Managing Archive Destination Failure........................................................................................ 8-15
Specifying the Minimum Number of Successful Destinations ............................................ 8-16
Re-Archiving to a Failed Destination....................................................................................... 8-18
Tuning Archive Performance by Specifying Multiple ARCn Processes................................ 8-19
Controlling Trace Output Generated by the Archivelog Process............................................ 8-21
Viewing Information About the Archived Redo Log ................................................................ 8-22
Fixed Views ................................................................................................................................. 8-23
The ARCHIVE LOG LIST Command ...................................................................................... 8-24
9 Using LogMiner to Analyze Redo Log Files
Understanding the Value of Analyzing Redo Log Files.............................................................. 9-2
Things to Know Before You Begin .................................................................................................. 9-2
Redo Log Files............................................................................................................................... 9-3
Dictionary Options ....................................................................................................................... 9-4
Tracking of DDL Statements....................................................................................................... 9-5
Storage Management.................................................................................................................... 9-6
Extracting Data Values from Redo Log Files............................................................................ 9-6
LogMiner Restrictions.................................................................................................................. 9-7
LogMiner Views............................................................................................................................ 9-7
Using LogMiner .................................................................................................................................. 9-8
Extracting a Dictionary ................................................................................................................ 9-9

Specifying Redo Log Files for Analysis................................................................................... 9-12
Starting LogMiner....................................................................................................................... 9-13
Analyzing Output from V$LOGMNR_CONTENTS............................................................. 9-17
Using LogMiner to Perform Object-Level Recovery ............................................................. 9-18
Ending a LogMiner Session....................................................................................................... 9-18
Example Uses of LogMiner............................................................................................................. 9-19
Example: Tracking Changes Made By a Specific User.......................................................... 9-19
Example: Calculating Table Access Statistics ......................................................................... 9-21
10 Managing Job Queues
Enabling Processes Used for Executing Jobs............................................................................... 10-2
Managing Job Queues...................................................................................................................... 10-3
The DBMS_JOB Package............................................................................................................ 10-3
Submitting a Job to the Job Queue ........................................................................................... 10-4
xi
How Jobs Execute....................................................................................................................... 10-9
Removing a Job from the Job Queue ..................................................................................... 10-10
Altering a Job............................................................................................................................. 10-10
Broken Jobs................................................................................................................................ 10-12
Forcing a Job to Execute........................................................................................................... 10-13
Terminating a Job ..................................................................................................................... 10-13
Viewing Job Queue Information ................................................................................................. 10-14
Displaying Information About a Job ..................................................................................... 10-14
Displaying Information About Running Jobs ...................................................................... 10-14
11 Managing Tablespaces
Guidelines for Managing Tablespaces ......................................................................................... 11-2
Use Multiple Tablespaces.......................................................................................................... 11-2
Specify Tablespace Default Storage Parameters .................................................................... 11-3
Assign Tablespace Quotas to Users ......................................................................................... 11-3
Creating Tablespaces........................................................................................................................ 11-4
Locally Managed Tablespaces .................................................................................................. 11-5

Dictionary-Managed Tablespaces............................................................................................ 11-9
Temporary Tablespaces........................................................................................................... 11-11
Managing Tablespace Allocation................................................................................................. 11-14
Storage Parameters in Locally Managed Tablespaces ........................................................ 11-14
Storage Parameters for Dictionary-Managed Tablespaces................................................. 11-15
Coalescing Free Space in Dictionary-Managed Tablespaces ............................................. 11-16
Altering Tablespace Availability ................................................................................................. 11-19
Taking Tablespaces Offline ..................................................................................................... 11-19
Bringing Tablespaces Online .................................................................................................. 11-21
Altering the Availability of Datafiles or Tempfiles ............................................................. 11-21
Using Read-Only Tablespaces...................................................................................................... 11-22
Making a Tablespace Read-Only............................................................................................ 11-23
Making a Read-Only Tablespace Writable ........................................................................... 11-25
Creating a Read-Only Tablespace on a WORM Device...................................................... 11-25
Delaying the Opening of Datafiles in Read Only Tablespaces .......................................... 11-26
Dropping Tablespaces.................................................................................................................... 11-27
Troubleshooting Tablespace Problems with DBMS_SPACE_ADMIN ............................... 11-28
Scenario 1: Fixing Bitmap When Allocated Blocks are Marked Free (No Overlap) ....... 11-29
xii
Scenario 2: Dropping a Corrupted Segment......................................................................... 11-30
Scenario 3: Fixing Bitmap Where Overlap is Reported....................................................... 11-30
Scenario 4: Correcting Media Corruption of Bitmap Blocks .............................................. 11-30
Scenario 5: Migrating from a Dictionary-Managed to a Locally Managed Tablespace . 11-31
Transporting Tablespaces Between Databases.......................................................................... 11-31
Introduction to Transportable Tablespaces .......................................................................... 11-32
Limitations................................................................................................................................. 11-33
Compatibility Considerations for Transportable Tablespaces........................................... 11-33
Transporting Tablespaces Between Databases: A Procedure ............................................ 11-34
Object Behaviors ....................................................................................................................... 11-40
Using Transportable Tablespaces........................................................................................... 11-42

Viewing Tablespace Information................................................................................................. 11-46
Listing Tablespaces and Default Storage Parameters: Example........................................ 11-47
Listing the Datafiles and Associated Tablespaces of a Database: Example ..................... 11-48
Displaying Statistics for Free Space (Extents) of Each Tablespace: Example................... 11-48
12 Managing Datafiles
Guidelines for Managing Datafiles............................................................................................... 12-2
Determine the Number of Datafiles......................................................................................... 12-2
Determine the Size of Datafiles................................................................................................. 12-4
Place Datafiles Appropriately................................................................................................... 12-4
Store Datafiles Separate from Redo Log Files ........................................................................ 12-4
Creating Datafiles and Adding Datafiles to a Tablespace......................................................... 12-5
Changing a Datafile’s Size............................................................................................................... 12-6
Enabling and Disabling Automatic Extension for a Datafile ............................................... 12-6
Manually Resizing a Datafile .................................................................................................... 12-7
Altering Datafile Availability......................................................................................................... 12-8
Bringing Datafiles Online or Taking Offline in ARCHIVELOG Mode............................... 12-9
Taking Datafiles Offline in NOARCHIVELOG Mode .......................................................... 12-9
Altering the Availability of All Datafiles or Tempfiles in a Tablespace............................. 12-9
Renaming and Relocating Datafiles............................................................................................ 12-10
Renaming and Relocating Datafiles for a Single Tablespace ............................................. 12-11
Renaming and Relocating Datafiles for Multiple Tablespaces .......................................... 12-13
Verifying Data Blocks in Datafiles .............................................................................................. 12-14
Viewing Datafile Information ...................................................................................................... 12-14
xiii
13 Managing Undo Space
What is Undo? ................................................................................................................................... 13-2
Specifying the Mode for Undo Space Management.................................................................. 13-3
Starting an Instance in Automatic Undo Management Mode............................................. 13-3
Starting an Instance in Manual Undo Management Mode .................................................. 13-4
Managing Undo Tablespaces.......................................................................................................... 13-5

Creating an Undo Tablespace................................................................................................... 13-6
Altering an Undo Tablespace ................................................................................................... 13-7
Dropping an Undo Tablespace................................................................................................. 13-7
Switching Undo Tablespaces.................................................................................................... 13-8
Establishing User Quotas for Undo Space.............................................................................. 13-9
Setting the Retention Period for Undo Information.............................................................. 13-9
Viewing Information About Undo Space ............................................................................. 13-11
Managing Rollback Segments ..................................................................................................... 13-13
Guidelines for Managing Rollback Segments ...................................................................... 13-13
Creating Rollback Segments ................................................................................................... 13-18
Altering Rollback Segments.................................................................................................... 13-21
Explicitly Assigning a Transaction to a Rollback Segment ................................................ 13-24
Dropping Rollback Segments ................................................................................................. 13-25
Viewing Rollback Segment Information ............................................................................... 13-25
Part III Schema Objects
14 Managing Space for Schema Objects
Managing Space in Data Blocks .................................................................................................... 14-2
Specifying the PCTFREE Parameter ........................................................................................ 14-2
Specifying the PCTUSED Parameter ....................................................................................... 14-5
Selecting Associated PCTUSED and PCTFREE Values ........................................................ 14-7
Specifying the Transaction Entry Parameters: INITRANS and MAXTRANS................... 14-8
Setting Storage Parameters ............................................................................................................. 14-9
Identifying the Storage Parameters.......................................................................................... 14-9
Setting Default Storage Parameters for Segments in a Tablespace ................................... 14-13
Setting Storage Parameters for Data Segments.................................................................... 14-13
Setting Storage Parameters for Index Segments .................................................................. 14-13
xiv
Setting Storage Parameters for LOBs, Varrays, and Nested Tables .................................. 14-14
Changing Values for Storage Parameters ............................................................................. 14-14
Understanding Precedence in Storage Parameters.............................................................. 14-14

Example of How Storage Parameters Effect Space Allocation .......................................... 14-15
Managing Resumable Space Allocation..................................................................................... 14-16
Resumable Space Allocation Overview................................................................................. 14-17
Enabling and Disabling Resumable Space Allocation......................................................... 14-21
Detecting Suspended Statements ........................................................................................... 14-22
Resumable Space Allocation Example: Registering an AFTER SUSPEND Trigger........ 14-24
Deallocating Space.......................................................................................................................... 14-26
Viewing the High Water Mark ............................................................................................... 14-27
Issuing Space Deallocation Statements.................................................................................. 14-27
Examples of Deallocating Space............................................................................................. 14-28
Understanding Space Use of Datatypes ..................................................................................... 14-31
15 Managing Tables
Guidelines for Managing Tables ................................................................................................... 15-2
Design Tables Before Creating Them ...................................................................................... 15-2
Specify How Data Block Space Is to Be Used ......................................................................... 15-2
Specify the Location of Each Table........................................................................................... 15-3
Consider Parallelizing Table Creation..................................................................................... 15-3
Consider Using NOLOGGING When Creating Tables ........................................................ 15-4
Estimate Table Size and Set Storage Parameters.................................................................... 15-4
Plan for Large Tables.................................................................................................................. 15-5
Table Restrictions........................................................................................................................ 15-6
Creating Tables.................................................................................................................................. 15-6
Creating a Table .......................................................................................................................... 15-6
Creating a Temporary Table ..................................................................................................... 15-7
Parallelizing Table Creation...................................................................................................... 15-8
Automatically Collecting Statistics on Tables ........................................................................ 15-9
Altering Tables .................................................................................................................................. 15-9
Moving a Table to a New Segment or Tablespace............................................................... 15-12
Manually Allocating Storage for a Table............................................................................... 15-12
Dropping Columns................................................................................................................... 15-12

Redefining Tables Online.............................................................................................................. 15-14
xv
Steps for Online Redefinition of Tables................................................................................. 15-15
Intermediate Synchronization ................................................................................................ 15-17
Abort and Cleanup After Errors............................................................................................. 15-17
Example of Online Table Redefinition .................................................................................. 15-17
Restrictions ................................................................................................................................ 15-18
Dropping Tables.............................................................................................................................. 15-19
Managing Index-Organized Tables............................................................................................. 15-20
What are Index-Organized Tables ......................................................................................... 15-21
Creating Index-Organized Tables.......................................................................................... 15-22
Maintaining Index-Organized Tables.................................................................................... 15-26
Analyzing Index-Organized Tables....................................................................................... 15-28
Using the ORDER BY Clause with Index-Organized Tables............................................. 15-29
Converting Index-Organized Tables to Regular Tables ..................................................... 15-29
Managing External Tables............................................................................................................. 15-30
Creating External Tables.......................................................................................................... 15-31
Altering External Tables.......................................................................................................... 15-34
Dropping External Tables ....................................................................................................... 15-35
System and Object Privileges for External Tables ............................................................... 15-35
Viewing Information About Tables ............................................................................................ 15-35
16 Managing Indexes
Guidelines for Managing Indexes................................................................................................. 16-2
Create Indexes After Inserting Table Data.............................................................................. 16-3
Index the Correct Tables and Columns................................................................................... 16-3
Order Index Columns for Performance................................................................................... 16-5
Limit the Number of Indexes for Each Table ......................................................................... 16-5
Drop Indexes That Are No Longer Required ........................................................................ 16-5
Specify Index Block Space Use ................................................................................................. 16-5
Estimate Index Size and Set Storage Parameters ................................................................... 16-6

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

Creating Range-Partitioned Tables .......................................................................................... 17-9
Creating Hash-Partitioned Tables.......................................................................................... 17-10
Creating List-Partitioned Tables............................................................................................. 17-11
Creating Composite Partitioned Tables ................................................................................ 17-12
Creating Partitioned Index-Organized Tables ..................................................................... 17-13
Partitioning Restrictions for Multiple Block Sizes ............................................................... 17-15
Maintaining Partitioned Tables ................................................................................................... 17-16
Updating Global Indexes Automatically .............................................................................. 17-19
Adding Partitions ..................................................................................................................... 17-20
Coalescing Partitions................................................................................................................ 17-23
Dropping Partitions.................................................................................................................. 17-24
xvii
Exchanging Partitions .............................................................................................................. 17-27
Merging Partitions.................................................................................................................... 17-29
Modifying Default Attributes................................................................................................. 17-32
Modifying Real Attributes of Partitions................................................................................ 17-33
Modifying List Partitions: Adding or Dropping Values..................................................... 17-34
Moving Partitions..................................................................................................................... 17-36
Rebuilding Index Partitions .................................................................................................... 17-37
Renaming Partitions................................................................................................................. 17-39
Splitting Partitions.................................................................................................................... 17-39
Truncating Partitions ............................................................................................................... 17-42
Partitioned Tables and Indexes Examples ................................................................................. 17-45
Moving the Time Window in a Historical Table ................................................................. 17-45
Converting a Partition View into a Partitioned Table......................................................... 17-46
Viewing Information About Partitioned Tables and Indexes................................................ 17-47
18 Managing Clusters
Guidelines for Managing Clusters................................................................................................ 18-2
Choose Appropriate Tables for the Cluster............................................................................ 18-4
Choose Appropriate Columns for the Cluster Key ............................................................... 18-4

Specify Data Block Space Use................................................................................................... 18-5
Specify the Space Required by an Average Cluster Key and Its Associated Rows.......... 18-5
Specify the Location of Each Cluster and Cluster Index Rows............................................ 18-6
Estimate Cluster Size and Set Storage Parameters ................................................................ 18-6
Creating Clusters .............................................................................................................................. 18-6
Creating Clustered Tables......................................................................................................... 18-7
Creating Cluster Indexes ........................................................................................................... 18-8
Altering Clusters............................................................................................................................... 18-8
Altering Clustered Tables.......................................................................................................... 18-9
Altering Cluster Indexes.......................................................................................................... 18-10
Dropping Clusters .......................................................................................................................... 18-10
Dropping Clustered Tables..................................................................................................... 18-11
Dropping Cluster Indexes ....................................................................................................... 18-11
Viewing Information About Clusters......................................................................................... 18-11
xviii
19 Managing Hash Clusters
When to Use Hash Clusters............................................................................................................. 19-2
Situations Where Hashing Is Useful ........................................................................................ 19-3
Situations Where Hashing Is Not Advantageous .................................................................. 19-3
Creating Hash Clusters.................................................................................................................... 19-4
Creating Single-Table Hash Clusters....................................................................................... 19-5
Controlling Space Use Within a Hash Cluster ....................................................................... 19-5
Estimating Size Required by Hash Clusters ........................................................................... 19-8
Altering Hash Clusters..................................................................................................................... 19-9
Dropping Hash Clusters.................................................................................................................. 19-9
Viewing Information About Hash Clusters................................................................................. 19-9
20 Managing Views, Sequences, and Synonyms
Managing Views................................................................................................................................ 20-2
Creating Views............................................................................................................................ 20-2
Updating a Join View................................................................................................................. 20-5

Altering Views........................................................................................................................... 20-10
Dropping Views........................................................................................................................ 20-10
Replacing Views........................................................................................................................ 20-10
Managing Sequences...................................................................................................................... 20-11
Creating Sequences................................................................................................................... 20-12
Altering Sequences ................................................................................................................... 20-13
Dropping Sequences................................................................................................................. 20-13
Managing Synonyms ..................................................................................................................... 20-13
Creating Synonyms .................................................................................................................. 20-14
Dropping Synonyms ................................................................................................................ 20-14
Viewing Information About Views, Synonyms, and Sequences .......................................... 20-15
21 General Management of Schema Objects
Creating Multiple Tables and Views in a Single Operation .................................................... 21-2
Renaming Schema Objects ............................................................................................................. 21-3
Analyzing Tables, Indexes, and Clusters ..................................................................................... 21-3
Using Statistics for Tables, Indexes, and Clusters.................................................................. 21-4
Validating Tables, Indexes, Clusters, and Materialized Views............................................ 21-9
xix
Listing Chained Rows of Tables and Clusters...................................................................... 21-10
Truncating Tables and Clusters.................................................................................................... 21-12
Using DELETE .......................................................................................................................... 21-12
Using DROP and CREATE...................................................................................................... 21-13
Using TRUNCATE ................................................................................................................... 21-13
Enabling and Disabling Triggers................................................................................................. 21-14
Enabling Triggers ..................................................................................................................... 21-16
Disabling Triggers .................................................................................................................... 21-16
Managing Integrity Constraints................................................................................................... 21-17
Integrity Constraint States....................................................................................................... 21-17
Setting Integrity Constraints Upon Definition..................................................................... 21-20
Modifying or Dropping Existing Integrity Constraints...................................................... 21-21

Deferring Constraint Checks .................................................................................................. 21-22
Reporting Constraint Exceptions ........................................................................................... 21-23
Managing Object Dependencies ................................................................................................. 21-25
Manually Recompiling Views ................................................................................................ 21-27
Manually Recompiling Procedures and Functions ............................................................. 21-27
Manually Recompiling Packages ........................................................................................... 21-27
Managing Object Name Resolution............................................................................................ 21-28
Changing Storage Parameters for the Data Dictionary........................................................... 21-28
Structures in the Data Dictionary........................................................................................... 21-29
Errors that Require Changing Data Dictionary Storage ..................................................... 21-31
Displaying Information About Schema Objects...................................................................... 21-31
Using PL/SQL Packages to Display Information About Schema Objects....................... 21-31
Using Views to Display Information About Schema Objects ............................................ 21-33
22 Detecting and Repairing Data Block Corruption
Options for Repairing Data Block Corruption ........................................................................... 22-2
About the DBMS_REPAIR Package.............................................................................................. 22-2
DBMS_REPAIR Procedures ...................................................................................................... 22-2
Limitations and Restrictions ..................................................................................................... 22-3
Using the DBMS_REPAIR Package .............................................................................................. 22-3
Task 1: Detect and Report Corruptions................................................................................... 22-4
Task 2: Evaluate the Costs and Benefits of Using DBMS_REPAIR..................................... 22-5
Task 3: Make Objects Usable..................................................................................................... 22-7
xx
Task 4: Repair Corruptions and Rebuild Lost Data............................................................... 22-7
DBMS_REPAIR Examples .............................................................................................................. 22-8
Using ADMIN_TABLES to Build a Repair Table or Orphan Key Table ............................ 22-9
Using the CHECK_OBJECT Procedure to Detect Corruption ........................................... 22-10
Fixing Corrupt Blocks with the FIX_CORRUPT_BLOCKS Procedure............................. 22-12
Finding Index Entries Pointing into Corrupt Data Blocks: DUMP_ORPHAN_KEYS ... 22-13
Rebuilding Free Lists Using the REBUILD_FREELISTS Procedure.................................. 22-13

Enabling or Disabling the Skipping of Corrupt Blocks: SKIP_CORRUPT_BLOCKS..... 22-14
Part IV Database Security
23 Establishing Security Policies
System Security Policy..................................................................................................................... 23-2
Database User Management ..................................................................................................... 23-2
User Authentication ................................................................................................................... 23-2
Operating System Security........................................................................................................ 23-3
Data Security Policy ......................................................................................................................... 23-3
User Security Policy.......................................................................................................................... 23-4
General User Security................................................................................................................. 23-4
End-User Security....................................................................................................................... 23-6
Administrator Security .............................................................................................................. 23-8
Application Developer Security ............................................................................................. 23-10
Application Administrator Security ...................................................................................... 23-12
Password Management Policy...................................................................................................... 23-12
Account Locking....................................................................................................................... 23-13
Password Aging and Expiration ............................................................................................ 23-14
Password History ..................................................................................................................... 23-15
Password Complexity Verification ........................................................................................ 23-16
Auditing Policy................................................................................................................................ 23-20
A Security Checklist....................................................................................................................... 23-20
24 Managing Users and Resources
Session and User Licensing ............................................................................................................ 24-2
Concurrent Usage Licensing..................................................................................................... 24-2
xxi
Named User Limits .................................................................................................................... 24-5
Viewing Licensing Limits and Current Values...................................................................... 24-6
User Authentication Methods ........................................................................................................ 24-7
Database Authentication ........................................................................................................... 24-8
External Authentication............................................................................................................. 24-9

Global Authentication and Authorization............................................................................ 24-11
Proxy Authentication and Authorization ............................................................................. 24-13
Managing Oracle Users ................................................................................................................. 24-16
Creating Users........................................................................................................................... 24-16
Altering Users ........................................................................................................................... 24-20
Dropping Users......................................................................................................................... 24-21
Managing Resources with Profiles.............................................................................................. 24-22
Enabling and Disabling Resource Limits.............................................................................. 24-23
Creating Profiles ....................................................................................................................... 24-24
Assigning Profiles..................................................................................................................... 24-25
Altering Profiles........................................................................................................................ 24-25
Using Composite Limits.......................................................................................................... 24-25
Dropping Profiles ..................................................................................................................... 24-27
Viewing Information About Database Users and Profiles ..................................................... 24-27
Listing All Users and Associated Information..................................................................... 24-29
Listing All Tablespace Quotas................................................................................................ 24-29
Listing All Profiles and Assigned Limits .............................................................................. 24-30
Viewing Memory Use for Each User Session ....................................................................... 24-31
25 Managing User Privileges and Roles
Identifying User Privileges............................................................................................................. 25-2
System Privileges........................................................................................................................ 25-2
Object Privileges ......................................................................................................................... 25-4
Managing User Roles....................................................................................................................... 25-4
Predefined Roles......................................................................................................................... 25-5
Creating a Role............................................................................................................................ 25-7
Specifying the Type of Role Authorization ............................................................................ 25-8
Dropping Roles ......................................................................................................................... 25-10
Granting User Privileges and Roles............................................................................................ 25-11
Granting System Privileges and Roles .................................................................................. 25-11
xxii

Granting Object Privileges and Roles .................................................................................... 25-12
Granting Privileges on Columns ............................................................................................ 25-13
Revoking User Privileges and Roles........................................................................................... 25-14
Revoking System Privileges and Roles.................................................................................. 25-14
Revoking Object Privileges and Roles ................................................................................... 25-14
Cascading Effects of Revoking Privileges............................................................................. 25-16
Granting to and Revoking from the User Group PUBLIC ................................................. 25-17
When Do Grants and Revokes Take Effect? .............................................................................. 25-17
The SET ROLE Statement ........................................................................................................ 25-18
Specifying Default Roles.......................................................................................................... 25-18
Restricting the Number of Roles that a User Can Enable................................................... 25-19
Granting Roles Using the Operating System or Network ..................................................... 25-19
Using Operating System Role Identification ........................................................................ 25-20
Using Operating System Role Management......................................................................... 25-22
Granting and Revoking Roles When OS_ROLES=TRUE ................................................... 25-22
Enabling and Disabling Roles When OS_ROLES=TRUE ................................................... 25-22
Using Network Connections with Operating System Role Management........................ 25-22
Viewing Privilege and Role Information................................................................................... 25-23
Listing All System Privilege Grants....................................................................................... 25-25
Listing All Role Grants............................................................................................................. 25-25
Listing Object Privileges Granted to a User.......................................................................... 25-25
Listing the Current Privilege Domain of Your Session....................................................... 25-26
Listing Roles of the Database.................................................................................................. 25-27
Listing Information About the Privilege Domains of Roles............................................... 25-27
26 Auditing Database Use
Guidelines for Auditing.................................................................................................................. 26-2
Decide Whether to Use the Database or Operating System Audit Trail ............................ 26-2
Keep Audited Information Manageable.................................................................................. 26-2
Guidelines for Auditing Suspicious Database Activity ........................................................ 26-3
Guidelines for Auditing Normal Database Activity ............................................................. 26-4

Managing Audit Trail Information................................................................................................ 26-4
What Information is Contained in the Audit Trail? .............................................................. 26-4
Events Audited by Default........................................................................................................ 26-5
Setting Auditing Options........................................................................................................... 26-6
xxiii
Turning Off Audit Options ..................................................................................................... 26-10
Enabling and Disabling Database Auditing......................................................................... 26-12
Controlling the Growth and Size of the Audit Trail ........................................................... 26-13
Protecting the Audit Trail........................................................................................................ 26-15
Fine-Grained Auditing .................................................................................................................. 26-16
Viewing Database Audit Trail Information............................................................................... 26-17
Creating the Audit Trail Views .............................................................................................. 26-17
Deleting the Audit Trail Views............................................................................................... 26-18
Using Audit Trail Views to Investigate Suspicious Activities........................................... 26-18
Part V Database Resource Management
27 Using the Database Resource Manager
What Is the Database Resource Manager?................................................................................... 27-2
What Problems Does the Database Resource Manager Address? ...................................... 27-2
How Does the Database Resource Manager Address These Problems?............................ 27-2
What are the Elements of the Database Resource Manager? ............................................... 27-3
Understanding Resource Plans ................................................................................................ 27-4
Administering the Database Resource Manager........................................................................ 27-8
Creating a Simple Resource Plan................................................................................................. 27-10
Creating Complex Resource Plans .............................................................................................. 27-11
Using the Pending Area for Creating Plan Schemas........................................................... 27-12
Creating Resource Plans.......................................................................................................... 27-14
Creating Resource Consumer Groups................................................................................... 27-16
Specifying Resource Plan Directives...................................................................................... 27-17
Managing Resource Consumer Groups ..................................................................................... 27-20
Assigning an Initial Resource Consumer Group ................................................................. 27-21

Changing Resource Consumer Groups................................................................................. 27-21
Managing the Switch Privilege............................................................................................... 27-22
Enabling the Database Resource Manager ................................................................................ 27-24
Putting It All Together: Database Resource Manager Examples........................................... 27-25
Multilevel Schema Example.................................................................................................... 27-25
Example of Using Several Resource Allocation Methods .................................................. 27-27
An Oracle Supplied Plan ......................................................................................................... 27-28
Monitoring and Tuning the Database Resource Manager...................................................... 27-29
xxiv
Creating the Environment....................................................................................................... 27-29
Why Is This Necessary to Produce Expected Results?........................................................ 27-30
Monitoring Results ................................................................................................................... 27-31
Viewing Database Resource Manager Information................................................................. 27-31
Viewing Consumer Groups Granted to Users or Roles...................................................... 27-32
Viewing Plan Schema Information ........................................................................................ 27-33
Viewing Current Consumer Groups for Sessions................................................................ 27-33
Viewing the Currently Active Plans ...................................................................................... 27-34
Part VI Distributed Database Management
28 Distributed Database Concepts
Distributed Database Architecture................................................................................................ 28-2
Homogenous Distributed Database Systems ......................................................................... 28-2
Heterogeneous Distributed Database Systems ...................................................................... 28-5
Client/Server Database Architecture ...................................................................................... 28-6
Database Links .................................................................................................................................. 28-8
What Are Database Links? ........................................................................................................ 28-8
What Are Shared Database Links?......................................................................................... 28-10
Why Use Database Links? ....................................................................................................... 28-11
Global Database Names in Database Links .......................................................................... 28-12
Names for Database Links....................................................................................................... 28-14
Types of Database Links.......................................................................................................... 28-15

Users of Database Links........................................................................................................... 28-16
Creation of Database Links: Examples .................................................................................. 28-19
Schema Objects and Database Links...................................................................................... 28-20
Database Link Restrictions ...................................................................................................... 28-22
Distributed Database Administration........................................................................................ 28-23
Site Autonomy........................................................................................................................... 28-23
Distributed Database Security ................................................................................................ 28-24
Auditing Database Links......................................................................................................... 28-31
Administration Tools ............................................................................................................... 28-31
Transaction Processing in a Distributed System ...................................................................... 28-33
Remote SQL Statements........................................................................................................... 28-33
Distributed SQL Statements.................................................................................................... 28-34
xxv
Shared SQL for Remote and Distributed Statements.......................................................... 28-34
Remote Transactions................................................................................................................ 28-35
Distributed Transactions ......................................................................................................... 28-35
Two-Phase Commit Mechanism ............................................................................................ 28-35
Database Link Name Resolution............................................................................................ 28-36
Schema Object Name Resolution ........................................................................................... 28-39
Global Name Resolution in Views, Synonyms, and Procedures....................................... 28-42
Distributed Database Application Development .................................................................... 28-44
Transparency in a Distributed Database System................................................................. 28-44
Remote Procedure Calls (RPCs) ............................................................................................. 28-46
Distributed Query Optimization............................................................................................ 28-47
Character Set Support .................................................................................................................... 28-47
Client/Server Environment .................................................................................................... 28-49
Homogeneous Distributed Environment.............................................................................. 28-49
Heterogeneous Distributed Environment............................................................................. 28-50
29 Managing a Distributed Database
Managing Global Names in a Distributed System.................................................................... 29-2

Understanding How Global Database Names Are Formed ................................................ 29-2
Determining Whether Global Naming Is Enforced............................................................... 29-3
Viewing a Global Database Name ........................................................................................... 29-4
Changing the Domain in a Global Database Name............................................................... 29-4
Changing a Global Database Name: Scenario........................................................................ 29-5
Creating Database Links ................................................................................................................. 29-8
Obtaining Privileges Necessary for Creating Database Links ............................................. 29-8
Specifying Link Types................................................................................................................ 29-9
Specifying Link Users .............................................................................................................. 29-11
Using Connection Qualifiers to Specify Service Names Within Link Names ................. 29-13
Creating Shared Database Links ................................................................................................. 29-14
Determining Whether to Use Shared Database Links......................................................... 29-14
Creating Shared Database Links ............................................................................................ 29-15
Configuring Shared Database Links...................................................................................... 29-16
Managing Database Links ............................................................................................................ 29-18
Closing Database Links ........................................................................................................... 29-19
Dropping Database Links........................................................................................................ 29-19

×