D17090GC31 sg2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 392

a ble

fe r
a ns
n- t r
a no
h a s
Oracle Database m ) e10g: .
c o i d
g i c. t Gu Workshop I
Administration
a relo uden
iw Volume S t
l e @ h i s II • Student Guide
a t
h . bh use
b o d to
su cens e
e (
hal li
h b
o d
sub

D17090GC31
Edition 3.1
December 2008
D57299

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Authors Copyright © 2008, Oracle. All rights reserved.

Tom Best Disclaimer

Maria Billings This document contains proprietary information and is protected by copyright and
other intellectual property laws. You may copy and print this document solely for your
own use in an Oracle training course. The document may not be modified or altered in
Technical Contributors any way. Except where your use constitutes "fair use" under copyright law, you may
and Reviewers not use, share, download, upload, copy, print, display, perform, reproduce, publish,
license, post, transmit, or distribute this document in whole or in part without the
Celia Antonio express authorization of Oracle.
Larry Baumann
The information contained in this document is subject to change without notice. If you
Tammy Bednar find any problems in the document, please report them in writing to: Oracle University,
500 Oracle Parkway, Redwood Shores, California 94065 USA. This document is not
Howard Bradley
warranted to be error-free.
M.J. Bryksa
Restricted Rights Notice
Sandra Cheevers
Steve Friedberg If this documentation is delivered to the United States Government or anyone using
the documentation on behalf of the United States Government, the following notice is
a ble
Joel Goodman applicable:
fe r
John Hibbard
a n s
Magnus Isaksson
U.S. GOVERNMENT RIGHTS
n- t r
The U.S. Government’s rights to use, modify, reproduce, release, perform, display, or
o
Sushma Jagannath
s an
disclose these training materials are restricted by the terms of the applicable Oracle
license agreement and/or the applicable U.S. Government contract.
Christine Jeal
) ha
Steven Karam
Trademark Notice

c o m ide.
Donna Keesling i c. t Gu
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other
g
elo den
names may be trademarks of their respective owners.
Stella Kister
a r
Pierre Labrousse
@ iw s Stu
Stefan Lindblad
h a le
e thi
Dee Matishak
d h .b us
Paul Needham o
b nse t o
Raza Siddiqui su
l e ( i ce
James aSpiller l
h bhStern
Janet
od Barry Trute
sub Jean-Francois Verrier
Anthony Woodell

Editor
Joyce Raftery

Graphic Designer
Satish Bettegowda

Publisher
Jobi Varghese

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Contents

Preface

1 Introduction
Course Objectives 1-2
Suggested Schedule 1-3
Lesson Objectives 1-4
a ble
Oracle Products and Services 1-5
fe r
Oracle Database 10g: “g” Stands for Grid 1-6 a ns
Oracle Database Architecture 1-8 n- t r
o
Database Structures 1-9
s an
Oracle Memory Structures 1-10
) ha
Process Structures 1-12
c o m ide.
Oracle Instance Management 1-13 g i c. t Gu
relo uden
Server Process and Database Buffer Cache 1-14
a
iw s St
Physical Database Structure 1-15
@
a le thi
Tablespaces and Data Files 1-17
h e
h .b us
SYSTEM and SYSAUX Tablespaces 1-18
d
o t o
( s ub ense
Segments, Extents, and Blocks 1-19

hal
e lic
Logical and Physical Database Structures 1-20

h b Course Examples: The HR Schema 1-22


o d Database Architecture: Summary of Structural Components 1-23
sub Summary 1-24

2 Installing the Oracle Database Software


Objectives 2-2
Tasks of an Oracle Database Administrator 2-3
Tools Used to Administer an Oracle Database 2-4
Installation: System Requirements 2-6
Checking the System Requirements 2-7
Optimal Flexible Architecture (OFA) 2-8
Using Optimal Flexible Architecture 2-9
Setting Environment Variables 2-11
Oracle Universal Installer (OUI) 2-13
Installing the Oracle Software 2-14
Database Configuration Options 2-15

iii
Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Executing Configuration Scripts 2-16
Completing Your Installation 2-17
Advanced Installation Options 2-18
Installation Option: Silent Mode 2-19
Summary 2-20
Practice Overview: Installing the Oracle Software 2-21

3 Creating an Oracle Database


Objectives 3-2
Planning the Database 3-3
Databases: Examples 3-4
a ble
Database Configuration Assistant (DBCA) 3-5
fe r
Using the DBCA to Create a Database 3-6
a ns
Password Management 3-12 n- t r
o
Creating a Database Design Template 3-13
s an
Using the DBCA to Delete a Database 3-14
) ha
Summary 3-16
c o m ide.
Practice Overview: Using the DBCA 3-17
g i c. t Gu
a r elo den
4 Managing the Oracle Instance
@ iw s Stu
Objectives 4-2
h a le
e t hi
Management Framework
d h .b 4-3 us
b o
Starting and Stopping to Control 4-4
Database
e
( su cManager
Oracle Enterprise
e e ns 4-5
hal Oracleli Enterprise Manager 4-6
Accessing
b
o d h Database Home Page 4-7
sub Using SQL*Plus and iSQL*Plus to Access Your Database 4-8
Using iSQL*Plus 4-9
Setting Up iSQL*Plus for SYSDBA and SYSOPER Access 4-10
Using SQL*Plus 4-12
Calling SQL*Plus from a Shell Script 4-13
Calling a SQL Script from SQL*Plus 4-14
Initialization Parameter Files 4-15
Simplified Initialization Parameters 4-16
Viewing and Modifying Initialization Parameters 4-18
Database Startup and Shutdown 4-19
Starting Up an Oracle Database Instance 4-20
Starting Up an Oracle Database Instance: NOMOUNT 4-21
Starting Up an Oracle Database Instance: MOUNT 4-22
Starting Up an Oracle Database Instance: OPEN 4-23

iv
Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Shutting Down an Oracle Database Instance 4-24
Shutdown Modes 4-25
SHUTDOWN Options 4-26
Using SQL*Plus to Start Up and Shut Down 4-29
Viewing the Alert Log 4-30
Viewing the Alert History 4-31
Dynamic Performance Views 4-32
Dynamic Performance Views: Usage Examples 4-33
Dynamic Performance Views: Considerations 4-34
Summary 4-35
Practice Overview: Managing the Oracle Instance 4-36
a ble
fe r
5 Managing Database Storage Structures
a ns
Objectives 5-2 n- t r
o
Storage Structures 5-3
s an
How Table Data Is Stored 5-4
) ha
Anatomy of a Database Block 5-5
c o m ide.
Tablespaces and Data Files 5-6
g i c. t Gu
relo uden
Oracle Managed Files (OMF) 5-7
a
iw s St
Space Management in Tablespaces 5-8
@
h a le
e thi
Exploring the Storage Structure 5-9
.b us
Creating a New Tablespace 5-10
d h
o t o
Storage for Locally Managed Tablespaces 5-12
( s ub ense
Tablespaces in the Preconfigured Database 5-14
hal
e lic
Altering a Tablespace 5-16
h b Actions with Tablespaces 5-19
o d
sub Dropping Tablespaces 5-21
Viewing Tablespace Information 5-22
Gathering Storage Information 5-23
Viewing Tablespace Contents 5-24
Enlarging the Database 5-25
What Is Automatic Storage Management? 5-26
ASM: Key Features and Benefits 5-27
ASM: Concepts 5-28
Summary 5-29
Practice Overview: Managing Database Storage Structures 5-30

6 Administering User Security


Objectives 6-2
Database User Accounts 6-3
Predefined Accounts: SYS and SYSTEM 6-5

v
Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Creating a User 6-6
Authenticating Users 6-7
Administrator Authentication 6-9
Unlocking a User Account and Resetting the Password 6-10
Privileges 6-11
System Privileges 6-12
Object Privileges 6-14
Revoking System Privileges with ADMIN OPTION 6-15
Revoking Object Privileges with GRANT OPTION 6-16
Benefits of Roles 6-17
Assigning Privileges to Roles and Roles to Users 6-18
a ble
Predefined Roles 6-19
fe r
Creating a Role 6-20
a ns
Secure Roles 6-21 n- t r
o
Assigning Roles to Users 6-22
s an
Profiles and Users 6-23
) ha
Implementing Password Security Features 6-25
c o m ide.
Creating a Password Profile 6-27
g i c. t Gu
relo uden
Supplied Password Verification Function: VERIFY_FUNCTION 6-28
a
Assigning Quota to Users 6-29
@ iw s St
Summary 6-31
h a le
e thi
.b us
Practice Overview: Administering Users 6-32
d h
o t o
s
7 Managing(Schema
ub eObjects
n se
h a le 7-2 lic
Objectives
h bWhat Is a Schema? 7-3
b d
o Accessing Schema Objects 7-5
s u
Naming Database Objects 7-6
Specifying Data Types in Tables 7-8
Creating and Modifying Tables 7-11
Understanding Data Integrity 7-13
Defining Constraints 7-15
Constraint Violations 7-16
Constraint States 7-17
Constraint Checking 7-19
Creating Constraints with SQL: Examples 7-20
Viewing the Columns in a Table 7-21
Viewing the Contents of a Table 7-22
Actions with Tables 7-23
Dropping a Table 7-24

vi
Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Truncating a Table 7-25
Indexes 7-26
Types of Indexes 7-27
B-Tree Index 7-28
Bitmap Indexes 7-30
Index Options 7-32
Creating Indexes 7-34
What Is a View? 7-35
Creating Views 7-36
Sequences 7-37
Creating a Sequence 7-38
a ble
Using a Sequence 7-40
fe r
Temporary Tables 7-41
a ns
Temporary Tables: Considerations 7-43 n- t r
o
Data Dictionary: Overview 7-44
s an
Data Dictionary Views 7-45
) ha
Data Dictionary: Usage Examples 7-47
c o m ide.
Summary 7-48
g i c. t Gu
relo uden
Practice Overview: Administering Schema Objects 7-49
a
@ iw s St
h a le
8 Managing Data and Concurrency
e t hi
Objectives 8-2 .b
o
Manipulatingd h to usSQL 8-3
Data Through
(
The s ub eCommand
INSERT n se 8-4
e lic Command 8-5
hal The UPDATE
h b
o d The DELETE Command 8-6
sub The MERGE Command 8-7
The COMMIT and ROLLBACK Commands 8-9
PL/SQL 8-10
Administering PL/SQL Objects 8-12
PL/SQL Objects 8-13
Functions 8-14
Procedures 8-15
Packages 8-16
Package Specification and Body 8-17
Built-in Packages 8-18
Triggers 8-19
Triggering Events 8-20
Locks 8-21
Locking Mechanism 8-22

vii
Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Data Concurrency 8-23
DML Locks 8-25
Enqueue Mechanism 8-26
Lock Conflicts 8-27
Possible Causes of Lock Conflicts 8-28
Detecting Lock Conflicts 8-29
Resolving Lock Conflicts 8-30
Resolving Lock Conflicts Using SQL 8-31
Deadlocks 8-32
Summary 8-33
Practice Overview: Managing Data and Concurrency 8-34
a ble
fe r
9 Managing Undo Data
a ns
Objectives 9-2 n- t r
o
Data Manipulation 9-3
s an
Undo Data 9-4
) ha
Transactions and Undo Data 9-6
c o m ide.
Storing Undo Information 9-7
g i c. t Gu
Undo Data Versus Redo Data 9-8
a relo uden
Monitoring Undo 9-9
@ iw s St
Administering Undo 9-11
h a le
e thi
.b us
Configuring Undo Retention 9-12
d h
o t o
Guaranteeing Undo Retention 9-14
( s ub ense
Sizing the Undo Tablespace 9-15
hal
e lic
Using the Undo Advisor 9-16
h b
Summary 9-17
o d
sub Practice Overview: Managing Undo Segments 9-18

10 Implementing Oracle Database Security


Objectives 10-2
Industry Security Requirements 10-3
Separation of Responsibilities 10-5
Database Security 10-6
Principle of Least Privilege 10-8
Applying the Principle of Least Privilege 10-9
Monitoring for Suspicious Activity 10-11
Standard Database Auditing 10-12
Enabling Auditing 10-13
Uniform Audit Trails 10-14
Enterprise Manager Audit Page 10-15
Specifying Audit Options 10-16

viii
Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Using and Maintaining Audit Information 10-17
Value-Based Auditing 10-18
Fine-Grained Auditing 10-20
FGA Policy 10-21
Audited DML Statement: Considerations 10-23
FGA Guidelines 10-24
DBA Auditing 10-25
Maintaining the Audit Trail 10-26
Security Updates 10-27
Applying Security Patches 10-28
Summary 10-29
a ble
Practice Overview: Implementing Oracle Database Security 10-30
fe r
a ns
11 Configuring the Oracle Network Environment n- t r
o
Objectives 11-2
s an
Oracle Net Services 11-3
) ha
Oracle Net Listener 11-4
c o m ide.
Establishing Net Connections 11-5
g i c. t Gu
Establishing a Connection 11-6
a relo uden
User Sessions 11-7
@ iw s St
h a le
e thi
Tools for Configuring and Managing the Oracle Network 11-8
.b us
Listener Control Utility 11-9
d h
o t o
Listener Control Utility Syntax 11-10
( s ub ense
Listener Home Page 11-12
hal
e lic
Net Services Administration Pages 11-13
h b Creating a Listener 11-14
o d
sub Adding Listener Addresses 11-15
Database Service Registration 11-16
Naming Methods 11-17
Easy Connect 11-18
Local Naming 11-19
Directory Naming 11-20
External Naming Method 11-21
Configuring Service Aliases 11-22
Advanced Connection Options 11-23
Testing Oracle Net Connectivity 11-25
User Sessions: Dedicated Server 11-26
User Sessions: Shared Servers 11-27
SGA and PGA 11-28
Shared Server: Connection Pooling 11-29
When Not to Use a Shared Server 11-30

ix
Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Summary 11-31
Practice Overview: Working with Oracle Network Components 11-32

12 Proactive Maintenance
Objectives 12-2
Proactive Maintenance 12-3
Introducing Terminology 12-4
Optimizer Statistics 12-5
Using the Manage Optimizer Statistics Page 12-7
Automatic Workload Repository (AWR) 12-9
AWR Infrastructure 12-10
a ble
AWR Snapshot Sets 12-11
fe r
Enterprise Manager and AWR 12-12
a ns
Managing the AWR 12-13 n- t r
o
Statistic Levels 12-14
s an
Automatic Database Diagnostic Monitor (ADDM) 12-15
) ha
ADDM Findings 12-16
c o m ide.
ADDM Recommendations 12-17
g i c. t Gu
Advisory Framework 12-18
a relo uden
iw s St
Enterprise Manager and Advisors 12-20
@
h a le
The DBMS_ADVISOR Package 12-21
e thi
.b
Server-Generated Alerts 12-22
d h us
o t o
Default Server-Generated Alerts 12-23
( s ub ense
Setting Thresholds 12-24
hal
e lic
Creating and Testing an Alert 12-25
h b
Alerts Notification 12-26
o d
sub Reacting to Alerts 12-28
Alert Types and Clearing Alerts 12-29
Automated Maintenance Tasks 12-30
Summary 12-31
Practice Overview: Proactive Maintenance 12-32

13 Performance Management
Objectives 13-2
Performance Monitoring 13-3
Performance Monitoring: Top Sessions 13-7
Performance Monitoring: Top Services 13-8
SQL Tuning Advisor: Overview 13-9
SQL Tuning Advisor Options and Recommendations 13-10
Using the SQL Tuning Advisor 13-11
Using the SQL Tuning Advisor: Example 13-12

x
Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
SQL Tuning Advisor: SQL Statistics 13-14
SQL Tuning Advisor: Identifying Duplicate SQL 13-15
Using the SQL Access Advisor 13-16
Managing Memory Components 13-18
Enabling Automatic Shared Memory Management (ASMM) 13-19
Manually Setting Shared Memory Management 13-21
Using the Memory Advisor 13-22
Dynamic Performance Statistics 13-23
Troubleshooting and Tuning Views 13-25
Invalid and Unusable Objects 13-26
Summary 13-28
a ble
Practice Overview: Monitoring and Improving Performance 13-29
fe r
a ns
14 Backup and Recovery Concepts n- t r
o
Objectives 14-2
s an
Part of Your Job 14-3
) ha
Categories of Failures 14-4
c o m ide.
Statement Failure 14-5
g i c. t Gu
User Process Failure 14-6
a relo uden
Network Failure 14-7
@ iw s St
User Error 14-8
h a le
e thi
.b
Instance Failure 14-10
d h us
o t o
Background Processes and Recovery: Checkpoint (CKPT) 14-11
( s ub ense
Background Processes and Recovery: Redo Log Files and LogWriter 14-12
hal
e lic
Background Processes and Recovery: Archiver (ARCn) 14-13
h b Instance Recovery 14-14
o d
sub Phases of Instance Recovery 14-15
Tuning Instance Recovery 14-16
Using the MTTR Advisor 14-17
Media Failure 14-18
Configuring for Recoverability 14-19
Control Files 14-20
Redo Log Files 14-21
Multiplexing the Redo Log 14-22
Archive Log Files 14-23
Archive Log File: Naming and Destinations 14-24
ARCHIVELOG Mode 14-26
Summary 14-27
Practice Overview: Configuring for Recoverability 14-28

xi
Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
15 Performing Database Backups
Objectives 15-2
Backup Solutions: Overview 15-3
Oracle Secure Backup 15-4
User-Managed Backup 15-5
Terminology 15-6
Recovery Manager (RMAN) 15-8
Configuring Backup Settings 15-9
Scheduling Backups: Strategy 15-11
Scheduling Backups: Options 15-12
Scheduling Backups: Settings 15-13
a ble
Scheduling Backups: Schedule 15-14
fe r
Scheduling Backups: Review 15-15
a ns
Backing Up the Control File to a Trace File 15-16 n- t r
o
Managing Backups 15-18
s an
Flash Recovery Area 15-19
) ha
Summary 15-20
c o m ide.
Practice Overview: Creating Database Backups 15-21
g i c. t Gu
a r elo den
16 Performing Database Recovery
@ iw s Stu
Objectives 16-2
h a le
e t hi
Opening a Database 16-3
d h .b us
Changing Instance o t
Status 16-5 o
s ub eOpen
Keeping a(Database n se 16-6
Lossaof
c 16-7
lea ControlliFile
h
bLoss of a Redo Log File 16-8
d h
o Loss of a Data File in NOARCHIVELOG Mode 16-10
s ub
Loss of a Noncritical Data File in ARCHIVELOG Mode 16-11
Loss of a System-Critical Data File in ARCHIVELOG Mode 16-12
Summary 16-13
Practice Overview: Performing Database Recovery 16-14

17 Performing Flashback
Objectives 17-2
Flashback Technology: Benefits 17-3
When to Use the Flashback Technology 17-4
Flashing Back Any Error 17-5
Flashback Database: Overview 17-6
Flashback Database: Reducing Restore Time 17-7
Flashback Database: Considerations 17-8

xii
Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Flashback Database: Limitations 17-9
Enabling Flashback Database 17-10
Flashback Table: Overview 17-11
Flashback Table 17-12
Enabling Row Movement on a Table 17-13
Performing Flashback Table 17-14
Flashback Table: Considerations 17-16
Flashback Drop: Overview 17-17
Flashing Back Dropped Tables Through Enterprise Manager 17-18
Flashback Drop: Considerations 17-19
Flashback Time Navigation 17-20
a ble
Flashback Query: Overview 17-21
fe r
Flashback Query: Example 17-22
a ns
Flashback Versions Query: Overview 17-23 n- t r
o
Flashback Versions Query Through Enterprise Manager 17-24
s an
Flashback Versions Query: Considerations 17-25
) ha
Flashback Transaction Query: Overview 17-26
c o m ide.
i c. t Gu
Flashback Transaction Query Through Enterprise Manager 17-27
g
relo uden
Flashback Transaction Query: Considerations 17-28
a
Summary 17-29
@ iw s St
h a le
e thi
Practice Overview: Using Flashback 17-30

d h .b us
o
18 Moving Data t o
( s ub 18-2
Objectives e n se
e lic General Architecture 18-3
hal Moving Data:
h b Directory Object: Overview 18-4
o d
sub Creating Directory Objects 18-5
SQL*Loader: Overview 18-6
Loading Data with SQL*Loader 18-8
SQL*Loader Control File 18-9
Loading Methods 18-11
Data Pump: Overview 18-13
Data Pump: Benefits 18-14
Data Pump Export and Import: Overview 18-15
Data Pump Utility: Interfaces and Modes 18-16
Fine-Grained Object Selection 18-17
Advanced Feature: Sampling 18-18
Export Options: Files 18-19
Data Pump File Locations 18-20
Scheduling and Running a Job 18-22
Data Pump File Naming and Size 18-23

xiii
Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Data Pump Import 18-24
Data Pump Import: Transformations 18-25
Data Pump: Performance Consideration 18-27
Performance Initialization Parameters 18-28
Data Pump Access Path: Considerations 18-29
Using Enterprise Manager to Monitor Data Pump Jobs 18-30
External Table Population 18-31
Using External Tables 18-32
External Table Population with ORACLE_DATAPUMP 18-33
External Table Population with ORACLE_LOADER 18-34
Data Dictionary 18-35
a ble
Summary 18-36
fe r
Practice Overview: Moving Data 18-37
a ns
n- t r
o
Appendix A: Practices
s an
) ha
Appendix B: Solutions
c o m ide.
g i c. t Gu
Appendix C: Basic Linux and vi Commandsrelo e n
a
iw s Stu d
@
Appendix D: SQL Statement Syntax
h a le
e thi
d h .b us
Appendix E: Acronyms o
b and t o
eTerms
s u
( ice n s
a l eF: Next l - Continuing Your Education
b h
Appendix Steps

o d h
sub Index

xiv
Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Preface

a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Profile

Before You Begin This Course


Before you begin this course, you should have the following qualifications:
• Working experience with SQL

How This Course Is Organized


Oracle Database 10g: Administration Workshop I is an instructor-led course featuring lecture and hands-on
exercises. Online demonstrations and written practice sessions reinforce the concepts and skills introduced.

Suggested Next Courses


Oracle Database 10g: Administration Workshop II (D17092GC30)

a b le
fe r
a n s
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

Preface - 3
Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Related Publications

Oracle Publications
Title Part Number
Oracle Database 2 Day DBA 10g Release 2 (10.2) B14196-01
Oracle Database Administrator's Guide 10g Release 2 (10.2) B14231-01
Oracle Database Backup and Recovery Basics 10g Release 2 (10.2) B14192-01
Oracle Database Concepts 10g Release 2 (10.2) B14220-01
Oracle Database Licensing Information 10g Release 2 (10.2) B14199-01
Oracle Database Net Services Administrator's Guide 10g Release 2 (10.2) B14212-01
Oracle Database Net Services Reference 10g Release 2 (10.2) B14213-01
Oracle Database New Features Guide 10g Release 2 (10.2) B14214-01
a ble
Oracle Database Performance Tuning Guide 10g Release 2 (10.2) B14211-01
fe r
Oracle Database PL/SQL Packages and Types Reference 10g Release 2 (10.2) B14258-01
a ns
t r
Oracle Database PL/SQL User's Guide and Reference 10g Release 2 (10.2) on-
B14261-01
n
Oracle Database Recovery Manager Quick Start Guide 10g Release 2 (10.2)
s a
B14193-01
Oracle Database Recovery Manager Reference 10g Release 2 (10.2) ) h
a B14194-01
o m d e .
Oracle Database Security Guide 10g Release 2 (10.2)
i c
c. t Gu i B14266-01
g
a r elo den
Oracle Database SQL Quick Reference 10g Release 2 (10.2) B14195-01
Oracle Database SQL Reference 10g Release 2iw (10.2)
S tu B14200-01
@ s
h a le
e thi
Additional Publications
d h .b us
• System releaseu o
b nse
bulletins
t o
( s
e and user e
cguides
l
• Installation
a l i
bh files
• read.me
h
b o d• International Oracle Users Group (IOUG) articles
su
• Oracle Magazine

Preface - 4
Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Typographic Conventions
Typographic Conventions in Text

Convention Element Example


Bold Emphasized words and To navigate within this application, do not click
phrases in Web content the Forward and Back buttons.
only
Bold italic Glossary term (if there is The algorithm inserts the new key.
a glossary)

Brackets Key names Press [Enter].

Caps and Buttons, Click the Executable button.


lowercase check boxes, Select the Can’t Delete Card check box.
application triggers, Assign a When-Validate-Item trigger to the
windows ORD block. a ble
Open the Master Schedule window. fe r
a n s
n- t r
Angle brackets Menu paths Select File > Save.
a no
Commas Key sequences h a s keys one at a
Press and release the following
time: [Alt], [F], [D]m ) e.
o
.c Guid('I', 300);
Courier new, Code output, Code output:
g i cdebug.set
t $FMHOME (UNIX)
case sensitive directory names, lo bine(DOS),
Directory:
r e n
(default is file names,
i wFile d the init.ora file.
a name:tuLocate
S
lowercase) passwords,
path names, hal
e@ tPassword:
h is Use tiger as your password.
h
user input,. b u se User
Path name: Open c:\my_docs\projects.
input: Enter 300.
o d t o
( s ub ense
usernames Username: Log in as HR.

hal
Initialbcap
e lic
Graphics labels Customer address (but Oracle Payables)
o d h (unless the term is a
sub proper noun)

Italic Emphasized words and Do not save changes to the database.


phrases,
titles of books and For further information, see Oracle Database
courses, SQL Reference 10g Release 1(10.1).
variables
Enter [email protected], where
user_id is the name of the user.

Preface - 5
Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Typographic Conventions (continued)
Typographic Conventions in Text (continued)

Convention Element Example


Quotation marks Interface elements Select “Include a reusable module component” and
with long names click Finish.
that have only
initial caps; This subject is covered in the lesson titled, “Working
lesson and chapter with Objects.”
titles in cross-
references

Uppercase SQL column Use the SELECT command to view information stored
names, commands, in the LAST_NAME column of the EMPLOYEES table.
functions, schemas,
a ble
table names,
fe r
database trigger
a ns
names
n- t r
a no
h a s
Typographic Conventions in Code
m ) e.
o
Convention Element Example
g i c.c t Guid
Lowercase Column names, lo en
SELECTrelast_name
table names, i
FROM a
S tud
w employees;
database trigger
a l e@ this
names .bh se OR REPLACE TRIGGER secure_employees
CREATE
d h u
to CREATE USER scott
b o e
e ( su cens
Passwords
IDENTIFIED BY tiger;
a l l i
h bh PL/SQL objects items.DELETE(3);
b o d
s u
Lowercase italic Syntax variables CREATE ROLE role

Uppercase SQL commands SELECT first_name


and functions FROM employees;

Preface - 6
Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Typographic Conventions (continued)
Typographic Conventions in Navigation Paths
This course uses simplified navigation paths, such as the following example, to direct you through Oracle
applications.
Example:

Invoice Batch Summary


(N) Invoice > Entry > Invoice Batches Summary (M) Query > Find (B) Approve

This simplified path translates to the following:


1. (N) From the Navigator window, select Invoice > Entry > Invoice Batches Summary.
2. (M) From the menu, select Query > Find.
3. (B) Click the Approve button.
a ble
Notation:
fe r
(N) = Navigator (I) = Icon a ns
n- t r
(M) = Menu (H) = Hyperlink o
(T) = Tab (B) = Button s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

Preface - 7
Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Performing Database Recovery

a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
hal li
h b
o d
sub

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Objectives

After completing this lesson, you should be able to


recover from the loss of a:
• Control file
• Redo log file
• Data file ble
fe r a
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
hal li
h b
o d
sub

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 16 - 2
Opening a Database

To open a database:
• All control files must be present and synchronized
• All online data files must be present and
synchronized
• At least one member of each redo log group must ble
be present fe r a
a ns
OPEN
n- t r
STARTUP
a no
MOUNT
h a s
m ) e.
o
NOMOUNT
g i c.c t Guid
a r elo den
SHUTDOWN
@ iw s Stu
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
Openingaal Database
h li
b
h a database moves from the shutdown stage to being fully open, it performs internal
As
o d
sub consistency checks. The stages are:
• NOMOUNT: In order for an instance to reach the NOMOUNT (also known as
STARTED) status, the instance must read the initialization parameter file. No
database files are checked while the instance enters the NOMOUNT state.
• MOUNT: As the instance moves to the MOUNT status, it checks whether all control
files listed in the initialization parameter file are present and synchronized. If even
one control file is missing or corrupt, the instance returns an error (noting the missing
control file) to the administrator and remains in the NOMOUNT state.
• OPEN: When the instance moves from the MOUNT state to the OPEN state, it:
- Checks whether all redo log groups known to the control file have at least one
member present. Any missing members are noted in the alert log.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 16 - 3
Opening a Database (continued)
- Verifies that all data files known to the control file are present unless they have
been taken offline. Offline files are not checked until the administrator tries to
bring them online. The administrator may take a data file offline and open the
instance as long as the data file does not belong to the SYSTEM or UNDO
tablespaces. If any files are missing, an error noting the first missing file is
returned to the administrator and the instance remains in the MOUNT state.
When the instance finds files that are missing, only the first file causing a
problem appears in the error message. To find all files that need recovery, the
administrator can check the v$recover_file dynamic performance view to
get a complete list of the files that need attention:
SQL> startup
ORACLE instance started.
a ble
Total System Global Area 171966464 bytes
fe r
Fixed Size 775608 bytes
a ns
Variable Size 145762888 bytes n- t r
o
Database Buffers 25165824 bytes
s an
Redo Buffers 262144 bytes
) ha
Database mounted.
c o m ide.
g i c. t Gu
ORA-01157: cannot identify/lock data file 4 - see DBWR

relo uden
trace file
ORA-01110: data file 4: a
iw s St
@
'/oracle/oradata/orcl/users01.dbf'
h a le
SQL> SELECT name, error
e thi
h .b
2 FROM v$datafile
d us
o t o
( s ub ense
3 JOIN v$recover_file

lic
4 USING (file#);
e
bhal NAME ERROR

o d h ----------------------------------- ------------------
sub /oracle/oradata/orcl/users01.dbf FILE NOT FOUND
/oracle/oradata/orcl/example01.dbf FILE NOT FOUND
- Verifies that all data files that are not offline or read-only are synchronized
with the control file. If necessary, instance recovery is automatically
performed. However, if a file is out of synchronization to the extent that it
cannot be recovered by using the online redo log groups, then the administrator
must perform media recovery. If any files require media recovery, an error
message noting the first file requiring recovery is returned to the administrator
and the instance remains in the MOUNT state:
ORA-01113: file 4 needs media recovery
ORA-01110: data file 4:
'/oracle/oradata/orcl/users01.dbf'
Again, v$recover_file gives a complete list of files that need attention.
Files that are present and which need media recovery are listed, but no error
message is displayed .

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 16 - 4
Changing Instance Status

Use Database Control to alter the instance’s status.

a ble
fe r
a ns
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
halInstanceli Status
Changing
b
o d h starting the instance, the default start mode is OPEN. You may choose to start the
When
sub instance in some other mode, or problems with the database may force you to start the
instance in another mode. The Advanced Startup Options properties page enables you to
select a state other than OPEN when starting the instance and to alter the state if the
instance has already started in another mode. You may also use SQL commands to modify
an instance’s status:
SQL> STARTUP NOMOUNT
ORACLE instance started.

Total System Global Area 188743680 bytes


Fixed Size 778036 bytes
Variable Size 162537676 bytes
Database Buffers 25165824 bytes
Redo Buffers 262144 bytes

SQL> ALTER DATABASE MOUNT


Database altered.

SQL> ALTER DATABASE OPEN


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 16 - 5
Keeping a Database Open

After the instance is open, it fails in the case of the


loss of:
• Any control file
• A data file belonging to the system or undo
tablespaces
r a ble
• An entire redo log group. As long as at least one s fe
member of the group is available, the instance -tra n
remains open. non a
a s
m ) h e.
i c .co Guid
l o g nt
r e e
i wa Stud
a l e@ this
h . bhCopyrightu©s2008,
e
o d t o Oracle. All rights reserved.

( s ub ense
Keepingaale
h Database lic Open
h b an instance is open, media failure that causes the loss of a control file, loss of an
After
b d
o entire redo log group, or loss of a data file belonging to the SYSTEM or UNDO tablespaces
s u
causes the instance to fail.
In many cases, the failed instance does not completely shut down, but is unable to continue
to perform work. Recovering from these types of media failures must be done with the
database down, and so the administrator must use the SHUTDOWN ABORT command
before beginning recovery efforts.
The loss of data files belonging to other tablespaces does not cause instance failure, and
the database can be recovered while open, with work continuing in other tablespaces.
These errors can be detected by inspecting the alert log file.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 16 - 6
Loss of a Control File

If a control file is lost or corrupted, the instance


normally aborts, at which time you must perform the
following steps:
1. Shut down the instance, if it is still open.
2. Restore the missing control file by copying an
existing control file. r a ble
n s fe
3. Start the instance. -tra on
a n
h a s
m ) e.
o
Control files
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
i
h a lControl lFile
Loss of a
h b
Recovering from the loss of a control file (as long as at least one control file remains) can
o d
sub be accomplished by performing the following steps:
1. If the instance has not already failed, shut it down by using SHUTDOWN ABORT.
2. Copy one of the remaining control files to the missing file’s location. If the media
failure is due to the loss of a disk drive or controller, copy one of the remaining
control files to some other location and update the instance’s parameter file to point
to the new location. Alternatively, you can delete the reference to the missing control
file from the initialization parameter file. Remember that Oracle recommends having
at least two control files at all times.
3. Start the instance.
Recovering from the loss of all control files is covered in Oracle Database 10g:
Administration Workshop II.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 16 - 7
Loss of a Redo Log File

If a member of a redo log file group is lost, as long as


the group still has at least one member, then:
• The normal operation of the instance is not
affected.
• You receive a message in the alert log notifying
you that a member cannot be found. r a ble
n s fe
• You can restore the missing log file by dropping
n - tra
the lost redo log member and adding a newno
s a
member. a
m ) h e.
• If the group with the missing log
i c .cofile uhas
id been
G to re-create
archived, you can clear thel o glog group
n t
the missing file. iwar
e e
tud
l e @ his S
. b ha se t
d h Copyright
t o u© 2008, Oracle. All rights reserved.
o
ub ense
( s
Loss of a
h
e Log
a lRedo licFile
h b
Recovering from the loss of a single redo log group member should not affect the running
o d
sub instance. To perform this recovery, perform the following steps:
1. Determine whether there is a missing log file by examining the alert log.
2. Restore the missing file by first dropping the lost redo log member:
SQL> ALTER DATABASE DROP LOGFILE MEMBER 'redo01a.log';
Then add a new member to replace the lost redo log member:
SQL> ALTER DATABASE ADD LOGFILE MEMBER 'redo01a.log'
TO GROUP 2;
Note: If you are using OMF for your redo log files and you use the above syntax to
add a new redo log member to an existing group, that new redo log member file will
not be an OMF file. If you want to ensure that the new redo log member is an OMF
file, the easiest recovery option would be to create a new redo log group and then
drop the redo log group that had the missing redo log member.
3. If the media failure is due to the loss of a disk drive or controller, rename the missing
file.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 16 - 8
Loss of a Redo Log File (continued)
4. If the group has already been archived, or if you are in NOARCHIVELOG mode, you
may choose to solve the problem by clearing the log group to re-create the missing
file or files. Select the appropriate group and select the Clear Logfile action. You can
also clear the affected group manually with the following command:
SQL> ALTER DATABASE CLEAR LOGFILE GROUP #;
Note: Database Control does not allow you to clear a log group that has not been archived.
Doing so breaks the chain of redo information. If you must clear an unarchived log group,
you should immediately take a full backup of the whole database. Failure to do so may
result in a loss of data if another failure occurs. To clear an unarchived log group, use the
following command:
SQL> ALTER DATABASE CLEAR UNARCHIVED LOGFILE GROUP #;
a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 16 - 9
Loss of a Data File in NOARCHIVELOG Mode

If the database is in NOARCHIVELOG mode, and any


data file is lost, perform the following tasks:
1. Shut down the instance if it is not already down.
2. Restore the entire database, including all data and
control files, from the backup.
r a ble
3. Open the database. s fe
tra n
4. Have users reenter all changes made since the n -
o
last backup. an s
h a
) e.
o m
g i c.c t Guid
a relo uden
User User iw UserSt User User
e @ i s
b h al e th
d t o u©s2008, Oracle. All rights reserved.
h. Copyright
o
ub ense
( s
e Filelicin NOARCHIVELOG Mode
Loss of aa lData
h
bloss of any data file from a database in NOARCHIVELOG mode requires complete
d h
The
subo restoration of the database, including control files and all data files.
With the database in NOARCHIVELOG mode, recovery is possible only up to the time of
the last backup. So users must reenter all changes made since that backup. For this type of
recovery, perform the following tasks:
1. Shut down the instance if it is not already down.
2. Click Perform Recovery on the Maintenance properties page.
3. Select Whole Database as the type of recovery.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 16 - 10
Loss of a Noncritical Data File
in ARCHIVELOG Mode

If a data file is lost or corrupted, and that file does not


belong to the SYSTEM or UNDO tablespace, then restore
and recover the missing data file.

a ble
fe r
a ns
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St Users
e
al e th i
b h
d t o u©s2008, Oracle. All rights reserved.
h. Copyright
o
ub ense
( s
Loss of a
h
e lic Data File in ARCHIVELOG Mode
a lNoncritical
h bthe database in ARCHIVELOG mode, the loss of any data file not belonging to the
With
d
subo SYSTEM or UNDO tablespaces only affects objects that are in the missing file. The rest of
the database remains available for users to continue work. To restore and recover the
missing data file, perform the following steps:
1. Click Perform Recovery on the Maintenance properties page.
2. Select “Datafiles” as the recovery type, and select “Restore to current time.”
3. Add all data files that need recovery.
4. Determine whether you want to restore the files to the default location or (if a disk or
controller is missing) to a new location.
5. Submit the RMAN job to restore and recover the missing files.
Because the database is in ARCHIVELOG mode, recovery up to the time of the last
commit is possible and users are not required to reenter any data.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 16 - 11
Loss of a System-Critical Data File
in ARCHIVELOG Mode

If a data file is lost or corrupted, and that file belongs


to the SYSTEM or UNDO tablespace:
1. The instance may or may not shut down
automatically. If it does not, use SHUTDOWN ABORT
to bring the instance down.
2. Mount the database r a ble
n s fe
3. Restore and recover the missing data file
n - tra
o
4. Open the database an s
h a
) e.
o m
g i c.c t Guid
a relo uden
@ iw s St Users
e
al e th i
b h
d t o u©s2008, Oracle. All rights reserved.
h. Copyright
o
ub ense
( s
Loss of a
h
e lic
a lSystem-Critical Data File
b
h files belonging to the SYSTEM tablespace or containing UNDO data are considered
Data
o d
sub system critical. A loss of one of these files requires the database to be restored from the
MOUNT state (unlike other data files that may be restored with the database open). To
perform this recovery, perform the following steps:
1. If the instance is not already shut down, shut it down.
2. Mount the database.
3. Click Perform Recovery on the Maintenance properties page.
4. Select “Datafiles” as the recovery type, and select “Restore to current time.”
5. Add all data files that need recovery.
6. Determine whether you want to restore the files to the default location or (if a disk or
controller is missing) to a new location.
7. Submit the RMAN job to restore and recover the missing files.
8. Open the database. Users are not required to reenter data because the recovery is up
to the time of the last commit.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 16 - 12
Summary

In this lesson, you should have learned how to recover


from the loss of a:
• Control file
• Redo log file
• Data file ble
fe r a
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
hal li
h b
o d
sub

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 16 - 13
Practice Overview:
Performing Database Recovery

This practice covers recovering from the loss of a:


• Control file
• Redo log file
• Noncritical data file
• System-critical data file
a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
hal li
h b
o d
sub

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 16 - 14
Performing Flashback

a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
hal li
h b
o d
sub

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Objectives

After completing this lesson, you should be able to:


• Describe Flashback Database
• Restore the table content to a specific point in the
past with Flashback Table
• Recover from a dropped table ble
r a
• View the contents of the database as of any single sfe
t r a n
point in time with Flashback Query
n on-
• See versions of a row over time with Flashback
s a
Versions Query a
) h e.
m
.co with
• View transaction history or aicrow
G uidFlashback
g t
Transaction Query relo den
i wa Stu
a l e@ this
h . bhCopyrightu©s2008,
e
o d t o Oracle. All rights reserved.

( s ub ense
hal
e lic
h b
o d
sub

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 17 - 2
Flashback Technology: Benefits > Overview
Database
Table
Drop
Query
Versions
• The Flashback technology is a revolutionary Transaction
advance in recovery.
• Traditional recovery techniques are slow.
– The entire database or a file (not just the incorrect
data) has to be restored.
– Every change in the database log must be r a ble
examined. n s fe
a - tr
• Flashback is fast. no n
– Changes are indexed by row and by h s
transaction.
a
) a
om de.
– Only the changed data is restored.
.c Gui
• Flashback commands areloeasy.nt g i c
re procedures e
– No complex multiple-step i w Stud
a are involved.
@ s
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
Flashback li
hal Technology: Benefits
b
h Oracle Database 10g architecture leverages the unique technological advances in the
The
o d
sub area of database recovery from the loss of data due to human errors. The Flashback
technology provides a set of new features to view and rewind data back and forth in time.
The Flashback technology revolutionizes recovery by simply operating on the changed
data. The time it takes to recover from the error is equal to the amount of time it takes to
make the error. When applicable, the Flashback technology provides significant benefits
over media recovery in terms of ease of use, availability, and restoration time.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 17 - 3
When to Use the Flashback Technology

Object Flashback Affects


Level Scenario Examples Technology Uses Data
Database Truncate table; Database Flashback True
Undesired multitable logs
changes made
Table Drop table Drop Recycle bin True
a ble
Update with the wrong Table Undo data True fe r
WHERE clause
a ns
n- t r
Compare current data Query Undo data
n oFalse
with data from the past a s
Compare versions of a Version h
Undo
a
) data False
o m e .
row
i c .c Guid
Tx Investigate several g
lo ent Undo data False
Transaction
r e
historical states of dataa
i w Stud
a l e@ this
h . bhCopyrightu©s2008,
e
o d t o Oracle. All rights reserved.

( s ub ense
When toaUse
h lic
le the Flashback Technology
b
h Flashback technology must be used when a logical corruption occurs in the Oracle
The
o d
sub database, and you need to recover data quickly and easily. As with human errors, it is
difficult to identify the objects and rows that are affected by an erroneous transaction.
With the Flashback technology, you can diagnose how errors are introduced into the
database, and then you can repair the damage. You can view the transactions that have
contributed to specific row modifications, view the entire set of versions of a given row
during some time period, or just view data as it appeared at a specific time in the past. The
table in the slide shows typical uses of the Flashback technology.
Flashback Database uses the flashback logs to perform flashback. Flashback Drop uses the
recycle bin. All others use undo data.
Not all flashback features modify the database. Some are simply methods to query other
versions of data. Those are tools for you to use to investigate a problem and aid in
recovery. The results of those flashback queries can help you perform one of these two
things:
• Determine which type of database-modifying flashback operation to perform to fix
the problem
• Feed the result set of these queries into an INSERT, UPDATE, or DELETE statement
that enables you to easily repair the erroneous data.
Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 17 - 4
Flashing Back Any Error

• Flashback Database brings the database to an


earlier point in time by undoing all changes made
since that time.
• Flashback Table recovers a table to a point in time
in the past without having to restore from a
backup. r a ble
fe
• Flashback Drop restores accidentally dropped trans
-
tables. non a
a s
m ) h e.
i c .co Guid
l o g nt
r e e
i wa Stud
a l e@ this
h . bhCopyrightu©s2008,
e
o d t o Oracle. All rights reserved.

( s ub ense
le AnylicError
FlashingaBack
h
h b Database 10g introduces expanded database flashback capabilities. If a major error
Oracle
b d
o occurs that makes unisolated changes, such as a batch job being run twice in succession,
s u
then you can request a flashback operation that quickly recovers the entire database to a
previous point in time. This eliminates the need to restore backups and perform a
point-in-time recovery. In addition to flashback operations at the database level, it is also
possible to flash back a single table or recover a table dropped in error.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 17 - 5
Flashback Database: Overview Overview
> Database
Table
Drop
Query
Versions
The Flashback Database operation: Transaction
• Works like a rewind button for the database
• Can be used in cases of logical data corruptions
made by users

a ble
fe r
a ns
n- t r
a no
Users The You "press the has The
generate database is rewind button." ) .
m idedatabase is
c o
errors. corrupted.
g i c. t Gu “rewound.”
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
li Overview
hal Database:
Flashback
b
h Flashback Database, you can quickly bring your database to an earlier point in time
With
o d
sub by undoing all the changes that have taken place since that time. This operation is fast
because you do not need to restore backups. You can use this feature to undo changes that
have resulted in logical data corruptions.
If you have experienced a loss of media or physical corruption in your database, then you
must use traditional recovery methods.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 17 - 6
Flashback Database:
Reducing Restore Time

Incomplete Recovery Repaired


Restore files database
Generate logs

Apply logs
Backup User error forward a ble
fe r
a ns
Flashback Database User Repaired n- t r
error database a no
Flashback logs
h a s
m ) e.
o
g i c.c t Guid
Backup
Apply
a r eloFlashback d e n
iw logs S tu
backward
@ s
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
li Reducing Restore Time
hal Database:
Flashback
h b
Flashback Database is faster than the traditional point-in-time recovery that uses restored
o d
sub files and redo log files. As a database grows in size, the length of time required to restore
all the data files to perform a traditional point-in-time recovery becomes prohibitive. With
Flashback Database, the time to recover a database is now proportional to the number of
changes that need to be backed out (and not to the size of the database) because you do not
have to restore data files.
Flashback Database is implemented by using a type of log file called Flashback Database
logs. The Oracle database periodically logs “before images” of data blocks in the
Flashback Database logs. Block images can be reused to quickly back out the data file
changes to any time at which flashback logs are captured just before the desired target
time. Then, changes from the redo log files are applied to fill in the gap. The Flashback
Database logs are automatically created and managed in the flash recovery area.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 17 - 7
Flashback Database: Considerations

• When the Flashback Database operation


completes, the database must be opened by using
one of these methods:
– In read-only mode to verify that the correct target
time or SCN has been used
– With the RESETLOGS parameter to allow for updates
a ble
fe r
• The opposite of flash back is recover. n s
t r a
n- no
s a
h a
) e.
o m
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
hal Database:
Flashback li Considerations
b
Inhsituations where you cannot use the Flashback Database feature, you must use an
o d
sub incomplete recovery operation to return the database to a specific time. After the
Flashback Database operation is complete, you can open the database in read-only mode to
verify that the correct target time or system change number (SCN) has been used. If not,
you can flash back the database again or perform a recovery to roll forward the database.
So, to undo a Flashback Database operation, you must recover the database forward.
Note: The flashback retention target is not an absolute guarantee that flashback is
available. If space is needed for required files in the flash recovery area, then flashback
logs may be deleted automatically.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 17 - 8
Flashback Database: Limitations

You cannot use Flashback Database in the following


situations:
• The control file has been restored or re-created.
• A tablespace has been dropped.
• A data file has been shrunk. le
r a b
ns fe
t r a
n-no
s a
h a
) e.
o m
g i c.c t Guid
Flashback Drop
a elo data
rShrink d e n Re-create Present
target time tablespace.
@ iw s Sfile.tu control file.
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
hal Database:
Flashback li Limitations
b
h cannot use Flashback Database to recover a data file that has been dropped since the
You
o d
sub Flashback target time. The dropped data file is added to the control file and marked
offline, but it is not flashed back. Flashback Database cannot flash back a data file if it has
been shrunk since the Flashback target time. Any such data files must be taken offline
before performing the flashback operation.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 17 - 9
Enabling Flashback Database

a ble
fe r
a ns
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
h l
EnablingaFlashback li Database
h b
Flashback Database can be enabled in Enterprise Manager, using the Recovery Settings
o d
sub link on the Maintenance tabbed page. Turn on the checkmark in the Flash Recovery region
of the page, and specify the retention time, which is how far back in the past you want to
be able to flash back the database to.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 17 - 10
Flashback Table: Overview Overview
Database
> Table
Drop
Query
Versions
• Flashback Table recovers tables to a Transaction
specific point in time.
• Flashback Table is an in-place operation.
• The database stays online.

a ble
fe r
a ns
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
Erroneous a relo uden Flashed back
DMLs @iw s StUser tables
l e h i
. b ha se t
d h Copyright
t o u© 2008, Oracle. All rights reserved.
o
ub ense
( s
Flashback
h a ic
leTable: lOverview
h b Flashback Table, you can recover a set of tables to a specific point in time without
Using
b d
o having to perform traditional point-in-time recovery operations.
s u
A Flashback Table operation is done in-place, while the database is online, by rolling back
only the changes that are made to the given tables and their dependent objects.
A Flashback Table statement is executed as a single transaction. All tables must be flashed
back successfully, or the entire transaction is rolled back.
Note: You can use Flashback Versions Query and Flashback Transaction Query to
determine the appropriate flashback time.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 17 - 11
Flashback Table

• Using Flashback Table, you can recover a table or


tables to a specific point in time without restoring
a backup.
• Data is retrieved from the undo tablespace to
perform a Flashback Table operation.
• The FLASHBACK object privilege and the r a ble
fe
FLASHBACK ANY TABLE system privilege can betrans
granted to allow a non-owner of a table to non
-
flashback that table. s a
a
) htheetable
• Row movement must be enabled o m
on d . that
. c u
c t operationi
ogi
you are performing the flashback G
rel uden
on.
a
iw s St
@
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
hal Table li
Flashback
b
o d h Flashback Table, you can recover a table or tables to a specific point in time without
With
sub restoring a backup. When you use this feature, the data in tables and their associated
objects (indexes, constraints, triggers, and so on) is restored. The data used to satisfy a
Flashback Table request is retrieved from the undo tablespace.
You can use Flashback Versions Query and Flashback Transaction Query to determine the
appropriate flashback time. For more information about using these features, refer to
Oracle Database Concepts.
Flashback Table provides a way for users to easily and quickly recover from accidental
modifications without a database administrator’s (DBA’s) involvement. You may grant the
FLASHBACK object privilege to other users for a specific table to allow them to flashback
that table. There is also the FLASHBACK ANY TABLE system privilege that allows a
user to flashback any table.
You can use Enterprise Manager to flash back a table. The wizard guides you through the
process.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 17 - 12
Enabling Row Movement on a Table

a ble
fe r
a ns
n- t r
a no
h a s
m )MOVEMENT;
e .
ALTER TABLE employees ENABLE ROW
c o i d
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
EnablingaRow li
h l Movement on a Table
b
h must enable row movement on a table to be able to flash back the table. When you
You
o d
sub enable row movement, the Oracle server can move a row in the table. You can use
Enterprise Manager to enable row movement.
Using Enterprise Manager, you can enable row movement on a table by performing the
following steps:
1. Select Tables in the Schema region on the Administration property page. Enter the
schema name to search for the table, and click Go.
2. Click the table name of the table for which you want to enable row movement. You
are now on the View Table page.
3. Click Edit, which takes you to the Edit Table page.
4. Click the Options tab, where you can change the Enable Row Movement setting for
the table.
5. Set Enable Row Movement to Yes, and click Apply.
The update confirmation message is displayed.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 17 - 13
Performing Flashback Table

a ble
fe r
a ns
n- t r
a no
h a s
m ) e.
FLASHBACK TABLE hr.employeesc.c o uid
TO TIMESTAMP
g i t G
TO_TIMESTAMP('2005-05-05
r e lo05:32:00', e n
'YYYY-MM-DD HH24:MI:SS'); i wa Stud
a l e@ this
h . bhCopyrightu©s2008,
e
o d t o Oracle. All rights reserved.

( s ub ense
a
Performing
h lic Table
leFlashback
h
You
bcan flash back a table through Enterprise Manager by performing the following steps:
d
subo 1. Select Perform Recovery in the Backup/Recovery region on the Maintenance
property page. The Perform Recovery page appears.
2. In the Object Level Recovery region, select Tables from the Object Type drop-down
list.
3. Select Flashback Existing Tables as the Operation Type. Click Perform Object Level
Recovery. The “Perform Object Level Recovery: Point-in-time” page is displayed.
4. Select “Flashback to a timestamp” or “Flashback to a known SCN” and then specify
a time stamp or SCN to flash back to, and click Next.
5. Click Add Tables to add tables to the list for the flashback operation. Click Next.
6. The Dependency Options page appears if there are dependent tables. Select the
desired option for dealing with dependent tables. Typically, you would choose
“Cascade” to ensure a consistent flashback. Click Next.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 17 - 14
Performing Flashback Table (continued)
7. The “Perform Object Level Recovery: Review” page appears. Review the
information and click Submit. The Confirmation page appears.
Note: You can also flash back tables from the Tables link in the Schema region of the
Administration page.

a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 17 - 15
Flashback Table: Considerations

• The FLASHBACK TABLE command executes as a


single transaction, acquiring exclusive DML locks.
• Statistics are not flashed back.
• Current indexes and dependent objects are
maintained. le
r a b
• Flashback Table operations: s fe
– Cannot be performed on system tables t r a n
o n-
– Cannot span DDL operations
s an
– Generate undo and redo data ) h a
de.
. c om ui
l o gic nt G
a re ude
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
Flashback
h i
al Table: lConsiderations
b
h• The entire FLASHBACK TABLE statement is executed within a single transaction.
o d
sub • Flashback Table acquires exclusive data manipulation language (DML) locks on all
All or none of the specified tables are flashed back.

the tables that are specified in the statement over the period of time when the
operation is in progress.
• Statistics of impacted objects are not flashed back.
• All existing indexes are maintained. Dropped indexes are not re-created. Dependent
on-commit materialized views are also maintained automatically.
• A FLASHBACK TABLE statement is written to the alert log file.
• Tables specified in the FLASHBACK TABLE statement are flashed back, provided
that none of the table constraints are violated. If any constraints are violated during
flashback execution, the operation is aborted and the tables are left in the same state
as they were just before the FLASHBACK TABLE statement invocation.
• You cannot perform Flashback Table to a particular time that is older than the time
of the execution of a data definition language (DDL) operation that altered the
structure of or shrunk a table that would be involved in the flashback operation. This
restriction does not apply to DDL statements that only change storage attributes of
the tables.
• Flashback Table cannot be performed on system tables, remote tables, and fixed
tables.
Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 17 - 16
Flashback Drop: Overview Overview
Database
Table
> Drop
Query
Versions
Transaction

Recycle
Bin

a ble
fe r
DROP TABLE employees; FLASHBACK TABLE
a n s
employees
n -t r
TO BEFORE DROP; n o
Mistake was s a
a
) h e.
made. m
i c .co Guid
l o g nt
r e e
i wa Stud
a l e@ this
h . bhCopyrightu©s2008,
e
o d t o Oracle. All rights reserved.

( s ub ense
Flashback
h a lic
leDrop: Overview
h bthe Flashback Drop feature, you can undo the effects of a DROP TABLE statement
With
b d
o without resorting to the traditional point-in-time recovery. This is made possible because
s u
of the recycle bin, which can be queried via the DBA_RECYCLEBIN view.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 17 - 17
Flashing Back Dropped Tables
Through Enterprise Manager

a ble
fe r
a ns
n- t r
a no
h a s
Dependent bitmap index m ) e.
o
will also be flashed back.
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
h l Dropped
FlashingaBack li Tables Through Enterprise Manager
b
h flash back dropped tables with the Database Control Console, select Perform Recovery
To
o d
sub in the Backup/Recovery region of the Maintenance page. Select Tables for the Object
Type in the Type region, and choose Flashback Dropped Tables in the Operation Type
region. After this is done, click Perform Object Level Recovery.
You should now see the “Perform Object Level Recovery: Dropped Objects Selection”
page, where you can select dropped tables from the recycle bin. You can also query the
content of dropped tables by clicking View Content. Select the tables that you want to
recover, and click Next.
The “Perform Object Level Recovery: Rename” page appears, where you can rename the
table if a table with the same name currently exists in the same schema. Click Next to
continue. On the “Perform Object Level Recovery: Review” page, you can review the
details of your operation as well as display the corresponding SQL statements. After you
are ready, click Submit. You should now see the Confirmation page. Click OK to go back
to the Maintenance page.
Note: You can also flash back dropped tables from the Tables link of the Schema region of
the Administration page. On the Tables page, click the Recycle Bin button.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 17 - 18
Flashback Drop: Considerations

• Flashback Drop does not work for tables that:


– Reside in the SYSTEM tablespace
– Use fine-grained auditing or Virtual Private
Database
– Reside in a dictionary-managed tablespace
a ble
– Have been purged, either by manual purging or r
automatic purging under space pressure ns fe
t r a
• The following dependencies are not protected:
no n-
– Bitmap-join indexes s a
h a
) e.
– Materialized view logs o m
– g i c.c t Guid
Referential integrity constraints
– a
Indexes dropped ibeforerelotables
d e n
w tu
l e @ his S
. b ha se t
d h Copyright
t o u© 2008, Oracle. All rights reserved.
o
ub ense
( s
Flashback
h a lic
leDrop: Considerations
h b Drop only works for tables in non-SYSTEM, locally managed tablespaces
Flashback
b d
o (LMT). However, dependent objects that reside in dictionary-managed tablespaces are
s u
flashed back as part of the flashback operation of the LMT-dwelling parent object.
Tables with fine-grained auditing (FGA) or Virtual Private Database (VPD) policies
defined on them are not eligible for a Flashback Drop operation. Also, you cannot flash
back a dropped table if it has been purged. It could have been purged manually with the
PURGE statement or automatically as the result of a need for space for other objects in the
tablespace.
When you perform Flashback Drop on a table, all objects dependent on that table are also
flashed back from the recycle bin. There are exceptions to this: Bitmap-join indexes,
referential integrity constraints, and materialized view logs are not flashed back, even
though their parent table is.
Note: If you drop an index before its associated table, recovery of the index is not
supported when you flash back the dropped table.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 17 - 19
Flashback Time Navigation Overview
Database
Table
Drop
> Query
Versions
• Flashback Query Transaction
– Query all data at a specified point in time.
• Flashback Versions Query
– See all versions of a row between two times.
– See the transactions that changed the row.
• Flashback Transaction Query a ble
fe r
– See all changes made a ns
by a transaction.
Time
n- t r
a no
h a s
Tx3 m ) e.
o
Tx2 g i c.c t Guid
a reloTx1uden Flashback
iw s S t
@
h a l e
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
li
hal Time Navigation
Flashback
b
h Flashback technology offers the capability to query past versions of schema objects,
The
o d
sub query historical data, and perform change analysis. Every transaction logically generates a
new version of the database. With the Flashback technology, you can navigate through
these versions to find an error and its cause:
• Flashback Query: Query all data as it existed at a specific point in time.
• Flashback Versions Query: See all versions of rows between two times and the
transactions that changed the row.
• Flashback Transaction Query: See all changes made by a transaction.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 17 - 20
Flashback Query: Overview

Employees Unwanted Employees


updates

a ble
fe r
ns
t1 t2 -tra
n on
a s
SELECT employee_id, salary FROM employees h a
) e.
o m
AS OF TIMESTAMP t1
g i c.c t Guid
WHERE employee_id = 200
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
hal Query:liOverview
Flashback
b
o d h the Flashback Query feature, you can perform queries on the database as of a certain
With
sub time. By using the AS OF clause of the SELECT statement, you can specify the time stamp
for which to view the data. This is useful for analyzing a data discrepancy.
Note: The AS OF clause can be followed by either TIMESTAMP or SCN.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 17 - 21
Flashback Query: Example

Employees Employees Employees

salary = 4,400 salary = 4,840 salary = 4,400

a ble
11:00 11:10 fe r
a ns
UPDATE employees SET salary = n- t r
(SELECT salary FROM employees a no
AS OF TIMESTAMP TO_TIMESTAMP h a s
m ) hh24:mi:ss')
e .
c o
('2005-05-04 11:00:00', 'yyyy-mm-dd
i d
WHERE employee_id = 200) ic. G u
WHERE employee_id = 200 relo
g t
en
i wa Stud
a l e@ this
h . bhCopyrightu©s2008,
e
o d t o Oracle. All rights reserved.

( s ub ense
Flashback a c
leQuery:liExample
b h
dIfha raise has been erroneously given to a particular employee recently, you can update the
ub o salary again, assigning the salary provided by a subquery that returns the flashed back
s value.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 17 - 22
Flashback Versions Query: Overview
Database
Overview Table
Drop
Query
Tx0 Tx1 Tx2 > Versions
Transaction
Employees Employees Employees

200

a ble
t1 t2 fe r
a ns
SELECT versions_xid, salary FROM employees
n- t r
o
VERSIONS BETWEEN TIMESTAMP t1 and t2
an
WHERE employee_id = 200; has ) e.
o m
g i c.c t Guid
Tx0 Tx1 elo n Tx2
a r d e
@ iw s Stu
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
hal Versions
Flashback li Query: Overview
b
h the Flashback Query feature, you can perform queries on the database as of a certain
With
o d
sub time span or range of user-specified system change numbers (SCNs). The Flashback
Versions Query feature enables you to use the VERSIONS clause to retrieve all the
versions of the rows that exist between two points in time or two SCNs.
The rows returned by Flashback Versions Query represent a history of changes for the
rows across transactions. Flashback Versions Query retrieves only committed occurrences
of the rows. Uncommitted row versions within a transaction are not shown. The rows
returned also include deleted and subsequently reinserted versions of the rows.
You can use Flashback Versions Query to retrieve row history. It provides you with a way
to audit the rows of a table and retrieve information about the transactions that affected the
rows. You can then use the returned transaction identifier either to perform transaction
mining by using LogMiner or to perform a Flashback Transaction Query, which is covered
later in this lesson.
Note: In the example, VERSIONS_XID is a pseudocolumn that returns the transaction
identifier of the corresponding version of a row.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 17 - 23
Flashback Versions Query Through
Enterprise Manager

a ble
fe r
a ns
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
li Query Through Enterprise Manager
hal Versions
Flashback
h b
Flashback Versions Query can also be performed through Enterprise Manager. On the
o d
sub Maintenance page, select Perform Recovery.
On the Perform Recovery page, select Tables for the Object Type and select Flashback
Existing Tables for the Operation Type. Click Perform Object Level Recovery. On the
“Perform Object Level Recovery: Point-in-Time” page, select “Evaluate row changes and
transactions to decide on a point in time,” and specify the name of the target table.
Select the columns that you want to view in the Available Columns box, and then enter a
search clause in the Bind The Row Value box. Select “Show all row history,” and then
click Next.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 17 - 24
Flashback Versions Query: Considerations

• The VERSIONS clause cannot be used to query:


– External tables
– Temporary tables
– Fixed tables
– Views le
• The VERSIONS clause cannot span DDL r a b
n s fe
commands. -t r a
o n
• an
Segment shrink operations are filtered out.
s
h a
) e.
o m
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
li Query: Considerations
hal Versions
Flashback
b
h VERSIONS clause cannot be used to query the following special tables:
The
o d
sub • External tables
• Temporary tables
• Fixed tables
You cannot use the VERSIONS clause to query a view. However, a view definition can
use the VERSIONS clause.
The VERSIONS clause in a SELECT statement cannot produce versions of rows across
the DDL statements that change the structure of the corresponding tables. This means that
the query stops producing rows after it reaches a time in the past when the table structure
was changed.
Certain maintenance operations, such as a segment shrink, may move table rows across
blocks. In this case, the version query filters out such phantom versions because the row
data remains the same.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 17 - 25
Flashback Transaction Query: Overview
Database
Overview Table
Drop
Query
FLASHBACK_TRANSACTION_QUERY Versions
> Transaction

DBA

a ble
fe r
Erroneous
Undo a ns
DML
n- t r
SQL
a no
h a s
m ) e.
o
g i c.c t Guid
a r elo den
User iw
S tu
@ s
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
li Query: Overview
hal Transaction
Flashback
h b
Flashback Transaction Query is a diagnostic tool that you can use to view changes made to
o d
sub the database at the transaction level. This enables you to diagnose problems in your
database and perform analysis and audits of transactions.
You can use the FLASHBACK_TRANSACTION_QUERY view to determine all the
necessary SQL statements that can be used to undo the changes made either by a specific
transaction or during a specific period of time.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 17 - 26
Flashback Transaction Query Through
Enterprise Manager

a ble
fe r
a ns
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
li Query Through Enterprise Manager
hal Transaction
Flashback
b
h feature is used in conjunction with the Flashback Versions Query feature with the
This
o d
sub help of the Perform Recovery Wizard. On the “Perform Object Level Recovery: Choose
SCN” page, click the corresponding Transaction ID link in the Flashback Versions Query
Result region.
In the example in the slide, a Flashback Versions Query is performed on the JOBS table to
retrieve the three versions of the JOBS row for JOB_ID = 'AD_PRES'. Then, one of the
transaction IDs is clicked, showing all the changes that were part of that transaction.
Notice that, besides the JOBS table update, there was also an update to the EMPLOYEES
table in that transaction.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 17 - 27
Flashback Transaction Query:
Considerations

• DDLs are seen as dictionary updates.


• Dropped objects appear as object numbers.
• Dropped users appear as user identifiers.

a ble
fe r
a ns
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
li Query: Considerations
hal Transaction
Flashback
b
h• Within the database, DDL operations are nothing but a series of space management
o d
sub operations and changes to the data dictionary. Flashback Transaction Query on a
transaction underlying a DDL displays the changes made to the data dictionary.
• When Flashback Transaction Query involves tables that have been dropped from the
database, the table names are not reflected. Instead, object numbers are used.
• If the user who executed a transaction is dropped, Flashback Transaction Query of
that transaction displays the corresponding user ID only, and not the username.
Note: When there is not enough undo data for a specific transaction, a row with a value of
UNKNOWN in the OPERATION column of FLASHBACK_TRANSACTION_QUERY is
returned.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 17 - 28
Summary

In this lesson, you should have learned how to:


• Describe Flashback Database
• Restore the table content to a specific point in the
past with Flashback Table
• Recover from a dropped table ble
r a
• View the contents of the database as of any single sfe
t r a n
point in time with Flashback Query
n on-
• See versions of a row over time with Flashback
s a
Versions Query a
) h e.
m
.co with
• View transaction history or aicrow
G uidFlashback
g t
Transaction Query relo den
i wa Stu
a l e@ this
h . bhCopyrightu©s2008,
e
o d t o Oracle. All rights reserved.

( s ub ense
hal
e lic
h b
o d
sub

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 17 - 29
Practice Overview:
Using Flashback

This practice covers the following topics:


• Using Flashback to recover a dropped table
• Performing Flashback Versions Query

a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
hal li
h b
o d
sub

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 17 - 30
Moving Data

a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
hal li
h b
o d
sub

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Objectives Directory Obj.
SQL*Loader
Data Pump
- Export
- Import
External Table

After completing this lesson, you should be able to do


the following:
• Describe available ways for moving data
• Create and use directory objects
• Use SQL*Loader to load data from a non-Oracle ble
database (or user files) fe r a
n s
• Explain the general architecture of Data Pumpn-tra
o
ndata
• Use Data Pump Export and Import to move s a
between Oracle databases h
) e.a
o m id
g c.c tvia
• Use external tables to move idata G uplatform-
independent files relo den
i wa Stu
a l e@ this
h . bhCopyrightu©s2008,
e
o d t o Oracle. All rights reserved.

( s ub ense
hal
e lic
h b
o d
sub

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 2
Moving Data:
General Architecture

SQL*Loader expdp impdp Other clients

Data Pump

DBMS_DATAPUMP a ble
fe r
Data/Metadata Movement Engine
a ns
n- t r
a no
h a s
Oracle Oracle m ) e.
c o id
loader DataPump Direct Path
g i c.API G uMetadata API

r e lo ent
External Table API
i wa Stud
a l e@ this
h . bhCopyrightu©s2008,
e
o d t o Oracle. All rights reserved.

( s ub ense
Moving Data:
h a le Generallic Architecture
h
This bis a block diagram of the major functional components:
b d
o • DBMS_DATAPUMP: This package embodies the API for high-speed export and import
s u
utilities for bulk data and metadata movement.
• Direct Path API (DPAPI): Oracle Database 10g supports a direct path API interface that
minimizes data conversion and parsing at both unload and load time.
• DBMS_METADATA: This package is used by worker processes for all metadata unloading
and loading. Database object definitions are stored using XML rather than SQL.
• External Table API: With the ORACLE_DATAPUMP and ORACLE_LOADER access
drivers, you can store data in external tables (that is, in platform-independent files). The
SELECT statement reads external tables as though they were stored in an Oracle database.
• SQL*Loader: The SQL*Loader client has been integrated with external tables, thereby
providing automatic migration of loader control files to external table access parameters.
• expdp and impdp: The expdp and impdp clients are thin layers that make calls to the
DBMS_DATAPUMP package to initiate and monitor Data Pump operations.
• Other clients: They are applications, such as Database Control, replication, transportable
tablespaces, and user applications, that benefit from this infrastructure. SQL*Plus may also
be used as a client of DBMS_DATAPUMP for simple status queries against ongoing
operations.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 3
Directory Object: Overview .

a ble
fe r
a ns
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
h l
DirectoryaObject: li
Overview
h b
Directory objects are logical structures that represent a physical directory on the server’s file
o d
sub system. They contain the location of a specific operating system directory. This directory object
name can be used in Enterprise Manager, so you do not need to hard-code directory path
specifications. Therefore, you get greater file management flexibility. Directory objects are
owned by the SYS user. Directory names are unique across the database because all the
directories are located in a single name space (that is, SYS).
Directory objects are required when you specify file locations for Data Pump because it accesses
files on the server rather than on the client.
In Enterprise Manager, select Administration > Directory Objects.
To edit or delete a directory object, select the directory object and click the appropriate button.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 4
Creating Directory Objects

3 le
5 r a b
ns fe
t r a
n-
no
s a
h a
) e.
o m
4
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
Creating a l
hDirectory li
Objects
b
1.hOn the Directory Objects page, click the Create button.
o d
sub 2. Enter the name of the directory object and the OS path to which it maps. OS directories
should be created before they are used. You can test this by clicking the “Test File System”
button. For the test, provide the host login credentials (that is, the OS user who has privileges
on this OS directory).
3. Permissions for the directory objects are not the same as the OS permissions on the physical
directory on the server file system. You can manage user privileges on individual directory
objects. This increases the level of security and gives you granular control over these objects.
On the Privileges tabbed page, click Add to select the user to which you give read or write
privileges or both.
4. Click Show SQL to view the underlying statements.
5. Click OK to create the object.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 5
SQL*Loader: Overview Directory Obj.
> SQL*Loader
Data Pump
- Export
- Import
External Table
Input data files Control file

SQL*Loader Rejected
Field processing
Discarded Accepted
Record selection le
r a b
Selected
ns fe
Bad
- t r a
Oracle server
n onfile
Discard file
(optional)
Inserted sa
Rejected
ha
)
m ide.
c o
Log file g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
hal Overview
SQL*Loader: li
h b
SQL*Loader loads data from external files into tables of an Oracle database. It has a powerful
o d
sub data parsing engine that puts little limitation on the format of the data in the data file. The files
that are used by SQL*Loader are as follows:
Input data files: SQL*Loader reads data from one or more files (or operating system–
equivalents of files) that are specified in the control file. From SQL*Loader’s perspective, the
data in the data file is organized as records. A particular data file can be in fixed record format,
variable record format, or stream record format. The record format can be specified in the
control file with the INFILE parameter. If no record format is specified, the default is stream
record format.
Control file: The control file is a text file that is written in a language that SQL*Loader
understands. The control file indicates to SQL*Loader where to find the data, how to parse and
interpret the data, where to insert the data, and so on. Although not precisely defined, a control
file can be said to have three sections.
• The first section contains sessionwide information, for example:
- Global options, such as the input data file name, and records to be skipped.
- INFILE clauses to specify where the input data is located
- Data to be loaded

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 6
SQL*Loader: Overview (continued)
• The second section consists of one or more INTO TABLE blocks. Each of these blocks
contains information about the table (such as the table name and the columns of the table)
into which the data is to be loaded.
• The third section is optional and, if present, contains input data.
Log file: When SQL*Loader begins execution, it creates a log file. If it cannot create a log file,
execution terminates. The log file contains a detailed summary of the load, including a
description of any errors that occurred during the load.
Bad file: The bad file contains records that are rejected, either by SQL*Loader or by the Oracle
database. Data file records are rejected by SQL*Loader when the input format is invalid. After a
data file record is accepted for processing by SQL*Loader, it is sent to the Oracle database for
insertion into a table as a row. If the Oracle database determines that the row is valid, then the
row is inserted into the table. If the row is determined to be invalid, then the record is rejected
and SQL*Loader puts it in the bad file. r a ble
n s fe
-tofrathe load
Discard file: This file is created only when it is needed, and only if you have specified that a
n
discard file should be enabled. The discard file contains records that are filteredoout
a n file.
because they do not match any record-selection criteria specified in the control
s
For more information about SQL*Loader, refer to the Oracle Database ) ha Utilities documentation.
.
. c om uide
l o gic nt G
a re ude
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 7
Loading Data with SQL*Loader

a ble
fe r
a ns
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
li
hal with SQL*Loader
Loading Data
b
h the Load Data from User Files Wizard to load data from a flat file into an Oracle database.
Use
o d
sub To display the wizard, select Enterprise Manager Maintenance > Data Movement > Move Row
Data > Load Data from User Files. The wizard guides you through the required steps.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 8
SQL*Loader Control File

The SQL*Loader control file instructs SQL*Loader


about:
• Location of the data to be loaded
• The data format
• Configuration details: ble
– Memory management fe r a
a ns
– Record rejection n- t r
– Interrupted load handling details a no
h a s
• Data manipulation details ) e.
o m
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
hal Controlli File
SQL*Loader
b
o d h SQL*Loader control file is a text file that contains data definition language (DDL)
The
sub instructions. DDL is used to control the following aspects of a SQL*Loader session:
• Where SQL*Loader finds the data to load
• How SQL*Loader expects that data to be formatted
• How SQL*Loader is being configured (including memory management, selection and
rejection criteria, interrupted load handling, and so on) as it loads the data
• How SQL*Loader manipulates the data being loaded

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 9
SQL*Loader Control File (continued)
1 -- This is a sample control file
2 LOAD DATA
3 INFILE ’SAMPLE.DAT’
4 BADFILE ’sample.bad’
5 DISCARDFILE ’sample.dsc’
6 APPEND
7 INTO TABLE emp
8 WHEN (57) = ’.’
9 TRAILING NULLCOLS
10 (hiredate SYSDATE,
deptno POSITION(1:2) INTEGER EXTERNAL(3)
NULLIF deptno=BLANKS,
job POSITION(7:14) CHAR TERMINATED BY WHITESPACE
NULLIF job=BLANKS "UPPER(:job)",
mgr POSITION(28:31) INTEGER EXTERNAL
a ble
TERMINATED BY WHITESPACE, NULLIF mgr=BLANKS,
fe r
ename POSITION(34:41) CHAR
a ns
TERMINATED BY WHITESPACE "UPPER(:ename)",
n- t r
empno POSITION(45) INTEGER EXTERNAL
TERMINATED BY WHITESPACE, a no
sal POSITION(51) CHAR TERMINATED BY WHITESPACE
h a s
"TO_NUMBER(:sal,’$99,999.99’)",
m ) e.
o
":comm * 100" g i c.c t Guid
comm INTEGER EXTERNAL ENCLOSED BY ’(’ AND ’%’

)
a relo uden
The explanation of a sample control file by S t is as follows:
iwlinesnumbers
1. Comments can appear anywhere
@ i
le in thethcommand section of the file, but they must not
b h a e
appear within the data.
h . Precedeuanys comment with two hyphens. All text to the right of the
o d
double hyphenbis ignored, t o
s u n s e until the end of the line.
2. The LOAD
l e ( ice
DATA statement indicates to SQL*Loader that this is the beginning of a new
l
haload. If you are continuing a load that has been interrupted in progress, use the
data
b
h CONTINUE LOAD DATA statement.
o d
sub 3. The INFILE keyword specifies the name of a data file containing data that you want to
load.
4. The BADFILE keyword specifies the name of a file into which rejected records are placed.
5. The DISCARDFILE keyword specifies the name of a file into which discarded records are
placed.
6. The APPEND keyword is one of the options that you can use when loading data into a table
that is not empty. To load data into a table that is empty, use the INSERT keyword.
7. The INTO TABLE keyword enables you to identify tables, fields, and data types. It defines
the relationship between records in the data file and tables in the database.
8. The WHEN clause specifies one or more field conditions that each record must match before
SQL*Loader loads the data. In this example, SQL*Loader loads the record only if the 57th
character is a decimal point. That decimal point delimits dollars and cents in the field and
causes records to be rejected if SAL has no value.
9. The TRAILING NULLCOLS clause prompts SQL*Loader to treat any relatively positioned
columns that are not present in the record as null columns.
10. The remainder of the control file contains the field list, which provides information about
column formats in the table that is being loaded.
Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 10
Loading Methods
Data Block
insert writes

Table
HWM
Conventional Load Direct Path Load

Uses COMMIT Uses data saves (faster operation)


Always generates redo
entries
Generates redo only under specific
conditions a b le
fe r
Enforces only PRIMARY KEY, UNIQUE, a n s
Enforces all constraints t r
and NOT NULL on- n
Fires INSERT triggers Does not fire INSERT a s a
) h triggers
o m clusters
d e .
Can load into clustered tables Does not load
i c into
c. t Gu i
g
Allows other users to modify Prevents
a relo uother d enusers from making
tables during load operation iw changes S t to tables during load operation
@ s
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
li Conventional Path Loads
hal Direct and
Comparing
b
h of Saving Data
Method
o d
sub Conventional path loads use SQL processing and a database COMMIT operation for saving data.
The insertion of an array of records is followed by a COMMIT operation. Each data load may
involve several transactions.
Direct path loads use data saves to write blocks of data to Oracle data files. This is why the direct
path loads are faster than the conventional ones. The following features differentiate a data save
from COMMIT:
• During a data save, only full database blocks are written to the database.
• The blocks are written after the high-water mark (HWM) of the table.
• After a data save, the high-water mark (HWM) is moved.
• Internal resources are not released after a data save.
• A data save does not end the transaction.
• Indexes are not updated at each data save.
Note: Direct path and parallel direct path loads are so similar regarding DML activities that they
are not separated in this comparison.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 11
Comparing Direct and Conventional Path Loads (continued)
Logging Changes
Conventional path loading generates redo entries similar to any DML statement. When using a
direct path load, redo entries are not generated if:
• The database is in NOARCHIVELOG mode
• The database is in ARCHIVELOG mode, but logging is disabled. Logging can be disabled
by setting the NOLOGGING attribute for the table or by using the UNRECOVERABLE
clause in the control file.
Enforcing Constraints
During a conventional path load, all enabled constraints are enforced in the same way that they
are during any DML operation.
During direct path loads, the constraints are handled as follows:
• NOT NULL constraints are checked when arrays are built.
r a ble
• FOREIGN KEY and CHECK constraints are disabled, and they can be enabled at the end
n s feof
the load by using the appropriate commands in the control file. The FOREIGNtKEY
n - ra
constraints are disabled because they reference other rows or tables, and the o CHECK
nsmall
constraints are disabled because they may use SQL functions. If only s a a number of
rows are to be inserted into a large table, then use conventional
) a
h loads.
PRIMARY KEY and UNIQUE constraints are checkedcduring o m and d e
at .the end of the load, and

they may be disabled if they are violated. i c. t Gu i
g
Firing the INSERT Triggers a relo uden
The WHILE INSERT triggers are fired @ iw s St
during iconventional loads; they are disabled before a
direct path load and reenabled h a l e
at the end e t h
of the load. They may remain disabled if a referenced
at h
object is not accessible d .bend
the of u srun.
the Consider using conventional path loads to load data
o t o
ubINSERTstriggers.
into tables with the
(s en
e
Loadinga
h into lic Tables
le Clustered
h bLoads cannot be used to load rows into clustered tables. Clustered tables can be loaded
Direct
b d
o with conventional path loads only.
s u
Locking
While a direct path load is in progress, other transactions cannot make changes to the tables that
are being loaded. The only exception to this rule is when several parallel direct load sessions are
used concurrently.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 12
Data Pump: Overview Directory Obj.
SQL*Loader
> Data Pump
- Export
- Import
External Table

As a server-based facility for high-speed data and


metadata movement, Data Pump:
• Is callable via DBMS_DATAPUMP
• Provides the following tools:
– expdp
– impdp a ble
fe r
– Web-based interface a n s
n- t r
• Provides data access methods: no
– Direct path s a
h a
) e.
– External tables m
o uid
• Detaches from and reattaches g i c.cto tlong-running
G
jobs a relo uden
• Restarts Data Pump iwjobs S t
@ s
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
hal Overview
Data Pump: li
b
h Pump enables very high-speed data and metadata loading and unloading of Oracle
Data
o d
sub databases. The Data Pump infrastructure is callable via the DBMS_DATAPUMP PL/SQL package.
Thus, custom data movement utilities can be built by using Data Pump.
Oracle Database 10g provides the following tools:
• Command-line export and import clients called expdp and impdp respectively
• A Web-based export and import interface that is accessible from Database Control
Data Pump automatically decides the data access methods to use; these can be either direct path
or external tables. Data Pump uses direct path load and unload when a table’s structure allows it
and when maximum single-stream performance is desired. However, if there are clustered tables,
referential integrity constraints, encrypted columns, or a number of other items, Data Pump uses
external tables rather than direct path to move the data.
The ability to detach from and reattach to long-running jobs without affecting the job itself
enables you to monitor jobs from multiple locations while they are running. All stopped Data
Pump jobs can be restarted without loss of data as long as the metainformation remains
undisturbed. It does not matter whether the job is stopped voluntarily or involuntarily due to a
crash.
Note: Data Pump is an integral feature of Oracle Database 10g and is, therefore, available in all
configurations. However, parallelism is available in Enterprise Edition only.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 13
Data Pump: Benefits

• Fine-grained object and data selection


• Explicit specification of database version
• Parallel execution
• Estimation of the export job space consumption
• Network mode in a distributed environment
r a ble
• Remapping capabilities during import n s fe
• Data sampling and metadata compression on-
tra
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
hal Benefitsli
Data Pump:
b
o d h EXCLUDE, INCLUDE, and CONTENT parameters are used for fine-grained object and data
The
sub selection.
You can specify the database version for objects to be moved (using the VERSION parameter) to
create a dump file set that is compatible with a previous release of the Oracle database that
supports Data Pump.
You can use the PARALLEL parameter to specify the maximum number of threads of active
execution servers operating on behalf of the export job.
You can estimate how much space an export job would consume (without actually performing
the export) by using the ESTIMATE_ONLY parameter.
Network mode enables you to export from a remote database directly to a dump file set. This can
be done by using a database link to the source system.
During import, you can change the target data file names, schemas, and tablespaces.
In addition, Oracle Database 10g enables you to specify a percentage of data to be sampled and
unloaded from the source database when performing a Data Pump export. This can be done by
specifying the SAMPLE parameter.
You can use the COMPRESSION parameter to indicate whether the metadata should be compressed
in the export dump file so that it consumes less disk space. If you compress the metadata, it is
automatically uncompressed during import.
Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 14
Data Pump Export and Import: Overview
expdp Database
client link

Source Target

Data Pump Server


job process
Database Database
Master Dump Dump Master
table file set file set table a ble
fe r
a ns
“Network mode” n- t r
a no
Server Data h a s
Pump
process
m ) jobe.
o
g i c.c t Guid
a relo uden impdp
@ iw s St client
l e h i
. b ha se t
d h Copyright
t o u© 2008, Oracle. All rights reserved.
o
ub ense
( s
Data Pump
h a lic Import: Overview
leExport and
h
Data bPump Export is a utility for unloading data and metadata into a set of operating system files
d
subo called dump file sets. Data Pump Import is used to load metadata and data stored in an export
dump file set into a target system.
The Data Pump API accesses its files on the server rather than on the client.
These utilities can also be used to export from a remote database directly to a dump file set, or to
load the target database directly from a source database with no intervening files. This is known
as network mode. This mode is particularly useful to export data from a read-only source
database.
At the center of every Data Pump operation is the master table (MT), which is a table created in
the schema of the user running the Data Pump job. The MT maintains all aspects of the job. The
MT is built during a file-based export job and is written to the dump file set as the last step.
Conversely, loading the MT into the current user’s schema is the first step of a file-based import
operation and is used to sequence the creation of all objects imported.
Note: The MT is the key to Data Pump’s restart capability in the event of a planned or
unplanned stopping of the job. The MT is dropped when the Data Pump job finishes normally.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 15
Data Pump Utility: Interfaces and Modes

• Data Pump Export and Import interfaces:


– Command line
– Parameter file
– Interactive command line
– Database Control le
r a b
• Data Pump Export and Import modes: fe
a ns
– Full
n- t r
– Schema a no
a s
– Table
m ) h e.
– Tablespace
i c .co Guid
g
– elo ent
Transportable tablespace
r
i wa Stud
a l e@ this
h . bhCopyrightu©s2008,
e
o d t o Oracle. All rights reserved.

( s ub ense
Data Pump
h a lic
leUtility: Interfaces and Modes
b
h can interact with Data Pump Export and Import by using one of the following interfaces:
You
o d
sub • The command-line interface enables you to specify most of the export parameters directly
on the command line.
• The parameter file interface enables you to specify all command-line parameters in a
parameter file. The only exception is the PARFILE parameter.
• The interactive-command interface stops logging to the terminal and displays the export or
import prompts, where you can enter various commands. This mode is enabled by pressing
[Ctrl] + [C] during an export operation that is started with the command-line interface or
the parameter file interface. Interactive-command mode is also enabled when you attach to
an executing or stopped job.
• You can also access the Web interface. On the Database Control home page, click the
Maintenance tab, and then select one of the following links from the Utilities region:
Export to Files, Import from Files, or Import from Database.
Data Pump Export and Import provide different modes for unloading and loading different
portions of the database. The mode is specified on the command line by using the appropriate
parameter.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 16
Fine-Grained Object Selection Directory Obj.
SQL*Loader
.

Data Pump
> - Export
- Import
External Table

a ble
fe r
a n s
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
hal Objectli Selection
Fine-Grained
b
o d h Data Pump job can include or exclude virtually any type of object.
The
sub The EXCLUDE parameter enables any database object type to be excluded from an export or
import operation. The optional name qualifier enables you to have finer selectivity within each
object type that is specified. Examples:
EXCLUDE=VIEW
EXCLUDE=PACKAGE
EXCLUDE=INDEX:"LIKE 'EMP%'"
The INCLUDE parameter includes only the specified object types and objects in an operation.
Syntax:
INCLUDE = object_type[:"name_expr"]
The CONTENT parameter enables you to request for the current operation, only the metadata,
only the data, or both. Syntax:
CONTENT = ALL | METADATA_ONLY | DATA_ONLY
The QUERY parameter operates in a similar manner as the original export utility, with two
significant enhancements: It can be qualified with a table name so that it applies to only that
table, and it can be used during import as well. Example:
QUERY=hr.employees:"WHERE department_id in (10,20) and salary
< 1600 ORDER BY department_id"
Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 17
Advanced Feature: Sampling

• Task: Create test data.


• Method: Specify a percentage of data to be
sampled and unloaded from the source database.

Example to unload 44% of the HR.EMPLOYEES table:


a ble
SAMPLE="HR"."EMPLOYEES":44 fe r
a ns
n- t r
Example to unload 30% of the entire export job no
a
(because no table name is specified): as ) h e.
m
expdp hr/hr DIRECTORY=DATA_PUMP_DIR i c .co Guid
l o g nt
DUMPFILE=sample1.dmp r eSAMPLE=30 e
i wa Stud
a l e@ this
h . bhCopyrightu©s2008,
e
o d t o Oracle. All rights reserved.

( s ub ense
le
AdvancedaFeature:
h ic
lSampling
h
Withbthe SAMPLE parameter, you can specify a percentage of data to be sampled and unloaded
d
subo from the source database when performing a Data Pump export.
Syntax:
SAMPLE=[[schema_name.]table_name:]sample_percent
Range for sample_percent: .000001 to (but not including) 100
Sample percentage indicates the likelihood that a block of rows will be included.
Note: The SAMPLE parameter is not valid for network exports.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 18
Export Options: Files

a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
hal
Export Options: li
Files
b
h are three types of files that are managed by Data Pump jobs:
There
o d
sub • Dump files for data and metadata that is to be moved
• Log files for messages
• SQL files for the output of a SQLFILE operation
Because Data Pump is server based and not client based, Data Pump files are accessed relative to
Oracle directory paths. Absolute paths are not supported for security reasons.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 19
Data Pump File Locations

a ble
fe r
a ns
n- t r
The order of precedence of file locations: a no
• Per-file directory h a s
m ) e.
o
• The DIRECTORY parameter
g i c.c t Guid
relo uden variable
• The DATA_PUMP_DIR environment
a
• DATA_PUMP_DIR@ directory t
iw Sobject
a l e t h is
h . bhCopyrightu©s2008,
e
o d t o Oracle. All rights reserved.

( s ub ense
Data Pump
h a lic
leFile Locations
h
The b shows you the order of precedence used by Data Pump clients to locate these files:
slide
d
subo • Per-file directory objects may be specified for each dump file, log file, and SQL file. If
specified, they are separated from the file name by a colon (:).
• The Data Pump Export and Import clients provide a DIRECTORY parameter, which
specifies the name of a directory object. These directory objects describe the location in
which the files are accessed.
• You can alternatively define an environment variable, DATA_PUMP_DIR, to specify the
directory object name rather than use the DIRECTORY parameter. The Data Pump clients
look for this environment variable if no explicit directory object is specified.
• There is a default directory object created for every database. This directory object is
named DATA_PUMP_DIR. Access to the DATA_PUMP_DIR directory is granted
automatically to the EXP_FULL_DATABASE and IMP_FULL_DATABASE roles.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 20
Data Pump File Locations (continued)
• You do not need to create a directory object manually before using Data Pump Export.
There is a default directory object created for every database, whether newly created or
upgraded by a script on UNIX or Windows platforms. This directory object is named
DATA_PUMP_DIR. Access to the DATA_PUMP_DIR directory is granted automatically to
the EXP_FULL_DATABASE and IMP_FULL_DATABASE roles. The DATA_PUMP_DIR
directory is created in one of the following locations:
- <ORACLE_BASE>/admin/ORACLE_SID
- <ORACLE_HOME>/admin/ORACLE_SID
The exact directory path specification for DATA_PUMP_DIR varies, depending on the
value of the ORACLE_BASE and ORACLE_HOME system environment variables and on
the existence of the DATA_PUMP_DIR subdirectory. If ORACLE_BASE is defined on the
target system, then that value is used. Otherwise, the value of ORACLE_HOME is used. If,
for some reason, the DATA_PUMP_DIR subdirectory is not found, the following default
r a ble
path is used: ORACLE_HOME/rdbms/log. sfe
n
tra for the
Note: In all cases, you must have the appropriate access privileges to the directory -object
n
noyou need read
operation attempted. For export, you need write access for all files; for import,
a
access for dump files and write access for log files and SQL files. as
m ) h e.
i c .co Guid
l o g nt
r e e
i wa Stud
a l e@ this
h . bh use
b o d to
su cens e
e (
hal li
h b
o d
sub

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 21
Scheduling and Running a Job

a ble
fe r
a ns
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
Scheduling li
hal and Running a Job
b
h Pump jobs (created through this wizard) are scheduled as repeatable jobs by Enterprise
Data
o d
sub Manager Database Control.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 22
Data Pump File Naming and Size

a ble
fe r
a ns
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
Data Pump
hal File Namingli and Size
b
h DUMPFILE parameter specifies the names and (optionally) directories of disk-based dump
The
o d
sub files. Multiple file specifications may be provided as a comma-separated list or in separate
DUMPFILE parameter specifications. File names may contain the substitution variable %U,
which implies that multiple files may be generated. %U is expanded in the resulting file names
into a two-character, fixed-width, monotonically increasing integer starting at 01. If no
DUMPFILE is specified, expdat.dmp is used by default. By default, created dump files are
autoextensible.
If FILESIZE is specified, each file is FILESIZE bytes in size and nonextensible. If more
dump space is required and a template with %U has been supplied, then a new file is
automatically created with FILESIZE bytes; otherwise, the client receives a message to add a
new file.
If a template with %U is specified, the number of files initially created is equal to the PARALLEL
parameter.
Preexisting files that match the resulting file names are not overwritten; they result in an error
and cause the job to be aborted.
Note: If multiple dump file templates are provided, then they are used to generate dump files in a
circular fashion.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 23
Data Pump Import Directory Obj.
SQL*Loader
Data Pump
- Export
> - Import
External Table

a ble
fe r
a n s
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
Data Pump
b hal Import li
o d h Pump Import is a utility for loading an export dump file set into a target system. The dump
Data
sub file set is made up of one or more disk files that contain table data, database object metadata, and
control information. The files are written in a proprietary, binary format. During an import
operation, the Data Pump Import utility uses these files to locate each database object in the
dump file set.
You can interact with Data Pump Import by using a command line, a parameter file, or an
interactive-command mode:
• You can use the impdp command and specify parameters directly on the command line.
• You can enter command-line parameters in a file (the PARFILE parameter is excluded
because parameter files cannot be nested).
• In interactive-command mode, the current job continues running, but logging to the
terminal is stopped and the Import prompt is displayed. You can, for example, attach
additional jobs to an executing or stopped job.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 24
Data Pump Import: Transformations

You can remap:


• Data files by using REMAP_DATAFILE
• Tablespaces by using REMAP_TABLESPACE
• Schemas by using REMAP_SCHEMA

a ble
REMAP_DATAFILE = 'C:\oradata\tbs6.f':'/u1/tbs6.f'
fe r
a ns
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
i
hal Import: lTransformations
Data Pump
b
h object metadata is stored as XML in the dump file set, it is easy to apply
Because
o d
sub transformations when DDL is being formed during import. Data Pump Import supports several
transformations:
• REMAP_DATAFILE is useful when moving databases across platforms that have different
file-system semantics.
• REMAP_TABLESPACE allows objects to be moved from one tablespace to another.
• REMAP_SCHEMA provides the old FROMUSER /TOUSER capability to change object
ownership.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 25
Data Pump Import: Transformations

Using TRANSFORM, you can also :


• Exclude from tables and indexes:
– STORAGE and TABLESPACE clauses
– STORAGE clause only
• Re-create object identifiers of abstract data types ble
fe r a
• Change extent allocations and file size s
t r a n
TRANSFORM = o n-
an
SEGMENT_ATTRIBUTES|STORAGE|OID|PCTSPACE:{y|n|v}[:object type]
s
h a
) e.
o m
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
Data Pump i
hal Import: lTransformations (continued)
b
h TRANSFORM parameter enables you to alter the object creation DDL for specific objects or
The
o d
sub all applicable objects being loaded. Specify the TRANSFORM parameter as shown in the
for
slide. The following are possible options:
• SEGMENT_ATTRIBUTES: If the value is specified as Y, segment attributes (physical
attributes, storage attributes, tablespaces, and logging) are included.
• STORAGE: If the value is specified as Y, the STORAGE clauses are included.
• OID: You can use this parameter to determine whether the object ID (OID) of abstract data
types is reused or created anew. If the value is specified as N, then the generation of the
export OID clause for object types is suppressed. This is useful when you need to duplicate
schemas across databases by using export and import, but you cannot guarantee that the
object types will have identical OID values in those databases.
• PCTSPACE: You can use the PCTSPACE parameter to reduce the amount of space
required for tablespaces by performing a shrink operation on tablespace storage allocation.
The value supplied for this transformation must be a number greater than zero. It represents
the percentage multiplier used to alter extent allocations and the size of data files.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 26
Data Pump: Performance Consideration

Maximizing job performance with the PARALLEL


parameter. Master Coordinator

Parallel
execution
a ble
fe r
Generated
a ns
files
n- t r
a no
Example: s
h a
) e.
expdp hr/hr FULL=y
o m
DUMPFILE=dp_dir1:full1%U.dmp, idp_dir2:full2%U.dmp
g c.c t Guid
FILESIZE=2G PARALLEL=3
a relo uden
LOGFILE=dp_dir1:expfull.log t
iw s SJOB_NAME=expfull
@
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
Data Pump: li
hal Performance Consideration
b
h can improve throughput of a job with the PARALLEL parameter. The parallelism setting is
You
o d
sub enforced by the master process, which allocates work to be executed to worker processes that
perform the data and metadata processing within an operation. These worker processes operate
in parallel. In general, the degree of parallelism should be set to more than twice the number of
CPUs on an instance. To maximize parallelism, you must supply at least one file for each degree
of parallelism. If there are not enough dump files, the performance will not be optimal because
multiple threads of execution will be trying to access the same dump file. The degree of
parallelism can be reset at any time during a job.
The example in the slide shows a full database export. All data and metadata in the database will
be exported. Dump files (full101.dmp, full201.dmp, full102.dmp, and so on) will be
created in a round-robin fashion in the directories pointed to by the dp_dir1 and dp_dir2
directory objects. For best performance, these should be on separate I/O channels. Each file will
be up to 2 gigabytes in size, as necessary. Initially, up to three files will be created. More files
will be created, if needed. The job and master table have the same name: expfull. The log file
will be written to expfull.log in the dp_dir1 directory.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 27
Performance Initialization Parameters

• Performance of Data Pump can be affected by:


– DISK_ASYNCH_IO=TRUE
– DB_BLOCK_CHECKING=FALSE
– DB_BLOCK_CHECKSUM=FALSE
• The following should be set high to allow for le
maximum parallelism: r a b
ns fe
– PROCESSES t r a
– SESSIONS
n- no
s a
– PARALLEL_MAX_SERVERS h a
) e.
o m
• The following should be sized
g i G uid
c.cgenerously:
– SHARED_POOL_SIZE elo
e n t
r
– UNDO_TABLESPACE i wa Stud
a l e@ this
h . bhCopyrightu©s2008,
e
o d t o Oracle. All rights reserved.

( s ub ense
Performance
h a lic Parameters
le Initialization
h
You bcan try using the parameters (shown in the slide) to improve performance, although the
b d
o effect may not be the same on all platforms.
s u
Additionally, the SHARED_POOL_SIZE and UNDO_TABLESPACE initialization parameters
should be generously sized. The exact values will depend upon the size of your database.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 28
Data Pump Access Path: Considerations

One of the following access paths is


Database
automatically selected by Data Pump:
• Direct path
• External tables, if data includes:
External Direct
– Encrypted columns tables path le
r a b
– Clustered tables
n s fe
– Different partition at unload and t r a
load time, and others (see Notes)
n- no
a
s Database
h a
) e.
o m
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
Data Pump li Considerations
hal Direct Path:
b
h Pump automatically selects the most appropriate access method for each table.
Data
o d
sub Data Pump uses direct path load and unload when a table’s structure allows it and when
maximum single-stream performance is desired.
Data Pump uses external tables, if any of the conditions exist:
• Tables with fine-grained access control enabled in insert and select modes
• Domain index, which exists for a LOB column
• Tables with active triggers defined
• Global index on partitioned tables with a single-partition load
• BFILE or opaque type columns
• Referential integrity constraint
• VARRAY columns with an embedded opaque type
Note: Because both methods support the same external data representation, data that is unloaded
with one method can be loaded using the other method.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 29
Using Enterprise Manager to Monitor
Data Pump Jobs

a ble
fe r
a ns
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
hal
Using Enterprise li
Manager to Monitor Data Pump Jobs
b
h can use the Enterprise Manager graphical user interface (GUI) to monitor all Data Pump
You
o d
sub jobs, including those created by using the expdp or impdp command-line interfaces or by
using the DBMS_DATAPUMP package.
You can view the current status of the job and also change the status to EXECUTE, STOP, or
SUSPEND.
To access the Export and Import Jobs page, click the Monitor Export and Import Jobs link in the
Move Row Data region of the Maintenance page.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 30
External Table Population . Directory Obj.
SQL*Loader
Data Pump
- Export
- Import
> External Table

• Unloading of data to external files with the


ORACLE_DATAPUMP access driver
• No modifications of external tables
CREATE TABLE … AS SELECT INSERT … SELECT

a ble
Unloading Loading
fe r
a n s
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
External filesrelo e n
Tables
a
w Stu
(proprietaryiformat)
d
Tables
e @ i s
b h al e th
d t o u©s2008, Oracle. All rights reserved.
h. Copyright
o
ub ense
( s
a
External Table
h lic
le Population
b
Anh“external table” is composed of proprietary format (that is, Direct Path API) flat files that are
o d
sub operating system independent. As data is extracted from the Oracle database and “unloaded” into
files, it is transparently converted from its Oracle internal representation into an equivalent
Oracle native external representation (that is, DPAPI).
You may use the CREATE TABLE AS SELECT command to populate an external table. After an
external table has been created and populated, no rows may be added, updated, or deleted from
the external table. Any attempt to modify the data in the external table fails. An external table
may not have indexes.
The Data Pump access driver enables the unloading and loading operations for external tables.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 31
Using External Tables

• Data can be used directly from the external file or


loaded into another database.
• Resulting files can be read only with the
ORACLE_DATAPUMP access driver.
• You can combine generated files from different le
sources for loading purposes. r a b
ns fe
t r a
n- no
s a
h a
) e.
o m
From Oracle Database
i c .c Guid File
From External
l o g nt
r e e
i wa Stud
a l e@ this
h . bhCopyrightu©s2008,
e
o d t o Oracle. All rights reserved.

( s ub ense
a le Tables
Using External
h lic
h
The b files created for the external table can be moved and used as the data files for another
data
d
subo external table in the same database or different database. They can be read only by the
ORACLE_DATAPUMP access driver. You can choose whether your applications should directly
access external tables with the SELECT command, or if the data should first be loaded into a
target database.
Data files populated by different external tables can all be specified in the LOCATION clause of
another external table. This provides an easy way of aggregating data from multiple sources. The
only restriction is that the metadata for all the external tables must be exactly the same.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 32
External Table Population with
ORACLE_DATAPUMP
CREATE TABLE emp_ext
(first_name, last_name, department_name)
ORGANIZATION EXTERNAL
(
TYPE ORACLE_DATAPUMP
DEFAULT DIRECTORY ext_dir
LOCATION ('emp1.exp','emp2.exp','emp3.exp')
a b le
) fe r
n s
PARALLEL
n - tra
no
AS
a
SELECT e.first_name,e.last_name,d.department_name
s
FROM employees e, departments d h a
) eAND
o m
WHERE e.department_id = d.department_id
d .
d.department_name in gic.
c u i
t G
relo en 'Purchasing');
('Marketing',
i wa Stud
a l e@ this
h . bhCopyrightu©s2008,
e
o d t o Oracle. All rights reserved.

( s ub ense
External Table
h a lic with ORACLE_DATAPUMP
le Population
h
This bexample shows you how the new external table population operation can help to export a
b d
o selective set of records resulting from the join of the EMPLOYEES and DEPARTMENTS tables.
s u
Because the external table can be large, you can use a parallel populate operation to unload your
data to an external table. As opposed to a parallel query from an external table, the degree of
parallelism of a parallel populate operation is constrained by the number of concurrent files that
can be written to by the access driver. There is never more than one parallel execution server
writing into one file at a particular point in time.
The number of files in the LOCATION clause must match the specified degree of parallelism
because each input/output (I/O) server process requires its own file. Any extra files that are
specified are ignored. If there are not enough files for the specified degree of parallelism, the
degree of parallelization is lowered to match the number of files in the LOCATION clause.
Note: For more information about the ORACLE_DATAPUMP access driver parameters, see the
Oracle Database Utilities guide.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 33
External Table Population with
ORACLE_LOADER
CREATE TABLE extab_employees
(employee_id NUMBER(4),
first_name VARCHAR2(20),
last_name VARCHAR2(25),
hire_date DATE)
ORGANIZATION EXTERNAL
( TYPE ORACLE_LOADER DEFAULT DIRECTORY extab_dat_dir
ACCESS PARAMETERS
a ble
( records delimited by newline fe r
a ns
badfile extab_bad_dir:'empxt%a_%p.bad'
n- t r
logfile extab_log_dir:'empxt%a_%p.log'
a no
fields terminated by ','
h a s
missing field values are null
m ) e.
o
c.c t Guid
( employee_id, first_name, last_name,
g i
hire_date char date_format date mask "dd-mon-yyyy“))
relo uden
LOCATION ('empxt1.dat', 'empxt2.dat') )
a
iw s St
PARALLEL REJECT LIMIT UNLIMITED;
@
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
External Table li
hal Population with ORACLE_LOADER
b
h ORACLE_LOADER access driver uses the SQL*Loader syntax to create external tables.
The
o d
sub The example shown in the slide assumes that three directory objects (extab_dat_dir,
extab_bad_dir, and extab_log_dir) are created and mapped to existing OS directories, to
which the user is granted access.
Tip: If you have a lot of data to load, enable PARALLEL for the load operation:
ALTER SESSION ENABLE PARALLEL DML;

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 34
Data Dictionary

View information about external tables in:


• [DBA| ALL| USER]_EXTERNAL_TABLES
• [DBA| ALL| USER]_EXTERNAL_LOCATIONS
• [DBA| ALL| USER]_TABLES, and others

a ble
fe r
a ns
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
hal
Data Dictionary li
b
h ALL| USER]_EXTERNAL_TABLES list the specific attributes of external tables in
o d
[DBA|
sub the database.
[DBA| ALL| USER]_EXTERNAL_LOCATIONS list the data sources for external tables.
[DBA| ALL| USER]_TABLES describe relational tables in the database.
[DBA| ALL| USER]_TAB_COLUMNS describe the columns of tables, views, and clusters in
the database.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 35
Summary

In this lesson, you should have learned how to:


• Describe available ways for moving data
• Create and use directory objects
• Use SQL*Loader to load data from a non-Oracle
database (or user files) ble
fe r a
• Explain the general architecture of Data Pump s
tra n
• Use Data Pump Export and Import to move data n -
between Oracle databases a no
h a s
• Use external tables to move data m ) e.
via
platform-independent files ic.c
o uid
l o g nt G
r e e
i wa Stud
a l e@ this
h . bhCopyrightu©s2008,
e
o d t o Oracle. All rights reserved.

( s ub ense
hal
e lic
h b
o d
sub

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 36
Practice Overview:
Moving Data

This practice covers the following topics:


• Using the Data Pump Export Wizard to select
database objects to be exported
• Monitoring a Data Pump Export job
• Using the Data Pump Import Wizard to import ble
tables in your database fe r a
n s
• Using the Load Data Wizard to load data into your n - tra
database a no
h a s
• Loading data by using the command ) line
om uide.
. c
l o gic nt G
a re ude
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
hal li
h b
o d
sub

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I 18 - 37
a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
________________
Appendix A

Practices
________________

a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice Sessions: Overview

The HR schema:

a ble
fe r
a ns
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St
Data Definition Language h a
(DDL) e thi
le Scripts
h
DDL scripts can be used to b theuinitial
.create s HR schema.
o d t o
( s ub ense
a le
TablehDefinitions lic ,STATE_PROVINCE VARCHAR2(25)
h b ,COUNTRY_ID CHAR(2)

b o dPROMPT Creating Table 'REGIONS' )


su CREATE TABLE REGIONS
(REGION_ID FLOAT(53) NOT NULL
/

,REGION_NAME VARCHAR2(25) PROMPT Creating Table 'JOB_HISTORY'


) CREATE TABLE JOB_HISTORY
/ (EMPLOYEE_ID NUMBER(10,0) NOT NULL
,START_DATE DATE NOT NULL
PROMPT Creating Table 'JOBS' ,END_DATE DATE NOT NULL
CREATE TABLE JOBS ,JOB_ID VARCHAR2(10) NOT NULL
(JOB_ID VARCHAR2(10) NOT NULL ,DEPARTMENT_ID NUMBER(5,0)
,JOB_TITLE VARCHAR2(35) NOT NULL )
,MIN_SALARY NUMBER(10,0) /
,MAX_SALARY NUMBER(10,0)
) PROMPT Creating Table 'DEPARTMENTS'
/ CREATE TABLE DEPARTMENTS
(DEPARTMENT_ID NUMBER(5,0) NOT NULL
PROMPT Creating Table 'LOCATIONS' ,DEPARTMENT_NAME VARCHAR2(30) NOT
CREATE TABLE LOCATIONS NULL
(LOCATION_ID NUMBER(5,0) NOT NULL ,MANAGER_ID NUMBER(10,0)
,STREET_ADDRESS VARCHAR2(40) ,LOCATION_ID NUMBER(5,0)
,POSTAL_CODE VARCHAR2(12) )
,CITY VARCHAR2(30) NOT NULL /

Oracle Database 10g: Administration Workshop I A-2


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice Sessions: Overview
(continued)

PROMPT Creating Table 'EMPLOYEES' ALTER TABLE JOB_HISTORY


CREATE TABLE EMPLOYEES ADD (CONSTRAINT
(EMPLOYEE_ID NUMBER(10,0) NOT NULL PK__JOB_HISTORY__0AD2A005 PRIMARY KEY
,FIRST_NAME VARCHAR2(20) (EMPLOYEE_ID
,LAST_NAME VARCHAR2(25) NOT NULL ,START_DATE))
,EMAIL VARCHAR2(25) NOT NULL /
,PHONE_NUMBER VARCHAR2(20)
,HIRE_DATE DATE NOT NULL PROMPT Creating Primary Key on
,JOB_ID VARCHAR2(10) NOT NULL 'DEPARTMENTS'
,SALARY NUMBER(8,2) ALTER TABLE DEPARTMENTS
,COMMISSION_PCT NUMBER(2,2) ADD (CONSTRAINT
,MANAGER_ID NUMBER(10,0) PK__DEPARTMENTS__7E6CC920 PRIMARY KEY
,DEPARTMENT_ID NUMBER(5,0) (DEPARTMENT_ID))
a ble
) /
fe r
/
a ns
PROMPT Creating Primary Key on
'EMPLOYEES' n- t r
no
PROMPT Creating Table 'COUNTRIES'
ALTER TABLE EMPLOYEES
CREATE TABLE COUNTRIES
ADD (CONSTRAINT s a
(COUNTRY_ID CHAR(2) NOT NULL
,COUNTRY_NAME VARCHAR2(40) h
) e.a
PK__EMPLOYEES__0425A276 PRIMARY KEY
o m
(EMPLOYEE_ID))
c.c t Guid
,REGION_ID FLOAT(53)
/
)
g i
/
lo Creating
rePROMPT e n Primary Key on
Constraint Definitions
a
iw sALTERt u d
'COUNTRIES'
@ i S TABLE COUNTRIES
l e h
aon e t PK__COUNTRIES__78B3EFCA
ADD (CONSTRAINT
.
PROMPT Creating Primary Key
b h s
'REGIONS'
d h o u PRIMARY KEY

b
ALTER TABLE REGIONS
u o se t /
(COUNTRY_ID))

( s
ADD (CONSTRAINT
e n
a le lic PRIMARY KEY
PK__REGIONS__76CBA758
h
/h
b
(REGION_ID)) PROMPT Creating Unique Key on

b o d 'EMPLOYEES'
su PROMPT Creating Primary Key on 'JOBS' ALTER TABLE EMPLOYEES
ADD (CONSTRAINT
ALTER TABLE JOBS UQ__EMPLOYEES__0519C6AF UNIQUE
ADD (CONSTRAINT PK__JOBS__023D5A04 (EMAIL))
PRIMARY KEY /
(JOB_ID))
/
PROMPT Creating Check Constraint on
PROMPT Creating Primary Key on 'JOB_HISTORY'
'LOCATIONS' ALTER TABLE JOB_HISTORY
ALTER TABLE LOCATIONS ADD (CONSTRAINT
CK__JOB_HISTORY__0EA330E9 CHECK
(END_DATE > START_DATE))
/
ADD (CONSTRAINT
PK__LOCATIONS__7B905C75 PRIMARY KEY
(LOCATION_ID))
/

PROMPT Creating Primary Key on


'JOB_HISTORY'
Oracle Database 10g: Administration Workshop I A-3
Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice Sessions: Overview
(continued)
PROMPT Creating Check Constraint on
'EMPLOYEES' PROMPT Creating Foreign Key on
ALTER TABLE EMPLOYEES 'DEPARTMENTS'
ADD (CONSTRAINT ALTER TABLE DEPARTMENTS ADD
CK__EMPLOYEES__SALAR__08EA5793 CHECK (CONSTRAINT
(SALARY > 0)) FK__DEPARTMEN__LOCAT__7F60ED59
/ FOREIGN KEY
(LOCATION_ID) REFERENCES LOCATIONS
(LOCATION_ID) ON DELETE CASCADE)
PROMPT Creating Foreign Key on /
'LOCATIONS'
ALTER TABLE LOCATIONS ADD (CONSTRAINT PROMPT Creating Foreign Key on
FK__LOCATIONS__COUNT__7C8480AE 'EMPLOYEES'
FOREIGN KEY ALTER TABLE EMPLOYEES ADD (CONSTRAINT
a ble
(COUNTRY_ID) REFERENCES COUNTRIES FK__EMPLOYEES__MANAG__07F6335A
fe r
(COUNTRY_ID) ON DELETE CASCADE) FOREIGN KEY
a ns
/
n- t
(EMPLOYEE_ID) ON DELETE CASCADE)
r
(MANAGER_ID) REFERENCES EMPLOYEES

PROMPT Creating Foreign Key on /


a no
'JOB_HISTORY'
a s Key on
PROMPT CreatinghForeign
'EMPLOYEES'm)
ALTER TABLE JOB_HISTORY ADD
(CONSTRAINT
o d e .
FK__JOB_HISTO__DEPAR__0BC6C43E
i c
c. t Gu
ALTER TABLE i
EMPLOYEES ADD (CONSTRAINT
FOREIGN KEY g
lo eKEY
FK__EMPLOYEES__JOB_I__07020F21
n
(DEPARTMENT_ID) REFERENCES
a reFOREIGNd
DEPARTMENTS i tu
w S(JOB_ID)
(JOB_ID) REFERENCES JOBS

l e
(DEPARTMENT_ID) ON DELETE CASCADE)@ his/ ON DELETE CASCADE)
/
. b ha se t
o
PROMPT Creating Foreignd h Keytoonu PROMPT Creating Foreign Key on
'JOB_HISTORY' ub e
sADD 'EMPLOYEES'
e s
ALTER TABLE (JOB_HISTORY
c e n ALTER TABLE EMPLOYEES ADD (CONSTRAINT
h a l
(CONSTRAINT l i FK__EMPLOYEES__DEPAR__060DEAE8
h b
FK__JOB_HISTO__JOB_I__0DAF0CB0 FOREIGN KEY

b o dFOREIGN KEY (DEPARTMENT_ID) REFERENCES


su (JOB_ID) REFERENCES JOBS
(JOB_ID) ON DELETE CASCADE)
DEPARTMENTS
(DEPARTMENT_ID) ON DELETE CASCADE)
/ /

PROMPT Creating Foreign Key on PROMPT Creating Foreign Key on


'JOB_HISTORY' 'COUNTRIES'
ALTER TABLE JOB_HISTORY ADD ALTER TABLE COUNTRIES ADD (CONSTRAINT
(CONSTRAINT FK__COUNTRIES__REGIO__79A81403
FK__JOB_HISTO__EMPLO__0CBAE877 FOREIGN KEY
FOREIGN KEY (REGION_ID) REFERENCES REGIONS
(EMPLOYEE_ID) REFERENCES EMPLOYEES (REGION_ID) ON DELETE CASCADE)
(EMPLOYEE_ID) ON DELETE CASCADE)
/

Oracle Database 10g: Administration Workshop I A-4


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 2: Installing the Oracle Database Software

Background: In the practices of this course, you assume the role of a database administrator
(DBA). The operating system (OS) accounts on your computer are:
• The oracle user with a password of oracle
• The root user with a password of oracle

The system administrator has set up the OS so that it is ready for the installation, and the
installation media is staged at /stage/Disk1. Perform the following tasks as the default
oracle OS user, unless otherwise indicated.

Use the Oracle Universal Installer (OUI) to begin your software installation of the Enterprise
Edition of Oracle Database 10g Release 2. This is a “Basic Installation” of the Oracle software.
a ble
fe r
After installing the software, execute the lab_02_05.sh script, which creates a listener for
a n s
you. n- t r
a no
h a s
Note: Completing this practice is critical for all following practice)sessions.
c o m ide.
Your Tasks g i c. t Gu
a r elo den
1. Install the Oracle database software asiwthe oracle
S tuuser. Navigate to the /stage/Disk1
@ s
directory, and start the OUI bylentering
h a e
e thi
./runInstaller.

h
2. Select your installation
b byuentering
.method s and accepting the following settings:
o
b nse d t o
Object (su Setting
e li c e
b hal Home
Installation
Database
Method
Location
Basic Installation
/u01/app/oracle/product/10.2.0/db_1
o d h Installation Type Enterprise Edition
sub UNIX DBA Group oinstall
Create Starter Database Deselected
Inventory Directory /u01/app/oracle/oraInventory

3. After entering the initial settings, OUI checks product-specific prerequisites for you. When
these checks are finished, install the Oracle software.

Estimated installation time is 10–15 minutes. However, varying environments can greatly
influence this estimate.

Oracle Database 10g: Administration Workshop I A-5


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 2: Installing the Oracle Database Software (continued)

4. When the Execute Configuration scripts page appears, follow the instructions on that page,
accept the default for the local bin directory, and then finish your installation with OUI.

Make a note of your End of Installation URLs. You will use them in later practice sessions.

iSQL*PlusURL:____________________________________________________________

iSQL*Plus DBA URL:_______________________________________________________

Optionally, review the product inventory, and then exit.

5. Execute the lab_02_05.sh script, which is in the /home/oracle/labs directory.


This script uses the netca utility to create a listener for you. If you create your first a ble
fe r
database with OUI (as part of your installation), then OUI invokes the network
a ns
t r
configuration assistant, which creates the first listener for you. For more details on listeners,
n-
see the lesson titled “Configuring the Oracle Network Environment.”
a no
h
You see an activity log, which should end with a success message.a s
If not, resolve any errors
that might have occurred. m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
h a le lic
o d hb
sub

Oracle Database 10g: Administration Workshop I A-6


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 3: Creating an Oracle Database

Background: You are about to begin creating your first Oracle database. You anticipate that
several similar databases will be needed in the near future. Therefore, you decide to create your
ORCL database, as well as a database template and the database creation scripts. Locate the
scripts in the /home/oracle/labs directory (which is the directory that you use most often
throughout this course).

Note: Completing the database creation is critical for all following practice sessions.

Your Tasks

1. Start the Database Configuration Assistant (DBCA) by entering dbca in a terminal a ble
window. fe r
a n s
2. Begin the ORCL database creation. Use the General Purpose database template.n r
-t the
Review
o
template’s details and answer the following questions.
s an
Question 1: How many control files are created? ) ha
c o m ide.
g i c. t Gu
________________________________________________________________________
a relo uden
Question 2: Would it maximize database S t to multiplex them?
iw availability
@ s
h a le
e thi
________________________________________________________________________
d h .b us
o t o
( s ub many
Question 3: How
e n e log groups are created?
sredo
a le lic
________________________________________________________________________
h
o d hb Question 4: Would it maximize database availability to mirror them?
sub
________________________________________________________________________

________________________________________________________________________

Question 5: What is the database block size (db_block_size)?

________________________________________________________________________

Question 6: What is the value of Sample Schemas?

________________________________________________________________________

Note: You will change this setting later in this practice to create and unlock the HR sample
schema.

Oracle Database 10g: Administration Workshop I A-7


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 3: Creating an Oracle Database (continued)

Question 7: What is the template default for the Database Character Set?

________________________________________________________________________

Note: You will change this setting later in this practice to use a Unicode database character
set.

3. Create the ORCL database, as well as the ORCL template and the database generation
scripts.

Create a database with the following settings:


Object Setting
a ble
Global Database Name orcl.oracle.com fe r
SID a ns
Configuration
orcl
n- t r
Configure the Database with Enterprise Manager
o
Database Management an
Use Database Control for Database Management
s
Enable Email Notifications deselect
) ha
Enable Daily Backup deselect
c o m ide.
Password for All Accounts
g i c. t Gu
oracle

relo uden
Storage Options File System
File Location a
iw s St Use Oracle-Managed Files
Recovery Configuration @ Specify Flash Recovery Area
Enable Archiving h a le
e thi deselect
Database Content
d h .b us Sample Schemas enabled
o t o
( s ub ense
Initialization Parameters Memory Custom and Automatic Shared Memory
Management
ale Setslic
hCharacter
bCreation Options: Use Unicode (AL32UTF8)

o d h Select all:

sub
- Create Database
- Save as a Database Template (optional)
- Generate Database Creation Scripts (optional)
Template Name orcl
Description ORCL Database template
Destination Directory /home/oracle/labs

Review and confirm options and parameters, such as Sample Schemas (true),
db_block_size (8KB), sga_target (270MB), undo_management
(AUTO), and Database Character Set (AL32UTF8).

Oracle Database 10g: Administration Workshop I A-8


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 3: Creating an Oracle Database (continued)

The DBCA displays the progress of the various installation steps. When the database itself
has been created, the DBCA displays essential information about the database. Make note
of this information. The Database Control URL will be used in several of the following
practice sessions.

a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
Unlock
h a lic with HR as password.
lethe HR user
o d hb You completed your task to create a database and (optionally) a database template and
sub database generation scripts.

Oracle Database 10g: Administration Workshop I A-9


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 4: Managing the Oracle Instance

Background: You have just installed the Oracle software and created a database. You want to
ensure that you can start and stop the database and see the application data.

Your Tasks

1. Invoke Enterprise Manager with Mozilla and the oracle profile. Enter the URL that you
wrote down in Practice 3, and log in as the SYS user with the oracle password and
SYSDBA as “Connect As.” Which port number does this database use? You noted this in
Practice 3.

_______________________________________________________________________
a ble
The first time you log in after installing the software, the “Oracle Database 10g Licensingsfe r
Information” page appears. Acknowledge this information.
t r a n
n o n-
2. View the initialization parameters (Navigation aid: Adminstration > AllaInitialization
Parameters). Set the JOB_QUEUE_PROCESSES parameter to 15.aWhat
h s SQL statement is
run to do this? m ) e.
o
g i c.c t Guid
_______________________________________________________________________
a relo uden
3. Question: What is the significance ofiw a check in
S t Dynamic column?
the
@ s
h a le
e thi
_______________________________________________________________________
d h .b us
o t o
4. Shut down the
( s ubdatabase
e n e by using Enterprise Manager.
sinstance
For
h aHost lic enter oracle as Username and oracle as Password.
le Credentials,
o d hb
b Question: What SQL is executed to shut down the database instance?
su
_______________________________________________________________________

If you click Refresh during the shutdown operation, you may see the following error: Click
OK and continue to refresh. The error will resolve itself.

Click OK and continue to click Refresh. Note that the Status of the instance is now
“Down.”

Oracle Database 10g: Administration Workshop I A - 10


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 4: Managing the Oracle Instance (continued)

5. When you note that the Status of the instance is “Down,” use SQL*Plus to verify that you
are not able to connect as the HR user.

6. Use Enterprise Manager to restart the database instance with the oracle host credentials.
Question: What SQL is run to accomplish the database startup?

_______________________________________________________________________

7. In the alert log, view the phases that the database went through during startup. (Navigation
aid: Database > Alert Log Content).
Question: What are the database instance startup phases?

a ble
_______________________________________________________________________
fe r
a ns
n- t r
8. Test access to iSQL*Plus for your HR application developers. (Navigation aid: Database >

a no
iSQL*Plus). Use the Normal role, hr username and password, and the default setting as
Connect Identifier. If there is an error accessing iSQL*Plus, then start the isqlplus process
h a s
using the isqlplusctl start command at the OS prompt, and then reattempt. After
m ) e.
o
connecting, select the contents of the EMPLOYEES table.
g i c.c t Guid
a r elo log
When you have finished reviewing the information,
d e n of iSQL*Plus and close the
out
iSQL*Plus window.
@ iw s Stu
h a le
e thi
d h .b us
o t o
( s ub ense
h a le lic
o d hb
sub

Oracle Database 10g: Administration Workshop I A - 11


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 5: Managing Database Storage Structures

Background: You need to create a new tablespace for the INVENTORY application. You also
need to create a database user that is not as privileged as the SYS user.

Your Tasks

1. Enter ./lab_05_01.sh to run a script that creates the DBA1 user. It is located at
/home/oracle/labs. The password for DBA1 is oracle. Leave the command shell
window open. You will use it again later.

2. Use the Setup link in the top-right corner of Enterprise Manager (EM) to define the DBA1
user as one who can perform administrative tasks in EM. Use the following settings:
a ble
Object Setting fe r
Name dba1 a ns
Password Oracle n- t r
Confirm Password Oracle a no
Super Administrator Selected
h a s
m ) e.
o and logidin as DBA1 user. Use
the DBA1 user to perform the rest of these tasks, g i c cotherwise
When the non-SYS user is configured, log out as SYS.user
unless t G u indicated.
a relo uden
iw sabout
3. Using Enterprise Manager, view information S t the EXAMPLE tablespace (Navigation
@
h a le Answer
aid: Administration > Tablespaces).
e thi the following questions about it:
d h.b toof free
Question 1: Whatopercentage
us space can be used up before the Warning threshold is
reached? sub n se
( e
h a le lic
_______________________________________________________________________
o d hb
sub Question 2: How many segments are there in the EXAMPLE tablespace? (Navigation aid:
“Show Tablespace Contents” Actions drop-down list selection).

_______________________________________________________________________

Question 3: Which index in the EXAMPLE tablespace takes up the most space? (Navigation
aid: Search type “INDEX”)

_______________________________________________________________________

Oracle Database 10g: Administration Workshop I A - 12


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 5: Managing Database Storage Structures (continued)

Question 4: Which segment is stored physically first in the tablespace? That is, which one
is stored right after the tablespace header?

Look at all extent types on the Extent Map. Note the extent just to the right of the
tablespace header extent.

a ble
fe r
a ns
n- t r
no
Scroll to the top of the page again, and note the segment that is being pointed to.
a
h a s
_______________________________________________________________________
m ) e.
o uid (Navigation aid:
g c.cINVENTORY
4. Create a new, locally managed tablespace (LMT) called
i t G
r e lo specifications:
Administration > Tablespaces). Use the following
e n
Object i a
wSetting S tud
Tablespace name
a l e@ tINVENTORY
h is
Extent Management .bh se Locally Managed
Type d h to u Permanent
Status su b o e
e ( tablespace
c e ns Read Write

ha File Nameli
Use lBigfile deselected
h bData inventory01.dbf
b o d File Size 5 MB
su Extent Allocation Automatic
Segment Space Management Automatic
Enable Logging selected

Review the SQL that will be run to create this tablespace.

Note: The INVENTORY tablespace will be used in later practice sessions during this class.

5. Run the lab_05_05.sql script to create and populate a table (called X) in the
INVENTORY tablespace. What error do you eventually see?

_______________________________________________________________________

Oracle Database 10g: Administration Workshop I A - 13


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 5: Managing Database Storage Structures (continued)

6. Go to the Enterprise Manager window and define space for 50 MB in the tablespace instead
of 5 MB, while keeping the same single data file in the tablespace. What is the ALTER
statement that is executed to make this change?

_______________________________________________________________________

7. Go back to the terminal window and run the lab_05_07.sql script that drops the table
and reexecutes the original script that previously returned the space error.

Note that the same number of row inserts are attempted, and there is no error because of the
increased size of the tablespace.

a ble
8. In a terminal window, run the lab_05_08.sql script to clean up the tablespace for later
fe r
practice sessions.
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

Oracle Database 10g: Administration Workshop I A - 14


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 6: Administering User Security

Background: You need to create a user account for Jenny Goodman, the new human resources
department manager. There are also two new clerks in the human resources department, David
Hamby and Rachel Pandya. All three of them must be able to log in to the ORCL database,
select data from, and update records in the HR.EMPLOYEES table. The manager also needs to
be able to insert and delete new employee records. Ensure that if the new users forget to log out
at the end of the day, they will automatically be logged out after 15 minutes. You also need to
create a new user account for the inventory application that you are installing.

Your Tasks

1. Mandatory: Review and run the lab_06_01.sh script (located in the


/home/oracle/labs directory) to create the INVENTORY schema user, which you
a ble
will use in the next practice. fe r
a n s
2. Create a profile named HRPROFILE, allowing 15 minutes idle time (Navigation n t r
-aid:
o
an
Administration > Profiles). Optionally, review the underlying SQL statement.
s
a
3. Set the RESOURCE_LIMIT initialization parameter to TRUE,)sohthat your profile limits
will be enforced time (Navigation aid: Administration .c>o
m ide. Parameters).
All Initialization
g i c t Gu
4. Use EM to create the role named HRCLERKre lohas permission
that e n to select from and update
the HR.EMPLOYEES table (Navigation
a tu d
iwaid:sAdministration > Roles). Review your
underlying SQL statement: le @ i S
h a e th
b
h. to us
o d
( s ub ense
h a le lic
o hb
d5. Use EM to create the role named HRMANAGER that has permissions to insert into and delete
sub from the HR.EMPLOYEES table. Grant the HRCLERK role to the HRMANAGER role.
Review your underlying SQL statement:

Oracle Database 10g: Administration Workshop I A - 15


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 6: Administering User Security (continued)

6. Use EM to create an account for David Hamby, a new HR clerk (Navigation aid:
Administration > Users). Use the following specifications:
Object Setting
Name DHAMBY
Profile HRPROFILE
Password Authentication selected
Password newuser
Expire Password now selected
Roles CONNECT and HRCLERK

7. Use EM to create an account for Rachel Pandya, another new HR clerk. Repeat the steps
a ble
from step 6 with RPANDYA as the username.
fe r
a n s
8. Use EM to create an account for Jenny Goodman, the new HR manager. Repeat the
n r
-t steps
from step 6 with JGOODMAN as the username and selecting the HRMANAGER o
n instead of
role
the HRCLERK role. Review your underlying SQL statement: s a
h
) e. a
o m
g i c.c t Guid
a relo uden
@ iw s St
9. Test the new users in SQL*Plus.
h a leConnectthtoi the ORCL database as the DHAMBY user. Use
. b Select
oracle as the new password.
h u sethe row with EMPLOYEE_ID=197 from the
b o d Then,toattempt to delete it. (You should get the “insufficient
table.
u ense
HR.EMPLOYEES
privileges”
( serror.)
h a le lic
o d h10.bRepeat the delete attempt as the JGOODMAN user. After deleting the row, issue a rollback,
so that you still have the original 107 rows.
sub
Question 1: Where was the row stored after deletion?

__________________________________________________________________________

Question 2: When you created the new users, you did not select a default or temporary
tablespace. What determines the tablespaces that the new users will use?
_________________________________________________________________________

Question 3: You did not grant the CREATE SESSION system privilege to any of the new
users, but they can all connect to the database. Why?
_________________________________________________________________________

11. Review the lab_05_01.sql script and the lab_05_01.txt log file that it generated
when you created the DBA1 user.

Oracle Database 10g: Administration Workshop I A - 16


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 6: Administering User Security (continued)

12. Use SQL*Plus to connect to the ORCL database as the RPANDYA user. Change the
password to oracle. (You must change the password, because this is the first connection
as RPANDYA.) Leave RPANDYA connected during the next lesson or at the end of the day.
HRPROFILE specifies that users whose sessions are inactive for more than 15 minutes will
automatically be logged out. Verify that the user was automatically logged out by trying to
select from the HR.EMPLOYEES table again.
ERROR at line 1:
ORA-02396: exceeded maximum idle time, please connect again

a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

Oracle Database 10g: Administration Workshop I A - 17


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 7: Managing Schema Objects

Background: You need to create schema objects for the new inventory application. Work as
DBA1 user in the SYSDBA role for your ORCL database.

Your Tasks

1. Return to the Enterprise Manager browser session, or invoke EM as the DBA1 user in the
SYSDBA role for your ORCL database.

2. In the INVENTORY tablespace, create the PRODUCT_MASTER table in the INVENTORY


schema. The specifications of the table are:
PRODUCT_ID number(7). This is the primary key field. (Constraint name: PK_INV) a ble
PRODUCT_NAME varchar2(50) with a Not NULL constraint fe r
a n s
CODE varchar2(10) with a Not NULL constraint
n- t r
always greater than zero (Constraint name: CHK_REORDER) a no
REORDER_THRESHOLD number(5) with a check constraint ensuring that the number is

h a s
COST number(5,2) ) e.
PRICE number(5,2) o m
g i c.c t Guid
a r elo den
3. In the INVENTORY tablespace, create the PRODUCT_ON_HAND table in the INVENTORY
iw s S
schema. You have been given the lab_07_03.sql t u script to create the table, but there is
a problem with it (intentionallyle @ i
created tohenhance your learning experience). Fix the
problem, and run the script. h a
If you e
cannot
t find the error right away, then go ahead and run
h . b u s
b dSQL*Plus
the original script in to toofsee
ospecifications the error message. This helps you discover and solve
the problem.uThe
s n s e the table are:
( e
h a le
PRODUCT_ID lic number(7). This field should have a foreign key constraint linking it to
o d h b the PRODUCT_ID field in the PRODUCT_MASTER table.
b QUANTITY number(5)
su WAREHOUSE_CITY varchar2(30)
LAST_UPDATE date

4. In the INVENTORY tablespace, create the OBSOLETE_PRODUCTS table in the


INVENTORY schema. This table definition is very much like that of the
PRODUCT_MASTER table, so you can use Enterprise Manager’s ability to “Define Using
SQL” rather than using “Column Specification.” The specifications of the table are:
PRODUCT_ID number(7). This is the primary key field.
PRODUCT_NAME varchar2(50) with a Not Null constraint
CODE varchar2(20) with a Not Null constraint
COST number(5,2)
PRICE number(5,2)

Oracle Database 10g: Administration Workshop I A - 18


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 7: Managing Schema Objects (continued)

5. In the INVENTORY tablespace, create an index called OBS_CODE on the CODE column of
the OBSOLETE_PRODUCTS table in the INVENTORY schema. Choose an appropriate
index type: either B-tree or Bitmap. Explain the reason for your choice.

Question: Which type of index is appropriate, and why?


_________________________________________________________________________
_________________________________________________________________________

6. In the INVENTORY tablespace, create an index called PROD_NAME_CODE on the


combined PRODUCT_NAME and CODE columns of the PRODUCT_MASTER table. Use the
lab_07_06.sql script (which contains an error, intentionally created to enhance your a ble
fe r
a n s
learning experience). Correct the error and run the script. If you cannot find the error right
t r
away, then run the original script in SQL*Plus to see the error message. This will help you
n-
discover and solve the problem.
a no
7. In the INVENTORY tablespace, use SQL*Plus to create a combined h a s
index on the
PRODUCT_ID and QUANTITY columns of the PRODUCT_ON_HAND m ) etable. . The index
c o i d
name should be POH_PROD_ID_QTY.
g i c. t Gu
a relo uthat
8. You receive an update for the inventory application d n
erequires you to add two columns to
the PRODUCT_MASTER table. Add ai w called
column S t PRIMARY_SOURCE of the data type
l e @ his
varchar2(50). Add another ha column e tcalled SECONDARY_SOURCE of the data type
varchar2(50). What . b
h is thetoSQL s
u that executes to do this?
o d
( s ub ense
_________________________________________________________________________
h a le lic
o d h b_________________________________________________________________________
sub 9. You receive another update for the inventory application. This change request instructs you
to drop the OBSOLETE_PRODUCTS table and add the OBSOLETED column to the
PRODUCT_MASTER table, with data type DATE. Do this using EM. What clause is added
to the end of the DROP TABLE statement to also remove the table constraints?

_________________________________________________________________________

10. Another change request to the inventory application instructs you to create a view called
WAREHOUSE_VW (Navigation aid: Administration > Views). The view is in the
INVENTORY schema and displays (in this order):
• The name of the product
• The amount of “product on hand”
• The warehouse city name

You will have to join two tables together to create this view.

Oracle Database 10g: Administration Workshop I A - 19


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 7: Managing Schema Objects (continued)

11. You receive a notice from developers that there is a certain type of query that will be run
very frequently, and they want to be sure that it runs in less than one second. You need to
run the query and see how it performs. First, run the lab_07_11_a.sql script to
generate some test data of the volume indicated in the request. Then, run the query in the
lab_07_11_b.sql script several times to see the average run time. Note that it takes
several seconds to run each time. Create a function-based index on the CODE column that
will improve the performance of this query.

12. Use iSQL*Plus to identify the data dictionary view name that you would use to list all
constraints that the INVENTORY user can see. What is the view name?

_________________________________________________________________________
a ble
fe r
13. How many indexes are owned by the INVENTORY user? You are looking for database
a n s
n- t r
objects owned by the INVENTORY user, so you know that the data dictionary view begins
with the “USER_” prefix. The view name is USER_INDEXES.
a no
h a s
) e.
_________________________________________________________________________
m
o
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
h a le lic
o d hb
sub

Oracle Database 10g: Administration Workshop I A - 20


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 8: Managing Data and Concurrency

Background: The Help desk just received a call from Susan Mavris, an HR representative,
complaining that the database is “frozen.” Upon questioning the user, you find that she was
trying to update John Chen’s personnel record with his new phone number, but when she
entered the new data, her session froze and she could not do anything else. SQL script files are
provided for you in the /home/oracle/labs directory.

Your Tasks

1. Make an uncommitted update to the row in question by running the lab_08_01.sql


script. Do not worry if the session seems to “hang”—this is the condition you are trying to
create.
a ble
2. Make an attempt to update the same row in a separate session by running, in a separate fe r
terminal window, the lab_08_02.sql script. Make sure you see the message “Update is a ns
n- t r
being attempted now” before moving on.
a no
3. Using the Blocking Sessions link on the Performance page, detect h a s session is causing
which
the locking conflict. m ) e.
o uid
4. What was the last SQL statement that the blocking g i c.c texecuted?
session G
a relo uden
5. Resolve the conflict in favor of the user S t
iwwhoscomplained, by killing the blocking session.
e @ i
b h al e th
What SQL statement resolves the conflict?

o d h. to us
_________________________________________________________________________
s b nse
uSQL*Plus
6. Return to (the ce Itcommand window, and note that SMAVRIS’s update has now
a l e successfully.
completed l i may take a few seconds for the success message to appear.
b h
o d h
sub

Oracle Database 10g: Administration Workshop I A - 21


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 9: Managing Undo Data

Background: A new version of your application will include several reports based on very
long-running queries. Configure your system to support these reports.

Your Tasks

1. Use the Undo Advisor to calculate the amount of undo space required to support a report
that takes two days to run, on the basis of an analysis period of the last seven days.
(Navigation aid: Administration > Advisor Central > Undo Management > Undo Advisor).

Question: What does the analysis recommend as “Required Tablespace Size for New Undo
Retention”?
a ble
_________________________________________________________________________
fe r
a ns
t r
2. Resize the undo tablespace to support the retention period required by the new reports (or 1
n-
no
GB, whichever is smaller). Do this by increasing the size of the existing data file.
a
Question: What are the two ways to add space to a tablespace? ha
s
m ) e.
o
g i c.c t Guid
_________________________________________________________________________

a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
h a le lic
o d hb
sub

Oracle Database 10g: Administration Workshop I A - 22


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 10: Implementing Oracle Database Security

Background: You have just been informed of suspicious activities in the HR.JOBS table in
your ORCL database. All maximum salaries seem to fluctuate in a strange way. You decide to
enable standard database auditing and monitor data manipulation language (DML) activities in
this table.

Log in as the DBA1 user (with oracle password, connect as SYSDBA) and perform the
necessary tasks either through Enterprise Manager Database Control or through SQL*Plus. All
scripts for this practice are in the /home/oracle/labs directory.

Your Tasks

1. Use Enterprise Manager to enable database auditing. Set the AUDIT_TRAIL parameter to
a ble
XML. This setting should be stored in the SPFILE. fe r
a n s
2. Because you changed a static parameter, you must restart the database. Do so byn -t r
running
o
the lab_10_02.sh script.
s an
) ha and the script has
Continue with the next step when you see that the database is restarted
exited out of SQL*Plus. c o m ide.
g i c. t Gu
3. Back in Enterprise Manager, select HR.JOBS
a relaso theudaudited
en object and DELETE, INSERT,
and UPDATE as Selected Statements.iw t information by session. (Navigation
Gather audit
S
@ s
h a le
aid: Administration > Audit Settings).
e thi
d
4. Provide input for the h .b executing
audit, by us the lab_10_04.sh script. This script creates the
o t o
AUDIT_USER
( s ubuser,econnects
n se to SQL*Plus as this user, and multiplies the values in the
le
MAX_SALARY
h a lic by 10. Then, the HR user connects and divides the column values
column

o d h bby 10. Finally, the AUDIT_USER user is dropped again.


sub 5. In Enterprise Manager, review the audited objects. Use the Audited Objects tab.

6. Undo your audit settings for HR.JOBS, disable database auditing, and then restart the
database by using the lab_10_06.sh script.

7. Maintain your audit trail: Because you are completely finished with this task, delete all
audit files from the /u01/app/oracle/admin/orcl/adump directory.

Oracle Database 10g: Administration Workshop I A - 23


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 11: Configuring the Oracle Network Environment

Background: Users need to connect to your ORCL database. Work with them to enable
connections by using different methods. Ensure that users can use connect-time failover to take
advantage of a backup listener.

Your Tasks

1. Make a copy of your listener.ora and tnsnames.ora files. They are in the
$ORACLE_HOME/network/admin directory.

2. Navigate to the Net Services Administration page. Start by clicking the Listener link on the
Database home page.

a ble
3. Modify your local Names Resolution file so that you can connect to another database.
fe r
(Navigation aid: Listener link > Net Services Administration > Administer > Local
a ns
Naming). Use the following information to define the connection:
n- t r
Object Setting a no
Connection name Testorcl h a s
DB ID Method SID m ) e.
o
SID value Orcl
g i c.c t Guid
relo uden
Protocol TCP/IP
Port a
iw s St1521
Host @ IP or name of other student’s computer
h a le
e thi
4. In Enterprise Manager,
h b accessusto your partner’s ORCL database as the system user
.test
with the oracle
b o d
password tousing the testorcl Local Naming.
by
su cens e
l e ( i displays status information. Then, it is followed by a success message.
TheaProcessing
h lpage
b
h If you receive any errors or warnings, resolve them.
b o d
su

Oracle Database 10g: Administration Workshop I A - 24


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 11: Configuring the Oracle Network Environment (continued)

5. Test your changes to the network configuration by using SQL*Plus or iSQL*Plus. Again,
use: system/oracle@testorcl. To see your partner’s information, select the
instance_name and host_name columns from the v$instance table. You should
see your partner’s host name.

6. Create a LISTENER2 listener to support connect-time failover. Use port 1561 for this
listener. First, log out of Enterprise Manager and run the lab_11_06.sh script to
configure the NetProperties file. (Navigation aid: Listener link > Net Services
Administration > Administer > Listeners). Use the Static Database Registration tab on the
Create Listener page to connect the listener to your database. Use the following
information:
a ble
Object Setting
fe r
Listener name LISTENER2
a ns
Host <your computer’s name>
n- t r
o
Service name
Protocol
orcl
TCP/IP s an
Port ) ha
SID
1561
c o m ide.
Oracle Home Directory
orcl
g i c. t Gu
relo uden
/u01/app/oracle/product/10.2.0/db_1

7. Start the LISTENER2 listener.


a
iw s St
@
h a le
e thi
d h .b us
o t o
( s ub ense
h a le lic
o d hb
sub

Oracle Database 10g: Administration Workshop I A - 25


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 12: Proactive Maintenance

Background: You want to proactively monitor your ORCL database so that common problems
can be fixed before they affect users. This practice session invents some issues so that you can
familiarize yourself with the tools that are available. First, execute scripts to set up your
Automatic Database Diagnostic Management (ADDM) environment.

Your Tasks

1. Create a new locally managed tablespace called TBSADDM. Its addm1.dbf data file is 50
MB. Ensure that the TBSADDM tablespace does not use Automatic Segment Space
Management (ASSM). Execute the lab_12_01.sh script to perform these tasks.

2. Create a new ADDM user, identifed by ADDM. Assign the TBSADDM tablespace as default a ble
tablespace. Assign the TEMP tablespace as temporary tablespace. Grant the following roles fe r
a n s
to the ADDM user: CONNECT, RESOURCE, and DBA. Execute the lab_12_02.sh script
n- t r
to perform these tasks.
a no
3. Use the DBMS_ADVISOR package to set the database activity time h a s
to 30 minutes. As an
ADDM user, drop and create the ADDM table and gather statistics m ) for this
e .table. Create a
c o i d
snapshot in Automatic Workload Repository (AWR).
g i c.Execute
t G u lab_12_03.sh script
the
to perform these tasks.
a relo uden
t
iwthe lab_12_04.sh
S
4. Create activity to be analyzed. Execute
l e @ h i s script to perform these tasks.
a t
5. In Enterprise Manager, h . bh theusPerformance
review
e page as a user connected as SYSDBA. View
performance data o d t o
a spike on(s
ub inereal
the “Average n
time
e with a 15-seconds refresh cycle. After a while, you should see
sActive Sessions” graph. This is your activity to be analyzed.
l e l i c
b ha at theproblems.
Looking
concurrency
graph, you can already determine that this instance is suffering from
If this is the first time that you accessed the Performance page, you
o d h
b need to accept the Adobe license agreement. Follow the directions in the pop-up window to
su accept the agreement.

Note: Depending on when you run the workload, you may see differences between your
graph and the one provided as a possible solution.

After the spike is finished, execute the lab_12_05.sh script. This script forces the
creation of a new snapshot and gathers statistics on your ADDM table.

Oracle Database 10g: Administration Workshop I A - 26


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 12: Proactive Maintenance (continued)

6. Look at the Performance Analysis findings in order of their impact. There are several
access paths to this information.

Looking at the Performance Analysis section, you see that the first finding (in the SQL
Tuning Recommendations category) has a 100% impact on the system. So your first
impluse is to look at this finding in more detail. However, looking at this SQL statement
does not yet help you to understand the concurrency problem of your database.

Research the next finding under Schema Recommendations: Read and write contention of
database blocks was consuming significant database time. Here, you are advised to use
the Automatic Segment Space Management (ASSM) feature for your ADDM table.

a ble
7. To implement the recommendation, you must re-create the object. Create a new locally
fe r
managed tablespace, called TBSADDM2 with a 50 MB data file, called addm2_1.dbf.
a n s
n-
Ensure that the TBSADDM2 tablespace uses the the ASSM feature. Then, execute the t r
no
lab_12_07.sh script to drop the ADDM table, to re-create it in the new tablespace, to
a
gather statistics and to take a new snapshot.
h a s
m ) e.
8. Execute your workload again by running the lab_12_08.sh
. c o script.
u id (The
lab_12_08.sh script is identical to the lab_12_04.sh i c
g nt G script.)
r e l o e
i wa Spage
9. In Enterprise Manager, review the Performance tudas a user connected as SYSDBA. View
a l e@
performance data in real time with
t h is refresh cycle. After a while, you should see
a 15-seconds
a spike on the “Average.b h Sessions”
Active se graph.
d h u
torun the workload, you may see differences between your
Note: Dependingb o on whene you
graphland
e suonecprovided
(the e ns as a possible solution.
ha li
b
h After the spike is finished, execute the lab_12_09.sh script. (The lab_12_09.sh
b o d script is identical to the lab_12_05.sh script.) This script forces the creation of a new
su snapshot and gathers statistics on your ADDM table.

10. Review the Performance Analysis on the Database home page. View the information for
this last ADDM task.

You see that there are no longer any schema-related recommendations. By moving the
ADDM table to the locally managed TBSADDM2 tablespace, which uses the Automatic
Autoextend Segment feature, you obviously fixed the root cause of this problem.

11. To not affect other practice session, execute the lab_12_11.sh script to clean up your
environment.

Oracle Database 10g: Administration Workshop I A - 27


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 13: Performance Management

Background: Users are complaining about slower-than-normal performance for operations


involving the human resources and order-entry applications. When you question other members
of the DBA staff, you find that maintenance was recently performed on some of the tables
belonging to the HR schema. You need to troubleshoot and make changes as appropriate to
resolve the performance problems. SQL script files are provided for you in the
/home/oracle/labs directory. Other directories are individually named.

Your Tasks

1. Log in to SQL*Plus as the DBA1 user and perform maintenance on tables in the HR schema
by running the lab_13_01.sql script. a ble
fe r
a ns
2. You get calls from HR application users saying that a particular query is taking longer than normal
n- t r
to execute. The query is in the lab_13_02.sql script. As the HR user, run it.
a no
3. Using Enterprise Manager (EM), locate the HR session in which h a
the s statement was
above
just executed, and view the execution plan for that statement.m ) e. aid: Performance
(Navigation
o
> Search Sessions).
g i c.c t Guid
4. Using EM, check to see the status of the a relo udtable’s
EMPLOYEE en index on EMPLOYEE_ID. See
iw s S>tIndexes).
if it is VALID. (Navigation aid: Administration
@
h a le
e thi
5. Now that you have seen
d h .bone indexuswith a non-VALID status, you decide to check all
o
indexes. UsingbSQL*Plus, easto
the HR user, find out which HR schema indexes do not have
u
STATUS (ofsVALID. s
n do this, you can query a data dictionary view with a condition on
eTo
l e l i c
b haSTATUS column.
the

o h
d 6. Using EM, reorganize all the indexes in the HR schema that are marked as UNUSABLE.
sub
7. Return to the SQL*Plus session where the HR user is logged in, and run the
lab_13_07.sql script to execute the same kind of query. Then, repeat the steps to see
the plan of the last SQL statement executed by this session, to see if the plan has changed.

8. What is the difference in execution plans, and why?


_________________________________________________________________________

Oracle Database 10g: Administration Workshop I A - 28


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 13: Performance Management (continued)

9. Simulate a working load on your instance by running the lab_13_09.sql script as the
DBA1 user. Note the SID value for task 10.

_________________________________________________________________________

This script takes about 20 minutes to complete. So, run it in a separate terminal window and
continue with this practice exercise while it runs.
Note: Because this script generates a fairly heavy load in terms of CPU and disk I/O, you
will notice that response time for Database Control is slower.

Use EM to view overall instance performance and answer the following questions:
a ble
fe r
a n s
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
r e lo Wait e nto see the beginning of a
i wa Stuspike d in the Average Active
@ his Sessions graph before
l e
. b ha se t proceeding.

o d h to u
Question 1: In
s u b nse Active Sessions graph, which are the two main categories that
the Average

a l e ( are
active sessions
l i e for?
cwaiting
h
o d h b_________________________________________________________________________
sub Question 2: In the Configuration category of waits, what is one of the contributors to the
wait time? Click Configuration to see the graph.

_________________________________________________________________________

Question 3: Review the Physical Writes on the Instance Disk I/O graph. Determine which
process is doing the most writing to the disk.

_________________________________________________________________________

Question 4: Review the Top Activity under Additional Monitoring Links. Which SQL
statement is causing the most waits?

_________________________________________________________________________

10. Kill the session that is generating the load. Use the SID value from step 9 in Enterprise
Manager’s Search Sessions link on the Performance tab to locate and kill the session.

Oracle Database 10g: Administration Workshop I A - 29


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 14: Backup and Recovery Concepts

Background: Your ORCL database is ready to move from test or development into production.
Configure your database to reduce the chances of failure or data loss.

Your Tasks

1. Verify that you have two control files to ensure redundancy. (Navigation aid:
Administration > Control Files).

Question 1: How would you add another control file if you needed to?

_________________________________________________________________________

_________________________________________________________________________ a ble
fe r
_________________________________________________________________________ a ns
n- t r
_________________________________________________________________________a no
h a s
) e.
_________________________________________________________________________
m
o
.c that id
uthere
2. Check how many members each redo log group has. g i cEnsure
t G are at least two redo
r
log members in each group. In what directory e l
or
o e n
directories are the redo log files stored?
a
iw s S t u d
@
h a l e
e thi
_________________________________________________________________________

h .b us
_________________________________________________________________________
d
o t o
Note: In a(s
ub endatabase,
production
se you want to ensure that the two members are on different
a
hard
h drives, lic with different disk controllers, to minimize the risk of any single
le preferably
o d h bhardware failure destroying an entire log group.
sub
3. You notice that, for each log group, the Archived column has a value of No. This means
that your database is not retaining copies of redo logs to use for database recovery, and in
the event of a failure, you will lose all data since your last backup. Place your database in
ARCHIVELOG mode, so that redo logs will be archived.

In the OS, create a new directory /u01/app/oracle/archive as the destination for


the redo log files. In Enterprise Manager, verify that Log Archive Filename Format
contains %t, %s, and %r.

Notice that the database is preconfigured to save archived logs to the Flash Recovery Area
by default (Archive Log Destination 10).

Oracle Database 10g: Administration Workshop I A - 30


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 14: Backup and Recovery Concepts (continued)

4. Configure redundant archive log destinations—one to the Flash Recovery Area and the
other to /u01/app/oracle/archive/. Do not forget the trailing slash. Leave Quota
blank.

Optionally, review the underlying SQL statement:

a ble
fe r
When prompted, restart your database with oracle Host Credentials and the SYS user.
a n s
n- t r
no
Now that your database is in ARCHIVELOG mode, it will continually archive a copy of
a
h a s
each online redo log file before reusing it for additional redo data.

Note: Remember that this consumes space on the disk and m ) e. regularly back up
o that youdmust
older archive logs to some other storage. g i c.c t Gui
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
h a le lic
o d hb
sub

Oracle Database 10g: Administration Workshop I A - 31


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 15: Performing Database Backups

Background: Your database is ready to move from development and test into production.
Ensure that your database is configured so that recovery is possible without loss of data.

Your Tasks

1. What is the difference between a backup set and an image copy?

________________________________________________________________________

2. What is the destination of any disk backups that are done?

________________________________________________________________________
a ble
fe r
3. Test making a backup to disk, as a backup set, with oracle for Host Credentials.
a n s
(Navigation aid: Maintenance > Backup Settings)
n- t r
a no
4. Back up your entire database, without archived logs, while the database is open for user
h a s
activity. This backup should be the base for an incremental backup strategy (Navigation
aid: Maintenance > Schedule Backup). m ) e.
o
g i c.c t Guid
shutting it down? a relo ua dvalid
Question: What prerequisite must be met to create
enbackup of a database without
@ iw s St
a le thi
________________________________________________________________________
h e
d h .b utosperform the backup:
Use the following o t o
specifications
Object ( s ub ense Setting
a l e l i c
hObject(s) Whole Database
o d h bHost Credentials Username oracle
sub Host Credentials Password oracle
Backup Type Full Backup
Use as the base of an incremental selected
backup strategy
Backup Mode Online Backup
Backup Location Disk
Disk Backup Location Flash Recovery Area
Also backup all archived logs on disk deselected
Schedule Defaults selected

Submit and monitor the job. This backup takes approximately 15 minutes to complete.

Oracle Database 10g: Administration Workshop I A - 32


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 15: Performing Database Backups (continued)

5. Schedule nightly disk-based incremental online backups for your whole database, without
archived logs backup (Navigation aid: Maintenance > Schedule Backup). Schedule it for
11:00 p.m.. The schedule should be in effect indefinitely.

Use the following specifications:


Object Setting
Object(s) Whole Database
Host Credentials Username oracle
Host Credentials Password oracle
Backup Type Incremental Backup (Level 1)
Use as the base of an incremental selected le
backup strategy r a b
Backup Mode Online Backup ns fe
Also backup all archived logs on disk deselected t r a
Backup Location Disk – Flash Recovery Area o n-
Job Name Nightly_Backup s an
Job Description ) ha
Default selected
Start Later c o m ide.
Time i c. t Gu
11:00 p.m.
g
Repeat
a relo uden
Interval
Frequency
@ iw s St 1 Days

h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

Oracle Database 10g: Administration Workshop I A - 33


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 16: Performing Database Recovery

Background: Many failures of the Oracle database can be traced to some sort of media failure,
such as disk or controller failure. Recover your database from a variety of simulated media
failures. SQL script files are provided for you in the /home/oracle/labs directory. If
needed, use appendix C for Linux and appendix D for SQL syntax. Note that where OS file
names are mentioned, your system may possibly have different file names than shown here.

Your Tasks

1. Recover from the loss of a control file.

a) As the DBA1 user, run the lab_16_01_a.sql script to prepare some procedures to
a ble
be called by the rest of this practice. fe r
a n s
b) Now run the lab_16_01_b.sql script. This script deletes one of your control n r
-t files.
n o
s
c) The Help desk begins receiving calls saying that the database appears
a to be down.
)
Troubleshoot and recover as necessary. Use Enterprise Manager’s ha Database page to
o m e .
attempt to start up the database, and use SQL*Plus,
g i c.c t Guid
if needed.

relo uManager,
d) The startup of the instance fails with Enterprise
a d en and you can get no other
information to explain the failure.iw So use the
S t
command-line tools.
@ s
- Connect to the instance h a with e thi as sysdba and check the current status of
le SQL*Plus
the instance. dh
.b us
o t o
( s
- Attempt
ubto mount
e n e
sthe database.
a l e l i c
h bh
e) The instance cannot move to the mount stage because it cannot find one of the control
o d files. Check the last 10 rows of the alert log to see which control file is the problem.
sub
f) The control file in the Flash Recovery Area is missing. Restore the missing control file
by copying the existing control file, and then mount and open the database.

Question 1: Why did you have to use two commands to move the instance state from
NOMOUNT to OPEN?

________________________________________________________________________

________________________________________________________________________

Question 2:Why did you use operating system commands to restore the control file instead
of using Oracle Recovery Manager?

________________________________________________________________________

________________________________________________________________________

Oracle Database 10g: Administration Workshop I A - 34


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 16: Performing Database Recovery (continued)

2. Recover from the loss of an application data file.

a) Start a SQL*Plus session as the DBA1 user, and run the lab_16_02.sql script. This
script deletes one of your application data files.

b) The Help desk has received a call from a user who is unable to access the COUNTRIES
table in the HR application schema. Count the rows in the table to see whether there is a
problem.

c) Troubleshoot and recover as necessary. The error message suggests that the data file for
the EXAMPLES tablespace is corrupt or missing. Using operating system commands, verify
that there is a problem with the file.
a ble
fe r
d) Recover the data file to the current time, specifying the missing data file to be
a ns
recovered. (Navigation aid: Maintenance > Perform recovery > Object Type >
n- t r
Datafiles).
a no
h a s
e) Verify that the COUNTRIES table is now accessible. ) e.
o m
3. Recover from the loss of a system data file.
g i c.c t Guid
a) Question 3: Why is recovery fromw relofo ausystem
thealoss d endata file or a data file belonging
@
to an undo tablespace different
i s St an application data file?
from recovering
h a le
e thi
.b us
________________________________________________________________________
d h
o t o
s ub ense
________________________________________________________________________
(
h a le lic
o d h bb) As SYSDBA, run the lab_16_03.sql script. This script deletes the system data file.
sub c) In Enterprise Manager, review the Database home page. The database is shut down, so
you click Startup to try to open it.

- Enter the host credentials as oracle and oracle for the host Username and
Password, and enter DBA1 and oracle for the database credentials, and then click
OK.

d) This command will fail with the database left in the MOUNT state, because there is a
data file missing from the SYSTEM tablespace.
e) Recover the missing data file.
f) Open the database.

g) Verify that the database is open and operating normally, by logging into EM as
DBA1/oracle, as SYSDBA, and reviewing the Database home page.

Oracle Database 10g: Administration Workshop I A - 35


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 17: Performing Flashback

Background: You decide to gain hands-on experience in some of the flashback functionality.
To avoid impacting other users, you will first copy the DEPARTMENTS table of the HR schema
to DEPARTMENTS2.

Your Tasks

1. Log in to SQL*Plus as DBA1 user and create a new HR.DEPARTMENTS2 table based on
the HR.DEPARTMENTS table. Count the rows in the DEPARTMENTS2 table. There should
be 27 rows.

2. Drop the HR.DEPARTMENTS2 table, and then verify that it has indeed been dropped.
a ble
3. Use the FLASHBACK TABLE command to restore the table. Count the rows in the fe r
a n s
DEPARTMENTS2 table.
n- t r
a no
4. Run the lab_17_04.sql script to insert three rows into the HR.DEPARTMENTS2 table
h a s
by using three separate transactions. The new rows have DEPARTMENT_ID values of 280,
290, and 300. m ) e.
o
g i c.c t Guid
5. Use Enterprise Manager to perform flashback
of the three new rows is present (with w a reltootheudversion of the table where only the first
en= 280). (Navigation aid:
i S t
DEPARTMENT_ID
Maintenance > Perform Recovery). @First,hevaluate
lerows is where row changes to decide on a point in time.
Limit your analysis to the h a
new just
e t added: department_id >= 280. If you
receive an error while . b
hperforming s
uthe flashback, you may need to enable row movement on
the table. Seeutheo d
b nse
next step. t o
Use the following specifications:
s
e ( lice
a l
Object
hObject Type
Setting
h b Tables
b o d Operation Type Flashback Existing Tables
su Evaluate row changes and transactions to selected
decide on a point in time
Table HR.DEPARTMENTS2
Choose Columns > Selected Columns DEPARTMENT_ID
Bind The Row Value where department_id >= 280

Review the Flashback Versions Query Result.

Select the row with the DEPARTMENT_ID = 290 and continue your flashback operation.
Review the SQL statement that you are about to execute and submit your operation.
Oracle Database 10g: Administration Workshop I A - 36
Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 17: Performing Flashback (continued)

6. You find that the operation fails because row movement is not enabled for the table. You
may recall from the lesson that row movement must be enabled for this feature to work.

Enable row movement (Navigation aid: Administration > Tables). Review the underlying
SQL statement:

After the table modification is confirmed, you can perform the flashback operation.

Repeat step 5 to perform the version flashback of the table. Because row movement has
a ble
been enabled, it should succeed this time. fe r
a n s
Then, in SQL*Plus, count the rows of the HR.DEPARTMENTS2 table to confirm n- t
ther
n oThen,
flashback operation. Note that there is only one additional row now, not three.
display the rows where DEPARTMENT_ID >= 280. Note that only s a
one of the original
a
) h e.
three is remaining.
m
i c .co Guid
l o g nt
r e e
i wa Stud
a l e@ this
h . bh use
b o d to
su cens e
e (
hal li
h b
b o d
su

Oracle Database 10g: Administration Workshop I A - 37


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 18: Moving Data

Background: In the recent past, you received a number of questions about the HR schema. To
analyze them, without interfering in the daily activities, you decide to use the Data Pump
Wizard to export the HR schema to file. When you perform the export, you are not sure into
which database you will be importing this schema.

In the end, you find out that the only database for which management approves an import, is
the ORCL database. So, you perform the import with the Data Pump Wizard, remapping the HR
schema to a newly created HR_TEST schema in the HR_TEST tablespace. To follow best
practice guidelines, you also decide to create a DP user who will be a DBA performing Data
Pump jobs. For your convenience in class, the creation of the DP user is included in the
lab_18_01.sql script. SQL scripts are in the /home/oracle/labs directory. However,
there is one step missing. a ble
fe r
Then you receive two data load requests for which you decide to use SQL*Loader. a n s
n- t r
Your Tasks a no
h a s
1. Review the lab_18_01.sql script, which creates the HR_TEST m ) tablespace,
e . the
HR_TEST_ROLE role, and the HR_TEST and DP users. o d
.c NoteGtheuipasswords for these
g i c
users.
r e lo ent
i wa Stud
HR_TEST password: ________________________
a l e@ this
h . bh use
DP password: ________________________
b o d to
u step
Which additional e
ndos you need to perform to allow the DP user access to Enterprise
sAdministrator?
e ( c e
hal
Manager as li
b
h _____________________________________________________________________
b o d
su 2. Execute the lab_18_02.sh script. Then, perform the required step to make the DP user
an EM administrator.

Oracle Database 10g: Administration Workshop I A - 38


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 18: Moving Data (continued)

3. Log in to Enterprise Manager as the DP user in the Normal role and export the HR schema
(Navigation aid: Maintenance > Export to Export Files). Use the following specifications:
Object Setting
Username oracle
Password oracle
Save as Preferred Credential selected
Export: Schemas HR
Export Options: Directory Objects DATA_PUMP_DIR
Log File hrexp.log
Export Files: Directory Objects DATA_PUMP_DIR
File Name HREXP%U.DMP
a ble
Export Schedule: Job Name hrexp
fe r
Description Export HR schema
a ns
Job Start Time Immediate n- t r
a no
Review the PL/SQL that the Export Wizard helped you to create and
h a ssubmit the job. A
m ) resolve
processing message appears, and then a success message. If not,
e . any errors, which
o
may have occurred.
g i c.c t Guid
Note: Please wait, not only for the job to bere lo butealso
created, n for the job to complete
execution. (It may take two minutes.)iw a tu d
@ s S
4. As the DP user, import theh a
exported e thi back into the ORCL database, remapping it
le HR schema
h .bHR_TEST
to the previously created
d usschema. (Navigation aid: Maintenance > Import from
o t
b thenfollowing o
Export Files).uUse
( s e se import specifications:
h a le
Object lic Setting
b
h Import Files: Directory Objects DATA_PUMP_DIR
b o d File Name HREXP%U.DMP
su Import Type Schemas
Host credentials oracle

The Data Pump Wizard reads the specified import file and gives you a success message. If
not, resolve any errors that may have occurred.

Oracle Database 10g: Administration Workshop I A - 39


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 18: Moving Data (continued)

Use the following import remapping specifications:


Object Setting
Re-Map Schemas: Source Schema HR
Re-Map Schemas: Destination Schema HR_TEST
Re-Map Tablespaces: Destination Tablespace HR_TEST
Import Options: Directory Objects DATA_PUMP_DIR
Log file hrimport.log
Import Schedule: Job Name hrimp
Description Import HR schema for test
purposes
Start Later
a ble
Time Enter a time between 2 and 5 minutes
fe r
from now (to give yourself time for
a ns
n- t
submitting and monitoring the job)r
a no
(Navigation aid: Maintenance > Monitor Export and Import Jobs) h a s the job while it
Monitor
is executing. m ) e.
o
.c Guid
Optional, as this requires quick action: Suspend g i c t the job.
r e loand resume
e n
waexecuted d
tu100%
In the end, you want to see that your ijob S without any errors.
e @ i s
b
Verify the import succeededh abyl viewing
e ththe log file.
o d h. to us
( s ub ense
$ cat </u01/app/oracle/product/10.2.0/db_1/rdbms/log/hrimport.log

a
Note:
h ic an error saying that the hr_test object already exists. This is because
leYou maylsee
o d h bthat user existed when you did the export, and still exists. This is not a problem.
sub Select data from tables in the hr_test schema, for verification of the import.

Oracle Database 10g: Administration Workshop I A - 40


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Practice 18: Moving Data (continued)

5. As the DP user, load data into the PRODUCT_MASTER table by using SQL*Loader via
Enterprise Manager Database Control. (Navigation aid: Maintenance > Load Data from
User Files). Use the following loading specifications:
Object Setting
Use Existing Control File selected
Username oracle
Password oracle
Save as Preferred Credential selected
Load Data Control File Name /home/oracle/labs/lab_18_05.ctl
Data File: Provide the full path and name selected
on the database server machine
a ble
Data File Name /home/oracle/labs/lab_18_05.dat
fe r
Load Method Conventional Path
a ns
Load Data Options: Log File Name /home/oracle/labs/lab_18_05.log n- t r
Load Data Schedule: Job Name lab_18_05
a no
Description Load data into the
h a s
) e.
PRODUCT_MASTER table
m
o
Start
c.c t Guid
Immediately
g i
Submit your job and confirm your results by lo your
reviewing e nlab_18_05.log file.
a
iw s Stu d
6. As the INVENTORY user, loadle @
data into the
h i PRODUCT_ON_HAND table by using
SQL*Loader command.line. h a e t
h b (Enter u sthe command in continuation, without pressing [Enter]
before reaching the
b dend
o se t of theocommand: sqlldr
s u n
userid=inventory/verysecure
( e
control=lab_18_06.ctl log=lab-
le
_18_06.log
h a ic
ldata=lab_18_06.dat).
o d h bConfirm your results by viewing your lab_18_06.log file in your
sub /home/oracle/labs directory.

Oracle Database 10g: Administration Workshop I A - 41


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
________________
Appendix B
Solutions
________________

a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 2: Installing the Oracle Database Software

Background: In the practices of this course, you assume the role of a database administrator
(DBA). The operating system (OS) accounts on your computer are:
• The oracle user with a password of oracle
• The root user with a password of oracle

The system administrator has set up the OS so that it is ready for the installation, and the
installation media is staged at /stage/Disk1. Perform the following tasks as the default
oracle OS user, unless otherwise indicated.

After installing the software, execute the lab_02_05.sh script, which creates a listener for
you.
a ble
fe r
Note: Completing this practice is critical for all following practice sessions.
a n s
n- t r
no
1. Install the Oracle database software as the oracle user. Navigate to the /stage/Disk1
a
directory, and start the Oracle Universal Installer (OUI) by entering ./runInstaller.
s
h a
)then enter:
a) Right-click your desktop and select Open Terminal, and
o m d e .
i c
c. t Gu i
g
relo uden
$ cd /stage/Disk1
$ ./runInstaller a
iw s St
@
for OUI.thi
2. Select your installation methodle
b h a e
h . u s
od Method
a) On the Installation
settings:ub e topage, select Basic Installation, and confirm the following
e ( s cens
al
hObject li Setting
b
h Database Home Location /u01/app/oracle/product/10.2.0/db_1
b o d Installation Type Enterprise Edition
su UNIX DBA Group oinstall
Create Starter Database Deselected

Note: Ensure that you deselect the Create Starter Database option.

b) Click Next.

c) You are now on the page titled “Specify Inventory directory and credentials.” Accept
/u01/app/oracle/oraInventory as inventory directory and oinstall as
Operating System group name. Click Next.

Oracle Database 10g: Administration Workshop I B-2


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 2: Installing the Oracle Database Software (continued)

OUI is loading the products list and checking product-specific prerequisites.

a ble
fe r
a n s
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h bd) After OUI has finished its prerequisite checks on the Product-Specific Prerequisite
o d
sub Checks page, click Next.

3. When the prerequisite checks are finished, the Summary page is displayed.

a) Click Install to begin your installation.

Estimated installation time is 10–15 minutes. However, varying environments can greatly
influence this estimate.

4. When the “Execute Configuration scripts” page appears, follow the instructions on that
page, accept the default for the local bin directory, and then finish your installation with
OUI.

Oracle Database 10g: Administration Workshop I B-3


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 2: Installing the Oracle Database Software (continued)

a ble
fe r
a ns
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St
h a le
e t hi
a) Right-click your desktop
h s Open Terminal.
.b anduselect
b d o
o se t and root.sh scripts as root, and then click Continue.
b) Run the u
l e (s icen
orainstRoot.sh
a l
#hpassword: oracle <root password, does not appear on the screen>
$ su
h b
b o d # cd /u01/app/oracle/oraInventory
su #
#
./orainstRoot.sh
cd /u01/app/oracle/product/10.2.0/db_1
# ./root.sh

c) Accept the default for the local bin directory.

Oracle Database 10g: Administration Workshop I B-4


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 2: Installing the Oracle Database Software (continued)

a ble
fe r
a ns
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St
a
d) Enter exit to exit thehroot e thi
le OS user.
d h .b us
o
e) Close the terminal
b nse t
window, o and then click OK on the “Execute Configuration scripts”
page. (su
a l e l i ce
h
o d h bThe End of Installation page appears.
sub

Oracle Database 10g: Administration Workshop I B-5


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 2: Installing the Oracle Database Software (continued)

a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
f) Make (as ub of eyour
note n e
sURLs. You will use them in later practice sessions.
a l e l i c
h bh iSQL*Plus URL:________________________________________________________
o d
sub iSQL*Plus DBA URL:___________________________________________________

g) Optionally, click Installed Products, review the product inventory, then click Close.

h) Click Exit, and then click Yes to leave OUI.

5. Execute the lab_02_05.sh script, which is in the /home/oracle/labs directory.


This script uses the netca utility to create a listener for you. If you create your first
database with OUI (as part of your installation), then OUI invokes the network
configuration assistant, which creates the first listener for you.

a) In a terminal window, enter:


cd /home/oracle/labs
./lab_02_05.sh

You see an activity log, which should end with a success message. If not, resolve any errors
that might have occurred.
Oracle Database 10g: Administration Workshop I B-6
Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 3: Creating an Oracle Database

Background: You are about to begin creating your first Oracle database. You anticipate that
several similar databases will be needed in the near future. Therefore, you decide to create your
ORCL database, as well as a database template and the database creation scripts. Locate the
scripts in the /home/oracle/labs directory (which is the directory that you use most often
throughout this course).

After you create the ORCL database, you execute the lab_03_03.sh script, which creates a
listener for you.

Note: Completing the database creation is critical for all following practice sessions.

1. Start the Database Configuration Assistant (DBCA).


a ble
fe r
a) Open a terminal window as the oracle user; that is, right-click your desktop and a ns
select Open Terminal. n- t r
a no
b) To start the DBCA, enter:
h a s
m ) e.
$ dbca
o
g i c.c t Guid
relo uPurpose
2. Begin the ORCL database creation. Use the General
a d en database template.
a) In the DBCA, click Next on the iw s page.
Welcome S t
@
h a le
e thi
.b selectuCreate
b) On the Operationshpage,
d
s a Database, and then click Next.
o t o
c) On the(s ub eTemplates
Database n se page, select General Purpose, and then click Show
h le
Details.
a lic
h b
d
o d) Review the template’s details and answer the following questions.
sub Question 1: How many control files are created?

Answer: 3

Question 2: Would it maximize database availability to multiplex them?

Answer: Yes. (This will be done in a later practice.)

Question 3: How many redo log groups are created?

Answer: 3

Question 4: Would it maximize database availability to mirror them?

It depends: No, not in class, because there are already three groups and you have only
one physical storage device; but yes, if you can put each group on a different physical
storage device.

Oracle Database 10g: Administration Workshop I B-7


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 3: Creating an Oracle Database (continued)

Question 5: What is the database block size (db_block_size)?

Answer: 8 KB

Question 6: What is the value of Sample Schemas?

Answer: Sample Schemas is set to False.

Note: You will change this setting later in this practice to create the HR sample schema.

Question 7: What is the template default for the Database Character Set?

Answer: WE8ISO8859P1 a ble


fe r
Note: You will change this setting later in this practice to use a Unicode databasea ns
n- t r
character set.
a no
e) Click Close to close the Template Details window.
h a s
m ) e.
o
f) Click Next.
g i c.c t Guid
3. Create the ORCL database, as well as the ORCL
o eand
reltemplate n the database generation scripts.
a
iw s Stu d
@ i orcl.oracle.com as Global Database
le page,thenter
a) On the Database Identification
h a e
d h .b to theusdatabase name orcl. Click Next.
Name. The SID defaults

b o e to page, ensure that the following items are selected:


e ( su cens
b) On the Management Options
l
ha-- Use
Configure i Database with Enterprise Manager
lthe
h b Database Control for Database Management
b o d
su c) Click Next.

d) On the Database Credentials page, select Use the Same Password for All Accounts
and enter oracle as Password and Confirm Password. Then, click Next.

e) On the Storage Options page, select File System, and then click Next.

f) On the Database File Locations page, select Use Oracle-Managed Files. Accept the
default Database Area, and then click Next.

g) On the Recovery Configuration page, select Specify Flash Recovery Area, and then
click Next.

h) On the Database Content page, select Sample Schemas, and then click Next.

i) On the Memory tabbed page of the Initialization Parameters page, select Custom and
then select Automatic for the Shared Memory Management setting.

Oracle Database 10g: Administration Workshop I B-8


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 3: Creating an Oracle Database (continued)

j) On the Initialization Parameters Character Sets tabbed, select Use Unicode


(AL32UTF8).

a ble
fe r
a ns
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St
h a le Mode
k) Review the Sizing and Connection
e thi tabbed pages, but do not change any values.
Then, click Next. .b
o d h to us
l) On thes
( ub eStorage
Database n se page, review your file names and locations. Then, click Next.
h a le lic
o d hb
sub

Oracle Database 10g: Administration Workshop I B-9


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 3: Creating an Oracle Database (continued)

m) On the Creation Options page, select Create Database.

a ble
fe r
a ns
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ubselect
n) Optionally, e n se
all creation options and enter orcl as Name for the database
h a le ORCL
template, lic Database template as Description, and
h b /home/oracle/labs as Destination Directory. Then, click Finish.
o d
sub o) The Confirmation page appears. Review options and parameters, such as Sample
Schemas (true), db_block_size (8KB), sga_target (270MB),
undo_management (AUTO), Database Character Set (AL32UTF8),
and then click OK.

p) Click OK to acknowledge that the template has been created. Then, acknowledge the
generation of the database scripts (if you selected those options).

Oracle Database 10g: Administration Workshop I B - 10


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 3: Creating an Oracle Database (continued)

q) The DBCA displays the progress of the various installation steps. When the database
itself has been created, the DBCA displays essential information about the database.
Make note of this information. The Database Control URL will be used in several of the
following practice sessions.

a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
r) Click
h a lic Management button.
le the Password
o d hb s) Scroll down the Password Management page until you see the HR User Name.
sub

Oracle Database 10g: Administration Workshop I B - 11


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 3: Creating an Oracle Database (continued)

t) Deselect Lock Account? and enter hr as New Password and Confirm Password. Then,
click OK.

a ble
fe r
a n s
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
s ubto close
u) Click(Exit e n stheeDBCA.
h a le lic
o d h bYou completed your task to create a database and (optionally) a database template and
database generation scripts.
sub

Oracle Database 10g: Administration Workshop I B - 12


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 4: Managing the Oracle Instance

Background: You have just installed the Oracle software and created a database. You want to
ensure that you can start and stop the database and see the application data.

1. Invoke Enterprise Manager, and log in as the SYS user. Which port number does this
database use? You noted this in Practice 3.

Answer: 1158

a) Open a Web browser.

b) If using Mozilla, the Select User Profile dialog box appears.


a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub
Select oracle as the profile, and select Don’t ask at startup, and then click Start
Mozilla.

c) Enter the URL that you wrote down in Practice 3. It has the following format:

http://hostname:portnumber/em

The Oracle Enterprise Manager window appears.

Oracle Database 10g: Administration Workshop I B - 13


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 4: Managing the Oracle Instance (continued)

d) Log in by entering sys as User Name and oracle as Password, and selecting
SYSDBA as Connect As. Then, click Login.

a ble
fe r
e) You may receive a security warning. In class, deselect Alert me whenever I submit a ns
information that’s not encrypted., and then click Continue. n- t r
a no
The first time you log in after installing the software, the Oracle
h a sDatabase 10g
Licensing Information page appears.
m ) e.
c o uiofdthe page.
f) To acknowledge this information, click I agree g i cat.the G
bottom
r e lo ent
2. View the initialization parameters andiw
S tud
setathe JOB_QUEUE_PROCESSES parameter to 15.
@
e this? thi
What SQL statement is run to ldo s
h a
h
a) Select Administration. u se Administration > Database Configuration > All
b > Database
b o d to
Initialization
su cens e
Parameters.
e (
hal li
h b
b o d
su

b) Enter job in the Name field, and then click Go.

c) When the JOB_QUEUE_PROCESSES initialization parameter appears, change its value from
10 to 15.

Oracle Database 10g: Administration Workshop I B - 14


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 4: Managing the Oracle Instance (continued)

d) Click Show SQL and note the SQL statement that is going to be run.

e) Click Return, and then click Apply.

3. Question: What is the significance of a check in the Dynamic column?

a ble
Answer: A “dynamic” parameter can be modified while the database is active.
fe r
a ns
4. Shut down the database instance by using Enterprise Manager.
n- t r
Question: What SQL is executed to do this? a no
h a s
) tab.
a) In the Enterprise Manager browser session, click the Database
m e .
c o i d
b) Click Shutdown. g i c. t Gu
a relo uden
c) For Host Credentials, enter oracle S t and oracle as Password.
iw assUsername
le @ hi
h a e t
d) Click OK.
d h .b us
o t o
( s ub enseConfirmation page appears.
The Startup/Shutdown:

e)ha
le lic
Click Advanced Options to see the mode for shutting down, but do not change the
h b mode; it should remain as “Immediate.”
o d
sub f) Click Cancel to return to the previous page.

g) Click Show SQL to view the SQL that is going to be executed to perform the shutdown
operation.

Question: What SQL is executed to do this?

Answer: SHUTDOWN IMMEDIATE

h) Click Return.

Oracle Database 10g: Administration Workshop I B - 15


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 4: Managing the Oracle Instance (continued)

i) Click Yes to confirm the shutdown operation.

j) Click Refresh. If you see the following error during the refresh, click OK and continue
to refresh. The error will resolve itself.

a ble
fe r
k) Note that the Status of the instance is now “Down.”
a n s
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b uares not able to connect as the HR user to a database that
5. Using SQL*Plus,overify thattyou
b nse o
s udown.
has been (shut
a l e l i ce
h ba)h In the Linux command window, enter the following to attempt to log in to the database:
od
sub
$ sqlplus hr

b) Enter hr for the password.

c) Note the “ORACLE not available” error message.

d) Press [Ctrl], [D] to exit the username prompt.

6. Use Enterprise Manager to restart the database instance, and then log in as the SYS user
again.

Question: What SQL is run to accomplish the database startup?

a) In Enterprise Manager, click the Startup button.

b) Enter oracle for both Username and Password in the Host Credentials region.

c) Click OK.

Oracle Database 10g: Administration Workshop I B - 16


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 4: Managing the Oracle Instance (continued)

d) The Startup/Shutdown: Confirmation page appears. Click Show SQL to view the SQL
that is about to run.

Question: What SQL is run to accomplish the database startup?

Answer: STARTUP

a ble
fe r
e) Click Return. a ns
n- t r
f) Click Yes to confirm the startup operation.
a no
g) The Startup/Shutdown: Activity Information page appears.)Wait hasfor the login page to
appear, at which time you can log in as SYS user with o m oracle
the d e .password and the
SYSDBA privilege. i c
c. t Gu i
g
a r elo den
7. In the alert log, view the phases that the
iwdatabaseS u through during startup. What are
twent
@ s
they?
h a le
e thi
a) Select Database b Links
> .Related
h us > Alert Log Content.
o d t o
( s ub ense
h a le lic
o d hb
sub

Oracle Database 10g: Administration Workshop I B - 17


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 4: Managing the Oracle Instance (continued)

b) Scroll toward the bottom of the log and review the phases of the database during
startup. Your alert log may look different from this screenshot, based on different
system activities.

a ble
fe r
a ns
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
c) Note that the modes
d h .bthe database
us goes through during startup are MOUNT and OPEN.
Click OK b o t o
to close theealert log.
( s u e ns
8. Test e li
l to iSQL*Plus
aaccess c for your HR application developers. (Navigation aid: Database >
b h
iSQL*Plus). Use the role, hr username and password, and the default setting as
o d h Normal
b Connect Identifier. If there is an error accessing iSQL*Plus, then start the isqlplus process
su using the isqlplusctl start command at the OS prompt, and then reattempt. After
connecting, select the contents of the EMPLOYEES table.

a) Select Database > Related Links > iSQL*Plus.

The iSQL*Plus Connection Role page appears.

b) Notice that the SYSOPER and SYSDBA roles require special setup and authentication
for security reasons. Select Normal, and then click Continue.

Oracle Database 10g: Administration Workshop I B - 18


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 4: Managing the Oracle Instance (continued)

c) If you see an error message saying that the connection was refused, that means you
need to start the supporting process. To do this, enter the isqlplusctl start
command at the OS prompt, and then retry step (b).
$ isqlplusctl start
iSQL*Plus 10.2.0.1.0
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Starting iSQL*Plus ...
iSQL*Plus started.

d) On the Login page, enter hr as Username and Password and leave the Connect
Identifier set to its default value. Click the Login button.
a ble
The Confirm window appears, with the Password Manager offering to remember this fe r
login for you. Click No. a n s
n- t r
o
an
e) Enter the following statement in the workspace, and then click the Execute button:
s
SELECT * FROM EMPLOYEES;
) ha
c o m ide.
g i
The content of the EMPLOYEES table appears in ca.tabular
t G u
form.

a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

f) When you have finished reviewing the information, click Logout in the top-right corner
of the page.

g) Click X in the top-right window frame to close the iSQL*Plus window.

Oracle Database 10g: Administration Workshop I B - 19


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 5: Managing Database Storage Structures

Background: You need to create a new tablespace for the INVENTORY application. You also
need to create a database user that is not as privileged as the SYS user.

1. Enter ./lab_05_01.sh to run a script that creates the DBA1 user. It is located at
/home/oracle/labs. The password for DBA1 is oracle.

a) Start a Linux command shell by right-clicking your desktop and selecting Open
Terminal.

b) Change the current directory to the labs directory by entering:


$ cd labs
a ble
fe r
c) Enter the following command to run the script that creates the DBA1 user:
a ns
n- t r
$ ./lab_05_01.sh
a no
d) Leave the command shell window open. You will use it again h a s
later.
m ) e.
o id to define the DBA1
g i c.cManager
2. Use the Setup link in the top-right corner of Enterprise
G u(EM)
t the non-SYS user is
user as one who can perform administrative tasks
r e lo in EM.e When
n
i w S udDBA1 user. Use the DBA1 user to
a in as tthe
configured, log out as the SYS user and log
perform the rest of these tasks, unless
a l e@ otherwise
t h is indicated.
a) In the far top-right
h . bh of uthesEM
corner e window, click Setup.
b o d to
su cens e
e (
hal li
h b
b o d
su
b) Click Create to add the DBA1 user to the Administrators list. This will enable the
DBA1 user to perform management tasks by using Enterprise Manager.

Oracle Database 10g: Administration Workshop I B - 20


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 5: Managing Database Storage Structures (continued)

c) Enter dba1 as Name, and oracle as Password and Confirm Password. Leave
Email Address blank, and leave Super Administrator selected, and then click Finish.

d) On the Create Administrator: Review page, click Finish again.

e) Now that there is a non-SYS user, click Logout in the top-right corner, and then click
Login.

f) Enter DBA1 as User Name and ORACLE as Password, and select SYSDBA as Connect
As. Then, click Login.

The first time you log in as a new user, the licensing page appears.
a ble
fe r
g) To acknowledge this information, click I agree at the bottom of the page.
a ns
n- t r
The Database Home page appears.
a no
3. Using Enterprise Manager, view information about the EXAMPLE h a s
tablespace. Answer the
) .
following questions about it:
. c om uide
a) In Enterprise Manager, select Administrationl o g>icDatabase
n t GAdministration > Storage >
r e e
Tablespaces.
i wa Stud
b) Click the EXAMPLE tablespace
a l [email protected]
h . bh use
c) Question 1: What
b o d percentage
to of free space can be used up before the Warning threshold
su cens
is reached? e
e (
hal 85% li
Answer:
b
o d h
sub

Oracle Database 10g: Administration Workshop I B - 21


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 5: Managing Database Storage Structures (continued)

d) From the Actions drop-down list, select Show Tablespace Contents, and then click
Go.

e) The Show Tablespace Contents page appears.

f) Question 2: How many segments are there in the EXAMPLE tablespace?


a ble
fe r
Answer: 418 a n s
n- t r
no
g) Select INDEX from the Type drop-down list in the Search region, and then click Go.
a
h a s
m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
b in the
h) Question 3: Which.index
h u sEXAMPLE tablespace takes up the most space?
b d
o se t o
u
Answer: SH.CUSTOMERS_PK
(s icen
l e l segment is stored physically first in the tablespace? That is, which one
b ha 4: Which
Question
o d h is stored right after the tablespace header?
sub
i) Scroll to the bottom of the page, and then click the plus icon to the left of the Extent
Map label.

j) After several seconds, the extent map appears. Note that the map legend indicates that
pink is the tablespace header.

k) Scroll back to the top of the page, select All Types from the Type drop-down list, and
then click Go.

Oracle Database 10g: Administration Workshop I B - 22


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 5: Managing Database Storage Structures (continued)

l) Click the extent just to the right of the tablespace header extent.

m) Scroll to the top of the page again, and note the segment that is being pointed to:
a ble
fe r
a ns
n- t r
a no
h a s
m ) e.
Answer: HR.REGIONS o
g i c.c t Guid
a relo called
4. Create a new, locally managed tablespace (LMT)
u d e n
INVENTORY of size 5 MB.
t
iw s Sin later practice sessions during this class.
Note: The INVENTORY tablespace e @ will be iused
b h al e th
h. select
a) In Enterprise Manager, s
uAdministration > Database Administration > Storage >
o d t o
Tablespaces
( s ub ense
.

b)ha le Createli.c
Click

o d hb c) Enter INVENTORY as the tablespace name, and verify that Extent Management is
sub Locally Managed, Type is Permanent, Status is Read Write, and Use Bigfile
tablespace is not selected.

d) Click Add in the Datafiles region.

e) On the Add Datafile page, enter inventory01.dbf for File Name, and 5 MB as File
Size.

f) Click Continue.

g) Click the Storage tab, and verify that Extent Allocation is Automatic, Segment Space
Management is Automatic, and Logging is enabled.

h) Click the General tab.

i) Click Show SQL to see the SQL that will be run, and then click Return.

j) Click OK, and a successful Update Message appears.


Oracle Database 10g: Administration Workshop I B - 23
Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 5: Managing Database Storage Structures (continued)

5. As the DBA1 user, run the lab_05_05.sql script to create and populate a table (called
X) in the INVENTORY tablespace. What error do you eventually see?

a) Right-click the desktop and select Open Terminal to start a command shell. Then
enter:
$ cd labs

b) Enter the following to run the script:


$ sqlplus dba1/oracle @lab_05_05.sql

c) Note that there is eventually an error ORA-01653 stating that the table cannot be
a ble
extended. There is not enough space to accommodate all of the rows to be inserted. fe r
a n s
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h6. bGo to the Enterprise Manager window and define space for 50 MB in the tablespace instead
o d
sub of 5 MB, while keeping the same single data file in the tablespace. What is the ALTER
statement that is executed to make this change?

a) Select Administration > Database Administration > Storage > Tablespaces.

b) Select the INVENTORY tablespace, and then click Edit.

c) In the Datafiles region, click Edit.

d) Change File Size from 5 MB to 50 MB.

e) Click Continue to return to the General tabbed page.

f) Click Show SQL to see the SQL that will be run. Note that it is an ALTER DATABASE
statement. Click Return.

Oracle Database 10g: Administration Workshop I B - 24


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 5: Managing Database Storage Structures (continued)

g) Click Apply.

7. Go back to the terminal window and run the lab_05_07.sql script. It drops the table
and reexecutes the original script that previously returned the space error.

a ble
a) Go to the SQL*Plus window.
fe r
a ns
b) Enter the following to run the script:
n- t r
$ sqlplus dba1/oracle @lab_05_07.sql a no
h a s
c) Note that the same number of row inserts are attempted,m ) thereeis. no error because of
and
o
the increased size of the tablespace.
g i c.c t Guid
8. In an terminal window, run the lab_05_08.sql
a relo uscript
d ento clean up the tablespace for later
practice sessions.
@ iw s St
a le t h i
a) Enter the following.to h e
b run theuscript:
s
o d h t o
$ sqlplus
s u b dba1/oracle
n s e @lab_05_08.sql

a l e ( lice
h
o d hb
sub

Oracle Database 10g: Administration Workshop I B - 25


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 6: Administering User Security

Background: You need to create a user account for Jenny Goodman, the new human resources
department manager. There are also two new clerks in the human resources department, David
Hamby and Rachel Pandya. All three of them must be able to log in to the ORCL database,
select data from, and update records in the HR.EMPLOYEES table. The manager also needs to
be able to insert and delete new employee records. Ensure that if the new users forget to log out
at the end of the day, they will automatically be logged out after 15 minutes. You also need to
create a new user account for the inventory application that you are installing.

1. Mandatory task: Review and run the lab_06_01.sh script (located in the
/home/oracle/labs directory) to create the INVENTORY user, which you will use in
the next practice.
a ble
a) In a terminal window, enter: fe r
a ns
cd /home/oracle/labs
n- t r
more lab_06_01.sh
./lab_06_01.sh a no
h a s
2. Create a profile named HRPROFILE, allowing 15 minutes o idle) time.e.
m
g i c.c t Guid
r e lo in theeSYSDBA
a) Invoke Enterprise Manager as the DBA1 user n role for your ORCL
database.
i wa Stud
b) Select Administration a e@ >thUsers
> lSchema is & Privileges > Profiles.
h . bh use
c) Click the Create
b o d button.to
( s u ense
d) Enter
h a lic in the Name field.
le HRPROFILE
h b
o d e) Enter 15 in the Idle Time (Minutes) field.
sub

Oracle Database 10g: Administration Workshop I B - 26


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 6: Administering User Security (continued)

a ble
fe r
a n s
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
b
h.fields us
f) Leave all theo d
other t o
set to DEFAULT.
( s ub ense
h a
DEFAULT.
lic tab, and review the Password options, which are currently all set to
le the Password
g) Click

o d hb
sub h) Optionally, click the Show SQL button, review your underlying SQL statement, and
then click Return.

i) Finally, click OK to create your profile.

3. Set the RESOURCE_LIMIT initialization parameter to TRUE so that your profile limits
will be enforced.

a) Select Administration > Database Administration > Database Configuration > All
Initialization Parameters.

b) Enter RESOURCE_LIMIT in the Filter field, and then click Go.

c) Select TRUE from the Value drop-down list, and then click Apply.

Oracle Database 10g: Administration Workshop I B - 27


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 6: Administering User Security (continued)

a ble
fe r
4. Create the role named HRCLERK with SELECT and UPDATE permissions on the a ns
n- t r
HR.EMPLOYEES table.
a no
a) Select Administration > Schema > Users & Privileges > Roles h a .s
m ) e.
o
g i c.c t Guid
b) Click the Create button at the top-right of the page.

c) Enter HRCLERK in the Name field. This


lo is noteauthenticated.
rerole n
a
iw s Stu d
@
d) Click Object Privileges. le
h a e thi
h b SelectuObject
.the s Type drop-down list, and then click Add.
o d
e) Select Table from t o
f) Enter( s ub ense in the Select Table Objects field.
h a le lic
HR.EMPLOYEES

h b
g) Move the SELECT and UPDATE privileges to the Selected Privileges box. Click OK.
o d
sub h) Click the Show SQL button, and review your underlying SQL statement.

i) Click Return, and then click OK to create the role.

Oracle Database 10g: Administration Workshop I B - 28


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 6: Administering User Security (continued)

5. Create the role named HRMANAGER with INSERT and DELETE permissions on the
HR.EMPLOYEES table. Grant the HRCLERK role to the HRMANAGER role.
a ble
fe r
a) Select Administration > Schema > Users & Privileges > Roles. a ns
n- t r
b) Click Create.
a no
h a s
c) Enter HRMANAGER in the Name field. This role is not authenticated.
) e.
o m
d) Click Object Privileges. g i c.c t Guid
r e lo en
e) Select Table from the Select Object
i a
w Type S tud list, and then click Add.
drop-down

f) Enter HR.EMPLOYEES ainl e@


the t
Select h is Objects field.
Table
h . bh use
o
g) Move the INSERT
b d and DELETE
to privileges to the Selected Privileges box. Click OK.
su cens e
e (
l Roles,liand then click Edit List.
bha
h) Click

o d h i) Move the HRCLERK role into the Selected Roles box, and then click OK.
sub

j) Click the Show SQL button, and review your underlying SQL statement.

k) Click Return, and then click OK to create the role.

Oracle Database 10g: Administration Workshop I B - 29


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 6: Administering User Security (continued)

6. Create an account for David Hamby, a new HR clerk.

a) Select Administration > Schema > Users & Privileges > Users.

b) Click Create, and enter DHAMBY in the Name field.

c) Select HRPROFILE for the Profile.

d) Select Password Authentication, and enter newuser as password. Enter it into the
Confirm Password field also. Select the Expire Password now check box so that
David will have to change the password the first time he logs in.

a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
newuser g i c. t Gu
relo uden
newuser
a
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h be) Click Roles. Notice that the CONNECT role has automatically been assigned to the user.
o d
sub f) Add the HRCLERK role by clicking Edit List and moving the HRCLERK role into the
Selected Roles box. Click OK to close the Modify Roles window.

g) Click OK again to create the user.

7. Create an account for Rachel Pandya, another new HR clerk. Repeat the steps under step 6
with RPANDYA as the username.

Oracle Database 10g: Administration Workshop I B - 30


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 6: Administering User Security (continued)

8. Create an account for Jenny Goodman, the new HR manager. Repeat the steps under step 6
with JGOODMAN as the username and selecting the HRMANAGER role instead of the
HRCLERK role.
a) Click the Show SQL button and review your underlying SQL statement.

b) Click Return, and then click OK to create the user.

9. Test the new users in SQL*Plus. Connect to the ORCL database as the DHAMBY user. Use a ble
oracle as the new password. Select the row with EMPLOYEE_ID=197 from the fe r
a ns
HR.EMPLOYEES table. Then, attempt to delete it. (You should get the “insufficient
n- t r
privileges” error.)
a no
a) In a terminal window, enter: h a s
m ) e.
o
sqlplus dhamby/newuser
g i c.c t Guid
relo udcommand.
or if you are already in SQL*Plus, use the CONNECT
a en If you reconnect as
w St
dhamby in SQL*Plus, the login and ichange-of-password session looks like this:
e @ i s
SQL> CONNECT dhamby/newuser
b h al e th
o d h. to us
ERROR:
s b password
uthe n se has expired
ORA-28001:
( e
h a lic for dhamby
le password
h bNew password: oracle <<<Password does not appear on screen
Changing

b o d <<<Password does not appearon screen


su Retype new password: oracle
Password changed

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – Production
With the Partitioning, OLAP and Data Mining options

SQL>

b) Select the salary for EMPLOYEE_ID=197 from the HR.EMPLOYEES table.

SQL> SELECT salary FROM hr.employees WHERE EMPLOYEE_ID=197;

SALARY
----------
3000

Oracle Database 10g: Administration Workshop I B - 31


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 6: Administering User Security (continued)

c) Now attempt to delete the same record from the hr.employees table.
SQL> DELETE FROM hr.employees WHERE EMPLOYEE_ID=197;
DELETE FROM hr.employees WHERE EMPLOYEE_ID=197
*
ERROR at line 1:
ORA-01031: insufficient privileges

10. Repeat the delete attempt as the JGOODMAN user. After deleting the row, issue a rollback,
so that you still have the original 107 rows.

a) Connect to the ORCL database as the JGOODMAN user.


a ble
SQL> connect jgoodman/newuser
fe r
ERROR:
a ns
ORA-28001: the password has expired
n- t r
<Change the password as shown above>
a no
b) Select the row with EMPLOYEE_ID=197 from the HR.EMPLOYEES h a s table.
m ) e.
o uid
SQL> SELECT salary FROM hr.employees WHERE
g i c.c tEMPLOYEE_ID=197;
G
SALARY r e lo en
----------
i w a
S t ud
3000
a l e@ this
h
.brow sthee HR.EMPLOYEES table.
c) Now delete thedsameh from
to u
b o e
(
SQL> DELETE
e su FROM c e nshr.employees WHERE EMPLOYEE_ID=197;
al deleted.
1hrow
li
h b
b o d
d) Roll back the delete operation (because this was just a test).
su
SQL> rollback;

Rollback complete.

e) Confirm that you still have 107 rows in this table.


SQL> SELECT COUNT(*) FROM hr.employees;

COUNT(*)
----------
107
SQL>

Question 1: Where was the row stored after deletion?

Answer: It was stored in the Undo tablespace.

Oracle Database 10g: Administration Workshop I B - 32


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 6: Administering User Security (continued)

Question 2: When you created the new users, you did not select a default or temporary
tablespace. What determines the tablespaces that the new users will use?

Answer: The system-defined default permanent and temporary tablespaces

Question 3: You did not grant the CREATE SESSION system privilege to any of the new
users, but they can all connect to the database. Why?

Answer: Because Enterprise Manager automatically assigns the CONNECT role to the new
users, and CREATE SESSION is contained within that role

11. Review the lab_05_01.sql script and the lab_05_01.txt log file that it generated
a ble
when you created the DBA1 user.
fe r
a ns
a) Double-click the oracle’s Home icon on your desktop.
n- t r
b) Navigate to the labs directory. a no
h a s
c) Double-click the lab_05_01.sql file, and reviewo itsm
)
content. e.
g i c.c t Guid
r e loclick theenUp icon to return to the labs
d) When you have finished reviewing the file,
directory.
i w Stud
a
e) Now, double-click theh a le@ this file, which was created when you executed
the lab_05_01.sqlh . b file. use
lab_05_01.txt

b o d to
e
su havecefinished
ns reviewing the file, click the X (Close Window) icon.
f) When(you
l e li
bha
12. Use SQL*Plus to connect to the ORCL database as the RPANDYA user. Change the
h
o d password to oracle. (You must change the password, because this is the first connection
sub as RPANDYA.) Leave RPANDYA connected during the next lesson or at the end of the day.
HRPROFILE specifies that users whose sessions are inactive for more than 15 minutes will
automatically be logged out. Verify that the user was automatically logged out by trying to
select from the HR.EMPLOYEES table again.
ERROR at line 1:
ORA-02396: exceeded maximum idle time, please connect again

Oracle Database 10g: Administration Workshop I B - 33


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 7: Managing Schema Objects

Background: You need to create schema objects for the new inventory application. Work as
the DBA1 user in the SYSDBA role for your ORCL database.

1. Return to the Enterprise Manager browser session, or invoke EM as the DBA1 user in the
SYSDBA role for your ORCL database.

2. In the INVENTORY tablespace, create the PRODUCT_MASTER table in the INVENTORY


schema. The specifications of the table are:
PRODUCT_ID number(7). This is the primary key field. (Constraint name: PK_INV)
PRODUCT_NAME varchar2(50) with a Not NULL constraint
CODE varchar2(10) with a Not NULL constraint
a ble
REORDER_THRESHOLD number(5) with a check constraint ensuring that the number is
fe r
always greater than zero (Constraint name: CHK_REORDER) a ns
COST number(5,2) n- t r
PRICE number(5,2) a no
h a s
a) Select Administration > Schema > Database Objects > Tables
m ) . e.
o
b) Click Create. g i c.c t Guid
a r elo den
c) Leave the default table type to beiw
S u Organized permanent, and then
Standard, tHeap
@ s
click Continue.
h a le
e thi
h
d) Enter PRODUCT_MASTER
d .b asutables name and set Schema to INVENTORY, and leave
o t o
( s ub esetting
the Tablespace
n seas the default for the user, which is INVENTORY.
le licfive columns’ information (including Data Type, Size, Scale, and Not
e)haEnter the first
h b NULL); but no constraints yet.
o d
sub f) Click Add 5 Table Columns, and then enter the last column, PRICE, along with its
type and size.

g) Click the Constraints tab.

h) Set the drop-down list value to PRIMARY, and then click Add.

i) Give the constraint a name by entering PK_INV in the Name field.

j) Double-click PRODUCT_ID in the left list to move it to the right list, to make it alone
the primary key. Then, click Continue.

Oracle Database 10g: Administration Workshop I B - 34


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 7: Managing Schema Objects (continued)

k) Set the constraint type drop-down list value to CHECK, and then click Add.

l) Enter CHK_REORDER for the name of the check constraint.

m) Enter “reorder_threshold > 0” (without the quotation marks) in the Check


Condition field.

a ble
fe r
a n s
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St
n) Leave the Attributesb h aleat their
settings e hi settings, and then click Continue.
tdefault
o d h. to us
ub elistnsshould
o) Your constraint
( s e now look like this:
h a le lic
o d hb
sub

p) Click OK to create the table. If you receive errors, correct them, and then click OK
again.

Oracle Database 10g: Administration Workshop I B - 35


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 7: Managing Schema Objects (continued)

3. In the INVENTORY tablespace, create the PRODUCT_ON_HAND table in the INVENTORY


schema. You have been given the lab_07_03.sql script to create the table, but there is
a problem with it (intentionally created to enhance your learning experience). Fix the
problem, and run the script. If you cannot find the error right away, then go ahead and run
the original script in SQL*Plus to see the error message. This helps you discover and solve
the problem. The specifications of the table are:
PRODUCT_ID number(7). This field should have a foreign key constraint linking it to
the PRODUCT_ID field in the PRODUCT_MASTER table.
QUANTITY number(5)
WAREHOUSE_CITY varchar2(30)
LAST_UPDATE date
a ble
fe r
a n s
a) Edit the lab_07_03.sql in the /home/oracle/labs directory. It has n r
-ant error in
o
table by entering this on the OS command line: s a n to create the
it. If you can spot the error, make the change to correct it. Run the script

) ha
$ sqlplus dba1/oracle @lab_07_03.sql
c o m ide.
g i c. t Gu
“(PRODUCT_ID)”. a relo isumissing
b) The error in the script is that “(PRODUCT_ID)”
d en after “FOREIGN KEY.” So, add
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense (PRODUCT_ID)
l e li c
h bha
o d
sub

c) Remove the prompt commands:


prompt There is an error in this statement. It will not
prompt run successfully unless fixed.

d) Run the script. The table should be created without error.

Oracle Database 10g: Administration Workshop I B - 36


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 7: Managing Schema Objects (continued)

4. In the INVENTORY tablespace, create the OBSOLETE_PRODUCTS table in the


INVENTORY schema. This table definition is very much like that of the
PRODUCT_MASTER table, so you can use Enterprise Manager’s ability to “Define Using
SQL” rather than using “Column Specification.” The specifications of the table are:
PRODUCT_ID number(7). This is the primary key field.
PRODUCT_NAME varchar2(50) with a Not Null constraint
CODE varchar2(20) with a Not Null constraint
COST number(5,2)
PRICE number(5,2)

a) In Enterprise Manager, select Administration > Schema > Database Objects > Tables. le
r a b
b) Click Create.
ns fe
t r a
n-
c) Leave the default setting for Table Organization, and then click Continue.
no
s a
d) Enter OBSOLETE_PRODUCTS for Name. h
) e.a
o m
e) Enter INVENTORY for Schema.
g i c.c t Guid
reloforuthisdeschema.
f) Leave the Tablespace setting as the default
a
n
@ iw s St
h a le listttohiSQL.
g) Set the Define Using drop-down
. b u s e
o h
h) In the SQL region,
d enter tthe
o following statement:
b e
su cproduct_id,
ns
e (
SELECT
e product_name, code, cost, price
li
l FROM inventory.product_master
h bha
o d
sub

i) Click OK to create the table.

Oracle Database 10g: Administration Workshop I B - 37


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 7: Managing Schema Objects (continued)

5. In the INVENTORY tablespace, create an index called OBS_CODE on the CODE column of
the OBSOLETE_PRODUCTS table in the INVENTORY schema. Choose an appropriate
index type: either B-tree or Bitmap. Explain the reason for your choice.

a) Question: Which type of index is appropriate, and why?

Answer: B-tree, because the CODE column can contain many different values, not just a
small, finite set.

b) Select Administration > Schema > Database Objects > Indexes, and the click Create.

c) Enter OBS_CODE as Name.


a ble
fe r
d) Enter INVENTORY as Schema.
a n s
n- t r
e) Enter INVENTORY.OBSOLETE_PRODUCTS as Table Name.
a no
f) Click Populate Columns. The column names have been filled h a s the table. If your
into
m
browser prompts you to remember entered values, click
) e.
No.
o
g i c.c t Guid
g) Enter an ORDER value of 1 for the CODE lo en
recolumn.
i w Stud
a
a l e@ this
h . bh use
b o d to
su cens e
e (
l li
h bha
o d
sub

h) Click Show SQL, confirm the SQL statement looks like the statement below, and then
click Return.

i) Click OK to create the index.

Oracle Database 10g: Administration Workshop I B - 38


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 7: Managing Schema Objects (continued)

6. In the INVENTORY tablespace, create an index called PROD_NAME_CODE on the


combined PRODUCT_NAME and CODE columns of the PRODUCT_MASTER table. Use the
lab_07_06.sql script (which contains an error, intentionally created to enhance your
learning experience). Correct the error and run the script. If you cannot find the error right
away, then run the original script in SQL*Plus to see the error message. This will help you
discover and solve the problem.

a) Edit the lab_07_06.sql in the /home/oracle/labs directory. It has an error


in it. If you can spot the error, make the change to correct it.

a ble
fe r
a n s
n- t r
o
an
Remove this
s
) ha
c o m ide.
g i c. t Gu
The corrected statement is:
a relo uden
@ iw s St
h a le
e thi
d h .b us
o
b) Remove thebprompt e t o
commands:
s u n s
a l e ( There
prompt l i ce is an error in this script.
h prompt Correct the error to have the index
o d h b prompt created successfully.
sub
c) Run the script to create the index by entering the following on the OS command line:

$ sqlplus dba1/oracle @lab_07_06.sql

d) The error in the script is that it should not have the word “COMPOSITE”. Delete the
word, run the script, and the index should be created without error.

7. In the INVENTORY tablespace, use SQL*Plus to create a combined index on the


PRODUCT_ID and QUANTITY columns of the PRODUCT_ON_HAND table. The index
name should be POH_PROD_ID_QTY.

a) At the SQL*Plus prompt, enter the following command:


SQL> create index inventory.poh_prod_id_qty on
inventory.product_on_hand(product_id, quantity);

Oracle Database 10g: Administration Workshop I B - 39


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 7: Managing Schema Objects (continued)

8. You receive an update for the inventory application that requires you to add two columns to
the PRODUCT_MASTER table. Add a column called PRIMARY_SOURCE of the data type
varchar2(50). Add another column called SECONDARY_SOURCE of the data type
varchar2(50). What is the SQL that executes to do this?

a) Select Administration > Schema > Database Objects > Tables.

b) Enter INVENTORY in the Schema field, and then click Go.

c) Select the PRODUCT_MASTER table, and then click Edit.

d) Enter PRIMARY_SOURCE in the Name field under PRICE, and set Data Type to
a ble
VARCHAR2, and Size to 50. fe r
a n s
e) Enter SECONDARY_SOURCE in the next available Name field, and set Data n r
t to
-Type
o
VARCHAR2, and Size to 50.
s an
f) Click Show SQL. ) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le Applyt.hi
g) Click Return, and then
h . b click
u se
9. You receive u b od update
another e to the inventory application. This change request instructs you
for
(
to dropethe c e ns
sOBSOLETE_PRODUCTS table and add the OBSOLETED column to the
h a l l i table, with data type DATE. Do this using EM. What clause is added
h bto the end of the DROP TABLE statement to also remove the table constraints?
PRODUCT_MASTER

b o d
su a) Select Administration > Schema > Database Objects > Tables.

b) Enter INVENTORY in the Schema field, and then click Go.

c) Select the OBSOLETE_PRODUCTS table, and then click Delete With Options.

d) Keep the default settings for performing DROP, and then click Show SQL to see the
CASCADE CONSTRAINTS option.

e) Click Return, and then click Yes.

f) Select the PRODUCT_MASTER table, and then click Edit.

Oracle Database 10g: Administration Workshop I B - 40


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 7: Managing Schema Objects (continued)

g) In the first empty Name field, enter OBSOLETED, and set Data Type to DATE.

h) Click Apply.

10. Another change request to the inventory application instructs you to create a view called
WAREHOUSE_VW (Navigation aid: Administration > Views). The view is in the
INVENTORY schema and displays (in this order):
• The name of the product
• The amount of “product on hand”
• The warehouse city name

You will have to join two tables together to create this view. a ble
fe r
a) Select Administration > Schema > Database Objects > Views. a n s
n- t r
b) Click Create. a no
h a s
c) Enter WAREHOUSE_VW in the Name field, and INVENTORY m ) in the
e .Schema field.
c o i d
d) Enter the following in the Query Text field: g i c. t Gu
o en
relwarehouse_city
select product_name, quantity,
i w Stud poh
a
from product_master pm,
a l e= @ t h is
product_on_hand

bh use
where pm.product_id poh.product_id

d h .
b o e to
e ( su cens
l li
h bha
o d
sub

e) Click OK.

Oracle Database 10g: Administration Workshop I B - 41


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 7: Managing Schema Objects (continued)

11. You receive a notice from developers that there is a certain type of query that will be run
very frequently, and they want to be sure that it runs in less than one second. You need to
run the query and see how it performs. First, run the lab_07_11_a.sql script to
generate some test data of the volume indicated in the request. Then, run the query in the
lab_07_11_b.sql script several times to see the average run time. Note that it takes
several seconds to run each time. Create a function-based index on the CODE column that
will improve the performance of this query.

a) Right-click the desktop and select Open Terminal. Then enter the following at the
command prompt to populate the table with test data. This will take three to five
minutes to run.
a ble
$ cd /home/oracle/labs
fe r
$ sqlplus dba1/oracle @lab_07_11_a.sql
a n s
n- t r
b) Enter the following on the command line to run the test query.
a no
SQL> @lab_07_11_b.sql
h a s
m ) e.
o d times until you
g ic cseconds
c) Enter / (a slash), and press [Enter] to run it again..Repeat
establish an average run time. It should takeoseveral t G
thisiseveral
ueach time.
e l n
d) Select Administration > Schemaiw
ar tObjects
> Database u de > Indexes.
l e @ his S
e) Click Create.
. b ha se t
o d h to u
( s ub ensinethe Name field.
f) Enter CODE_FUNC
le lic in the Schema field.
g)haEnter INVENTORY
h b
o d
sub h) Enter INVENTORY.PRODUCT_MASTER in the Table Name field.

i) Click Populate Columns.

j) Click Add Column Expression.

k) Enter upper(substr(code,5,2)) in the newly added empty Column Name


field.

l) Enter 1 in the Order field beside the expression that you just entered.

m) Click Show SQL to confirm that the SQL statement looks like this:

Oracle Database 10g: Administration Workshop I B - 42


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 7: Managing Schema Objects (continued)

n) Click Return.

o) Click OK.

p) Return to the SQL*Plus command line and run the benchmark query a few more times.
Note that the execution time is greatly reduced.

12. Use iSQL*Plus to identify the data dictionary view name that you would use to list all
constraints that the INVENTORY user can see.

a) In the Enterprise Manager browser session, select Database > Related Links >
iSQL*Plus. le
r a b
The iSQL*Plus Connection Role page appears.
ns fe
t r a
b) Select Normal, and then click Continue.
no n-
s a
c) On the Login page, enter inventory as Username and verysecure
) h a as the
Password, leave the Connect Identifier set to its default
o value,
m ide .
and then click Login.
i c
c. tofferingu to remember this login
The Confirm window appears, with the Password gManager G
for you. Click No. a relo uden
@ iw s St
d) You are looking for things
h a lthat
e thi
e the INVENTORY user has access to. So, you must use a
view with the ALL_.b prefix. You
u scan assume that the name of the view that shows constraint
d h
o with
information begins t o
“ALL_CON .” In the iSQL*Plus Workspace, enter:
u b s e
l e
SELECT(s * FROM
i c endictionary
haWHERE l
table_name like ‘ALL_CON%’
h b
b o d ORDER BY table_name;

su e) Click the Execute button.

Oracle Database 10g: Administration Workshop I B - 43


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 7: Managing Schema Objects (continued)

a ble
fe r
a ns
n- t r
a no
h a s
m ) e.
o
.c Guvalue
f) Review the returned rows. One of them has the COMMENTS id “Constraints
definitions on accessible tables.” The object g i c t
r e loname eis nALL_CONSTRAINTS .
wa Stuuser? d
13. How many indexes are owned by theiINVENTORY
l e @user,hsoisyou know thatYou are looking for database
objects owned by the INVENTORY
h a e t the data dictionary view begins
b usname is USER_INDEXES.
h. Thetoview
with the “USER_” prefix.
o d
a) In the(is ub enWorkspace,
SQL*Plus se enter:
l e l i c
b haSELECT * FROM user_indexes;
o d h
sub b) Click the Execute button.

How many indexes are owned by the INVENTORY user?

Answer: 4

Oracle Database 10g: Administration Workshop I B - 44


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 7: Managing Schema Objects (continued)

a ble
fe r
a ns
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b us
o
b arenfour
c) Note thatuthere t o
erows returned.
s s
d)ha leout( of iSQL*Plus
Log lice by clicking Logout in the top-right corner of the window. Then,
o d h b close the window by clicking X (Close icon) in the top-right corner.
sub

Oracle Database 10g: Administration Workshop I B - 45


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 8: Managing Data and Concurrency

Background: The Help desk just received a call from Susan Mavris, an HR representative,
complaining that the database is “frozen.” Upon questioning the user, you find that she was
trying to update John Chen’s personnel record with his new phone number, but when she
entered the new data, her session froze and she could not do anything else. SQL script files are
provided for you in the /home/oracle/labs directory.

1. Make an uncommitted update to the row in question by running the lab_08_01.sql


script. Do not worry if the session seems to “hang”—this is the condition you are trying to
create.

a) Enter the following to run the script. When the script completes executing, you will see a
note stating that an uncommitted update has been made. a ble
fe r
$ sqlplus dba1/oracle @lab_08_01.sql
a ns
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub toeupdate
2. Make an attempt
n sethe same row in a separate session by running, in a separate
h a le window,licthe lab_08_02.sql script. Make sure you see the message “Update is
terminal
being attempted now” before moving on.
o d hb
sub a) Right-click the desktop and select Open Terminal to start another command shell.
Then enter the following to run the second script.
$ sqlplus dba1/oracle @lab_08_02.sql

Oracle Database 10g: Administration Workshop I B - 46


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 8: Managing Data and Concurrency (continued)

3. Using the Blocking Sessions link on the Performance page, detect which session is causing
the locking conflict.

a) In Enterprise Manager, click the Performance page.

b) The first time you invoke the Performance page, a Software License Agreement is
displayed. Press [A] to accept and continue.

c) Click Blocking Sessions in the Additional Monitoring Links area.

a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
iw S t
4. What was the last SQL statement
l e @
that the i s
blocking
h session executed?
a t
h .
a) Select the NGREENBERG
bh session,
u seand then click View Session.
b o d to
suhashcvalue e
nslink named “Previous SQL.”
b) Click (the e
e li
b hal
odh
sub

Oracle Database 10g: Administration Workshop I B - 47


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 8: Managing Data and Concurrency (continued)

c) Note the SQL that was most recently run.

5. Resolve the conflict in favor of the user who complained, by killing the blocking session.
What SQL statement resolves the conflict?

a) Click the browser’s Back button.


a ble
b) Now, on the Session Details: NGREENBERG page, click Kill Session. fe r
a n s
t r
on-
c) Leave the Options set to Kill Immediate, and then click Show SQL to see the
statement that is going to be executed to kill the session.
a n
a s
h from those shown
Note: Your session and serial number are most likely to be different
)
here. o m d e .
i c
c. t Gu i
g
a relo uden
@ iw s St
h a le
e thi
b clickuYes
d) Click Return, and .then
h s to carry out the KILL SESSION command.
o d
b nscommand t o
6. Return to(the
s uSQL*Plus e window, and note that SMAVRIS’s update has now
e li c e
b hal successfully.
completed It may take a few seconds for the success message to appear.

o d h
sub

a) Close all open SQL sessions by entering exit, and then close the terminal windows.

Oracle Database 10g: Administration Workshop I B - 48


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 9: Managing Undo Data

Background: A new version of your application will include several reports based on very
long-running queries. Configure your system to support these reports.

1. Use the Undo Advisor to calculate the amount of undo space required to support a report
that takes two days to run, on the basis of an analysis period of the last seven days.

a) In Enterprise Manager, select Administration > Related Links > Advisor Central.

b) Click Undo Management.

c) Click Undo Advisor.

a ble
d) In the New Undo Retention field, enter 2. Then select days from the drop-down list.
fe r
a n s
e) Select Last Seven Days in the Analysis Time Period drop-down list. Results-of
n r
t the
analysis will be displayed. o
Note: The values that you see are likely to be different from those
s a n here.
shown
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
h a le lic
o d h bf) Question: What does the analysis recommend as “Required Tablespace Size for New
sub Undo Retention”?

Answer: 110 MB

g) Click OK.

Oracle Database 10g: Administration Workshop I B - 49


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 9: Managing Undo Data (continued)

2. Resize the undo tablespace to support the retention period required by the new reports (or 1
GB, whichever is smaller). Do this by increasing the size of the existing data file.

a) Click Edit Undo Tablespace.

b) Question: What are the two ways to add space to a tablespace?

Answer: Add a new data file or increase the size of an existing data file.

c) To increase the size of the existing data file, select the data file, and then click Edit.

d) Enter the new value from step 1 (f) in the File Size field. Round off to the nearest 100
MB (not to exceed 1 GB). Make sure the box for “Automatically extend datafile when a ble
full” is not selected. Then, click Continue. fe r
a n s
e) Click Show SQL to confirm that the SQL statement looks similar to this: n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
f) Click Return, then click
h aApply e thi
le to implement your change.
. b
h to u s
o d
( s ub ense
h a le lic
o d hb
sub

Oracle Database 10g: Administration Workshop I B - 50


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 10: Implementing Oracle Database Security

Background: You have just been informed of suspicious activities in the HR.JOBS table in
your ORCL database. All maximum salaries seem to fluctuate in a strange way. You decide to
enable standard database auditing and monitor data manipulation language (DML) activities in
this table.

Log in as the DBA1 user (with oracle password, connect as SYSDBA) and perform the
necessary tasks either through Enterprise Manager Database Control or through SQL*Plus. All
scripts for this practice are in the /home/oracle/labs directory.

1. Use Enterprise Manager to enable database auditing. Set the AUDIT_TRAIL parameter to
XML.
a ble
a) Invoke Enterprise Manager as the DBA1 user in the SYSDBA role for your ORCL fe r
database. a ns
n- t r
o
an
b) Select Administration > Schema > Users & Privileges > Audit Settings.
s
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
c) Click the NONEo
b link. t o
( s u e n se
d) a
h On lic Parameters page, click the SPFile tab.
lethe Initialization
o d hb e) Enter audit in the Name field and then click Go.
sub
f) For the audit_trail parameter, select the XML value.

g) Click Show SQL.

h) Review the statement and then click Return.

i) On the Initialization Parameters page, click Apply.

Oracle Database 10g: Administration Workshop I B - 51


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 10: Implementing Oracle Database Security (continued)

2. Because you changed a static parameter, you must restart the database. Do so by running
the lab_10_02.sh script.

a) In a terminal window, enter:


cd /home/oracle/labs
./lab_10_02.sh

Continue with the next step when you see that the database is restarted and the script has
exited out of SQL*Plus.

3. Back in Enterprise Manager, select HR.JOBS as the audited object and DELETE, INSERT,
and UPDATE as Selected Statements. Gather audit information by session. a ble
fe r
a
a) Click the Database home page tab to ensure that Enterprise Manager had time to updatens
n- t r
the status of the database and its agent connections. Because the database has been
restarted, you have to log in to EM again as the DBA1 user. a no
h a s
) > Audit
b) Then, select Administration > Schema > Users & Privileges
m e . Settings.
c o i d
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
h a le lic
o d hb
sub

c) Click the Audited Objects tab, and then click the Add button.

d) On the Add Audited Object page, ensure that the Object Type is Table, and enter
HR.JOBS in the Table field (or use the flashlight icon to retrieve this table).

e) Move DELETE, INSERT, and UPDATE into the Selected Statements area by double-
clicking each of them.

f) Click Show SQL.

Oracle Database 10g: Administration Workshop I B - 52


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 10: Implementing Oracle Database Security (continued)

g) Review the statement, and then click Return.

h) Click OK to activate this audit.

4. Provide input for the audit, by executing the lab_10_04.sh script. This script creates the
AUDIT_USER user, connects to SQL*Plus as this user, and multiplies the values in the
MAX_SALARY column by 10. Then, the HR user connects and divides the column values
by 10. Finally, the AUDIT_USER user is dropped again.

a) In a terminal window, enter:


cd /home/oracle/labs
a ble
./lab_10_04.sh
fe r
5. In Enterprise Manager, review the audited objects. a ns
n- t r
no
a) Select Administration > Schema > Users & Privileges > Audit Settings.
a
h a s
b) Click Audited Objects in the Audit Trails area, whichm ) the eright
is on . side of the page.
c o uidand optionally click
g i c.information,
c) On the Audited Objects page, review the collected G
Show SQL. r e lo ent
i wa Stud
a l e@ this
h . bh use
b o d to
su cens e
e (
hal li
h b
b o d
su
d) Click Return.

6. Undo your audit settings for HR.JOBS, disable database auditing, and then restart the
database by using the lab_10_06.sh script.

a) On the Audit Settings page, click the Audited Objects tab.

b) Enter HR as Schema, and then click Search.

c) Select all three rows, and then click Remove.

Oracle Database 10g: Administration Workshop I B - 53


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 10: Implementing Oracle Database Security (continued)

d) On the Confirmation page, click Show SQL.

e) Review the statements, then click Yes to confirm your removal.


a ble
f) On the Audit Settings page, click XML in the Configuration region. fe r
a n s
g) On the Initialization Parameters page, click the SPFile tab. n- t r
n o
h) On the SPFile page, enter audit in the Name field, and then a s a
) h click Go.
i) For the audit_trail parameter, select the NONE c o m ide.
value.
g i c. t Gu
j) Click Show SQL.
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
k)haReview ic
le the lstatement, and then click Return.
h b
b o d l) On the Initialization Parameters page, click Apply.
su
m) Because you changed a static parameter, you must restart the database. Do so by
running the lab_10_06.sh script. In a terminal window, enter:
cd /home/oracle/labs
./lab_10_06.sh

7. Maintain your audit trail: Because you are completely finished with this task, delete all
audit files from the /u01/app/oracle/admin/orcl/adump directory.

a) In a terminal window, enter:


cd /u01/app/oracle/admin/orcl/adump
ls
rm –f *

b) Close the terminal window.

Oracle Database 10g: Administration Workshop I B - 54


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 11: Configuring the Oracle Network Environment

Background: Users need to connect to your ORCL database. Work with them to enable
connections by using different methods. Ensure that users can use connect-time failover to take
advantage of a backup listener.

1. Make a copy of your listener.ora and tnsnames.ora files. They are in the
$ORACLE_HOME/network/admin directory.

a) In an terminal window, enter cd $ORACLE_HOME/network/admin to navigate to


the /u01/app/oracle/product/10.2.0/db_1/network/admin directory.

b) Enter cp listener.ora listener.old to create a copy of the


listener.ora file.
a ble
fe r
c) Enter cp tnsnames.ora tnsnames.old to create a copy of the a ns
tnsnames.ora file. n- t r
a no
d) Enter ls -l, if you want to see the copies and their privilegesainsyour directory.
m ) h e.
2. Navigate to the Net Services Administration page. Start
i c . cbyo clicking
uidthe Listener link on
the Database home page. g
lo ent G
a r e d SYSDBA role for your ORCL
a) Invoke Enterprise Manager as theiw DBA1 userS tinuthe
database.
a l e@ this
. b h s e
b) On the Database h u
dInstanceto– Home page, click the Listener link in the General region.
b o
c) In e su cLinks
the(Related e nseregion, click Net Services Administration.
h al li
b
h3. Modify your local Names Resolution file so that you can connect to another database.
b o d Name the connection to a partner’s ORCL database testorcl.
su
a) On the Net Services Administration page, select Local Naming from the Administer
drop-down list, and then click Go.

The Netservices Administration: Host Login page appears.

b) If you previously saved the oracle username and oracle password as preferred
credentials for your host login, then they appear on the screen. If not, enter oracle as
Username and Password, select the Save as Preferred Credential check box, and then
click Login.

c) On the Local Naming page, click Create to enter a new network service name.

d) Enter testorcl as Net Service Name.

e) Select Use SID, and enter orcl as SID.

Oracle Database 10g: Administration Workshop I B - 55


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 11: Configuring the Oracle Network Environment
(continued)

f) Select Database Default.

a ble
fe r
a n s
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
g) Click Add in the d h .b
Addresses
s
uregion.
o t o
ubareeasked,
Click No (ifsyou n se“Do you want to remember the values you filled in?”
h a le lic
o d h bh) On the Add Address page, select the following values:
sub - Protocol: TCP/IP
- Port: 1521
- Host: <Enter the host name or IP address of your partner’s computer. It could be
something like edrsr9p1.us.oracle.com or like 139.185.35.109>

Your partner’s server

Oracle Database 10g: Administration Workshop I B - 56


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 11: Configuring the Oracle Network Environment
(continued)

i) Click OK to return to the Create Net Service Name properties page.

j) Click OK.

The Creation Message appears: Net Service “testorcl” created successfully.

4. In Enterprise Manager, test access to your partner’s ORCL database as the system user
with the oracle password by using the testorcl Local Naming.

a) Select testorcl on the Local Naming page, and then click Test Connection.

The “Test Connection To Net Service Name: testorcl” appears. a ble


fe r
a ns
b) Enter system as Username and oracle as Password, and then click Test.
n- t r
o
an
The Processing page displays status information. Then, it is followed by a success message.
s
If you receive any errors or warnings, resolve them.
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

5. Test your changes to the network configuration by using SQL*Plus or iSQL*Plus. Again,
use: system/oracle@testorcl. To see your partner’s information, select the
instance_name and host_name columns from the v$instance table.

a) In an terminal window, enter:


sqlplus system/oracle@testorcl

The Oracle SQL*Plus window opens. If you receive any errors or warnings, resolve them.

b) At the SQL> prompt, enter the following command:


select instance_name, host_name from v$instance;

Oracle Database 10g: Administration Workshop I B - 57


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 11: Configuring the Oracle Network Environment
(continued)

a ble
fe r
a ns
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
You should see your partner’s host@ iw s St
name.
h a le
e t hi
b SQL*Plus
c) Enter exit to exit.your
h u s session.
b d
o se t o
( u
s cenlistener to support connect-time failover. Use port 1561 for this
6. Create a LISTENER2
e li out of Enterprise Manager and run the lab_11_06.sh script to
b hal First,
listener.
configure
log
the NetProperties file.
o d h
sub a) Logout of Enterprise Manager.

b) Run the lab_11_06.sh script at the operating system command prompt.

c) Log in to Enterprise Manager as the DBA1 user in the SYSDBA role for your ORCL
database.

d) On the Database Instance – Home page, click the Listener link in the General region.

e) In the Related Links region, click Net Services Administration.

f) On the Net Services Administration page, select Listeners from the Administer drop-
down list, and then click Go. Enter host credentials as oracle and oracle for
username and password, and then click Login.

Oracle Database 10g: Administration Workshop I B - 58


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 11: Configuring the Oracle Network Environment
(continued)

g) On the Listeners page, which gives you an overview of the existing listeners, click the
Create button.

The Create Listener page appears.

h) Enter LISTENER2 as Listener Name, and then click Add to add a listener address.

i) Enter or confirm the following values:


- Protocol: TCP/IP
- Port: 1561
- Host: <Your computer’s host name; for example, edrsr30p1.us.oracle.com> a ble
fe r
j) Click OK. a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h bk) Click the Static Database Registration tab, and then click the Add button to connect
o d the new listener with your ORCL database.
sub l) Enter the following values:
- Service Name: orcl
- Oracle Home Directory: /u01/app/oracle/product/10.2.0/db_1
- Oracle System Identifier (SID): orcl

m) Click OK to add the database service.

n) Click OK to create the LISTENER2 listener.

Oracle Database 10g: Administration Workshop I B - 59


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 11: Configuring the Oracle Network Environment
(continued)

a ble
fe r
a ns
n- t r
7. Start the LISTENER2 listener.
a no
a) Confirm that the LISTENER2 listener and Start/Stop Actions h a s selected, and then
are
click Go. m ) e.
o
g i c.c t Guid
b) Click OK on the Start/Stop page.
a relo uden
A confirmation message appears @
w Details
withi a View S t link.
le thi s
h a e
d h .bView Details
c) Optionally, click the usto return
link, review the listener status information, and use
the Back icon
b o t o
of your browser
e to the previous page.
u
(s icen s
l e l
b ha
o d h
sub

Oracle Database 10g: Administration Workshop I B - 60


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 12: Proactive Maintenance

Background: You want to proactively monitor your ORCL database so that common problems
can be fixed before they affect users. This practice session invents some issues so that you can
familiarize yourself with the tools that are available. First, execute scripts to set up your
Automatic Database Diagnostic Management (ADDM) environment.

1. Create a new, locally managed tablespace called TBSADDM. Its addm1.dbf data file is 50
MB. Ensure that the TBSADDM tablespace does not use Automatic Segment Space
Management (ASSM). Execute the lab_12_01.sh script to perform these tasks.

a) In a terminal window, enter:


cd /home/oracle/labs
a ble
./lab_12_01.sh
fe r
a n s
2. Create a new ADDM user, identifed by ADDM. Assign the TBSADDM tablespace as n t r
-default
o
tablespace. Assign the TEMP tablespace as temporary tablespace. Grant thenfollowing roles
to the ADDM user: CONNECT, RESOURCE, and DBA. Execute the lab_12_02.sh s a script
) h a
to perform these tasks.
c o m ide.
a) In a terminal window, enter: g i c. t Gu
a relo uden
./lab_12_02.sh
@ iw s St
3. Use the DBMS_ADVISOR h a le to setththei database activity time to 30 minutes. As an
package
ADDM user, drop and h . b the ADDM
create u setable and gather statistics for this table. Create a
b o d Workloadto Repository (AWR). Execute the lab_12_03.sh script
snapshot in Automatic
u tasks.
sthese ns e
to perform
e ( c e
h al li
b
h a) In a terminal window, enter:
b o d
su ./lab_12_03.sh

4. Create activity to be analyzed. Execute the lab_12_04.sh script to perform these tasks.

a) In a terminal window, enter the following. You may have to press [Enter] after you see
that eight PL/SQL procedures have completed, in order to see the command prompt
again.
./lab_12_04.sh

Oracle Database 10g: Administration Workshop I B - 61


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 12: Proactive Maintenance (continued)

5. In Enterprise Manager, review the Performance page as a user connected as SYSDBA. View
performance data in real time with a 15-seconds refresh cycle. After a while, you should see
a spike on the “Average Active Sessions” graph. This is your activity to be analyzed.
Looking at the graph, you can already determine that this instance is suffering from
concurrency problems.

a ble
fe r
a ns
n- t r
a no
Note: Depending on when you run the workload, you may see differences between your
graph and the one provided as a possible solution. h a s
m ) e.
o id script forces the
After the spike is finished, execute the lab_12_05.sh
g i c.c script.
G uThis
t table.
r e loon yourenADDM
creation of a new snapshot and gathers statistics

a) Invoke Enterprise Manager as@


wa Stinudthe SYSDBA role for your ORCL
thei DBA1suser
database. h a le
e thi
d h .b us
o
b) Click the Performance
b nse tab. t o
s u
a e (is thelfirst
Iflthis i cetime that you accessed the Performance page, you need to accept the
h
o d h b Adobe license agreement. Follow the directions in the pop-up window to accept the
agreement.
sub

Oracle Database 10g: Administration Workshop I B - 62


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 12: Proactive Maintenance (continued)

a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d c) After the spike has finished, in a terminal window, enter:
sub ./lab_12_05.sh

Note: The icon next to the cursor in this screenshot is a shortcut to the Automatic Database
Diagnostic Monitor (ADDM) page.

Oracle Database 10g: Administration Workshop I B - 63


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 12: Proactive Maintenance (continued)

6. Look at the Performance Analysis findings in order of their impact. There are several
access paths to this information.

Looking at the Performance Analysis section, you see that the first finding (in the SQL
Tuning Recommendations category) has a 100% impact on the system. So your first
impluse is to look at this finding in more detail. However, looking at this SQL statement
does not yet help you to understand the concurrency problem of your database.

Research the next finding under Schema Recommendations: Read and write contention of
database blocks was consuming significant database time. Here you are advised to use
the Automatic Segment Space Management (ASSM) feature for your ADDM table.

a ble
a) Navigate to the Database home page, and then click Advisor Central at the bottom of
fe r
the page.
a n s
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

b) Your ADDM task should already be displayed. If not, search for it and display it on this
page.

c) Select the task, and then click the View Result button (or alternatively, click the name
of the task).

Oracle Database 10g: Administration Workshop I B - 64


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 12: Proactive Maintenance (continued)

a ble
fe r
a n s
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a
impact on the system. So your first impluseriseltoolook
Looking at the Performance Analysis section, you see that
d e
at
nthe first finding has a 100%
this finding in more detail.
i w Stu
d) Click the SQL statements a l e@ thisignificant
consuming
s database time were found link.
. b h s e
o d h to u
( s ub ense
h a le lic
o d hb
sub

Oracle Database 10g: Administration Workshop I B - 65


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 12: Proactive Maintenance (continued)

e) Review the recommendations on the Performance Finding Details page. However,


looking at this SQL statement does not yet help you to understand the concurrency
problem of your database. Click the Back icon in your Web browser.

f) On the Automatic Database Diagnostic Monitor (ADDM) page, click the Read and
write contention of database blocks was consuming significant database time link .
This finding appears as type Schema under the Recommendations heading.

a ble
fe r
a n s
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub g) You are advised to use the Automatic Segment Space Management feature for your
ADDM table.

7. To implement the recommendation, you must re-create the object. Create a new, locally
managed tablespace, called TBSADDM2 with a 50 MB datafile, called addm2_1.dbf.
Ensure that the TBSADDM2 tablespace uses the the Automatic Segment Space Management
feature. Then, execute the lab_12_07.sh script to drop the ADDM table, to re-create it in
the new tablespace, to gather statistics and to take a new snapshot.

a) In Enterprise Manager, select Administration > Database Administration > Storage >
Tablespaces.

b) Click Create.

c) Enter TBSADDM2 as the tablespace name, and verify that Extent Management is
Locally Managed, Type is Permanent, Status is Read Write, and Use Bigfile
tablespace is not selected.
Oracle Database 10g: Administration Workshop I B - 66
Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 12: Proactive Maintenance (continued)

d) Click Add in the Datafiles region.

e) On the Add Datafile page, enter addm2_1.dbf for File Name, and 50 MB as File
Size.

f) Click Continue.

g) Click the Storage tab, and verify that Extent Allocation is Automatic, Segment Space
Management is Automatic, and Logging is enabled.

h) Click the General tab.

i) Click Show SQL to see the SQL that will be run, and then click Return. a ble
fe r
j) Click OK, and a successful Update Message appears. a ns
n- t r
k) In a terminal window, enter: a no
h a s
./lab_12_07.sh
m ) e.
o uid to the
c is identical
8. Execute your workload again. (The lab_12_08.sh g i c.script G
lab_12_04.sh script.) r e lo ent
i wa Stud
@following.
a) In a terminal window, enterlethe
h is You may have to press [Enter] after you see
a t
again. h . bh uhave
that eight PL/SQL procedures
se completed, in order to see the command prompt
b o d to
su cens e
(
./lab_12_08.sh
e
h al li
b
h9. In Enterprise Manager, review the Performance page as a user connected as SYSDBA. View
b o d performance data in real time with a 15-seconds refresh cycle. After a while, you should see
su a spike on the “Average Active Sessions” graph.

Note: Depending on when you run the workload, you may see differences between your
graph and the one provided as a possible solution.

After the spike is finished, execute the lab_12_09.sh script. (The lab_12_09.sh
script is identical to the lab_12_05.sh script.) This script forces the creation of a new
snapshot and gathers statistics on your ADDM table.

a) Invoke Enterprise Manager as the DBA1 user in the SYSDBA role for your ORCL
database.

b) Click on the Performance tabbed page.

Oracle Database 10g: Administration Workshop I B - 67


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 12: Proactive Maintenance (continued)

a ble
fe r
a ns
n- t r
c) After the spike is finished, enter the following in a terminal window:
a no
./lab_12_09.sh
h a s
m ) e.
o
10. Review the Performance Analysis on the Database home
g i c.c t Guid
page.

a) Navigate to the Database home page, and r lo clickeAdvisor


ethen n Central at the bottom of
the page. a
iw s S t u d
@
ltask name.thi
e
b) Click the topmost ADDM h a
h . b u se
b o d to
su cens e
e (
hal li
h b
b o d
su

You see that there are no longer any schema-related recommendations. By moving the
ADDM table to the locally managed TBSADDM2 tablespace, which uses the Automatic
Autoextend Segment feature, you obviously fixed the root cause of this problem.

Oracle Database 10g: Administration Workshop I B - 68


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 12: Proactive Maintenance (continued)

11. To not affect other practice session, execute the lab_12_11.sh script to clean up your
environment.

a) In a terminal window, enter:


./lab_12_11.sh

a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

Oracle Database 10g: Administration Workshop I B - 69


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 13: Performance Management

Background: Users are complaining about slower-than-normal performance for operations


involving the human resources and order-entry applications. When you question other members
of the DBA staff, you find that maintenance was recently performed on some of the tables
belonging to the HR schema. You need to troubleshoot and make changes as appropriate to
resolve the performance problems. SQL script files are provided for you in the
/home/oracle/labs directory. Other directories are individually named.

1. Log in to SQL*Plus as the DBA1 user and perform maintenance on tables in the HR schema
by running the lab_13_01.sql script.

a) Connect to the database as the DBA1 user and perform some maintenance on the
employees table by running the lab_13_01.sql script. a ble
fe r
a ns
$ cd labs
$ sqlplus dba1/oracle n- t r
SQL> @lab_13_01.sql
a no
h a s
m ) is taking
2. You get calls from HR application users saying that a particular query
e . longer than normal
to execute. The query is in the lab_13_02.sql script. o
.c Guid run it.
As the HR user,
i
g ntc
a) Enter the following in SQL*Plus , while r e l o
logged in e
as the HR user:
a
iw s S t u d
SQL> @lab_13_02.sql @
h a l e
e thi
.b locateuthe
3. Using Enterprise Manager,
d h s HR session in which the above statement was just
executed, and viewo t
b thensexecution
e o plan for that statement.
( s u e
a) a Enterpriselic
Inle Manager, click Search Sessions on the Performance tabbed page.
h
o d hb
sub

Oracle Database 10g: Administration Workshop I B - 70


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 13: Performance Management (continued)

b) Change the Filter for the search criteria to “DB User,” enter HR in the field to the right
of that, and then click Go.

a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h bc) Click the SID number in the Results listing.
o d
sub d) You now see the Session Details page for this session. Click the hash value link to the
right of the Previous SQL label.

Oracle Database 10g: Administration Workshop I B - 71


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 13: Performance Management (continued)

e) That shows you the SQL Details page for the last SQL statement executed by that
session, which is the one in question. Click the Plan tab to see the execution plan for
the query.

a ble
fe r
a ns
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
f) You see in the Operation columnithat S t is doing a full table scan (TABLE
w this query
ACCESS FULL). Because
@ s
i the query’s condition is an equality
leyou knowththat
h a
b key e
comparison on the .primary
d h
key index.to
us(EMPLOYEE_ID), you decide to investigate the status
of the primary o
ub ense
( s
4. Using
h a leEnterpriselicManager, check to see the status of the EMPLOYEE table’s index on
h bEMPLOYEE_ID. See if it is VALID.
o d
sub a) Select Administration > Schema > Database Objects > Indexes.

b) Select Table Name as the Search By value.

c) Enter HR as Schema Name.

d) Enter employees for Object Name.

e) Click Go, and the list of six indexes appears.

f) Click the index named EMP_EMP_ID_PK.

g) Click the index link and note that the status of the index is UNUSABLE.

Oracle Database 10g: Administration Workshop I B - 72


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 13: Performance Management (continued)

5. Now that you have seen one index with a non-VALID status, you decide to check all
indexes. Using SQL*Plus, as the HR user, find out which HR schema indexes do not have
STATUS of VALID. To do this, you can query a data dictionary view with a condition on
the STATUS column.

a) Go to the SQL*Plus session where you are still logged in as the HR user, and run this
query:
SQL> select index_name, table_name, status
from user_indexes where status <> ‘VALID’;

b) See that the output lists six indexes, all on the EMPLOYEES table.
a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub
6. Using Enterprise Manager, reorganize all the indexes in the HR schema that are marked as
UNUSABLE.

a) In Enterprise Manager, on the page displaying the EMP_EMP_ID_PK index, select


Reorganize in the Actions list, and then click Go.

b) Click Add, to add each of the other five indexes to the reorganization operation.

c) In the Add screen, choose Indexes for the Type drop-down list, and enter hr in the
Schema field.

d) Click Search.

Oracle Database 10g: Administration Workshop I B - 73


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 13: Performance Management (continued)

e) Select the five other indexes whose names start with “EMP_.”

a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub
f) Click OK.

g) Click Next.

h) Keep all the default settings for Options, and then click Next.

i) Note that there are no problems reported on Impact Report, and then click Next.

j) On the Schedule page, enter oracle and oracle for Username and Password under
Host Credentials.

k) Click Next.

l) On the Review page, click Submit Job.

Oracle Database 10g: Administration Workshop I B - 74


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 13: Performance Management (continued)

m) After the Confirmation page appears, click the job name to see its status. Click Reload
on your browser until you see the job has succeeded.

a ble
fe r
a ns
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
7. Return to the SQL*Plus session where the HR
r e o is logged
luser e n in, and run the
lab_13_07.sql script to execute the a
iwsamesbykind d
tuof query. Then, repeat the steps to see
the plan of the last SQL statement @
executed i Sthis session, to see if the plan has changed.
a l e t h
a) Enter the following h . bhthe SQL*Plus
at u se prompt:
b o d to
su cens e
(
SQL> @lab_13_07.sql
e
al li
b)h Repeat the tasks listed in step 3. Note that the plan now uses the index.
b
o d h
sub

c) Quit the SQL*Plus session.

8. What is the difference in execution plans, and why?

Answer: The statement execution uses a unique index scan instead of a full table scan,
because the index is usable after your index reorganization.

Oracle Database 10g: Administration Workshop I B - 75


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 13: Performance Management (continued)

9. Simulate a working load on your instance by running the lab_13_09.sql script as the
DBA1 user. Please note the SID value for task 10.

Possible answer: 147 (Your answer is most likely a different one).

This script takes about 20 minutes to complete. So, run it in a separate terminal window and
continue with this practice exercise while it runs.
Note: Because this script generates a fairly heavy load in terms of CPU and disk I/O, you
will notice that response time for Database Control is slower.
$ sqlplus dba1/oracle
SQL> @lab_13_09.sql
a ble
fe r
a n s
t r
on-
a) In Enterprise Manager, navigate to the Performance page, and investigate system
performance.
a n
a s
h load generation script
b) You may need to wait a minute or two to see the effects of)the
appear on the graphs. o m d e .
i c
c. t Gu i
g
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
h a le lic Wait to see the beginning of a
h b
o d spike in the Average Active
sub Sessions graph before
proceeding.

Question 1: In the Average Active Sessions graph, which are the two main categories that
active sessions are waiting for?

Answer: System I/O and CPU Used

Oracle Database 10g: Administration Workshop I B - 76


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 13: Performance Management (continued)

Question 2: In the Configuration category of waits, what is one of the contributors to the
wait time? Click Configuration to see the graph.

Answer: Any one of these:

Question 3: Click Back, and then click Physical Writes on the Instance Disk I/O graph.
Determine which process is doing the most writing to the disk.
a ble
Answer: DBW0 fe r
a ns
c) Click Back. n- t r
a no
d) Click Top Activity in the Additional Monitoring Links region.
h a s
) e.
mTop
e) Click the SQL ID of the first SQL statement listed c inothe
i c . GuiSQL d region.
f) See the first SQL statement. l o g nt
e
ar tude
Question 4: What SQL statement @
i w
is causingistheS most waits?
a l e t h
Answer: delete from h . bhsh.sales_copy
u se
b o d to
su that s e
isngenerating
l e (
10. Kill the session
i c e the load. Use the session ID recorded in step 9. The
h a
session ID l
should be listed at the top of the list on the right side of the page, under the Top
b
h Sessions region.
b o d
su a) Click the SID number for the session ID recorded earlier. This is found under the
heading Detail for Selected 5 Minute Interval.

Oracle Database 10g: Administration Workshop I B - 77


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 13: Performance Management (continued)

b) On the Session Details page, click Kill Session, and then click Yes to confirm.
Note: If you remain on this Session Details page long enough for a few automatic refreshes
to be done, you may see the following warning, which means you are attempting to refresh
information about a session that’s already been killed. You can ignore this warning.

c) Click Top Activity in the navigation history at the top of the page. Note that the session
a ble
activity in the database has declined considerably. fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

Oracle Database 10g: Administration Workshop I B - 78


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 14: Backup and Recovery Concepts

Background: Your ORCL database is ready to move from test or development into production.
Configure your database to reduce the chances of failure or data loss.

1. Verify that you have two control files to ensure redundancy.

a) Invoke Enterprise Manager as the DBA1 user in the SYSDBA role for your ORCL
database.

b) Select Administration > Database Administration > Storage > Control Files.

a ble
fe r
a n s
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b us
o
c) Question 1:bHow would t o
e you add another control file if you needed to?
s u
( iaccontroln s
e file is a manual operation. To perform this, you must:
l
Answer
a e: Addingl
h
o d h b - Shut down the database
sub
- Use the operating system to copy an existing control file to the location where you
want your new file to be
- Start the database by using Enterprise Manager. Unlike a normal startup, you would
use Advanced Options to select a different startup mode. Select “Start the instance” to
leave the instance in the NOMOUNT state.
- Edit the CONTROL_FILES initialization parameter to point to the new control file
- Continue the STARTUP database operation until the database is in an open state
Note: This answer does not apply to an OMF database, as the control files in that case
would have to all be recreated.

2. Check how many members each redo log group has. Ensure that there are at least two redo
log members in each group. In what directory or directories are the redo log files stored?

Oracle Database 10g: Administration Workshop I B - 79


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 14: Backup and Recovery Concepts (continued)

a) Select Administration > Database Administration > Storage > Redo Log Groups, and
note how many members are in the “# of Members” column. There should be two per
group.

a ble
fe r
a
b) Select the first group, and then click Edit to see the member file names. Note that onen s
n-
member is in directories under the oradata directory, and another is in the Flash
t r
o
Recovery Area. Click the browser’s Back button.
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h bNote: In a production database, you want to ensure that the two members are on different
o d hard drives, preferably with different disk controllers, to minimize the risk of any single
sub hardware failure destroying an entire log group.

3. You notice that, for each log group, the Archived column has a value of No. This means
that your database is not retaining copies of redo logs to use for database recovery, and in
the event of a failure, you will lose all data since your last backup. Place your database in
ARCHIVELOG mode, so that redo logs will be archived.

a) Create a new directory /u01/app/oracle/archive as the destination for the redo


log files.

- In a terminal window, enter cd /u01/app/oracle.

- Then, enter mkdir archive.

- Optionally, enter ls –l to view your new directory and its OS permissions.

Oracle Database 10g: Administration Workshop I B - 80


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 14: Backup and Recovery Concepts (continued)

b) In Enterprise Manager, select Maintenance > High Availability > Backup/Recovery


Settings > Recovery Settings.

c) In the Media Recovery region, select the ARCHIVELOG Mode check box.

d) Verify that Log Archive Filename Format contains %t, %s, and %r.

4. Configure redundant archive log destinations—one to the Flash Recovery Area and the
other to /u01/app/oracle/archive.

a ble
fe r
a n s
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

Notice that the database is preconfigured to save archived logs to the Flash Recovery Area
by default (Archive Log Destination 10). Add an additional Archive Log Destination so that
you will have redundant copies of your log files.

a) In Archive Log Destination number 1, enter /u01/app/oracle/archive/. The


directory path should end with a slash. Leave Quota blank.

Note: You must create the directory, if it does not already exist. You already did this in
step (3).

Oracle Database 10g: Administration Workshop I B - 81


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 14: Backup and Recovery Concepts (continued)

b) Optionally, click Show SQL, review the statements, and then click Return.

c) Click Apply. When prompted whether you want to restart the database now, click Yes.

a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d d) Enter the credentials to restart the database, and then click OK.
sub e) When asked to confirm, click Yes again.

Now that your database is in ARCHIVELOG mode, it will continually archive a copy of
each online redo log file before reusing it for additional redo data.

Note: Remember that this consumes space on the disk and that you must regularly back up
older archive logs to some other storage.

Oracle Database 10g: Administration Workshop I B - 82


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 15: Performing Database Backups

Background: Your database is ready to move from development and test into production.
Ensure that your database is configured so that recovery is possible without loss of data.

1. What is the difference between a backup set and an image copy?

Answer: A backup set contains data and archive log files packed in an Oracle proprietary
format. Files must be extracted before use. Image copies are the equivalent of operating
system file copies and can be used to restore operations immediately.

2. What is the destination of any disk backups that are done?

a) In Enterprise Manager, select Maintenance > High Availability > Backup/Recovery


a ble
Settings > Backup Settings. Note the message under the Disk Backup Location that
fe r
says the Flash Recovery Area is the current disk backup location.
a n s
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub 3. Test making a backup to disk, as a backup set, with oracle for Host Credentials.

a) Select Backup Set as your Disk Backup Type.

b) Scroll to the bottom and enter oracle and oracle for Host Credentials Username
and Password for your server.

c) Click Test Disk Backup.

d) When the test finishes, click OK.

Oracle Database 10g: Administration Workshop I B - 83


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 15: Performing Database Backups (continued)

4. Back up your entire database, without archived logs, while the database is open for user
activity. This backup should be the base for an incremental backup strategy.

Question: What prerequisite must be met to create a valid backup of a database without
shutting it down?

Answer: The database must be in ARCHIVELOG mode. Backups made with the database
open but not in ARCHIVELOG mode cannot be used for recovery.

a) Select Maintenance > High Availability > Backup/Recovery > Schedule Backup.

b) Select Whole Database as the object to be backed up.


a ble
fe r
c) Enter oracle and oracle for Host Credentials Username and Password for your
a n s
server.
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

d) Click Schedule Customized Backup.

e) Select Full Backup for your Backup Type, and select the Use as the base of an
incremental backup strategy check box.

f) Select Online Backup as Backup Mode.

g) In the Advanced region, deselect the Also backup all archived logs on disk check
box, and then click Next to continue.

Oracle Database 10g: Administration Workshop I B - 84


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 15: Performing Database Backups (continued)

h) Select Disk for your backup location (notice that your Disk Backup Location is retained
from step [2]). Click Next to continue.

i) Accept all the defaults on the Schedule page, and then click Next to continue.

a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d Click Submit Job to perform the online database backup.
sub
j)

Oracle Database 10g: Administration Workshop I B - 85


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 15: Performing Database Backups (continued)

k) Click View Job to monitor the status of the backup job. This backup takes
approximately five minutes to complete.

a ble
fe r
a ns
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b us online backups for your whole database, without
o
5. Schedule nightlyodisk-based tincremental
s ubSchedule
archived (logs.
e n sitefor 11:00 p.m. The schedule should be in effect indefinitely.
h a le lic
o d h ba) In Enterprise Manager, select Maintenance > High Availability > Backup/Recovery >
Schedule Backup.
sub
b) Select Whole Database as the object to be backed up.

c) Enter oracle and oracle for Host Credentials Username and Password for your
server, and then click Schedule Customized Backup.

d) Select Incremental Backup (Level 1) for your Backup Type.

e) Select Online Backup as Backup Mode.

f) In the Advanced region, deselect the Also backup all archived logs on disk check
box, and then click Next to continue.

g) Select Disk as your backup location, and then click Next to continue.

Oracle Database 10g: Administration Workshop I B - 86


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 15: Performing Database Backups (continued)

h) Change Job Name to Nightly_Backup and accept the default value for Job
Description.

i) Select Later in the Start region. Accept today’s date and use the drop-down lists and
option buttons to select 11:00 p.m. for Time.

j) In the Repeat area, select Interval, and Frequency 1 Days.

k) Select Indefinite in the Repeat Until region, and then click Next.

a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

l) Click Submit Job, and then click OK.

m) Navigate to Maintenance > Related Links > Jobs to see the scheduled job in the Job
Activity list.

Oracle Database 10g: Administration Workshop I B - 87


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 16: Performing Database Recovery

Background: Many failures of the Oracle database can be traced to some sort of media failure,
such as disk or controller failure. Recover your database from a variety of simulated media
failures. SQL script files are provided for you in the /home/oracle/labs directory. If
needed, use appendix C for Linux and appendix D for SQL syntax. Note that where OS file
names are mentioned, your system may possibly have different file names than shown here.

1. Recover from the loss of a control file.

a) As the DBA1 user, run the lab_16_01_a.sql script to prepare some procedures to
be called by the rest of this practice.
@$HOME/labs/lab_16_01_a.sql
a ble
fe r
b) Now run the lab_16_01_b.sql script. This script deletes one of your control files.
a ns
n- t r
@$HOME/labs/lab_16_01_b.sql
a no
c) The Help desk begins receiving calls saying that the databasehappearsa s to be down.
Troubleshoot and recover as necessary. Use Enterprisem ) eDatabase
Manager’s . page to
c o i d
attempt to start up the database, and use SQL*Plus,
g i c. if needed.
t G u
- In Enterprise Manager, navigate to thea elo dpage.
rDatabase e n It reports that the database is
down and offers you the chance to
u Attempt to do so by clicking
iwstart sit upStagain.
Startup. You may needa tole
@ hitwo minutes before the page appears as
wait onetor
described. If you see h e
.ba Connection
s Refused message, ignore it; the connection will
d h
eventually beoestablished.t o u
u b
s credentials s e
l e
- Enter
(host
l i c en as oracle for Username and Password, and then click OK.
b ha
o d h - When asked whether you are sure that you want to start the database, click Yes.
sub

Oracle Database 10g: Administration Workshop I B - 88


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 16: Performing Database Recovery (continued)

d) The startup of the instance fails with Enterprise Manager, and you can get no other
information to explain the failure. So use the command-line tools.

- Connect to the instance with SQL*Plus as sysdba and check the current status of the
instance.
sqlplus / as sysdba
select status from v$instance;

- The instance status is STARTED, which means that the database is in the NOMOUNT
stage. Attempt to mount the database by entering this:

a ble
SQL> alter database mount;
fe r
a n s
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
e) The instance cannot move to the@ iw s Stbecause it cannot find one of the control
mountistage
a leof the alert
files. Check the last 10hrows th log to see which control file is the problem.
b e
o d h. to us
SQL> host
( s ub tail
e n e $ORACLE_BASE/admin/orcl/bdump/aler*
s-10
h a le lic
o d h b Output:
sub SQL> host tail -10 $ORACLE_BASE/admin/orcl/bdump/aler*
ORA-205 signalled during: ALTER DATABASE MOUNT...
Sun Oct 30 13:35:01 2005
alter database mount
Sun Oct 30 13:35:01 2005
ORA-00202: control file:
'/u01/app/oracle/flash_recovery_area/ORCL/controlfile/o1_mf_1p4sbncs_.ct
l'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
Sun Oct 30 13:35:01 2005
ORA-205 signalled during: alter database mount...

Oracle Database 10g: Administration Workshop I B - 89


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 16: Performing Database Recovery (continued)

f) The control file in the Flash Recovery Area is missing. Restore the missing control file
by copying the existing control file, and then mount and open the database.
SQL> host
$ cd /u01/app/oracle/oradata/ORCL/controlfile
$ ls -l
total 6908
-rw-r----- 1 oracle oinstall 7061504 Oct 30 13:32 o1_mf_1p4sbn1o_.ctl
$ cp o1_mf_1p4sbn1o_.ctl
/u01/app/oracle/flash_recovery_area/ORCL/controlfile/o1_mf_1p4sbncs_.ctl
$ exit

SQL> alter database mount;


a ble
fe r
a ns
SQL> alter database open;
n- t r
no
g) Why did you have to use two commands to move the instance state from NOMOUNT to
a
OPEN? h a s
m ) e.
Answer: Because the ALTER DATABASE commandcenables o
.c Gyouuitodchange only one state
g i
level per command
r e lo ent
h) Why did you use operating system i a
wcommandsS tutodrestore the control file instead of using
Oracle Recovery Manager? a l e@ this
h . bh use
Answer: Becauseoall
b d control tfiles
o are identical. As long as any one control file is intact, it
u restore
can be usedsto e
nthes others.
e ( c e
hal li
h b
b o d
su

Oracle Database 10g: Administration Workshop I B - 90


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 16: Performing Database Recovery (continued)

2. Recover from the loss of an application data file.

a) Start a SQL*Plus session as the DBA1 user, and run the lab_16_02.sql script. This
script deletes one of your application data files.
$ sqlplus dba1/oracle @$HOME/labs/lab_16_02.sql

b) The Help desk has received a call from a user who is unable to access the COUNTRIES
table in the HR application schema. Count the rows in the table to see whether there is a
problem.

SQL> select count(*) from HR.COUNTRIES;


a ble
select count(*) from HR.COUNTRIES
fe r
*
a ns
ERROR at line 1:
n- t r
ORA-01116: error in opening database file 5
ORA-01110: data file 5: a no
h a
'/u01/app/oracle/oradata/ORCL/datafile/o1_mf_example_1p4sd3y2_.dbf' s
ORA-27041: unable to open file
m ) e.
o
Linux Error: 2: No such file or directory
Additional information: 3 g i c.c t Guid
a relo uden
iw The
c) Troubleshoot and recover as necessary. S t message suggests that the data file for
error
the EXAMPLES tablespacelis @ s
e corruptthorimissing. Using operating system commands,
h a
verify that there is a.b
h sethe file.
problem with
u
b o d to
SQL> host ls
su cens e
(
/u01/app/oracle/oradata/ORCL/datafile/o1_mf_example_1p4sd3y2_.dbf
e
b
Noh such fileli or directory
ls:al/u01/app/oracle/oradata/ORCL/datafile/o1_mf_example_1p4sd3y2_.dbf:

o d h
sub d) Recover the data file to the current time, specifying the missing data file to be
recovered.

- In Enterprise Manager, select Maintenance > High Availability > Backup/Recovery


> Perform Recovery.

- Select Datafiles from the Object Type drop-down list.

- In the Object Level Recovery region, select Recover to current time for the
Operation Type.

- Enter the host credentials as oracle and oracle for Username and Password,
and then click Perform Object Level Recovery.

Oracle Database 10g: Administration Workshop I B - 91


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 16: Performing Database Recovery (continued)

- On the Datafiles page, select the data file in question.

- Click Next.

- Because the problem is simply a deleted file rather than a bad hard drive, there is no
need to restore the file to a different location. Select No. Restore the files to the
default location, and then click Next. le
r a b
- Click Submit. (It will take one or two minutes for the operation to complete.)
ns fe
t r a
n-
e) When you see the Operation Succeeded message, ensure that the restored data file is
no
online.
s a
h a
) Administration
- In Enterprise Manager, select Administration > Database
o m d e . > Storage
> Datafiles.
i c
c. t Gu i
g
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

f) Verify that the COUNTRIES table is now accessible.


SQL> select count(*) from HR.COUNTRIES;

COUNT(*)
----------
25

Oracle Database 10g: Administration Workshop I B - 92


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 16: Performing Database Recovery (continued)

3. Recover from the loss of a system data file.

a) Why is recovery from the loss of a system data file or a data file belonging to an undo
tablespace different from recovering an application data file?

Answer: Because recovery of system or undo data files must be done with the database
closed, whereas recovery of an application data file can be done with the database open and
available to users.

b) As SYSDBA, run the lab_16_03.sql script. This script deletes the system data file.
SQL> @lab_16_03.sql
a ble
PL/SQL procedure successfully completed. fe r
a ns
ORACLE instance shut down.
n- t r
SQL>
a no
h a s
c) In Enterprise Manager, review the Database home page. The ) e. is shut down, so
database
you click Startup to try to open it. If you see a message m
co inthattheusays
d the connection was
ibrowser.
refused, dismiss it, and reenter the EM home g i
pagec.URL t G
r e l o e n
- Enter the host credentials as oracle
i tud for the host Username and
wa andSoracle
Password, and enter DBA1le @oracle
and
h isfor the database credentials, and then click
a t
OK.
h . bh use
b o d to
su cens e
e (
l li
h bha
o d
sub

- Click Yes.

Oracle Database 10g: Administration Workshop I B - 93


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 16: Performing Database Recovery (continued)
d) This command will fail with the database left in the MOUNT state, because there is a
data file missing from the SYSTEM tablespace.

e) Click Perform Recovery.


a ble
- If prompted, enter host (oracle/oracle) and database (dba1/oracle AS fe r
a ns
SYSDBA) credentials, and then click Continue.
n- t r
- In the Object Level Recovery region, select Datafiles for Object Type.
a no
h a s
- Select Recover to current time for Operation Type. )
c o m ide.
- Fill in the host credentials if not already set,ic . thenG
and u Perform Object Level
click
g t
Recovery.
a relo uden
- Select the data file for the SYSTEM S t and then click Next.
iw stablespace,
le @ i
- Because the problem h ais e
simply a
thdeleted file rather than a bad hard drive, there is no
h . b u s
b o d to a different
need to restore to Nextlocation. Select No. Restore the files to the default
su cens
location , and theneclick .
e (
li . It will take three to four minutes for the operation to complete.
ha- l Click Submit
h b
o d f) When you see the Operation Succeeded message, click Open Database.
sub g) After you see the success message, click OK, and then verify that the database is open
and operating normally by logging into EM as DBA1/oracle, as SYSDBA, and
reviewing the Database home page.

Oracle Database 10g: Administration Workshop I B - 94


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 17: Performing Flashback

Background: You decide to gain hands-on experience in some of the flashback functionality.
To avoid impacting other users, you will first copy the DEPARTMENTS table of the HR schema
to DEPARTMENTS2.

1. Log in to SQL*Plus as DBA1 user and create a new HR.DEPARTMENTS2 table based on
the HR.DEPARTMENTS table.

a) Log in to SQL*Plus as dba1/oracle.


$ sqlplus dba1/oracle

b) Enter the following command to create the copy table:


a ble
fe r
SQL> create table hr.departments2 as select * from hr.departments;
n s
n - tra
c) Count the rows in the DEPARTMENTS2 table. There should be 27 rows.
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St
2. Drop the HR.DEPARTMENTS2 a letable, and i verify that it has indeed been dropped.
ththen
.b h e
d h t o us
o
ub ense
( s
h a le lic
o d hb
sub

3. Use the FLASHBACK TABLE command to restore the table. Count the rows in the
DEPARTMENTS2 table.

Oracle Database 10g: Administration Workshop I B - 95


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 17: Performing Flashback (continued)

4. Run the lab_17_04.sql script to insert three rows into the HR.DEPARTMENTS2 table
by using three separate transactions. The new rows have DEPARTMENT_ID values of 280,
290, and 300.
SQL> @lab_17_04.sql

5. Use Enterprise Manager to perform flashback to the version of the table where only the first
of the three new rows is present (with DEPARTMENT_ID = 280). First, evaluate row
changes to decide on a point in time. Limit your analysis to the new rows just added: where
department_id >= 280. If you receive an error while performing the flashback, you
may need to enable row movement on the table. See the next step.
a ble
a) In Enterprise Manager, select Maintenance > High Availability > Backup/Recovery >
fe r
Perform Recovery.
a ns
n- t r
o
b) Select Tables from the Object Type drop-down list, and then select Flashback
an
Existing Tables for Operation Type. Click Perform Object Level Recovery.
s
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

c) Select Evaluate row changes and transactions to decide on a point in time, and enter
HR.DEPARTMENTS2 as the fully qualified name of the table in the Table field, and
then click Next.
Oracle Database 10g: Administration Workshop I B - 96
Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 17: Performing Flashback (continued)

d) Highlight DEPARTMENT_ID under Available Columns, and then click the Move
button to move it under Selected Columns. Under Step 2, enter a WHERE clause that
will select the added rows. For example, earlier you added rows with
DEPARTMENT_IDs of 280, 290, and 300, so the “WHERE department_id >=
280” clause is suitable.

a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
e) a
h le Next toliccontinue.
Click

o d hb f) You can now review the rows under Flashback Versions Query Result.
sub

g) Under Flashback Versions Query Result, select the middle transaction from the list to
flash back. Click Next to continue.

Oracle Database 10g: Administration Workshop I B - 97


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 17: Performing Flashback (continued)

h) On the next page, you are asked to include any tables related to or dependent on the
table that you are flashing back. Because there are none, click Next to continue.

a ble
fe r
a n s
n- t r
a no
h a s
i) Review the SQL statement that you are about to execute. Click) Show . SQL, view the
SQL statement, click OK, and then click Submit. com e
g i c. t Guid
a relo uden
@ iw s St
h a le
e t hi
h b that the
6. On the next page, you .find
u soperation has failed because row movement is not
b o d
enabled for the table. You may
t o recall from the lesson that row movement must be enabled
su tocwork.
for this feature ns e
e ( e
a)ha
l li
Note this error:
h b
b o d
su

b) To enable row movement for this table, select Administration > Schema > Database
Objects > Tables.

c) Enter HR in the Schema field and DEPARTMENTS2 in the Object Name field, and
then click Go.

Oracle Database 10g: Administration Workshop I B - 98


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 17: Performing Flashback (continued)

d) One table is displayed in the Results region and is selected by default. Click Edit.

The Edit Table page appears.

e) Click the Options tab. a ble


fe r
f) From the Enable Row Movement drop-down list, select Yes. a n s
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
g) Click Show SQL, and then
h a e thi .
leclick Return
d h .b us
o t o
( s ub ense
h a le lic
o d h bh) Click Apply to apply the change.
sub After the table modification is confirmed, you can perform the flashback operation.

Repeat step 5 to perform the version flashback of the table. Because row movement has
been enabled, it should succeed this time.

Oracle Database 10g: Administration Workshop I B - 99


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 17: Performing Flashback (continued)

i) In SQL*Plus, count the rows of the HR.DEPARTMENTS2 table to confirm the


flashback operation. Note that there is only one additional row now, not three. Then
display the rows where DEPARTMENT_ID >= 280. Note that only one of the original
three is remaining.

a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

Oracle Database 10g: Administration Workshop I B - 100


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 18: Moving Data

Background: In the recent past, you received a number of questions about the HR schema. To
analyze them, without interfering in the daily activities, you decide to use the Data Pump
Wizard to export the HR schema to file. When you perform the export, you are not sure into
which database you will be importing this schema.

In the end, you find out that the only database for which the management approves an import
for, is the ORCL database. So you perform the import with the Data Pump Wizard, remapping
the HR schema to a newly created HR_TEST schema in the HR_TEST tablespace. To follow
best practice guidelines, you also decide to create a DP user who will be a DBA performing
Data Pump jobs. For your convenience in class, the creation of the DP user is included in the
lab_18_01.sql script. SQL scripts are in the /home/oracle/labs directory. However,
there is one step missing. a ble
fe r
Then, you receive two data load requests for which you decide to use SQL*Loader. a ns
n- t r
1. Review the lab_18_01.sql script, which creates the HR_TEST tablespace, the
a no
HR_TEST_ROLE role, and the HR_TEST and DP users. h a s
m ) e.
a) Double-click the oracle’s Home icon on your desktop, o uid labs, and then
.c double-click
double-click lab_18_01.sql to reviewlo g i c
this script.nt G
a r e de
i w t u
l e @ his S
b) Note the passwords for these users.

HR_TEST password: . b ha se t
hr_4test
o d h to u
( s ub dp_4test
DP password:
e n se
h a le l ic
h bc) Which additional step do you need to perform to allow the DP user access to Enterprise
o d Manager as Administrator?
sub
You need to log in to Enterprise Manager as the SYS user in the SYDBA role and make the
DP user an EM Administrator (as you learned in the lesson titled “Managing the Oracle
Instance”).

d) Close the lab_18_01.sql window.

2. Execute the lab_18_02.sh script. Then, perform the required step to make the DP user
an EM administrator.

a) Right-click your desktop and select Open Terminal. Then navigate to the
/home/oracle/labs directory by entering cd labs.

b) Enter ./lab_18_02.sh to create the HR_TEST tablespace, the HR_TEST_ROLE


role, and the HR_TEST and DP users.

c) Log in to Enterprise Manager as the SYS user in the SYSDBA role.

Oracle Database 10g: Administration Workshop I B - 101


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 18: Moving Data (continued)

d) Make the DP user an EM Administrator (as you learned in the lesson titled “Managing
the Oracle Instance”). (Select Setup > Create > Enter Name: DP, Password:
dp_4test, Super Administrator, checked > Click Finish > Finish > Logout.)

a ble
fe r
a ns
n- t r
a no
h a s
m ) e.
3. Log in to Enterprise Manager as the DP user in the Normal o
.c Guand
role id export the HR schema.
i
g ntc
a) Invoke Enterprise Manager as the DP user e
r thel o
in e role for your ORCL database.
The Connect As setting should be
a
iwNormal. t u dNormal

@ i s S
l e t h
If this is the first time that
. b htheaDP user
s e logs in, click I agree to accept the licensing
agreement.
o d h to u
b) Select ( s ub ens>eData Movement > Move Row Data > Export to Export Files.
Maintenance
h a le lic
o d h bc) Select Schemas, enter oracle as Username and Password, select Save as Preferred
sub Credential, and then click Continue.

d) On the Export: Schemas page, click Add, select the HR schema, and then click the
Select button.

e) Click Next.

Oracle Database 10g: Administration Workshop I B - 102


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 18: Moving Data (continued)

f) On the Export: Options page, select DATA_PUMP_DIR from the Directory Object
drop-down list, and enter hrexp.log as Log File.

g) Review Advanced Options, but do not change, and then click Next.

h) On the Export: Files page, select DATA_PUMP_DIR from the Directory Object drop-
down list, enter HREXP%U.DMP as File Name, and then click Next.

i) On the Export: Schedule page, enter hrexp as Job Name and Export HR schema
as Description, accept the immediate job start time, and then click Next.

j) On the Export: Review page, click Show PL/SQL and review the PL/SQL that the
a ble
Export Wizard helped you to create.
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

k) Click Submit Job.

A processing message appears, and then a success message. If not, resolve any errors,
which may have occurred.

l) When the Job Activity Confirmation page appears, click the HREXP job name, and
then monitor the job progress by clicking the browser’s Reload button.

Note: Please wait, not only for the job to be created, but also for the job to complete
execution. (It may take two minutes.)

4. As the DP user, import the exported HR schema back into the ORCL database, remapping it
to the previously created HR_TEST schema.
Oracle Database 10g: Administration Workshop I B - 103
Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 18: Moving Data (continued)

a) Invoke Enterprise Manager as the DP user in the Normal role for your ORCL database.

b) Select Maintenance > Data Movement > Move Row Data > Import from Export
Files.

c) On the Import: Files page, select DATA_PUMP_DIR from the Directory Object drop-
down list, and enter HREXP%U.DMP as File Name.

d) Select Schemas as the Import Type.

e) Confirm oracle as your Host Credentials, and then click Continue.

a ble
At this point, the export file is read, to verify the contents. Wait for this to complete.
fe r
a ns
f) On the Import: Schemas page, click Add, select HR, and then click Select.
n- t r
g) Click Next. a no
h a s
h) On the Import: Re-Mapping page, click Add Another m ) undereRe-Map
Row . Schemas.
Then select HR_TEST as Destination Schema. c. c o u i d
g i t G
lo en , enter HR_TEST as Destination
reTablespaces
Tablespace. i w Stud
i) Click Add Another Row under Re-Mapa
a l e@ this
h . bh use
b o d to
su cens e
e (
l li
h bha
o d
sub

j) Click Next.

Oracle Database 10g: Administration Workshop I B - 104


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 18: Moving Data (continued)

k) On the Import: Options page, select DATA_PUMP_DIR from the Directory Object
drop-down list, enter hrimport.log as Log File, review the advanced options, but
leave them at their default values, and then click Next.

l) On the Import: Schedule page, enter hrimp as Job Name and Import HR schema
for test purposes as Description.

m) Select Later as Start and enter a time between 2 and 5 minutes from now (to give
yourself time for the following steps):

- Click Next.
a ble
- On the Import: Review page, review the PL/SQL that the Data Pump Wizard creates
fe r
for you, and then click Submit Job.
a ns
n- t r
no
- After the confirmation that the job was successfully created, note the job name (for
a
example HRIMP), and navigate to Maintenance > Data Movement > Move Row
s
Data > Monitor Export and Import Jobs. h a
) e.
o m
- Click your last job (for example, HRIMP). gic.
c
G uid
r e lo ent
- On the “Monitor Data Pump job”wpage,
i d in your browser, when it is time
a clicktuReload
S
to execute your job.
a l e@ this
h . bh use
b o d to
su cens e
e (
hal li
h b
o d
sub

Oracle Database 10g: Administration Workshop I B - 105


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 18: Moving Data (continued)

- Optional,as this requires quick action: Click Change Job State.

- Optional (continued): Click Suspend and later Resume to halt the job and then to
continue it again.
a ble
fe r
n) In the end, you want to see that your job executed 100% without any errors.
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub
o) Click OK.

p) Verify that the import succeeded by viewing the log file.


$ cat </u01/app/oracle/product/10.2.0/db_1/rdbms/log/hrimport.log

Note: You may see an error saying that the hr_test object already exists. This is because
that user existed when you did the export, and still exists. This is not a problem.

q) Using SQL*Plus, connect to the database as the HR_TEST user.


$ sqlplus hr_test/hr_4test

r) Select data from tables in the hr_test schema, for verification of the import.
SQL> select * from jobs;
Oracle Database 10g: Administration Workshop I B - 106
Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 18: Moving Data (continued)

5. As the DP user, load data into the PRODUCT_MASTER table by using SQL*Loader via
Enterprise Manager Database Control.

a) Invoke Enterprise Manager as the DP user in the Normal role for your ORCL database.

b) Select Maintenance > Data Movement > Move Row Data > Load Data from User
Files.

c) Click Use Existing Control File.

d) If you have not done so before, enter oracle as Username and as Password, click
Save as Preferred Credential, and then click Continue.
a ble
fe r
e) On the Load Data: Control File page, enter
a ns
/home/oracle/labs/lab_18_05.ctl as control file name and path, or use the
n- t r
flashlight icon to select this control file. Click Next.
a no
f) On the Load Data: Data File page, click Provide the full path h a s name on the
and
m
database server machine and enter /home/oracle/labs/lab_18_05.dat
) e. as
. c o u i d
data file name and path, or use the flashlight icon
l o gicto select
n t Gthis data file. Click Next.
e Conventional
raccept e
g) On the Load Data: Load Method page,
i w Stud
a Path, and then click Next.
l @ accept
epage, h isall defaults, but enter
h) On the Load Data: Options a t
h . bh use
/home/oracle/labs/lab_18_05.log as log file name and path.
o d t o
i) Review ( s ubadvanced
the e n seoptions, but do not change any, and then click Next.
h a le lic
h b
o d
sub

Oracle Database 10g: Administration Workshop I B - 107


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 18: Moving Data (continued)
j) On the Load Data: Schedule page, enter lab_18_05 as Job Name and Load data
into the PRODUCT_MASTER table as Description. Let the job start
immediately, and then click Next.

a ble
fe r
a ns
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
k) On the Load Data: Review page, ireview t
w theSloading information and parameters, and
then click Submit Job. ale
@ h i s
h e t
. b s
u your lab_18_05.log file in your
h by tviewing
o d
l) Confirm your results o
s ub ense directory.
/home/oracle/labs
(
6. As
h a le
the INVENTORYlic user, load data into the PRODUCT_ON_HAND table by using
h bSQL*Loader command line.
o d
sub a) Invoke a terminal window and navigate to the /home/oracle/labs directory.
b) Enter the following SQL*Loader command (in continuation, without pressing [Enter]
before reaching the end of the command): sqlldr
userid=inventory/verysecure control=lab_18_06.ctl log=lab-
_18_06.log data=lab_18_06.dat.
sqlldr userid=inventory/verysecure control=lab_18_06.ctl
log=lab_18_06.log data=lab_18_06.dat

SQL*Loader: Release 10.2.0.1.0 - Production on Tue Aug 02 22:24:44


2005

Copyright © 1982, 2005, Oracle. All rights reserved.

Commit point reached – logical record count 64


Commit point reached – logical record count 82
Commit point reached – logical record count 83

Oracle Database 10g: Administration Workshop I B - 108


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Solutions for Practice 18: Moving Data (continued)
c) Confirm your results by viewing your lab_18_06.log file in your
/home/oracle/labs directory.

Congratulations!
You completed all practices for the
Oracle Database 10g: Administration Workshop I

a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

Oracle Database 10g: Administration Workshop I B - 109


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
___________________

Appendix C
Basic Linux and
vi Commands
___________________

a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
vi Commands

The Visual Interpreter/Editor (vi) is the most widely used text editor available for the UNIX environment.
While almost everybody curses its unwieldy command syntax, it is still the only editor almost certain to
be included with every version of the UNIX and Linux operating system. The following are a partial list
of available vi commands.

vi has two modes. Command line (where anything typed is taken as an editing command) and input mode
(where everything typed will be treated as part of the file being edited. To enter the input mode, type a, A,
i, I, o, O, c, C, s, S, r, or R. To return to the command line mode, use the <ESC> key. To access the vi
editor from SQLPlus, enter the following command:

SQL>define _editor=vi
ab le
To edit a file from SQLPlus prompt, edit <filename> (press enter), from the Linux command prompt, vifer
<filename> (press enter) a n s
n -t r
o
To MOVE the cursor:
s an
h - move left j - move down k - move up
)l -h a right
move

c o m ide.
w - one word forward b - one word backward
g i c. t Gu
e - end of current word

relo uden
W, B, or E - same as lower case but ignores punctuation
a
iw$ - end S t
@
0 (zero) - Move to beginning of current line s of current line
h a le
e thi
G - go to last line of file
d h .b u s H - go to top line on the screen
b oscreen se t o
( s u
L - go to last line on
e n M - go to middle line on the screen

a
/<string>
h lic to the next occurrence of <string>
le- Search forward
h b
b d
o ?<string> - Search backward to the next occurrence of <string>
s u
n - Repeat previous search N - Repeat previous search in opposite direction

<ctrl> f - Scroll forward one page <ctrl> b - Scroll backward one page

To UNDO previous changes:

u - Will undo the most recent change. U - Will undo the most recently deleted text.

:e! - re-edit current file without saving any changes made since last change

To ENTER NEW text:

a - Append text after the current cursor position.

A - Append text to the end of a line (jumps to end of line and begin appending).

c - Change object C - Change from current cursor position to end of the line

i - Insert text before the current cursor position. I - Insert text at the beginning of a line.

Oracle Database 10g: Administration Workshop I C - 2

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
o - Insert a blank line BELOW the current cursor position.

O - Insert a blank line ABOVE the current cursor position.

r - Replace character at current cursor position R - Replace all characters until <ESC> is pressed

s - substitute text for character under cursor

:s/A/B/opt substitutes string B for string A. %s/A/B/opt is global replace

options include: g (change all occurences on current line) c (confirm prior to each change)

p (print changed lines) S - Substitute entire line to the end

. <period> - repeat last change n. <integer><period> repeat last change n times


a ble
To leave the input mode, press <ESC> fe r
a n s
To DELETE existing text: n- t r
a no
x - Will delete the character directly under the current cursor location.
h a s
dd - Will delete the entire line where the cursor is located. m ) e.
o uid
dnd (where n is some integer) will delete n lines from currentg i c.cposition
G
r e lo entcursor

dw - delete current word i wDa- delete d of current line


ttouend
@this linehiand S
s the next
a l
J - Delete return at end of current line. eJoin t
h . bh use
d lines to
<int> J - Join the nexto<int>
b
( s u ense
COPY, CUT,
h a leand
be manipulated
PASTE:
lic vi uses a single buffer where the last changed or deleted text is stored. This text may
with the following commands:
h b
b d
o Y - Yank a copy of the current line y <integer> - Yank a copy of next <int> lines
s u
yw - Yank a copy of the current word yb - Yank a copy of the previous word

p - Put buffer contents after cursor P - Put buffer contents before cursor

Also, see the s and S commands under the input section

To SAVE edited changes to an operating system file:

zz - Will terminate edit mode. :w filename - Will save changes to the filename specified.

:wq - Write all changes and quit the edit mode

To QUIT without saving changes:

ZZ - Will terminate edit mode. :q! - Will terminate the file without saving changes.

Oracle Database 10g: Administration Workshop I C - 3

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Basic Linux Commands

This appendix is meant to serve only as a quick reference while you are in class. For more
details on these commands, consult the man pages, your Linux documentation, or other
Linux command reference books.
Files and Linux Commands Description/Comments
Directories
Command man <command> Find the manual entry for this
manual <command>.
man –k <string> Show all the manual entries that
contain this <string>.
man man Displays the manual page for
a ble
man.
fe r
Command info <command> Show the information system entry
a n s
information t
for this command. Using info
n- r
no
info shows a tutorial of the info
a
documentation system.
s
Print to cat <file> h
) and a
standard out
Concatenate
o m d e . print – print the
i c
c. named i
u to the terminal screen.
file
g t G
List users cat /etc/password
a r elo den
Change
working
cd <directory>
@ iw s Stu Change working directory to
specified directory
a l e t h i
directory
h . bh use cd with no parameters changes to
$HOME.
o d t o
Copy a file ubcp <source_file>
se Copy a source file to a destination
( s e n file.
h a le l ic <file>
<destination_file>

View a file View a file a page at a time. This


hb
less

b o d is a GNU version of more, or pg.


su View a file more <file> View a file a page at a time. BSD
version.
List directory ls <directory>
Options –l long listing, -R
recursive, -a show hidden files, -t
sort by time, -r reverse sort,
default directory is current
working directory.
Create a mkdir <directory> Make a directory defaults into the
directory current working directory, full
path may be specified.
Move or mv <old_file> <new_file> Move changes the name of a file
rename a file or moves it to a different directory.

Oracle Database 10g: Administration Workshop I C - 4

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Process List ps Shows the processes report
ps -ef Shows all processes on the system
with a full listing. Many option
exist see the man page for details.
Print working pwd Print to stdout the current working
directory directory.
Remove or rm <file> Removing a file on Linux is
erase a file permanent. Options –r recursive,
and –f force (including
subdirectories) are very a ble
dangerous. Often the rm fe r
a n s
command is aliased with -rm
n r
t –i
The option –i asks n o
‘Are you sure?’
Create an empty Create a file.s a
ha
touch <file>
file )
m theidname e .
Name of the hostname c o
. Gu
Returns of the machine.
machine g i c t
The IP address host <machine_name> are
lo eQueriesn
i w t u d the Domain Name Server,
of the machine
l e @ his S and returns the IP address of the
h a e t machine name.
Remote shell rsh h b
<host> us
. <command> Execute a <command> on <host>.
o d
bssh <host> t o Rsh is not secure, use ssh instead.
s u n s e
a l e ( lice
Remote shell Secure shell, has features to
replace rsh, rcp, ftp, and telnet.
b h
o d h Remote shell telnet <host> Start a terminal session on <host>.
sub Telnet is not secure use ssh
instead.
Search a file for grep <option> <pattern> <file> Search a <file> or stream for a
a pattern regular expression defined by
<pattern> and show the line that
contains that pattern. A common
option is –i for case insensitive.
grep can accept input from a file
or stdin through a pipe as in:
netstat –a| grep ESTABLISHED
Source a script . <script_file> In the bash shell this command ‘.’
forces the script to run in the shell.
Normal behavior is for the script
to run in a child shell.

Oracle Database 10g: Administration Workshop I C - 5

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
An interpreter awk A macro language for reformatting
or interpreting input. For each line
of input, a variety of actions can
be taken. May be referred to as
nawk – for “new awk.”
Sort a file sort Sort a file takes input from stdin or
a filename argument, many
options to sort by a particular
column, field, etc. See man page.
Command line sed Sed is a command line editor, with a ble
editor many possible commands and fe r
options that are very good for a ns
n- t r
editing from a shell script.
o
Visual editor vi <file> an
Terminal based editor available on
s
ha
every Unix system, Linux provides
)
c o m ide.
vim, an improved vi, that is a
g i c. t Gu
superset of vi.
Gnu editor
relo uden This is a GPL editor with
emacs <file>
a
iw s St extensive customizable features
@ available on most UNIX and
h a le
e thi Linux distributions.
WSIWIG editor gedit h b
.<file> us A full-screen editor, requiring X.
o d t o
( s ubkateen<file>
se Available under Gnome.
WSIWIG A full-screen editor, requires X.
h a le lic Available under KDE
o d hb Terminal output
stdout Standard out (stdout), is not a
sub command but a concept, most
Linux commands write to stdout
by default unless redirected.
Terminal input stdin Standard in (stdin), is not a
(keyboard) command but a concept, most
Linux commands read from stdin
by default unless redirected.
Alias alias <command> <alias> Make a substitution when a user
types <command> substitute and
execute <alias>, common alias is
alias ‘rm’ ‘rm –i’. These aliases
are set in the .bashrc file.
Show shell set Prints all of the variables that are
variables currently defined in the shell.

Oracle Database 10g: Administration Workshop I C - 6

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Show printenv or env Prints all the environment
environment variables – an environment
variables variable has been ‘exported’ so
that it will be inherited by child
processes.
File Creation umask –S u=rwx,g=rx,o=rx Set the default permissions for all
mask files created by this shell or its
children. The –S option uses the
symbolic notation, the numeric
notation is obsolete.
a ble
Clock An X client that shows a clock on fe r
xclock
a ns
the screen. Often used to test the X
n- t r
windows system. o
X access xhost an
Show the current access control in
s
control xhost +<Xclient>
ha
place.
)
c o m ide.
Add a Xclient that is allowed to
g i c. t Gu
access the local DISPLAY, if no

a relo uden <Xclient> is given all are allowed.

@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

Oracle Database 10g: Administration Workshop I C - 7

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
System Linux Commands Description / Comments
Administration
Root file system / The root directory for the system
directory tree.
Home Directory /home Typically the directory in which
all user home directories placed.
For example: /home/oracle.
Tmp directory /tmp A temporary storage area. Do
notput anything here you want to
keep. SA often have a cron job to a ble
fe r
remove everything periodically.
a ns
Boot directory /boot t r
A small partition to hold the kernel
n-
o
image(s) and boot loader
an
instructions.
s
Log directory /var/log ha
The location of most system log
)
c o m ide.
files.
Sample /etc/inittab g i c. t Gu
Configuration files are located per
configuration
a relo uden the application. Any configuration
files
@ iw s St file that you change after

h a le
e thi installation should be included in
the backup.
d h .b us
Password files /etc/passwd
o t o The /etc/passwd file holds
( s ub/etc/shadow
e n se user information and must be

h a le lic readable by others; even with

o d hb encrypted passwords this can be a


security hole. The /etc/shadow
sub file holds the encrypted passwords
and is only readable by root.
Groups file /etc/group The /etc/groups file defines
the groups on a server and the
users that are members of the
group; primary group for a user is
defined in the /etc/passwd
file.
X configuration /etc/X11/XF86Config The file that sets the X server
file settings for your video card,
monitor, mouse, and keyboard.
Usually set up with a vendor
supplied tool, such as sax2.

Oracle Database 10g: Administration Workshop I C - 8

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Schedule a crontab -e Use this command to edit the
command to run crontab file, to create the
at a regularly specification for the cron daemon
scheduled time to use.
Schedule a /etc/anacrontab Edit the file to specify a script to
script to run at a run at a particular frequency (see
particular man anacrontab for details).
frequency
Schedule a at <options> TIME Runs a job specified by <options>
command to run at a specified TIME parameter. a ble
at a single fe r
specified time a n s
n- t r
Schedule a batch <options> <TIME> o
Run a command when the load
command an
average drops below .8, optionally
s
ha
after a set TIME.
)
Mount a file m ide.
mount <opt> <dev> <mount_point> Mount a file system on device
c o
system
g i c. t Gu
<dev> at <mount_point> with the

a relo uden options specified by <dev>.


Unmount a file umount <dev>
@ iw s St Unmount the file system or device.
system le thi
umount <mount_point>

Maximum # of 65535 h a e
d h .b us
user ID
o t o
( s ub ense
Recover root {lilo} This is a procedure to recover the

hal
e
password lic
control-x
linux S
root password if is lost. This
h b passwd root requires physical access to the
o d machine and system console. You
sub start by rebooting the machine,
then during the LILO boot press
{grub}
and hold [Ctrl] + [x] to get a
c prompt and command LILO to
kernel vmlinuz-2.4.9-13 single boot linux to runlevel S.
ro root=/dev/hda8
initrd /initrd-2.4.9-13.img The second procedure uses the
boot
passwd root grub boot loader.

Create new user useradd The –D option alone shows the


defaults.
–D with other options changes the
defaults options; without –D
override, the default (e.g., –g) sets
a primary group.

Oracle Database 10g: Administration Workshop I C - 9

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Delete user userdel Remove a user and optionally all
files belonging to the user.
Modify user usermod Change /etc/password
account information.
Create new groupadd –g sets the group id; default is first
group free value above 500.
Delete group groupdel Remove a group from the system.
May not remove a group that is a
primary group for a user. Files
owned by deleted group must be a ble
manually changed with chown. fe r
a ns
Change run init <runlevel> The init command causes the
n- t r
levels o
rcN.d scripts to be evaluated, for
an
the change in run level. init 6
s
ha
forces a reboot.
)
Synchronize the sync c o m ide.
Forces the buffer cache and page
disks g i c. t Gucache to write all dirty buffers to
a relo uden disk. Used just before a reboot to

@ iw s St prevent disk corruption.


Shutdown the shutdown <mode>
h a e t hi
le <delay> Do a graceful shutdown of the
Linux system
d h .b us system, shut down processes, run
o t o all shutdown scripts, and sync
( s ub ense disks. The modes are –r, reboot

h a le lic and –h, halt. The delay is a


required parameter is a number in
o d hb seconds or ‘now’. Option
sub shutdown warning message may
be sent as well.
Error logs dmesg View boot messages. This log is
circular, and limited system errors
could overwrite boot information
after a time.
Network IP /etc/sysconfig/network- This directory holds scripts
configuration scripts/ executed as part of the boot up
sequence by rc.sysinit.
Hosts IP /etc/hosts A list of hosts that your machine
addresses knows about. Must at minimum
include the name of the local
machine and loopback IP.
Name service /etc/nsswitch.conf
switch

Oracle Database 10g: Administration Workshop I C - 10

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Network sysctl -a | grep net View all net parameters that are
parameters set for the kernel.
Routing routed
daemon
NIC ifconfig -a Show all the network devices
Configurations currently configured.
Secondary IP modprobe ip_alias
Address ifconfig eth0:1 IP
Login prompt /etc/issue Banner message user sees when
a ble
issued the login prompt.
fe r
YP/NIS service /sbin/ypbind n
Finds and attaches to a NIS server
a s
binder n- t
for name resolution and otherr
services.
a no
Module modinfo <options> <module>
h a s
Display information about kernel
information ) e.
modules: –l shows license, –p
m
o
.c Guid
parameters, –d description.
g i c
List modules lsmod
r e lo ent Show currently loaded modules.
Load module insmod
i w a
S t ud Load a loadable module.
Unload module rmmod
a l e@ this Unload a loadable module.
Install Software rpm -ivh
h . bh use
package
Install –i, verbose –v, with
b d
o se t o progress hash marks –h.
Uninstall (s u rpm
e n
-e package Erase package –e; will not
l e l i c
b hainstalled rpm -qa
software uninstall if dependencies exist.

o d h List Query –q, All –a, lists all installed


b software
su packages.
Verify installed rpm -V package Compares installed files with the
software rpm database information.
List all files rpm -ql package List all the files that are part of a
package.
Package owner rpm -qf file List the package when given the
full file name.
Machine model uname -m Shows CPU level (e.g., i686).
OS Level uname -r Shows kernel version.
Run Level runlevel Shows previous and current
runlevel.
Kernel sysctl -a Show settings of all settable kernel
Parameters parameters.
Max # File sysctl fs.file-max Shows the value of maximum number
Descriptors of file descriptor per process.

Oracle Database 10g: Administration Workshop I C - 11

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Kernel /etc/sysctl.conf Compiled in kernel parameters;
parameter may be reset at bootup by setting
settings them in this file.
Change Kernel echo <value> > </proc/<file> Write the new value of a kernel
Parameter parameter into the /proc file
system.
echo 2147483648 Set the value of the maximum size
>/proc/sys/kernel/shmmax of a shared memory segment.
Shared Memory sysctl kernel.shmmax Show the shmmax parameter.
Change Kernel sysctl –w <parameter>=<value> Change a kernel parameter; the –p a ble
fe r
Parameter s
option reads the setting from a file
a n
n- t r
and sets them. The default file is
o
an
/etc/sysctl.conf
Set Process ulimit <option> <value> Set limits on a shell and processes
s
limits ha
started by the shell. Users can
)
c o m ide.
make limits more restrictive;
g i c. t Gugenerally only root can make limit

a relo uden less restrictive; some options


require root privilege. Options: –u
@ iw s St sets number of processes, –n
h a le
e thi number of file handles; many
d h .b us others (see man bash).
o t o
Show processubulimitse Without options ulimit show the
limits le (
s cen current limit settings.
ha i <option>
lipcs
Interprocess
b Options: –m the current usage of
o d h Communication shared memory; –s usage of
sub (Shared semaphores; –a shows all.
Memory and
Semaphores)
Remove a ipcrm shm <shmid> Releases the shared memory
shared memory segment identified by <shmid>.
segment This is very dangerous. You can
corrupt a database that is using the
segment that is released.

Oracle Database 10g: Administration Workshop I C - 12

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
System Linux Commands Description / Comments
Performance
Performance top View real-time OS and process
monitor statistics.
System activity sar –<options> <interval> Options: –q shows CPU queue, –u
reporter <count> CPU utilization, –d device
activity, –n DEV network device
activity, many more (see man
page). Interval is in seconds.
Virtual Memory vmstat <interval> < count> Interval is in seconds. a ble
fe r
statistics
a n s
Virtual Memory cat /proc/meminfo Shows instantaneous virtual -t r
statistics memory usage. non
Kernel Cache cat /proc/slabinfo s a statistics:
Kernel slab allocator
statistics frequently
a
) h allocated cache objects
m .
i c .csuch ideIO
o as uinode,
asynchronous
dentries, and
buffers.
l o g n t G
I/O statistics iostat <option> <interval>
a re udeOptions: –d device activity, –c
<count>
@ iw s St CPU activity, –x extended disk
h a le
e thi activity statistics. The interval is in
seconds.
d h .b–P <cpu>
u s<count>
Multiprocessor mpstat
b o e t o Return CPU statistics for
Statistics su ns
<interval> particular processor or all CPUs in
e ( c e
h a l l64i GB(Theoretical) an smp system.

o d h bPhysical RAM Maximum physical RAM requires


enterprise kernel (Red Hat
sub Enterprise Linux AS 21 only
supports up to 16 GB).
Swap device swapon -s Shows devices currently in use for
swap. The swap device is arbitrary
designated at install. It may be
changed or added to. Multiple
swap devices may be created;
swap size should be at least as
large as physical memory.

Oracle Database 10g: Administration Workshop I C - 13

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Display swap free Show the current memory and
size swap usage.
Activate Swap swapon -a Turn on swap.
Free disk blocks df -k Measured in KB; use –m for MB
units.
Device listing cat /proc/devices List devices known to the system
by major and minor number.
Disk cat /proc/scsi/scsi0/sda/model View SCSI disk information.
information le
cat /proc/ide/ide0/hda/model View IDE disk information. r a b
Print network netstat <options> Print a wide variety of network
ns fe
t r a
statistics
n-
statistics (see man netstat).
o
Graphical
system statistics
xosview
s an
An X-based display of recent OS
statistics.
viewer ) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

Oracle Database 10g: Administration Workshop I C - 14

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Misc System Linux Commands Description / Comments
Information
NFS exported /etc/exports Database file are not supported on
simple NFS.
NFS Client /var/lib/nfs/xtab
mounted
directories
Max File 2 TB with 4KB block size (on 32 With ext3 and ext2, others vary.
System kernel)

Max File Size The oracle database can create a ble


2 GB {512B block size}
fe r
files up to 64 GB with a 16 KB
a n s
File size can not database block size.
n- t r
exceed file
system a no
The 32-bit kernel limits file and
2 TB {4KB block size}
h a s
block devices to 2 TB.
m ) e.
File System oDump the file system properties to
c.c t Guid
dumpe2fs <device>
Block size g i stdout.
Filesystem table /etc/fstab
a relo uden Mounts these file systems at boot

@ iw s St up.
Journal ext3
h a le
e t hi
Filesystem
d h .b us
types
b
reiserfs
o t o
Disk Label(su fdiskns -le fdisk is not available on all
e li c e
b h al distributions.

o d h Extend File
system
resize2fs Extending a file system is
applicable to only some file
sub resize_reiserfs
system types.
Backup tar cvf /dev/rst0 / Create a backup of the root / file
system.
Restore tar xvf /dev/rst0 Restore the root / file system.
Prepare boot /sbin/lilo Must be run after changing
volumes /etc/lilo.conf to push
changes to boot loader.
Startup script /etc/rc.d/rc
Kernel /boot/vmlinuz
Kernel Bits getconf WORD_BIT POSIX call to get kernel
information. There are many other
variables besides WORD_BIT.

Oracle Database 10g: Administration Workshop I C - 15

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Boot single user {lilo} Use LILO facility.
control-x
linux S

{grub}
c Use GRUB Boot Loader.
kernel vmlinuz-2.4.9-13 single
ro root=/dev/hda8
initrd /initrd-2.4.9-13.img
boot

Time zone /etc/sysconfig/clock


a ble
Management fe r
SW Directory Directory where rpm database are
a ns
/var/lib/rpm
kept. n- t r
Devices /dev a no
This directory holds all the device
files. h a s
CPU m ) e.
Shows CPU static information.
cat /proc/cpuinfo
o
Whole Disk /dev/sda
g i c.c t Guid
Device name.
CDROM /dev/cdrom
a relo uden Usually mounted at

@ iw s St /mnt/cdrom.
CDROM file iso9660
h a le
e t hi
type
d h .b us
Floppy drive
b o
/dev/fd0
e t o Usually mounted at
u
(s /proc en s /mnt/floppy.
a
Systeml e l i c The /proc filesystem is a memory-
b h
o d h information based file system that allows
access to process and kernel
sub settings and statistics.
Compile and make –f <file> <command> Use a make file <file> to
link a determine which parts of a large
executable program need to be recompiled,
and issue the commands required
to compile, link, and prepare the
executable for use.

Oracle Database 10g: Administration Workshop I C - 16

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
LVM Linux (UnitedLinux) Description / Comments
LVM Logical Volume Manager This package is not provided by Red Hat
Enterprise Linux AS 2.1 and may not be
added without tainting the kernel. Kernel
support is provided in United Linux.
LVM Concepts logical extents A Logical volume is made up of logical
extents.
logical volume A set of logical extents taken from a volume
group and presented to the OS as a disk
volume. These extents may be striped across
a ble
multiple disks. fe r
volume group ns
A set of physical disk partitions created by
a
n-
fdisk or the like, initialized witht r
o
an
pvcreate, then grouped into a physical
s
ha
volume with vgcreate.
)
Display volume vgdisplay -v
c o m ide.
group
g i c. t Gu
Modify physical
volume
pvchange
a relo uden
@ iw s St
Prepare physical pvcreate
disk h a le
e thi
List physical d h .b us
pvdisplay
o t o
volume
( s ub ense
Remove
h a ic
ledisk lvgreduce
from volume
o d hb group
sub Move logical pvmove
volumes to
another physical
volumes
Create volume vgcreate
group
Remove volume vgremove
group
Volume group vgchange
availability
Restore volume vgcfgrestore
group

Oracle Database 10g: Administration Workshop I C - 17

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Exports volume vgexport
group
Imports volume vgimport
group
Volume group vgscan
listing
Change logical lvchange
volume
characteristics
List logical a ble
lvdisplay
fe r
volume
a ns
Make logical lvcreate
n- t r
volume o
Extend logicallvextend s an
volume ) ha
Reduce logical c o m ide.
c. t Gu
lvreduce
volume g i
Remove logicallvremove
a relo uden
volume
@ iw s St
Create stripedlvcreate -i le3 -I 64thi
h a
volumes h . b u se
b o d to
su cens e
e (
hal li
h b
o d
sub

Oracle Database 10g: Administration Workshop I C - 18

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
____________________
Appendix D
SQL Statement Syntax
____________________

a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
SQL Statements
This excerpt from the Oracle Database SQL Quick Reference guide presents the syntax for
Oracle SQL statements. SQL statements are the means by which programs and users access data
in an Oracle database.

Table 1 shows each SQL statement and its related syntax. Table 2 shows the syntax of the
subclauses found in the table 1.

See Also: Oracle Database SQL Reference for detailed information about Oracle SQL
a ble
Table 1: Syntax for SQL Statements fe r
a ns
SQL Statement Syntax n- t r
o
ALTER CLUSTER ALTER CLUSTER [ schema. ]cluster
s an
ha
{ physical_attributes_clause
)
| SIZE size_clause
c o m ide.
g i c. t Gu
| allocate_extent_clause
| deallocate_unused_clause
relo uden
| { CACHE | NOCACHE }
a
}
@ iw s St
[ physical_attributes_clause

h a le thi
| SIZE size_clause
e
d h .b us
| allocate_extent_clause

o t o | deallocate_unused_clause

( s ub ense | { CACHE | NOCACHE }


]...

hal
e lic [ parallel_clause ] ;

h b
b d
o ALTER DATABASE ALTER DATABASE [ database ]
s u { startup_clauses
| recovery_clauses
| database_file_clauses
| logfile_clauses
| controlfile_clauses
| standby_database_clauses
| default_settings_clauses
| redo_thread_clauses
| security_clause
} ;

ALTER DIMENSION ALTER DIMENSION [ schema. ]dimension


{ ADD
{ level_clause
| hierarchy_clause
| attribute_clause
| extended_attribute_clause
}
[ ADD

Oracle Database 10g: Administration Workshop I D - 2

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
SQL Statement Syntax
{ level_clause
| hierarchy_clause
| attribute_clause
| extended_attribute_clause
}
]...
| DROP
{ LEVEL level
[ RESTRICT | CASCADE ]
| HIERARCHY hierarchy
| ATTRIBUTE attribute
[ LEVEL level [ COLUMN column
[, COLUMN column ]... ]
a ble
}
fe r
[ DROP
{ LEVEL level
a ns
[ RESTRICT | CASCADE ]
n- t r
| HIERARCHY hierarchy
a no
| ATTRIBUTE attribute
h a s
[ LEVEL level [ COLUMN column
m ) e.
[, COLUMN column ]... ]
o
c.c t Guid
}
]...
g i
| COMPILE
a relo uden
iw s St
} ;
@
ALTER DISKGROUP h a
ALTER e thi
leDISKGROUP
d h .b { disk_clauses
us | diskgroup_clauses }
o t o
ub ense
[ { disk_clauses | diskgroup_clauses } ]... ;
( s
h a le
ALTER FUNCTION lic ALTER FUNCTION [ schema. ]function
h b COMPILE [ DEBUG ]

b o d [ compiler_parameters_clause
su [ compiler_parameters_clause ] ... ]
[ REUSE SETTINGS ] ;

ALTER INDEX ALTER INDEX [ schema. ]index


{ { deallocate_unused_clause
| allocate_extent_clause
| shrink_clause
| parallel_clause
| physical_attributes_clause
| logging_clause
}
[ deallocate_unused_clause
| allocate_extent_clause
| shrink_clause
| parallel_clause
| physical_attributes_clause
| logging_clause
]...
| rebuild_clause

Oracle Database 10g: Administration Workshop I D - 3

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
SQL Statement Syntax
| PARAMETERS ('ODCI_parameters')
| { ENABLE | DISABLE }
| UNUSABLE
| RENAME TO new_name
| COALESCE
| { MONITORING | NOMONITORING } USAGE
| UPDATE BLOCK REFERENCES
| alter_index_partitioning
} ;

ALTER INDEXTYPE ALTER INDEXTYPE [ schema. ]indextype

le
{ { ADD | DROP }
[ schema. ]operator (parameter_types)
r a b
[, { ADD | DROP }
[ schema. ]operator (parameter_types) ns fe
t r a
n-
]...
[ using_type_clause ]
| COMPILE a no
} ;
h a s
m ) e.
o id
ALTER JAVA ALTER JAVA
{ SOURCE | CLASS g
c.c t Gu]object_name
} i[ schema.
[ RESOLVER rel
o en
( ( iw a
S t
match_stringud[, ] { schema_name | - } )
a l e@[]...t h is
( match_string [, ] { schema_name | - } )

h . bh u) se
b o d ]to
s e
u ens {| {invoker_rights_clause
COMPILE | RESOLVE }
(
h a le lic } ;
h b
o d
sub ALTER MATERIALIZED VIEW ALTER MATERIALIZED VIEW
[ schema. ](materialized_view)
[ physical_attributes_clause
| table_compression
| LOB_storage_clause
[, LOB_storage_clause ]...
| modify_LOB_storage_clause
[, modify_LOB_storage_clause ]...
| alter_table_partitioning
| parallel_clause
| logging_clause
| allocate_extent_clause
| shrink_clause
| { CACHE | NOCACHE }
]
[ alter_iot_clauses ]
[ USING INDEX physical_attributes_clause ]
[ MODIFY scoped_table_ref_constraint
| alter_mv_refresh
]

Oracle Database 10g: Administration Workshop I D - 4

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
SQL Statement Syntax
[ { ENABLE | DISABLE } QUERY REWRITE
| COMPILE
| CONSIDER FRESH
] ;

ALTER MATERIALIZED VIEW ALTER MATERIALIZED VIEW LOG [ FORCE ]


LOG ON [ schema. ]table
[ physical_attributes_clause
| alter_table_partitioning
| parallel_clause
| logging_clause

le
| allocate_extent_clause
| shrink_clause
r a b
| { CACHE | NOCACHE }
] ns fe
t r a
n-
[ ADD
{ { OBJECT ID o
| PRIMARY KEY
s an
| ROWID
) ha
| SEQUENCE
}
c o m ide.
i c. t Gu
[ (column [, column ]...) ]
g
relo uden
| (column [, column ]... )
}
a
iw s St
[, { { OBJECT ID
@
h a le
e thi
| PRIMARY KEY
| ROWID

d h .b us | SEQUENCE
o t o
ub ense
}
( s [ (column [, column ]...) ]

hal
e lic | (column [, column ]...)

h b }

o d ]...

sub
[ new_values_clause ]
] ;

ALTER OPERATOR ALTER OPERATOR [ schema. ]operator


{ add_binding_clause
| drop_binding_clause
| COMPILE
} ;

ALTER OUTLINE ALTER OUTLINE


[ PUBLIC | PRIVATE ] outline
{ REBUILD
| RENAME TO new_outline_name
| CHANGE CATEGORY TO new_category_name
| { ENABLE | DISABLE }
}
[ REBUILD
| RENAME TO new_outline_name
| CHANGE CATEGORY TO new_category_name

Oracle Database 10g: Administration Workshop I D - 5

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
SQL Statement Syntax
| { ENABLE | DISABLE }
]... ;

ALTER PACKAGE ALTER PACKAGE [ schema. ]package


COMPILE [ DEBUG ]
[ PACKAGE | SPECIFICATION | BODY ]
[ compiler_parameters_clause
[ compiler_parameters_clause ] ... ]
[ REUSE SETTINGS ] ;

ALTER PROCEDURE ALTER PROCEDURE [ schema. ]procedure


COMPILE [ DEBUG ]
a ble
[ compiler_parameters_clause
fe r
[ compiler_parameters_clause ] ... ]
a ns
[ REUSE SETTINGS ] ;
n- t r
o
ALTER PROFILE ALTER PROFILE profile LIMIT s an
) ha
{ resource_parameters | password_parameters }

c o m ide.
[ resource_parameters | password_parameters
]... ;
g i c. t Gu
lo en
reCOST
ALTER RESOURCE COST
w Stud
a
ALTER RESOURCE
i
e@ this
{ CPU_PER_SESSION
| lCONNECT_TIME
a
bh|| LOGICAL_READS_PER_SESSION
h . u se
b o d }to
PRIVATE_SGA
e
su cens integer
e (
h a l li [ { CPU_PER_SESSION

h b | CONNECT_TIME

o d | LOGICAL_READS_PER_SESSION

sub
| PRIVATE_SGA
}
integer
] ... ;

ALTER ROLE ALTER ROLE role


{ NOT IDENTIFIED
| IDENTIFIED
{ BY password
| USING [ schema. ]package
| EXTERNALLY
| GLOBALLY
}
} ;

ALTER ROLEBACK SEGMENT ALTER ROLLBACK SEGMENT rollback_segment


{ ONLINE
| OFFLINE
| storage_clause

Oracle Database 10g: Administration Workshop I D - 6

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
SQL Statement Syntax
| SHRINK [ TO integer [ K | M ] ]
};

ALTER SEQUENCE ALTER SEQUENCE [ schema. ]sequence


{ INCREMENT BY integer
| { MAXVALUE integer | NOMAXVALUE }
| { MINVALUE integer | NOMINVALUE }
| { CYCLE | NOCYCLE }
| { CACHE integer | NOCACHE }
| { ORDER | NOORDER }
}

le
[ INCREMENT BY integer
| { MAXVALUE integer | NOMAXVALUE }
r a b
| { MINVALUE integer | NOMINVALUE }
| { CYCLE | NOCYCLE } ns fe
t r a
n-
| { CACHE integer | NOCACHE }
| { ORDER | NOORDER }
]... ; a no
h a s
ALTER SESSION ALTER SESSION
m ) e.
{ ADVISE { COMMIT | ROLLBACK o
.cdblink | id
u NOTHING }
| CLOSE DATABASE LINK i c
g } nCOMMITt G IN PROCEDURE
e l o
| { ENABLE a|r DISABLE d}e GUARD
| { ENABLE | DISABLE

i w t u
S | FORCE } PARALLEL
l @ | DDL
{eDML h i s
| { ENABLE | DISABLE

h|a { ENABLE
e t RESUMABLE
| QUERY } [ PARALLEL integer ]
. b s
h to u[ TIMEOUT integer ] [ NAME string ]
o d
b nse |} DISABLE RESUMABLE
s u
a l e ( lice | alter_session_set_clause
b h } ;

o d h
b
su ALTER SYSTEM ALTER SYSTEM
{ archive_log_clause
| checkpoint_clause
| check_datafiles_clause
| DUMP ACTIVE SESSION HISTORY [ MINUTES integer ]
| distributed_recov_clauses
| restricted_session_clauses
| FLUSH { SHARED_POOL | BUFFER_CACHE }
| end_session_clauses
| SWITCH LOGFILE
| { SUSPEND | RESUME }
| quiesce_clauses
| shutdown_dispatcher_clause
| REGISTER
| SET alter_system_set_clause
[ alter_system_set_clause ]...
| RESET alter_system_reset_clause
[ alter_system_reset_clause ]...
} ;

Oracle Database 10g: Administration Workshop I D - 7

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
SQL Statement Syntax
ALTER TABLE ALTER TABLE [ schema. ]table
[ alter_table_properties
| column_clauses
| constraint_clauses
| alter_table_partitioning
| alter_external_table_clauses
| move_table_clause
]
[ enable_disable_clause
| { ENABLE | DISABLE }
{ TABLE LOCK | ALL TRIGGERS }
[ enable_disable_clause
| { ENABLE | DISABLE }
a ble
{ TABLE LOCK | ALL TRIGGERS }
fe r
]...
] ;
a ns
n- t r
o
ALTER TABLESPACE ALTER TABLESPACE tablespace
s an
{ DEFAULT
) ha
c o m ide.
[ table_compression ] storage_clause
| MINIMUM EXTENT integer [ K | M ]
i
| RESIZE size_clause
g c. t Gu
relo uden
| COALESCE
a
| RENAME TO new_tablespace_name
iw s St
| { BEGIN | END } BACKUP
@
h a le
e thi
| datafile_tempfile_clauses
| tablespace_logging_clauses

d h .b us
| tablespace_group_clause
o t o
ub ense
| tablespace_state_clauses
( s | autoextend_clause

hal
e lic | flashback_mode_clause

h b | tablespace_retention_clause

b o d } ;

s u ALTER TRIGGER ALTER TRIGGER [ schema. ]trigger


{ ENABLE
| DISABLE
| RENAME TO new_name
| COMPILE [ DEBUG ]
[ compiler_parameters_clause
[ compiler_parameters_clause ] ... ]
[ REUSE SETTINGS ]
} ;

ALTER TYPE ALTER TYPE [ schema. ]type


{ compile_type_clause
| replace_type_clause
| { alter_method_spec
| alter_attribute_definition
| alter_collection_clauses
| [ NOT ] { INSTANTIABLE | FINAL }
}

Oracle Database 10g: Administration Workshop I D - 8

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
SQL Statement Syntax
[ dependent_handling_clause ]
} ;

ALTER USER ALTER USER


{ user
{ IDENTIFIED
{ BY password [ REPLACE old_password ]
| EXTERNALLY
| GLOBALLY AS ’external_name’
}
| DEFAULT TABLESPACE tablespace

le
| TEMPORARY TABLESPACE
{ tablespace | tablespace_group_name }
r a b
| QUOTA { integer [ K | M ]
| UNLIMITED ns fe
t r a
n-
} ON tablespace
[ QUOTA { integer [ K | M ] o
| UNLIMITED
s an
} ON tablespace
) ha
]...
| PROFILE profile
c o m ide.
i c. t Gu
| DEFAULT ROLE { role [, role ]...
g
relo uden
| ALL [ EXCEPT
a
iw s St | NONE
role [, role ]... ]

@
h a le
e thi }
| PASSWORD EXPIRE

d h .b us
| ACCOUNT { LOCK | UNLOCK }
o t o
ub ense
}
( s (continued)

hal
e lic UPDATE MANUALLY too big to fit on page, split

h b ALTER USER manually

b o d(cont.) [ { IDENTIFIED

s u { BY password [ REPLACE old_password ]


| EXTERNALLY
| GLOBALLY AS ’external_name’
}
| DEFAULT TABLESPACE tablespace
| TEMPORARY TABLESPACE
{ tablespace | tablespace_group_name }
| QUOTA { integer [ K | M ]
| UNLIMITED
} ON tablespace
[ QUOTA { integer [ K | M ]
| UNLIMITED
} ON tablespace
]...
| PROFILE profile
| DEFAULT ROLE { role [, role ]...
| ALL [ EXCEPT
role [, role ]... ]
| NONE
}

Oracle Database 10g: Administration Workshop I D - 9

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
SQL Statement Syntax
| PASSWORD EXPIRE
| ACCOUNT { LOCK | UNLOCK }
}
]...
| user [, user ]... proxy_clause ;
UPDATE MANUALLY too big to fit on page, split
manually
ALTER VIEW ALTER VIEW [ schema. ]view
{ ADD out_of_line_constraint
| MODIFY CONSTRAINT constraint
{ RELY | NORELY }
| DROP { CONSTRAINT constraint
| PRIMARY KEY
a ble
| UNIQUE (column [, column ]...)
fe r
}
a ns
| COMPILE
n- t r
} ;
o
s an
ANALYZE
{ TABLE [ schema. ]table m)
ANALYZE ha
o d e .
c
c. t Gu
[ PARTITION (partition)
i i
g
relo u]index
| SUBPARTITION (subpartition)
]
a d en
t
iw s S(partition)
| INDEX [ schema.
@
[
hi
PARTITION
le| SUBPARTITION
h a e t (subpartition)
b us [ schema. ]cluster
h. |toCLUSTER
]
o d
b nse }
s u
( ice { validation_clauses
l e l
b ha | LIST CHAINED ROWS [ into_clause ]
| DELETE [ SYSTEM ] STATISTICS
o d h | compute_statistics_clause

sub | estimate_statistics_clause
} ;

ASSOCIATE STATISTICS ASSOCIATE STATISTICS WITH


{ column_association | function_association } ;

AUDIT AUDIT
{ sql_statement_clause | schema_object_clause }
[ BY { SESSION | ACCESS } ]
[ WHENEVER [ NOT ] SUCCESSFUL ] ;

CALL CALL
{ routine_clause
| object_access_expression
}
[ INTO :host_variable
[ [ INDICATOR ] :indicator_variable ] ] ;

Oracle Database 10g: Administration Workshop I D - 10

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
SQL Statement Syntax
COMMENT COMMENT ON
{ TABLE [ schema. ]
{ table | view }
| COLUMN [ schema. ]
{ table. | view. | materialized_view. } column
| OPERATOR [ schema. ] operator
| INDEXTYPE [ schema. ] indextype
| MATERIALIZED VIEW materialized_view
}
IS 'text' ;

le
COMMIT COMMIT [ WORK ]
[ COMMENT 'text'
r a b
| FORCE 'text' [, integer ]
] ; ns fe
t r a
on-
CREATE CLUSTER CREATE CLUSTER [ schema. ]cluster
s an
ha
(column datatype [ SORT ]
)
[, column datatype [ SORT ] ]...
m ide.
)
c o
i c. t Gu
[ { physical_attributes_clause
g
relo uden
| SIZE size_clause
a
| TABLESPACE tablespace
iw s St
| { INDEX
@
le thi
| [ SINGLE TABLE ]
h a e
HASHKEYS integer [ HASH IS expr ]

d h .b us
}
o t o
}

( s ub ense [ physical_attributes_clause

hal
e lic | SIZE size_clause
| TABLESPACE tablespace
h b | { INDEX
o d | [ SINGLE TABLE ]
sub }
HASHKEYS integer [ HASH IS expr ]

]...
]
[ parallel_clause ]
[ NOROWDEPENDENCIES | ROWDEPENDENCIES ]
[ CACHE | NOCACHE ] ;

CREATE CONTEXT CREATE [ OR REPLACE ] CONTEXT namespace


USING [ schema. ] package
[ INITIALIZED { EXTERNALLY | GLOBALLY }
| ACCESSED GLOBALLY
] ;

CREATE CONTROLFILE CREATE CONTROLFILE


[ REUSE ]
[ SET ]
DATABASE database

Oracle Database 10g: Administration Workshop I D - 11

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
SQL Statement Syntax
[ logfile_clause ]
{ RESETLOGS | NORESETLOGS }
[ DATAFILE file_specification
[, file_specification ]... ]
[ { MAXLOGFILES integer
| MAXLOGMEMBERS integer
| MAXLOGHISTORY integer
| MAXDATAFILES integer
| MAXINSTANCES integer
| { ARCHIVELOG | NOARCHIVELOG }
| FORCE LOGGING
}
[ MAXLOGFILES integer
a ble
| MAXLOGMEMBERS integer
fe r
| MAXLOGHISTORY integer
| MAXDATAFILES integer
a ns
| MAXINSTANCES integer
n- t r
o
an
| { ARCHIVELOG | NOARCHIVELOG }
| FORCE LOGGING
]...
ha s
] )
m ide.
c o
c. t Gu
[ character_set_clause ] ;
g i
CREATE DATABASE
a
CREATE DATABASEre[lodatabase
d e n]
{ USER SYS
S tu BY password
iw IDENTIFIED
l e
| USER@ h
SYSTEM s
i REUSE
IDENTIFIED BY password
a t
h . bh| MAXDATAFILES
|
u se
CONTROLFILE
integer
o d |to
ub ense | CHARACTER SET charset
MAXINSTANCES integer
( s
h a le lic | NATIONAL CHARACTER SET charset

h b | SET DEFAULT

o d { BIGFILE | SMALLFILE } TABLESPACE

sub
| database_logging_clauses
| tablespace_clauses
| set_time_zone_clause
}... ;

CREATE DATABASE LINK CREATE [ SHARED ] [ PUBLIC ] DATABASE LINK dblink


[ CONNECT TO
{ CURRENT_USER
| user IDENTIFIED BY password
[ dblink_authentication ]
}
| dblink_authentication
]
[ USING 'connect_string' ] ;

CREATE DIMENSION CREATE DIMENSION [ schema. ]dimension


level_clause
[ level_clause ]...
{ hierarchy_clause

Oracle Database 10g: Administration Workshop I D - 12

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
SQL Statement Syntax
| attribute_clause
| extended_attribute_clause
}
[ hierarchy_clause
| attribute_clause
| extended_attribute_clause
]... ;

CREATE DIRECTORY CREATE [ OR REPLACE ] DIRECTORY directory


AS 'path_name' ;

CREATE DISKGROUP CREATE DISKGROUP diskgroup_name


a ble
[ { HIGH | NORMAL | EXTERNAL } REDUNDANCY ]
fe r
[ FAILGROUP failgroup_name ]
DISK qualified_disk_clause
a n s
[, qualified_disk_clause ]...
n- t r
[ [ FAILGROUP failgroup_name ]
a no
DISK qualified_disk_clause
h a s
[, qualified_disk_clause ]...
]... ;
m ) e.
o
c.c t Gu[ idschema. ]function
CREATE [ OR REPLACEg]i FUNCTION
CREATE FUNCTION
[ (argument r[eINlo | OUTen| IN OUT ]
i w
[ NOCOPY a t ud
] datatype
S
a l e@ h is [] IN
[, argument
[ tNOCOPY
| OUT | IN OUT ]

bh u]...
datatype
. s e
o d h to)
b e
su cens RETURN datatype
]
e (
hal li [ { invoker_rights_clause
h b | DETERMINISTIC

b o d | parallel_enable_clause
su }
[ invoker_rights_clause
| DETERMINISTIC
| parallel_enable_clause
]...
]
{ { AGGREGATE | PIPELINED }
USING [ schema. ]implementation_type
| [ PIPELINED ]
{ IS | AS }
{ pl/sql_function_body | call_spec }
} ;

CREATE INDEX CREATE [ UNIQUE | BITMAP ] INDEX [ schema. ]index


ON { cluster_index_clause
| table_index_clause
| bitmap_join_index_clause
} ;

Oracle Database 10g: Administration Workshop I D - 13

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
SQL Statement Syntax
CREATE INDEXTYPE CREATE [ OR REPLACE ] INDEXTYPE
[ schema. ]indextype FOR
[ schema. ]operator (paramater_type
[, paramater_type ]...)
[, [ schema. ]operator (paramater_type
[, paramater_type ]...)
]...
using_type_clause ;

CREATE JAVA CREATE [ OR REPLACE ]


[ AND { RESOLVE | COMPILE } ]

le
[ NOFORCE ]
JAVA { { SOURCE | RESOURCE }
r a b
NAMED [ schema. ]primary_name
| CLASS [ SCHEMA schema ] ns fe
t r a
n-
}
[ invoker_rights_clause ] o
[ RESOLVER
s an
ha
((match_string [,] { schema_name | - })
)
)
c o m ide.
[ (match_string [,] { schema_name | - }) ]...

]
g i c. t Gu
relo uden
{ USING { BFILE (directory_object_name ,
a
iw s St
server_file_name)
| { CLOB | BLOB | BFILE }
@
h a le
e thi
subquery
| 'key_for_BLOB'

d h .b us }
o t o
ub ense
| AS source_text
( s } ;

hal
e lic
h b
CREATE LIBRARY CREATE [ OR REPLACE ] LIBRARY [ schema. ]libname
o d { IS | AS } 'filename' [ AGENT 'agent_dblink' ] ;

sub CREATE MATERIALIZED CREATE MATERIALIZED VIEW


VIEW [ schema. ]materialized_view
[ OF [ schema. ]object_type ]
[ (scoped_table_ref_constraint) ]
{ ON PREBUILT TABLE
[ { WITH | WITHOUT } REDUCED PRECISION ]
| physical_properties materialized_view_props
}
[ USING INDEX
[ physical_attributes_clause
| TABLESPACE tablespace
]
[ physical_attributes_clause
| TABLESPACE tablespace
]...
| USING NO INDEX
]
[ create_mv_refresh ]

Oracle Database 10g: Administration Workshop I D - 14

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
SQL Statement Syntax
[ FOR UPDATE ]
[ { DISABLE | ENABLE }
QUERY REWRITE
]
AS subquery ;

CREATE MATERIALIZED CREATE MATERIALIZED VIEW LOG


VIEW LOG ON [ schema. ] table
[ physical_attributes_clause
| TABLESPACE tablespace
| logging_clause
| { CACHE | NOCACHE }
[ physical_attributes_clause
a ble
| TABLESPACE tablespace
fe r
| logging_clause
a ns
| { CACHE | NOCACHE }
n- t r
]...
o
]
[ parallel_clause ] s an
) ha
[ table_partitioning_clauses ]
[ WITH { OBJECT ID
c o m ide.
| PRIMARY KEY
g i c. t Gu
relo uden
| ROWID
| SEQUENCE
a
iw s St
| (column [, column ]...)
@
thi
}
h a le [, { OBJECT ID
.b us e | PRIMARY KEY
o d h t o | ROWID

( s ub ense | SEQUENCE
e lic
| (column [, column ]...)

bhal }

o d h ]...
[ new_values_clause ]
sub ] ;

CREATE OPERATOR CREATE [ OR REPLACE ] OPERATOR


[ schema. ] operator binding_clause ;

CREATE OUTLINE CREATE [ OR REPLACE ]


[ PUBLIC | PRIVATE ] OUTLINE [ outline ]
[ FROM [ PUBLIC | PRIVATE ] source_outline ]
[ FOR CATEGORY category ]
[ ON statement ] ;

CREATE PACKAGE CREATE [ OR REPLACE ] PACKAGE [ schema. ]package


[ invoker_rights_clause ]
{ IS | AS } pl/sql_package_spec ;

CREATE PACKAGE BODY CREATE [ OR REPLACE ] PACKAGE BODY


[ schema. ]package
{ IS | AS } pl/sql_package_body ;

Oracle Database 10g: Administration Workshop I D - 15

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
SQL Statement Syntax
CREATE PFILE CREATE PFILE [= 'pfile_name' ]
FROM SPFILE [= 'spfile_name'] ;

CREATE PROCEDURE CREATE [ OR REPLACE ] PROCEDURE [ schema. ]procedure


[ (argument [ IN | OUT | IN OUT ]
[ NOCOPY ]
datatype
[, argument [ IN | OUT | IN OUT ]
[ NOCOPY ]
datatype
]...

le
)
]
r a b
[ invoker_rights_clause ]
{ IS | AS } ns fe
t r a
n-
{ pl/sql_subprogram_body | call_spec } ;

a no
CREATE PROFILE
LIMIT { resource_parameters ha
CREATE PROFILE profile s
m ) e.
o
| password_parameters
}
g i c.c t Guid
elo den
[ resource_parameters
a r
| password_parameters

@ iw]...s;Stu
h a le
e thi
CREATE ROLE
d h .bCREATEu s role
ROLE

b o e o
t| IDENTIFIED
[ NOT IDENTIFIED

( s u ens { BY password

a l e l i c | USING [ schema. ] package

b h | EXTERNALLY

o d h | GLOBALLY
}
sub ] ;

CREATE ROLEBACK SEGMENT CREATE [ PUBLIC ] ROLLBACK SEGMENT rollback_segment


[ { TABLESPACE tablespace | storage_clause }
[ TABLESPACE tablespace | storage_clause ]...
];

CREATE SCHEMA CREATE SCHEMA AUTHORIZATION schema


{ create_table_statement
| create_view_statement
| grant_statement
}
[ create_table_statement
| create_view_statement
| grant_statement
]... ;

Oracle Database 10g: Administration Workshop I D - 16

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
SQL Statement Syntax
CREATE SEQUENCE CREATE SEQUENCE [ schema. ]sequence
[ { INCREMENT BY | START WITH } integer
| { MAXVALUE integer | NOMAXVALUE }
| { MINVALUE integer | NOMINVALUE }
| { CYCLE | NOCYCLE }
| { CACHE integer | NOCACHE }
| { ORDER | NOORDER }
]
[ { INCREMENT BY | START WITH } integer
| { MAXVALUE integer | NOMAXVALUE }
| { MINVALUE integer | NOMINVALUE }
| { CYCLE | NOCYCLE }
| { CACHE integer | NOCACHE }
a ble
| { ORDER | NOORDER }
fe r
]... ;
a ns
n- t r
no
CREATE SPFILE CREATE SPFILE [= 'spfile_name' ]
FROM PFILE [= 'pfile_name' ] ;
s a
h a
CREATE [ OR REPLACE ] [ PUBLIC) ] SYNONYM
CREATE SYNONYM
c o m ide.
c. [ t@ Gdblink
[ schema. ]synonym
g
FOR [ schema. ]objecti u ];
a relo |uobject_table
d en
CREATE TABLE
i w St
{ relational_table | XMLType_table }

l e @ his
a
h [ BIGFILE
e t
CREATE TABLESPACE
. bCREATE
u s
h t{opermanent_tablespace_clause
o d | SMALLFILE ]

( s ub ense | temporary_tablespace_clause
h a le lic | undo_tablespace_clause

h b } ;

b o dCREATE TRIGGER
su CREATE [ OR REPLACE ] TRIGGER [ schema. ]trigger
{ BEFORE | AFTER | INSTEAD OF }
{ dml_event_clause
| { ddl_event [ OR ddl_event ]...
| database_event [ OR database_event ]...
}
ON { [ schema. ]SCHEMA
| DATABASE
}
}
[ WHEN (condition) ]
{ pl/sql_block | call_procedure_statement } ;

CREATE TYPE { create_incomplete_type


| create_object_type
| create_varray_type
| create_nested_table_type
}

Oracle Database 10g: Administration Workshop I D - 17

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
SQL Statement Syntax
CREATE TYPE BODY CREATE [ OR REPLACE ] TYPE BODY [ schema. ]type_name
{ IS | AS }
{ subprogram_declaration
| map_order_func_declaration
}
[; { subprogram_declaration
| map_order_func_declaration
}
]...
END ;

le
CREATE USER CREATE USER user
IDENTIFIED { BY password
r a b
| EXTERNALLY
| GLOBALLY AS 'external_name' ns fe
t r a
n-
}
[ DEFAULT TABLESPACE tablespace o
| TEMPORARY TABLESPACE
s an
ha
{ tablespace | tablespace_group_name }
)
| UNLIMITED
c o m ide.
| QUOTA { integer [ K | M ]

}
g i c. t Gu
relo uden
ON tablespace
a
[ QUOTA { integer [ K | M ]
iw s St
| UNLIMITED
@
h a le
e thi
}
ON tablespace

d h .b us
]...
o t o
ub ense
| PROFILE profile
( s | PASSWORD EXPIRE

hal
e lic | ACCOUNT { LOCK | UNLOCK }

h b [ DEFAULT TABLESPACE tablespace

o d | TEMPORARY TABLESPACE

sub
{ tablespace | tablespace_group_name }
| QUOTA { integer [ K | M ]
| UNLIMITED
}
ON tablespace
[ QUOTA { integer [ K | M ]
| UNLIMITED
}
ON tablespace
]...
| PROFILE profile
| PASSWORD EXPIRE
| ACCOUNT { LOCK | UNLOCK }
]...
] ;

CREATE VIEW CREATE [ OR REPLACE ] [ [ NO ] FORCE ] VIEW


[ schema. ]view
[ (alias [ inline_constraint
[ inline_constraint ]... ]

Oracle Database 10g: Administration Workshop I D - 18

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
SQL Statement Syntax
| out_of_line_constraint
[, alias [ inline_constraint
[ inline_constraint ]... ]
| out_of_line_constraint
]...
)
| object_view_clause
| XMLType_view_clause
]
AS subquery [ subquery_restriction_clause ] ;

DELETE DELETE [ hint ]


[ FROM ]
a ble
{ dml_table_expression_clause
fe r
| ONLY (dml_table_expression_clause)
a ns
}
n- t r
[ t_alias ]
[ where_clause ]
a no
[ returning_clause ] ;
h a s
m ) e.
DISASSOCIATE STATISTICS DISASSOCIATE STATISTICS.c o uid
g i c ]table.column
FROM
G
t ]table.column ]...
[,lo[ schema.
{ COLUMNS [ schema.
r e e n
i wa [ S
| FUNCTIONS tu[ dschema.
schema. ]function

l e @ hi[sschema. ]package
[, ]function ]...

. b ha se t [, [ schema. ]package ]...


| PACKAGES

d h t|oTYPES u [ schema. ]type


u o
b nse [, [ schema. ]type ]...
e s
( ice | INDEXES [ schema. ]index
ha l l [, [ schema. ]index ]...
h b | INDEXTYPES [ schema. ]indextype

b o d [, [ schema. ]indextype ]...

su }
[ FORCE ] ;

DROP CLUSTER DROP CLUSTER [ schema. ]cluster


[ INCLUDING TABLES [ CASCADE CONSTRAINTS ] ] ;

DROP CONTEXT DROP CONTEXT namespace ;

DROP DATABASE DROP DATABASE ;

DROP DATABASE LINK DROP [ PUBLIC ] DATABASE LINK dblink ;

DROP DIMENSION DROP DIMENSION [ schema. ]dimension ;

DROP DIRECTORY DROP DIRECTORY directory_name ;

Oracle Database 10g: Administration Workshop I D - 19

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
SQL Statement Syntax
DROP DISKGROUP DROP DISKGROUP diskgroup_name
[ { INCLUDING | EXCLUDING }
CONTENTS
] ;

DROP FUNCTION DROP FUNCTION [ schema. ]function_name ;

DROP INDEX DROP INDEX [ schema. ]index [ FORCE ] ;

DROP INDEXTYPE DROP INDEXTYPE [ schema. ]indextype [ FORCE ] ;

a ble
fe r
DROP JAVA DROP JAVA
{ SOURCE | CLASS | RESOURCE }
a ns
[ schema. ]object_name ;
n- t r
a no
DROP LIBRARY DROP LIBRARY library_name ;
h a s
m ) e.
o
DROP MATERIALIZED VIEW DROP MATERIALIZED VIEW .c
g i c t Guid
elo ] d; en
[ schema. ]materialized_view
[ PRESERVE rTABLE
a
iw s Stu
@ i VIEW LOG
leMATERIALIZED
h
DROP MATERIALIZED VIEW DROP
h a e t
LOG
d h .b ON u[ sschema. ]table ;
b o e to
(
DROP OPERATOR
e su cens DROP OPERATOR [ schema. ]operator [ FORCE ] ;
h al li
h b
DROP OUTLINE DROP OUTLINE outline ;
o d
sub DROP PACKAGE DROP PACKAGE [ BODY ] [ schema. ]package ;

DROP PROCEDURE DROP PROCEDURE [ schema. ]procedure ;

DROP PROFILE DROP PROFILE profile [ CASCADE ] ;

DROP ROLE DROP ROLE role ;

DROP ROLLBACK SEGMENT DROP ROLLBACK SEGMENT rollback_segment ;

DROP SEQUENCE DROP SEQUENCE [ schema. ]sequence_name ;

DROP SYNONYM DROP [ PUBLIC ] SYNONYM [ schema. ]synonym


[ FORCE ] ;

Oracle Database 10g: Administration Workshop I D - 20

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
SQL Statement Syntax
DROP TABLE DROP TABLE [ schema. ]table
[ CASCADE CONSTRAINTS ]
[ PURGE ] ;

DROP TABLESPACE DROP TABLESPACE tablespace


[ INCLUDING CONTENTS [ AND DATAFILES ]
[ CASCADE CONSTRAINTS ]
] ;

DROP TRIGGER DROP TRIGGER [ schema. ]trigger ;

a ble
DROP TYPE DROP TYPE [ schema. ]type_name
fe r
[ FORCE | VALIDATE ] ;
a ns
n- t r
DROP TYPE BODY DROP TYPE BODY [ schema. ]type_name ;
a no
DROP USER user [ CASCADE ] ; ) h
as
DROP USER
c o m ide.
c.
DROP VIEW [ schema.g]i view t G
u
relo uden] ;
DROP VIEW
a
[ CASCADE CONSTRAINTS
iw s St
@
le PLANthi
EXPLAIN PLAN a
EXPLAIN
h
h . b [[ SET
u seSTATEMENT_ID = 'text' ]

b d o
o se tFOR statement ;
INTO [ schema. ]table [ @ dblink ] ]
u
(s icen
l e l
b ha DATABASE
FLASHBACK FLASHBACK [ STANDBY ] DATABASE [ database ]

o d h { TO { SCN | TIMESTAMP } expr

sub
| TO BEFORE { SCN | TIMESTAMP } expr
};

FLASHBACK TABLE FLASHBACK TABLE


[ schema. ]table
[, [ schema. ]table ]...
TO { { SCN | TIMESTAMP } expr
[ { ENABLE | DISABLE } TRIGGERS ]
| BEFORE DROP [ RENAME TO table ]
} ;

GRANT GRANT { grant_system_privileges


| grant_object_privileges
} ;

INSERT INSERT [ hint ]


{ single_table_insert | multi_table_insert } ;

Oracle Database 10g: Administration Workshop I D - 21

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
SQL Statement Syntax
LOCK TABLE LOCK TABLE
[ schema. ] { table | view }
[ { PARTITION (partition)
| SUBPARTITION (subpartition)
}
| @ dblink
]
[, [ schema. ] { table | view }
[ { PARTITION (partition)
| SUBPARTITION (subpartition)
}
| @ dblink
]
a ble
]...
fe r
IN lockmode MODE
[ NOWAIT ] ;
a ns
n- t r
o
MERGE MERGE [ hint ]
s an
ha
INTO [ schema. ]table [ t_alias ]
)
[ t_alias ]
c o m ide.
USING [ schema. ] { table | view | subquery }

ON ( condition )
g i c. t Gu
relo uden
[ merge_update_clause ]
a
[ merge_insert_clause ] ;
iw s St
@
NOAUDIT
h a le
NOAUDIT
e thi
d h .b { sql_statement_clause
us
o t o [, sql_statement_clause ]...

( s ub ense | schema_object_clause
a l e l i c [, schema_object_clause ]...

bh
}

o d h [ WHENEVER [ NOT ] SUCCESSFUL ] ;

sub PURGE PURGE


{ { TABLE table
| INDEX index
}
| { RECYCLEBIN | DBA_RECYCLEBIN }
| TABLESPACE tablespace
[ USER user ]
} ;
DO NOT IMPORT AS INSET problem importing file, locks
up FrameMaker
RENAME RENAME old_name
TO new_name ;

REVOKE REVOKE { revoke_system_privileges


| revoke_object_privileges
} ;

Oracle Database 10g: Administration Workshop I D - 22

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
SQL Statement Syntax
ROLLBACK ROLLBACK [ WORK ]
[ TO [ SAVEPOINT ] savepoint
| FORCE 'text'
] ;

SAVEPOINT SAVEPOINT savepoint ;

SELECT subquery [ for_update_clause ] ;

SET CONSTRAINT[S] SET { CONSTRAINT | CONSTRAINTS }


{ constraint [, constraint ]...
a ble
| ALL
fe r
}
a ns
{ IMMEDIATE | DEFERRED } ;
n- t r
a no
SET ROLE SET ROLE
h a
{ role [ IDENTIFIED BY password ] s
m ) e.
[, role [ IDENTIFIED BY password ] ]...
o
c.c t Guid
| ALL [ EXCEPT role [, role ]... ]
| NONE
g i
} ;
a relo uden
@ iw s St
SET TRANSACTION
h a le
e
{ { READ t{hiONLY | WRITE }
SET TRANSACTION

d h .b |uISOLATION
s LEVEL
o t o
ub ense | USE ROLLBACK SEGMENT rollback_segment
{ SERIALIZABLE | READ COMMITTED }
( s
h a le lic }

h b [ NAME 'text' ]

o d | NAME 'text'

sub
} ;

TRUNCATE TRUNCATE
{ TABLE [ schema. ]table
[ { PRESERVE | PURGE } MATERIALIZED VIEW LOG ]
| CLUSTER [ schema. ]cluster
}
[ { DROP | REUSE } STORAGE ] ;

UPDATE UPDATE [ hint ]


{ dml_table_expression_clause
| ONLY (dml_table_expression_clause)
}
[ t_alias ]
update_set_clause
[ where_clause ]
[ returning_clause ] ;

Oracle Database 10g: Administration Workshop I D - 23

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Table 2: Syntax for Subclauses

Subclause Syntax
activate_standby_db_clause ACTIVATE
[ PHYSICAL | LOGICAL ]
STANDBY DATABASE
[ SKIP [ STANDBY LOGFILE ] ]

add_binding_clause ADD BINDING


(parameter_type
[, parameter_type ]...)
RETURN (return_type)
[ implementation_clause ]
using_function_clause
a ble
fe r
a ns
add_column_clause ADD
( column datatype n- t r
o
[ DEFAULT expr ]
[ { inline_constraint
s an
ha
[ inline_constraint ]...
)
c o m ide.
| inline_ref_constraint
}
g i c. t Gu
relo uden
]
[, column datatype
a
iw s St
[ DEFAULT expr ]
@
thi
[ { inline_constraint

h a le [ inline_constraint ]...
.b us e | inline_ref_constraint
o d h t o }

( s ub ense ]
]...
hal
e lic )

h b [ column_properties ]

b d
o add_disk_clause
s u ADD
[ FAILGROUP failgroup_name ]
DISK qualified_disk_clause
[, qualified_disk_clause ]...
[ [ FAILGROUP failgroup_name ]
DISK qualified_disk_clause
[, qualified_disk_clause ]...
]...

add_hash_index_partition ADD PARTITION


[ partition_name ]
[ TABLESPACE tablespace_name ]
[ parallel_clause ]

add_hash_partition_clause ADD PARTITION [ partition ]


partitioning_storage_clause
[ update_index_clauses ]
[ parallel_clause ]

Oracle Database 10g: Administration Workshop I D - 24

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
add_hash_subpartition ADD subpartition_spec
[ update_index_clauses ]
[ parallel_clause ]

add_list_partition_clause ADD PARTITION [ partition ]


list_values_clause
[ table_partition_description ]
[ update_index_clauses ]

add_list_subpartition ADD subpartition_spec


[ update_index_clauses ]

a ble
fe r
add_logfile_clauses ADD [ STANDBY ] LOGFILE
a ns
] n- t r
{ [ INSTANCE 'instance_name' | THREAD integer

no
[ GROUP integer ] redo_log_file_spec
a
h a s
[, [ GROUP integer ] redo_log_file_spec
]...
m ) e.
| MEMBER 'filename' [ REUSE ]
o
g i c.c t Guid
[, 'filename' [ REUSE ] ]...

relo uden
TO logfile_descriptor
[, logfile_descriptor ]...
} a
iw s St
@
h a e thi [ segment_attributes_clause ]
leADD OVERFLOW
add_overflow_clause
d h .b [u(PARTITION
s
o
b nse ]... t o [,
[ segment_attributes_clause ]
PARTITION [ segment_attributes_clause ]
s u
a l e ( lice )
b h ]
d h
o add_range_partition_clause ADD PARTITION [ partition ]
s ub
range_values_clause
[ table_partition_description ]
[ update_index_clauses ]

add_table_partition { add_range_partition_clause
| add_hash_partition_clause
| add_list_partition_clause
}

alias_file_name +diskgroup_name [ (template_name) ] /alias_name

allocate_extent_clause ALLOCATE EXTENT


[ ( { SIZE size_clause
| DATAFILE 'filename'
| INSTANCE integer
}

Oracle Database 10g: Administration Workshop I D - 25

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
[ SIZE size_clause
| DATAFILE 'filename'
| INSTANCE integer
]...
)
]

alter_attribute_definition { { ADD | MODIFY } ATTRIBUTE


{ attribute [ datatype ]
| ( attribute datatype
[, attribute datatype ]...

le
)
}
r a b
| DROP ATTRIBUTE
{ attribute ns fe
t r a
n-
| ( attribute [, attribute ]... )
} o
}
s an
) ha
alter_collection_clauses MODIFY { LIMIT integerm
o d e .
i c
c. t Gu
| ELEMENT TYPE i
datatype
g
relo uden
}
a
iw s St
alter_datafile_clause @
DATAFILE
hi
le { 'filename'
h a e t | filenumber }

h . b u s} [, 'filename' | filenumber ]...

b d o
o se t { ONLINE
u
(s icen | OFFLINE [ FOR DROP ]
l e l
b ha | RESIZE size_clause
| autoextend_clause
o d h | END BACKUP

sub }

alter_external_table_clauses { add_column_clause
| modify_column_clauses
| drop_column_clause
| parallel_clause
| external_data_properties
| REJECT LIMIT { integer | UNLIMITED }
| PROJECT COLUMN { ALL | REFERENCED }
}
[ add_column_clause
| modify_column_clauses
| drop_column_clause
| parallel_clause
| external_data_properties
| REJECT LIMIT { integer | UNLIMITED }
| PROJECT COLUMN { ALL | REFERENCED }
]...

Oracle Database 10g: Administration Workshop I D - 26

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
alter_index_partitioning { modify_index_default_attrs
| add_hash_index_partition
| modify_index_partition
| rename_index_partition
| drop_index_partition
| split_index_partition
| coalesce_index_partition
| modify_index_subpartition
}

alter_iot_clauses { index_org_table_clause

le
| alter_overflow_clause
| alter_mapping_table_clauses
r a b
|
}
COALESCE
ns fe
t r a
on-
alter_mapping_table_clauses MAPPING TABLE
s an
ha
{ UPDATE BLOCK REFERENCES
)
| allocate_extent_clause
m ide.
o
| deallocate_unused_clause
c
}
g i c. t Gu
{ ADD | a
relo en
DROP } ud
alter_method_spec
{@ iw s St
hi
map_order_function_spec

h a le| subprogram_spec
t
e
.b }u[s{ ADD | DROP }
o d h to { map_order_function_spec
b
su cens e
l e ( i
| subprogram_spec
ha l }

h b ]...
o d
sub alter_mv_refresh REFRESH
{
{ FAST | COMPLETE | FORCE }
|
ON { DEMAND | COMMIT }
|
{ START WITH | NEXT } date
|
WITH PRIMARY KEY
|
USING
{ DEFAULT MASTER ROLLBACK SEGMENT
| MASTER ROLLBACK SEGMENT
rollback_segment
}
| USING { ENFORCED | TRUSTED } CONSTRAINTS
}

alter_overflow_clause { OVERFLOW
{ allocate_extent_clause
| deallocate_unused_clause
}
[ allocate_extent_clause
| deallocate_unused_clause

Oracle Database 10g: Administration Workshop I D - 27

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
]...
| add_overflow_clause
}

alter_session_set_clause SET parameter_name = parameter_value


[ parameter_name = parameter_value ]...

alter_system_reset_clause parameter_name
[ SCOPE = { MEMORY | SPFILE | BOTH } ]
SID = 'sid'

a ble
alter_system_set_clause parameter_name =
fe r
parameter_value [, parameter_value ]...
a ns
[ COMMENT 'text' ]
[ DEFERRED ] n- t r
o
[ SID = { 'sid' | * } ] s an
[ SCOPE = { MEMORY | SPFILE | BOTH } ]

) ha
c o m ide.
c. t Gu
alter_table_partitioning { modify_table_default_attrs
g i
| set_subpartition_template

relo uden
| modify_table_partition
a
iw s St
| modify_table_subpartition
@
| move_table_partition

h a e thi
le|| move_table_subpartition
d h .b |ucoalesce_table_partition
s
add_table_partition

o t o
b nse || drop_table_partition
( s u e drop_table_subpartition
a l e li c | rename_partition_subpart
b h | truncate_partition_subpart

o d h | split_table_partition

sub | split_table_subpartition
| merge_table_partitions
| merge_table_subpartitions
| exchange_partition_subpart
}

alter_table_properties { { physical_attributes_clause
| logging_clause
| table_compression
| supplemental_table_logging
| allocate_extent_clause
| deallocate_unused_clause
| shrink_clause
| { CACHE | NOCACHE }
| upgrade_table_clause
| records_per_block_clause
| parallel_clause
| row_movement_clause
}
[ physical_attributes_clause

Oracle Database 10g: Administration Workshop I D - 28

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
| logging_clause
| table_compression
| supplemental_table_logging
| allocate_extent_clause
| deallocate_unused_clause
| shrink_clause
| { CACHE | NOCACHE }
| upgrade_table_clause
| records_per_block_clause
| parallel_clause
| row_movement_clause
]...
| RENAME TO new_table_name
a ble
}
fe r
[ alter_iot_clauses ]
a ns
n- t r
alter_tempfile_clause TEMPFILE
a
{ 'filename' [, 'filename' ]... no
a s
| filenumber [, filenumber ]...
h
}
m ) e.
o
c.c t Guid
{ RESIZE size_clause
i
| autoextend_clause
g
relo uden
| DROP [ INCLUDING DATAFILES ]
a
| ONLINE
iw s St
| OFFLINE
@
h a le }
e thi
d h .b MODIFY
us VARRAY varray_item
o
alter_varray_col_properties t o
( s ub ense ( modify_LOB_parameters )

h a le lic
h b
analytic_clause [ query_partition_clause ]

b o d [ order_by_clause [ windowing_clause ] ]
su
archive_log_clause ARCHIVE LOG
[ INSTANCE 'instance_name' | THREAD integer
]
{ { SEQUENCE integer
| CHANGE integer
| CURRENT [ NOSWITCH ]
| GROUP integer
| LOGFILE 'filename'
[ USING BACKUP CONTROLFILE ]
| NEXT
| ALL
| START
}
[ TO 'location' ]
| STOP
}

Oracle Database 10g: Administration Workshop I D - 29

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
array_DML_clause [ WITH | WITHOUT ]
ARRAY DML
[ ([ schema. ]type
[, [ schema. ]varray_type ])
[, ([ schema. ]type
[, [ schema. ]varray_type ])...
]

attribute_clause ATTRIBUTE level DETERMINES


{ dependent_column
| ( dependent_column

le
[, dependent_column ]... )
}
r a b
ns fe
auditing_by_clause BY { proxy [, proxy ]...
t r a
| user [, user ]... n-
no
}
s a
h a
ON { [ schema. ]objectm) .
auditing_on_clause
c o
. Gu i d e
| DEFAULT gic
| DIRECTORY directory_name

}
r e lo ent
i wa Stud
l @ his
eAUTOEXTEND
autoextend_clause
h a {eOFFt
. b s
h to u | ON [ NEXT size_clause ]
o d
b nse [ maxsize_clause ]
s u
e ( lice
}
a l
h bh
b o dbinding_clause BINDING
(parameter_type [, parameter_type ]...)
s u RETURN return_type
[ implementation_clause ]
using_function_clause
[, (parameter_type [, parameter_type ]...)
RETURN return_type
[ implementation_clause ]
using_function_clause
]...

bitmap_join_index_clause [ schema.]table
( [ [ schema. ]table. | t_alias. ]column
[ ASC | DESC ]
[, [ [ schema. ]table. | t_alias. ]column
[ ASC | DESC ]
]...
)
FROM [ schema. ]table [ t_alias ]
[, [ schema. ]table [ t_alias ]
]...

Oracle Database 10g: Administration Workshop I D - 30

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
WHERE condition
[ local_partitioned_index ]
index_attributes

build_clause BUILD { IMMEDIATE | DEFERRED }

C_declaration C [ NAME name ]


LIBRARY lib_name
[ AGENT IN (argument[, argument ]...) ]
[ WITH CONTEXT ]
[ PARAMETERS (parameter[, parameter ]...) ]

a ble
fe r
call_spec LANGUAGE { Java_declaration | C_declaration }
a ns
n- t r
cancel_clause CANCEL [ IMMEDIATE ] [ WAIT | NOWAIT ]
a no
h a s
cell_assignment measure_column [ { { condition
m ) e.
| oexpr

g i G uid
c.c|} single_column_for_loop
r e lo en[,t { condition
i wa Stud | expr
l e @ h i s | single_column_for_loop
h a e t }
. b
h to u s ]...
b o d
u
s cen s e | multi_column_for_loop

e ( }

hal li ]

h b
b o d Note: The outer square brackets are part of the
syntax.
s u In this case, they do not indicate
optionality.

cell_reference_options [ { IGNORE | KEEP } NAV ]


[ UNIQUE { DIMENSION | SINGLE REFERENCE } ]

character_set_clause CHARACTER SET character_set

check_datafiles_clause CHECK DATAFILES [ GLOBAL | LOCAL ]

check_diskgroup_clauses CHECK
{ ALL
| DISK
disk_name
[, disk_name ]...
| DISKS IN FAILGROUP
failgroup_name

Oracle Database 10g: Administration Workshop I D - 31

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
[, failgroup_name ]...
| FILE
filename
[, filename ]...
}
[ CHECK
{ ALL
| DISK
disk_name
[, disk_name ]...
| DISKS IN FAILGROUP
failgroup_name
[, failgroup_name ]...
a ble
| FILE
fe r
filename
[, filename ]...
a ns
}
n- t r
]...
a no
[ REPAIR | NOREPAIR ]
h a s
)
LOCAL ] e.
m
o
c.c t Guid
checkpoint_clause CHECKPOINT [ GLOBAL |

g i
CLUSTER [re lo ]encluster index_attributes
w Stud
a
cluster_index_clause schema.
i
@ hPARTITION
coalesce_index_partition ale t
COALESCE is
h . bh us[eparallel_clause ]
b o d to
su cens e
e (
coalesce_table_partition COALESCE PARTITION

h a l li [ update_index_clauses ]

h b [ parallel_clause ]

b o d
su column_association COLUMNS [ schema. ]table.column
[, [ schema. ]table.column ]...
using_statistics_type

column_clauses { { add_column_clause
| modify_column_clause
| drop_column_clause
}
[ add_column_clause
| modify_column_clause
| drop_column_clause
]...
| rename_column_clause
| modify_collection_retrieval
[ modify_collection_retrieval ]...
| modify_LOB_storage_clause
| alter_varray_col_properties
}

Oracle Database 10g: Administration Workshop I D - 32

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
column_properties { object_type_col_properties
| nested_table_col_properties
| { varray_col_properties | LOB_storage_clause }
[ (LOB_partition_storage
[, LOB_partition_storage ]...
)
]
| XMLType_column_properties
}
[ { object_type_col_properties
| nested_table_col_properties
| { varray_col_properties |
LOB_storage_clause }
a ble
[ (LOB_partition_storage
fe r
)
[, LOB_partition_storage ]...
a ns
]
n- t r
| XMLType_column_properties
a no
}
]...
h a s
m ) e.
o ui}d PRIMARY
commit_switchover_clause { PREPARE | COMMIT
g i c.|c}LOGICAL
TO SWITCHOVER
t G
r e lo STANDBY
[ TO { { PHYSICAL
e n
w[a {{ WITH u|dWITHOUT } SESSION SHUTDOWN
| PHYSICAL
i S t
a l e@ t]hisWAIT | NOWAIT }
h . bh use| LOGICAL STANDBY
b o d to| CANCEL}
su cens e
l e ( i ]
a l
h bh
o dcompile_type_clause COMPILE

sub
[ DEBUG ]
[ SPECIFICATION | BODY ]
[ compiler_parameters_clause
[ compiler_parameters_clause ] ... ]
[ REUSE SETTINGS ]

compiler_parameters_clause parameter_name = parameter_value

composite_partitioning PARTITION BY RANGE ( column_list )


[ subpartition_by_list | subpartition_by_hash
]
( PARTITION [ partition ]
range_values_clause
table_partition_description
[, PARTITION [ partition ]
range_values_clause
table_partition_description ] ...
)

Oracle Database 10g: Administration Workshop I D - 33

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
compute_statistics_clause COMPUTE [ SYSTEM ] STATISTICS [ for_clause ]

conditional_insert_clause [ ALL | FIRST ]


WHEN condition
THEN insert_into_clause
[ values_clause ]
[ error_logging_clause ]
[ insert_into_clause
[ values_clause ]
[ error_logging_clause ]
]...

le
[ WHEN condition
THEN insert_into_clause
r a b
[ values_clause ]
[ error_logging_clause ] ns fe
t r a
n-
[ insert_into_clause
[ values_clause ] o
an
[ error_logging_clause ]
s
]...
) ha
]...
c o m ide.
[ ELSE insert_into_clause
i c. t Gu
[ values_clause ]
g
relo uden
[ error_logging_clause ]
a
[ insert_into_clause
iw s St
[ values_clause ]
@
h a le
e thi[ error_logging_clause ]
]...

d h .b us
]
o t o
constraint (s
ub ense { inline_constraint
h a le lic | out_of_line_constraint
h b | inline_ref_constraint

b o d | out_of_line_ref_constraint
su }

constraint_clauses { ADD { out_of_line_constraint


[ out_of_line_constraint ]...
| out_of_line_REF_constraint
}
| MODIFY { CONSTRAINT constraint
| PRIMARY KEY
| UNIQUE (column [, column ]...)
}
constraint_state
| RENAME CONSTRAINT old_name TO new_name
| drop_constraint_clause
}

constraint_state [ [ [ NOT ] DEFERRABLE ]


[ INITIALLY { IMMEDIATE | DEFERRED } ]
| [ INITIALLY { IMMEDIATE | DEFERRED } ]

Oracle Database 10g: Administration Workshop I D - 34

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
[ [ NOT ] DEFERRABLE ]
]
[ RELY | NORELY ]
[ using_index_clause ]
[ ENABLE | DISABLE ]
[ VALIDATE | NOVALIDATE ]
[ exceptions_clause ]

constructor_declaration [ FINAL ]
[ INSTANTIABLE ]
CONSTRUCTOR FUNCTION datatype
[ [ SELF IN OUT datatype, ]
parameter datatype
a ble
[, parameter datatype ]...
fe r
]
a ns
RETURN SELF AS RESULT
{ IS | AS } { pl/sql_block | call_spec }
n- t r
o
constructor_spec [ FINAL ] s an
[ INSTANTIABLE ]
) ha
c o m ide.
CONSTRUCTOR FUNCTION datatype

g i c. t Gu
[ ([ SELF IN OUT datatype, ]

relo uden
parameter datatype
[, parameter datatype ]...
) a
iw s St
@
thi
]

h a leRETURN SELF AS RESULT


.b us e
[ { IS | AS } call_spec ]
o d h t o
context_clauseub se [ WITH
( s e n INDEX CONTEXT,
le lic
SCAN CONTEXT implementation_type

b h a [ COMPUTE ANCILLARY DATA ]

o d h ]
[ WITH COLUMN CONTEXT ]
b
su controlfile_clauses { CREATE [ LOGICAL | PHYSICAL ]
STANDBY CONTROLFILE AS
'filename' [ REUSE ]
| BACKUP CONTROLFILE TO
{ 'filename' [ REUSE ]
| trace_file_clause
}
}

create_datafile_clause CREATE DATAFILE


{ 'filename' | filenumber }
[, 'filename' | filenumber ]...
}
[ AS { file_specification
[, file_specification ]...
| NEW
}
]

Oracle Database 10g: Administration Workshop I D - 35

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
create_incomplete_type CREATE [ OR REPLACE ]
TYPE [ schema. ]type_name ;

create_mv_refresh { REFRESH
{ { FAST | COMPLETE | FORCE }
| ON { DEMAND | COMMIT }
| { START WITH | NEXT } date
| WITH { PRIMARY KEY | ROWID }
| USING
{ DEFAULT [ MASTER | LOCAL ]
ROLLBACK SEGMENT

le
| [ MASTER | LOCAL ]
ROLLBACK SEGMENT rollback_segment
r a b
}
[ DEFAULT [ MASTER | LOCAL ] ns fe
t r a
n-
ROLLBACK SEGMENT
| [ MASTER | LOCAL ] o
an
ROLLBACK SEGMENT rollback_segment
s
]...
) ha
| USING
c o m ide.
{ ENFORCED | TRUSTED }
i
CONSTRAINTS
g c. t Gu
relo uden
}
a
[ { FAST | COMPLETE | FORCE }
iw s St
| ON { DEMAND | COMMIT }
@
h a le
e thi
| { START WITH | NEXT } date
| WITH { PRIMARY KEY | ROWID }

d h .b us| USING
o t o
ub ense
{ DEFAULT [ MASTER | LOCAL ]
( s ROLLBACK SEGMENT

hal
e lic | [ MASTER | LOCAL ]

h b ROLLBACK SEGMENT rollback_segment

o d }

sub
[ DEFAULT [ MASTER | LOCAL ]
ROLLBACK SEGMENT
| [ MASTER | LOCAL ]
ROLLBACK SEGMENT
rollback_segment
]...
| USING
{ ENFORCED | TRUSTED }
CONSTRAINTS
]...
| NEVER REFRESH
}

create_nested_table_type CREATE [ OR REPLACE ]


TYPE [ schema. ]type_name
[ OID 'object_identifier' ]
{ IS | AS } TABLE OF datatype ;

Oracle Database 10g: Administration Workshop I D - 36

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
create_object_type CREATE [ OR REPLACE ]
TYPE [ schema. ]type_name
[ OID 'object_identifier' ]
[ invoker_rights_clause ]
{ { IS | AS } OBJECT
| UNDER [schema.]supertype
}
[ sqlj_object_type ]
[ ( attribute datatype
[ sqlj_object_type_attr ]
[, attribute datatype
[ sqlj_object_type_attr ]...
[, element_spec
a ble
[, element_spec ]...
fe r
)
]
a ns
]
n- t r
[ [ NOT ] FINAL ]
a no
[ [ NOT ] INSTANTIABLE ] ;
h a s
m ) e.
create_varray_type CREATE [ OR REPLACE ]
c o uid
.]type_name
TYPE [ schema.
g i c G
{ IS |re
lo VARRAY
AS } { d e nt | VARYING
[ OID 'object_identifier' ]

wa OFSdatatype
ARRAY }
i
(limit) tu ;

a l e@ this
database_file_clauses .bh se FILE
d h u
{ RENAME
to 'filename'
b o e
[, 'filename' ]...

e ( su cens TO 'filename'

h a l l i | create_datafile_clause
| alter_datafile_clause
h b | alter_tempfile_clause

b o d }
su
database_logging_clauses { LOGFILE
[ GROUP integer ] file_specification
[, [ GROUP integer ] file_specification
]...
| MAXLOGFILES integer
| MAXLOGMEMBERS integer
| MAXLOGHISTORY integer
| { ARCHIVELOG | NOARCHIVELOG }
| FORCE LOGGING
}

datafile_tempfile_clauses { ADD { DATAFILE | TEMPFILE }


[ file_specification
[, file_specification ]...
]
| RENAME DATAFILE 'filename' [, 'filename' ]...
TO

Oracle Database 10g: Administration Workshop I D - 37

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
'filename' [, 'filename' ]...
| { DATAFILE | TEMPFILE } { ONLINE | OFFLINE }
}

datafile_tempfile_spec [ 'filename' ]
[ SIZE size_clause ]
[ REUSE ]
[ autoextend_clause ]

dblink database[.domain [.domain ]... ]


[ @ connect_descriptor ]

a ble
fe r
dblink_authentication AUTHENTICATED BY user
a ns
IDENTIFIED BY password
n- t r
a no
deallocate_unused_clause DEALLOCATE UNUSED
[ KEEP size_clause ]
h a s
m ) e.
o uid network_cost)
default_cost_clause i c.c t G
DEFAULT COST (cpu_cost,
g io_cost,

a r elo den
default_selectivity_clause DEFAULT
S tu default_selectivity
iw SELECTIVITY
le @ h i s
h a e t
default_tablespace
d h .b DEFAULTs TABLESPACE tablespace
[uDATAFILE datafile_tempfile_spec ]
b o
o se t extent_management_clause
u
(s icen
l e l
b ha
default_settings_clauses { SET DEFAULT

o d h { BIGFILE | SMALLFILE } TABLESPACE

sub
| DEFAULT TABLESPACE tablespace
| DEFAULT TEMPORARY TABLESPACE
{ tablespace | tablespace_group_name }
| RENAME GLOBAL_NAME TO
database.domain [.domain ]...
| { ENABLE BLOCK CHANGE TRACKING
[ USING FILE 'filename' [ REUSE ] ]
| DISABLE BLOCK CHANGE TRACKING
}
| flashback_mode_clause
| set_time_zone_clause
}

default_temp_tablespace [ BIGFILE | SMALLFILE ]


DEFAULT TEMPORARY TABLESPACE tablespace
[ TEMPFILE file_specification
[, file_specification ]...
]
extent_management_clause

Oracle Database 10g: Administration Workshop I D - 38

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
dependent_handling_clause { INVALIDATE
| CASCADE [ { [ NOT ] INCLUDING TABLE DATA
| CONVERT TO SUBSTITUTABLE
}
]
[ [FORCE ] exceptions_clause ]
}

dimension_join_clause JOIN KEY


{ child_key_column
| (child_key_column [, child_key_column ]...)

le
}
REFERENCES parent_level
r a b
[ JOIN KEY
{ child_key_column ns fe
t r a
n-
| (child_key_column [, child_key_column
]...) o
}
s an
REFERENCES parent_level
) ha
]...
c o m ide.
g i c. t Gu
elo den
disk_clauses { diskgroup_name
a r
{ add_disk_clause
|iw
S tu
drop_disk_clauses
@
le } thi s
| resize_disk_clauses
h a e
b |u{sdiskgroup_name
d h . | ALL }

b o se t } o undrop_disk_clause
u
(s icen
l e l
b ha
diskgroup_alias_clauses { ADD ALIAS
o d h alias_name FOR filename

sub [, alias_name FOR filename ]...


| DROP ALIAS
alias_name
[, alias_name ]...
| RENAME ALIAS
old_alias_name TO new_alias_name
[, old_alias_name TO new_alias_name ]...
}

diskgroup_availability { MOUNT
| DISMOUNT [ FORCE | NOFORCE ]
}

diskgroup_clauses { diskgroup_name
{ rebalance_diskgroup_clause
| check_diskgroup_clauses
| diskgroup_template_clauses
| diskgroup_directory_clauses
| diskgroup_alias_clauses

Oracle Database 10g: Administration Workshop I D - 39

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
| drop_diskgroup_file_clause
}
| { diskgroup_name | ALL }
diskgroup_availability
}

diskgroup_directory_clauses { ADD DIRECTORY


filename
[, filename ]...
| DROP DIRECTORY
filename [ FORCE | NOFORCE ]
[, filename [ FORCE | NOFORCE ] ]...
| RENAME DIRECTORY
a ble
old_dir_name TO new_dir_name
fe r
[, old_dir_name TO new_dir_name ]...
a ns
}
n- t r
diskgroup_file_spec [ ' { fully_qualified_file_name a no
| numeric_file_name
h a s
m
| incorporate_file_name) e.
o
c.c t Guid
| alias_file_name
}
g i
relo uden
'
] a
iw s St
[ SIZE size_clause ]
@
h a le
e thi
[ REUSE ]

d h .b us
[ autoextend_clause ]

o t o
( s ub ense { { ADDqualified_template_clause
diskgroup_template_clauses | ALTER } TEMPLATE

h a le lic [, qualified_template_clause ]...


h b | DROP TEMPLATE

b o d template_name
su }
[, template_name ]...

distributed_recov_clauses { ENABLE | DISABLE } DISTRIBUTED RECOVERY

dml_event_clause { DELETE | INSERT | UPDATE


[ OF column [, column ]... ]
}
[ OR { DELETE | INSERT | UPDATE
[ OF column [, column]... ]
}
]...
ON { [ schema. ]table
| [ NESTED TABLE nested_table_column OF ]
[ schema. ] view
}
[ referencing_clause ]
[ FOR EACH ROW ]

Oracle Database 10g: Administration Workshop I D - 40

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
dml_table_expression_clause { [ schema. ]
{ table
[ { PARTITION (partition)
| SUBPARTITION (subpartition)
}
| @ dblink
]
| { view | materialized view } [ @ dblink ]
}
| ( subquery [ subquery_restriction_clause ] )
| table_collection_expression
}

a ble
domain_index_clause INDEXTYPE IS indextype
fe r
[ parallel_clause ]
a ns
[ PARAMETERS ('ODCI_parameters') ]
n- t r
a no
drop_binding_clause DROP BINDING
h a s
(parameter_type
m ) e.
o
[, parameter_type ]...)
[ FORCE ]
g i c.c t Guid
a relo{ uCOLUMN
d en column
drop_column_clause
iw s S|t(column [, column ]...)
{ SET UNUSED
@
h a le
e t hi }
d h .b u[s{ CASCADE CONSTRAINTS | INVALIDATE }

b o e o
t ] [ CASCADE CONSTRAINTS | INVALIDATE ]...
e ( su cens | DROP { COLUMN column
ha l l i | (column [, column ]...)

h b }

b o d [ { CASCADE CONSTRAINTS | INVALIDATE }

s u ]
[ CASCADE CONSTRAINTS | INVALIDATE ]...

[ CHECKPOINT integer ]
| DROP { UNUSED COLUMNS
| COLUMNS CONTINUE
}
[ CHECKPOINT integer ]
}

drop_constraint_clause DROP
{ { PRIMARY KEY
| UNIQUE (column [, column ]...)
}
[ CASCADE ]
[ { KEEP | DROP } INDEX ]
| CONSTRAINT constraint
[ CASCADE ]
}

Oracle Database 10g: Administration Workshop I D - 41

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
drop_disk_clauses DROP
{ DISK
disk_name [ FORCE | NOFORCE ]
[, disk_name [ FORCE | NOFORCE ] ]...
| DISKS IN FAILGROUP
failgroup_name [ FORCE | NOFORCE ]
[, failgroup_name [ FORCE | NOFORCE ] ]...
}

drop_diskgroup_file_clause DROP FILE


filename

le
[, filename ]...

r a b
drop_index_partition DROP PARTITION partition_name
ns fe
t r a
drop_logfile_clauses DROP [ STANDBY ] LOGFILE no n-
{ logfile_descriptor s a
h a
) e.
[, logfile_descriptor ]...
| MEMBER 'filename'
o m
g i c.c t Guid
[, 'filename' ]...

relo uden
}

DROP iw
a tpartition
drop_table_partition
@ S
PARTITION
s
h a e thi
le [ update_index_clauses [ parallel_clause ] ]

d h .b us
o t o
ub ense
drop_table_subpartition DROP SUBPARTITION subpartition

e ( s c
[ update_index_clauses [ parallel_clause ] ]

h al li
h b
element_spec [ inheritance_clauses ]

b o d { subprogram_spec
su | constructor_spec
| map_order_function_spec
}
[ subprogram_clause
| constructor_spec
| map_order_function_spec
]...
[, pragma_clause ]

else_clause ELSE else_expr

enable_disable_clause { ENABLE | DISABLE }


[ VALIDATE | NOVALIDATE ]
{ UNIQUE (column [, column ]...)
| PRIMARY KEY
| CONSTRAINT constraint
}
[ using_index_clause ]

Oracle Database 10g: Administration Workshop I D - 42

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
[ exceptions_clause ]
[ CASCADE ]
[ { KEEP | DROP } INDEX ]

end_session_clauses { DISCONNECT SESSION 'integer1, integer2'


[ POST_TRANSACTION ]
| KILL SESSION 'integer1, integer2'
}
[ IMMEDIATE ]

estimate_statistics_clause ESTIMATE [ SYSTEM ] STATISTICS [ for_clause ]


[ SAMPLE integer { ROWS | PERCENT } ]
a ble
fe r
a ns
exceptions_clause EXCEPTIONS INTO [ schema. ]table
n- t r
o
exchange_partition_subpart EXCHANGE { PARTITION partition
s an
ha
| SUBPARTITION subpartition
)
}
c o m ide.
c. t Gu
WITH TABLE table
g i
[ { INCLUDING | EXCLUDING } INDEXES ]

relo uden
[ { WITH | WITHOUT } VALIDATION ]
a
iw s St
[ exceptions_clause ]
@
[ update_index_clauses [ parallel_clause ] ]

h a le
e thi
expr
d h .b {usimple_expression
s
o t o
ub ense | case_expression
| compound_expression
( s
h a le lic | cursor_expression

h b | datetime_expression

b o d | function_expression
| interval_expression
s u | object_access_expression
| scalar_subquery_expression
| model_expression
| type_constructor_expression
| variable_expression
}

expression_list { expr [, expr ]...


| (expr [, expr ]...)
}

extended_attribute_clause ATTRIBUTE attribute


LEVEL level
DETERMINES { dependent_column
| (dependent_column
[, dependent_column ]...
)
[ LEVEL level

Oracle Database 10g: Administration Workshop I D - 43

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
DETERMINES { dependent_column
| (dependent_column
[, dependent_column ]...
)
]...

extent_management_clause EXTENT MANAGEMENT


{ DICTIONARY
| LOCAL
[ AUTOALLOCATE
| UNIFORM

le
[ SIZE size_clause ]
]
r a b
}
ns fe
t r a
external_data_properties DEFAULT DIRECTORY directory
no n-
[ ACCESS PARAMETERS
s a
{ (opaque_format_spec)
| USING CLOB subquery h a
) e.
}
o m
]
g i c.c t Guid
relo uden
LOCATION
a
([ directory: ] 'location_specifier'
iw s St
[, [ directory: ] 'location_specifier'
@
le thi
]...
h a )
e
d h .b us
o t o
b nse ([ TYPE access_driver_type ]
s u
external_table_clause
( ice external_data_properties
l e l
b ha )
[ REJECT LIMIT { integer | UNLIMITED } ]
o d h
s ub file_specification { datafile_tempfile_spec
| diskgroup_file_spec
| redo_log_file_spec
}

finish_clause [ DISCONNECT [ FROM SESSION ] ]


[ parallel_clause ]
FINISH
[ SKIP [ STANDBY LOGFILE ] ]
[ WAIT | NOWAIT ]

flashback_mode_clause FLASHBACK { ON | OFF }

flashback_query_clause [ VERSIONS BETWEEN


{ SCN | TIMESTAMP }
{ expr | MINVALUE } AND
{ expr | MAXVALUE }

Oracle Database 10g: Administration Workshop I D - 44

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
]
AS OF { SCN | TIMESTAMP } expr

for_clause FOR
{ TABLE
| ALL [ INDEXED ] COLUMNS [ SIZE integer ]
| COLUMNS [ SIZE integer ]
{ column | attribute } [ SIZE integer ]
[ { column | attribute }
[ SIZE integer ]
]...
| ALL [ LOCAL ] INDEXES
}
a ble
[ FOR fe r
{ TABLE
a ns
| ALL [ INDEXED ] COLUMNS
n- t r
[ SIZE integer ]
| COLUMNS [ SIZE integer ] a no
h a s
{ column | attribute } [ SIZE integer ]
m ) e.
[ { column | attribute }
o
c.c t Guid
[ SIZE integer ]
g
]... i
a
} relo uden
| ALL [ LOCAL ] INDEXES

@ iw s St
]...

h a le
e thi
for_update_clause dh.
b FOR usUPDATE
o t o
b nse [ OF [ [{ schema.
s u
( ice table |
]
view } . ]column
l e l
ha
[, [ [ schema. ]

h b { table | view } . ]column

b o d ]...

su
]
[ NOWAIT | WAIT integer ]

full_database_recovery [ STANDBY ] DATABASE


[ { UNTIL { CANCEL
| TIME date
| CHANGE integer
}
| USING BACKUP CONTROLFILE
}
[ UNTIL { CANCEL
| TIME date
| CHANGE integer
}
| USING BACKUP CONTROLFILE
]...
]

Oracle Database 10g: Administration Workshop I D - 45

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
fully_qualified_file_name +diskgroup_name/db_name/file_type/
file_type_tag.filenumber.incarnation_number

function_association { FUNCTIONS
[ schema. ]function [, [ schema. ]function
]...
| PACKAGES
[ schema. ]package [, [ schema. ]package
]...
| TYPES
[ schema. ]type [, [ schema. ]type ]...

le
| INDEXES
[ schema. ]index [, [ schema. ]index ]...
r a b
| INDEXTYPES
[ schema. ]indextype [, [ schema. ns fe
t r a
n-
]indextype ]...
}
{ using_statistics_type a no
| { default_cost_clause
h a s
) e.
[, default_selectivity_clause ]
m
o
c.c t Guid
| default_selectivity_clause
i
[, default_cost_clause ]
g
relo uden
}
}
a
iw s St
@ i
leFUNCTIONthname
function_declaration
h a e
d h .b ]...) u s(parameter datatype[, parameter datatype
b o
o se t RETURN datatype
u
(s icen
a l e l { IS | AS } { pl/sql_block | call_spec }

b h
o h
dfunction_spec FUNCTION name

sub (parameter datatype [, parameter datatype


]...)
return_clause

general_recovery RECOVER
[ AUTOMATIC ]
[ FROM 'location' ]
{ { full_database_recovery
| partial_database_recovery
| LOGFILE 'filename'
}
[ { TEST
| ALLOW integer CORRUPTION
| parallel_clause
}
[ TEST
| ALLOW integer CORRUPTION
| parallel_clause
]...

Oracle Database 10g: Administration Workshop I D - 46

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
]
| CONTINUE [ DEFAULT ]
| CANCEL
}

global_partitioned_index GLOBAL PARTITION BY


{ RANGE
(column_list)
(index_partitioning_clause)
| HASH
(column_list)

le
{ individual_hash_partitions
| hash_partitions_by_quantity
r a b
}
}
ns fe
t r a
on-
grant_object_privileges
an
{ object_privilege | ALL [ PRIVILEGES ] }
s
ha
[ (column [, column ]...) ]
)
[, { object_privilege | ALL [ PRIVILEGES ] }
m ide.
o
[ (column [, column ]...) ]
c
]...
g i c. t Gu
relo uden
on_object_clause
a
TO grantee_clause
iw s St
[ WITH HIERARCHY OPTION ]
@
le thi
[ WITH GRANT OPTION ]
h a e
d h .b {usystem_privilege
s
o
grant_system_privileges
b nse | role t o
s u
( ice | ALL PRIVILEGES
l e l
b ha }
[, { system_privilege
o d h | role

sub | ALL PRIVILEGES


}
]...
TO grantee_clause
[ IDENTIFIED BY password ]
[ WITH ADMIN OPTION ]

grantee_clause { user | role | PUBLIC }


[, { user | role | PUBLIC } ]...

group_by_clause GROUP BY
{ expr
| rollup_cube_clause
| grouping_sets_clause
}
[, { expr
| rollup_cube_clause
| grouping_sets_clause
}

Oracle Database 10g: Administration Workshop I D - 47

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
]...
[ HAVING condition ]

grouping_expression_list expression_list [, expression_list ]...

grouping_sets_clause GROUPING SETS


({ rollup_cube_clause | grouping_expression_list
})

hash_partitioning PARTITION BY HASH


(column [, column ] ...)
a ble
{ individual_hash_partitions
fe r
| hash_partitions_by_quantity
a ns
}
n- t r
a no
hash_partitions_by_quantity PARTITIONS hash_partition_quantity
[ STORE IN
h a s
m ) e.
(tablespace [, tablespace ]...) ]
o
c.c t Guid
[ OVERFLOW STORE IN
g i
(tablespace [, tablespace ]...) ]

a relo uden
hierarchical_query_clause iw WITH
[ START
S t
condition ]
e @ i s
al e th
CONNECT BY [ NOCYCLE ] condition
b h
d us
h. toHIERARCHY
hierarchy_clause
b o
u ens e
hierarchy

e ( s c
(child_level CHILD OF parent_level

a l l i [ CHILD OF parent_level ]...

bh
[ dimension_join_clause ]

o d h )

sub implementation_clause { ANCILLARY TO


primary_operator (parameter_type
[, parameter_type ]...)
[, primary_operator ( parameter_type
[, parameter_type
]...)
]...
| context_clause
}

incomplete_file_name +diskgroup_name [ (template_name) ]

index_attributes [ { physical_attributes_clause
| logging_clause
| ONLINE
| COMPUTE STATISTICS
| TABLESPACE { tablespace | DEFAULT }
| key_compression

Oracle Database 10g: Administration Workshop I D - 48

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
| { SORT | NOSORT }
| REVERSE
| parallel_clause
}
[ physical_attributes_clause
| logging_clause
| ONLINE
| COMPUTE STATISTICS
| TABLESPACE { tablespace | DEFAULT }
| key_compression
| { SORT | NOSORT }
| REVERSE
| parallel_clause
a ble
]...
fe r
]
a ns
n- t r
index_expr { column | column_expression } o
s an
[ INCLUDING column_name ] ha
index_org_overflow_clause
m ) e.
OVERFLOW
o
i c.c t Gui]d
[ segment_attributes_clause
g
a relo uden
index_org_table_clause
iw s St integer
[ { mapping_table_clause
@ hi
| PCTTHRESHOLD

h a le | key_compression
t
.b u}s e
o d h t o [ mapping_table_clause

s u b n s e | PCTTHRESHOLD integer

l e ( ice | key_compression
ha l ]...

h b ]

b o d [ index_org_overflow_clause ]

su
index_partition_description PARTITION
[ partition
[ { segment_attributes_clause
| key_compression
}
[ segment_attributes_clause
| key_compression
]...
]
]

index_partitioning_clause PARTITION [ partition ]


VALUES LESS THAN (value[, value... ])
[ segment_attributes_clause ]

index_properties [ { { global_partitioned_index
| local_partitioned_index

Oracle Database 10g: Administration Workshop I D - 49

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
}
| index_attributes
}
[ { { global_partitioned_index
| local_partitioned_index
}
| index_attributes
}
]...
| domain_index_clause
]

index_subpartition_clause { STORE IN (tablespace[, tablespace ]...)


a ble
| (SUBPARTITION
fe r
[ subpartition [ TABLESPACE tablespace ] ]
a ns
[, SUBPARTITION
n- t r
] ] a no
[ subpartition [ TABLESPACE tablespace

]...
h a s
)
m ) e.
o
c.c t Guid
}

g i
individual_hash_partitions
a
(PARTITION r elo den
[iw
S
partition tupartitioning_storage_clause ]
@ s
le th[i partition partitioning_storage_clause
[, PARTITION
h a e
d h .b ]u]... s
o t o
( s ub ense )
h a le lic
h b
inheritance_clauses [ NOT ] { OVERRIDING | FINAL | INSTANTIABLE }

b o d [ [ NOT ] { OVERRIDING | FINAL | INSTANTIABLE

su } ]...

inline_constraint [ CONSTRAINT constraint_name ]


{ [ NOT ] NULL
| UNIQUE
| PRIMARY KEY
| references_clause
| CHECK (condition)
}
[ constraint_state ]

inline_ref_constraint { SCOPE IS [ schema. ] scope_table


| WITH ROWID
| [ CONSTRAINT constraint_name ]
references_clause
[ constraint_state ]
}

Oracle Database 10g: Administration Workshop I D - 50

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
inner_cross_join_clause table_reference
{ [ INNER ] JOIN table_reference
{ ON condition
| USING (column [, column ]...)
}
| { CROSS
| NATURAL [ INNER ]
}
JOIN table_reference
}

le
insert_into_clause INTO dml_table_expression_clause [ t_alias ]
[ (column [, column ]...) ]
r a b
ns fe
integer [ + | - ] digit [ digit ]...
t r a
on-
interval_day_to_second INTERVAL s an
) ha
'{ integer | integer time_expr | time_expr }'

c o m ide.
{ { DAY | HOUR | MINUTE }

g i c. t Gu
[ (leading_precision) ]

relo uden
| SECOND
[ (leading_precision
a
iw s St
[, fractional_seconds_precision ]
@
thi
)

h a le ]
.b }
us e
o d h t o
[ TO { DAY | HOUR | MINUTE | SECOND

( s ub ense }
[ (fractional_seconds_precision) ]

hal
e lic ]

h b
b d
o interval_year_to_month
s u INTERVAL 'integer [- integer ]'
{ YEAR | MONTH } [ (precision) ]
[ TO { YEAR | MONTH } ]

into_clause INTO [ schema. ] table

invoker_rights_clause AUTHID { CURRENT_USER | DEFINER }

Java_declaration JAVA NAME 'string'

join_clause { inner_cross_join_clause | outer_join_clause }

key_compression { COMPRESS [ integer ]


| NOCOMPRESS
}

Oracle Database 10g: Administration Workshop I D - 51

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
level_clause LEVEL level IS
{ level_table.level_column
| (level_table.level_column
[, level_table.level_column ]...
)
}

list_partitioning PARTITION BY LIST (column)


(PARTITION [ partition ]
list_values_clause
table_partition_description

le
[, PARTITION [ partition ]
list_values_clause
r a b
]...
table_partition_description
ns fe
t r a
n-
)

a no
list_values_clause VALUES ({ value | NULL
h a s
m ) e.
[, { value | NULL }...)
| DEFAULT
o
)
g i c.c t Guid
a relotablespace
d e n
LOB_parameters { TABLESPACE
|@
tu } STORAGE IN ROW
iw s|SDISABLE
hi
{ ENABLE

h a le| storage_clause
t
.b ||uCHUNK e
s integer
d h o
o se t | RETENTION
PCTVERSION integer
u b
l e (s icen | FREEPOOLS integer
ha l | { CACHE

h b | { NOCACHE | CACHE READS } [ logging_clause ]

b o d }

su }
[ TABLESPACE tablespace
| { ENABLE | DISABLE } STORAGE IN ROW
| storage_clause
| CHUNK integer
| PCTVERSION integer
| RETENTION
| FREEPOOLS integer
| { CACHE
| { NOCACHE | CACHE READS } [ logging_clause
]
}
]...

LOB_partition_storage PARTITION partition


{ LOB_storage_clause | varray_col_properties }
[ LOB_storage_clause | varray_col_properties
]...
[ (SUBPARTITION subpartition

Oracle Database 10g: Administration Workshop I D - 52

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
{ LOB_storage_clause | varray_col_properties
}
[ LOB_storage_clause
| varray_col_properties
]...
)
]

LOB_storage_clause LOB
{ (LOB_item [, LOB_item ]...)
STORE AS (LOB_parameters)
| (LOB_item)
STORE AS
a ble
{ LOB_segname (LOB_parameters)
fe r
| LOB_segname
a ns
| (LOB_parameters)
n- t r
no
}
}
s a
local_partitioned_index LOCAL h a
) e.
o m
.c Guid
[ on_range_partitioned_table
i c
| on_list_partitioned_table
g
r e lo ent
| on_hash_partitioned_table

wa Stud
| on_comp_partitioned_table
] i
a l e@ this
logfile_clause
h . bh LOGFILE
u se integer ] file_specification
b o d to [, [ GROUP integer ] file_specification ]...
[ GROUP

su cens e
e (
hal
logfile_clauses li { { ARCHIVELOG [ MANUAL ]
h b | NOARCHIVELOG

b o d }
su | [ NO ] FORCE LOGGING
| RENAME FILE 'filename'
[, 'filename' ]...
TO 'filename'
| CLEAR
[ UNARCHIVED ]
LOGFILE logfile_descriptor
[, logfile_descriptor ]...
[ UNRECOVERABLE DATAFILE ]
| add_logfile_clauses
| drop_logfile_clauses
| supplemental_db_logging
}

logfile_descriptor { GROUP integer


| ('filename' [, 'filename' ]...)
| 'filename'
}

Oracle Database 10g: Administration Workshop I D - 53

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
logging_clause { LOGGING | NOLOGGING }

main_model [ MAIN main_model_name ]


model_column_clauses
[ cell_reference_options ]
model_rules_clause

managed_standby_recovery RECOVER MANAGED STANDBY DATABASE


[ recover_clause | cancel_clause |
finish_clause ]

a ble
map_order_func_declaration { MAP | ORDER } MEMBER function_declaration
fe r
a ns
map_order_function_spec { MAP | ORDER } MEMBER function_spec
n- t r
a no
mapping_table_clauses { MAPPING TABLE | NOMAPPING a }s
h
) e.
o m
materialized_view_props [ column_properties
g i c.c] t Guid]
lo ]en
[ table_partitioning_clauses
[ CACHE |re
a ud]
NOCACHE
i w S
[ parallel_clauset
a l e[ @ t h is ]
build_clause

h . bh SET u e
sSTANDBY
o d
maximize_standby_db_clause
b nse t o DATABASE TO MAXIMIZE

s u { PROTECTION | AVAILABILITY | PERFORMANCE }

a l e ( lice
h bh
maxsize_clause MAXSIZE { UNLIMITED | size_clause }

b o d
su merge_insert_clause WHEN NOT MATCHED THEN
INSERT [ (column [, column ]...) ]
VALUES ({ expr [, expr ]... | DEFAULT })
[ where_clause ]

merge_table_partitions MERGE PARTITIONS partition_1, partition_2


[ INTO partition_spec ]
[ update_index_clauses ]
[ parallel_clause ]

merge_table_subpartitions MERGE SUBPARTITIONS subpart_1, subpart_2


[ INTO subpartition_spec ]
[ update_index_clauses ]
[ parallel_clause ]

merge_update_clause WHEN MATCHED THEN


UPDATE SET column = { expr | DEFAULT }

Oracle Database 10g: Administration Workshop I D - 54

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
[, column = { expr | DEFAULT } ]...
[ where_clause ]
[ DELETE where_clause ]

model_clause MODEL
[ cell_reference_options ]
[ return_rows_clause ]
[ reference_model ]
[ reference_model ]...
main_model

model_column expr [ [ AS ] c_alias ]


a ble
fe r
model_column_clauses [ query_partition_clause [ c_alias ] ]
a ns
DIMENSION BY (model_column
n- t r
[, model_column ]...)
MEASURES (model_column a no
[, model_column ]...)
h a s
m ) e.
o
model_rules_clause RULES
g i c.]c t Guid
r e lo | SEQUENTIAL
[ UPSERT | UPDATE
e n
[ { AUTOMATIC
a
iw | UPSERT
[ ITERATE t u
(number) d [ UNTIL
} ORDER ]
(condition) ] ]
([@UPDATE s S
hi
lecell_assignment ]
h a e t [ order_by_clause ] = expr
h . b u s cell_assignment [ ]order_by_clause ] = expr
[ [ UPDATE | UPSERT

b d
o se t ]... o
u
(s icen
a l e l
)

h bh
b o dmodify_col_properties ( column [ datatype ]
[ DEFAULT expr ]
s u [ inline_constraint
[ inline_constraint ]... ]
[ LOB_storage_clause ]
[, column [ datatype ]
[ DEFAULT expr ]
[ inline_constraint
[ inline_constraint ]... ]
[ LOB_storage_clause ]
]
)

modify_col_substitutable COLUMN column


[ NOT ] SUBSTITUTABLE AT ALL LEVELS
[ FORCE ]

modify_collection_retrieval MODIFY NESTED TABLE collection_item


RETURN AS { LOCATOR | VALUE }

Oracle Database 10g: Administration Workshop I D - 55

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
modify_column_clauses MODIFY { modify_col_properties
| modify_col_substitutable
}

modify_hash_partition MODIFY PARTITION partition


{ partition_attributes
| alter_mapping_table_clause
| [ REBUILD ] UNUSABLE LOCAL INDEXES
}

modify_hash_subpartition { { allocate_extent_clause
| deallocate_unused_clause
a ble
| shrink_clause
fe r
| { LOB LOB_item
a ns
| VARRAY varray
n- t r
no
}
modify_LOB_parameters
s a
[ { LOB LOB_item
| VARRAY varray h
) e.a
}
o m
i c.c t Guid
modify_LOB_parameters
g
elo den
]...
}
a r
| [ REBUILD
}@
tu
iw s ]SUNUSABLE LOCAL INDEXES

h a le
e thi
d h .b MODIFY
us DEFAULT ATTRIBUTES
o
modify_index_default_attrs
b nse t o
s u
( ice
[ FOR PARTITION partition ]
{ physical_attributes_clause
l e l
b ha | TABLESPACE { tablespace | DEFAULT }
| logging_clause
o d h }

sub [ physical_attributes_clause
| TABLESPACE { tablespace | DEFAULT }
| logging_clause
]...

modify_index_partition MODIFY PARTITION partition


{ { deallocate_unused_clause
| allocate_extent_clause
| physical_attributes_clause
| logging_clause
| key_compression
}
[ deallocate_unused_clause
| allocate_extent_clause
| physical_attributes_clause
| logging_clause
| key_compression
]...
| PARAMETERS ('ODCI_parameters')

Oracle Database 10g: Administration Workshop I D - 56

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
| COALESCE
| UPDATE BLOCK REFERENCES
| UNUSABLE
}

modify_index_subpartition MODIFY SUBPARTITION subpartition


{ UNUSABLE
| allocate_extent_clause
| deallocate_unused_clause
}

modify_list_partition MODIFY PARTITION partition


a ble
{ partition_attributes
fe r
| {ADD | DROP} VALUES
a ns
(partition_value[, partition_value ]...)
n- t r
no
| [ REBUILD ] UNUSABLE LOCAL INDEXES
}
s a
h
) e.a
modify_list_subpartition { allocate_extent_clause
o m
g i c.c t Guid
| deallocate_unused_clause

relo ud| enVARRAY varray }


| shrink_clause
| { LOB LOB_item
a
w St
[i { LOB LOB_item
modify_LOB_parameters

l e @ h i s | VARRAY varray }

ha s]e ... t
modify_LOB_parameters
. b
h to|u[ REBUILD ] UNUSABLE LOCAL INDEXES
o d
b nse | { ADD | DROP } VALUES (value[, value ]...)
s u
( ice }
l e l
b ha
o d h
modify_LOB_parameters { storage_clause

sub
| PCTVERSION integer
| RETENTION
| FREEPOOLS integer
| REBUILD FREEPOOLS
| { CACHE
| { NOCACHE | CACHE READS } [ logging_clause ]
}
| allocate_extent_clause
| deallocate_unused_clause
| shrink_clause

}
[ storage_clause
| PCTVERSION integer
| RETENTION
| FREEPOOLS integer
| REBUILD FREEPOOLS
| { CACHE
| { NOCACHE | CACHE READS } [ logging_clause
]

Oracle Database 10g: Administration Workshop I D - 57

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
}
| allocate_extent_clause
| deallocate_unused_clause
| shrink_clause
]...

modify_LOB_storage_clause MODIFY LOB (LOB_item)


(modify_LOB_parameters)

modify_range_partition MODIFY PARTITION partition


{ partition_attributes
| { add_hash_subpartition
a ble
| add_list_subpartition fe r
}
a ns
| COALESCE SUBPARTITION
n- t r
o
an
[ update_index_clauses ]
[ parallel_clause ]
| alter_mapping_table_clause
ha s
)
m ide.
| [ REBUILD ] UNUSABLE LOCAL INDEXES
c o
c. t Gu
}
g i
modify_table_default_attrs a relo uATTRIBUTES
MODIFY DEFAULT d en
[ iw S t partition ]
FOR PARTITION
@ s
h a e thi
le [[ segment_attributes_clause ]

d h .b us[ PCTTHRESHOLD integer ]


table_compression ]

b o e t o [ key_compression ]
( u
s cen s [ alter_overflow_clause ]
a l e li [ { LOB (LOB_item)
b h | VARRAY varray

o d h }

s ub (LOB_parameters)
[ { LOB (LOB_item)
| VARRAY varray
}
(LOB_parameters)
]...
]

modify_table_partition { modify_range_partition
| modify_hash_partition
| modify_list_partition
}

modify_table_subpartition MODIFY SUBPARTITION subpartition


{ modify_hash_subpartition
| modify_list_subpartition
}

Oracle Database 10g: Administration Workshop I D - 58

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
move_table_clause MOVE [ ONLINE ]
[ segment_attributes_clause ]
[ table_compression ]
[ index_org_table_clause ]
[ { LOB_storage_clause
| varray_col_properties
}
[ { LOB_storage_clause
| varray_col_properties
}
]...
]
[ parallel_clause ]
a ble
fe r
move_table_partition MOVE PARTITION partition
a ns
[ MAPPING TABLE ]
n- t r
[
[
table_partition_description ]
update_index_clauses ] a no
[ parallel_clause ]
h a s
m ) e.
o
move_table_subpartition MOVE SUBPARTITION .c
g i c t Guid
elo den ]
subpartition_spec
a r
[ update_index_clauses
[ iw
S tu ]
parallel_clause
le @ hi s
multi_column_for_loop b h a e t
FORs(dimension_column
d h . u [, dimension_column ]...)
o
b nse t o
s u
( ice
IN ( { (literal [, literal ]...)
[ (literal [, literal ]...)... ]
l e l
b ha |
}
subquery

o d h )

sub
multi_table_insert { ALL insert_into_clause
[ values_clause ]
[ insert_into_clause
[ values_clause ]
]...
| conditional_insert_clause
}
subquery

multiset_except nested_table1
MULTISET EXCEPT [ ALL | DISTINCT ]
nested_table2

multiset_intersect nested_table1
MULTISET INTERSECT [ ALL | DISTINCT ]
nested_table2

Oracle Database 10g: Administration Workshop I D - 59

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
multiset_union nested_table1
MULTISET UNION [ ALL | DISTINCT ]
nested_table2

nested_table_col_properties NESTED TABLE


{ nested_item | COLUMN_VALUE }
[ substitutable_column_clause ]
STORE AS storage_table
[ ( { (object_properties)
| [ physical_properties ]
| [ column_properties ]

le
}
[ (object_properties)
r a b
| [ physical_properties ]
| [ column_properties ] ns fe
t r a
n-
]...

]
)
a no
a s
[ RETURN AS { LOCATOR | VALUE } ]
h
m ) e.
o id VALUES
new_values_clause
i c.c t G
{ INCLUDING | EXCLUDING
g
} u
NEW

[ + | -a
relo uden
number
{@ iw [ sdigit
]
S t ]... [ . ] [ digit [ digit ]...
hi
digit

h a le] t
e
.b |}u.sdigit [ digit ]...
o d h to[ e [ + | - ] digit [ digit ]... ]
b
su cens e
l e ( i
[ f | d ]
ha l
h b
o dnumeric_file_name +diskgroup_name.filenumber.incarnation_number

sub object_properties { { column | attribute }


[ DEFAULT expr ]
[ inline_constraint [ inline_constraint ]...
| inline_ref_constraint
]
| { out_of_line_constraint
| out_of_line_ref_constraint
| supplemental_logging_props
}
}

object_table CREATE [ GLOBAL TEMPORARY ] TABLE


[ schema. ]table OF
[ schema. ]object_type
[ object_table_substitution ]
[ (object_properties) ]
[ ON COMMIT { DELETE | PRESERVE } ROWS ]
[ OID_clause ]

Oracle Database 10g: Administration Workshop I D - 60

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
[ OID_index_clause ]
[ physical_properties ]
[ table_properties ] ;

object_table_substitution [ NOT ] SUBSTITUTABLE AT ALL LEVELS

object_type_col_properties COLUMN column substitutable_column_clause

object_view_clause OF [ schema. ]type_name


{ WITH OBJECT IDENTIFIER
{ DEFAULT | ( attribute
a ble
[, attribute ]... )
fe r
}
a ns
| UNDER [ schema. ]superview
} n- t r
o
({ out_of_line_constraint
| attribute inline_constraint s an
) ha
[ inline_constraint ]...
}
c o m ide.
g i c. t Gu
[, { out_of_line_constraint

relo uden
| attribute inline_constraint
[ inline_constraint ]...
} a
iw s St
@
thi
]...

h)a le
.b us e
o d h t o
OID_clause
s u b nse OBJECT IDENTIFIER IS

e ( c e { SYSTEM GENERATED | PRIMARY KEY }

h al li
h b
b o dOID_index_clause OIDINDEX [ index ]
({ physical_attributes_clause
s u | TABLESPACE tablespace
}
[ physical_attributes_clause
| TABLESPACE tablespace
]...
)

on_comp_partitioned_table [ STORE IN ( tablespace [, tablespace ]... ) ]


( PARTITION
[ partition
[ { segment_attribute_clause
| key_compression
}
[ segment_attribute_clause
| key_compression
]...
]
[ index_subpartition_clause ]
]

Oracle Database 10g: Administration Workshop I D - 61

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
[, PARTITION
[ partition
[ { segment_attribute_clause
| key_compression
}
[ segment_attribute_clause
| key_compression
]...
]
[ index_subpartition_clause ]
]...
]
)
a ble
fe r
on_hash_partitioned_table { STORE IN (tablespace[, tablespace ]...)
a ns
| (PARTITION
n- t r
[, PARTITION a no
[ partition [ TABLESPACE tablespace ] ]

a s
[ partition [ TABLESPACE tablespace ] ]
h
]...
m ) e.
o
c.c t Guid
)
}
g i
a r elo den
on_list_partitioned_table iw s Stu
( PARTITION
@
h a le [th{i segment_attributes_clause
[ partition

h . b u se | key_compression
b o d to }
s u ens e [ segment_attributes_clause
l e ( i c | key_compression
h a l ]...
h b ]

b o d ]
su [, PARTITION
[ partition
[ { segment_attributes_clause
| key_compression
}
[ segment_attributes_clause
| key_compression
]...
]
]
]...
)

on_object_clause { schema.object
| { DIRECTORY directory_name
| JAVA { SOURCE | RESOURCE } [ schema. ]object
}
}

Oracle Database 10g: Administration Workshop I D - 62

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
on_range_partitioned_table ( PARTITION
[ partition
[ { segment_attributes_clause
| key_compression
}
[ segment_attributes_clause
| key_compression
]...
]
]
[, PARTITION
[ partition
[ { segment_attributes_clause
a ble
| key_compression
fe r
}
[ segment_attributes_clause
a ns
| key_compression
n- t r
]...
a no
]
]
h a s
]...
m ) e.
o
c.c t Guid
)
g i
order_by_clause
elo ] BYn
positiond|ec_alias }
ORDER [ SIBLINGS
{ expr |ar
[ ASCiw| DESC S]t
u
@
le[ NULLS s
i | NULLS LAST ]
h a thFIRST
[,e{ expr | position | c_alias }
d h .b us [ ASC | DESC ]
o
b nse t o
s u [ NULLS FIRST | NULLS LAST ]

e ( lice
]...
a l
h bh
out_of_line_constraint [ CONSTRAINT constraint_name ]

b o d { UNIQUE (column [, column ]...)

su | PRIMARY KEY (column [, column ]...)


| FOREIGN KEY (column [, column ]...)
references_clause
| CHECK (condition)
}
[ constraint_state ]

out_of_line_ref_constraint { SCOPE FOR


({ ref_col | ref_attr })
IS [ schema. ]scope_table
| REF
({ ref_col | ref_attr })
WITH ROWID
| [ CONSTRAINT constraint_name ]
FOREIGN KEY
({ ref_col | ref_attr })
references_clause
[ constraint_state ]
}

Oracle Database 10g: Administration Workshop I D - 63

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
outer_join_clause table_reference
[ query_partition_clause ]
{ outer_join_type JOIN
| NATURAL [ outer_join_type ] JOIN
}
table_reference [ query_partition_clause ]
[ ON condition
| USING ( column [, column ]...)
]

outer_join_type { FULL | LEFT | RIGHT }

le
[ OUTER ]

r a b
parallel_clause { NOPARALLEL | PARALLEL [ integer ] }
ns fe
t r a
parallel_enable_clause PARALLEL_ENABLE no n-
[ (PARTITION argument BY s a
{ ANY h a
) e.
m
| { HASH | RANGE } (column [, column ]...)
o
}
g i c.c t Guid
relo uden
)
[ streaming_clause ]
] a
iw s St
@
le thi tablespace [, tablespace ]...
partial_database_recoveryha { TABLESPACE
e
d h .b |uDATAFILE
s
o
b nse t o { 'filename' | filenumber }
[, 'filename' | filenumber ]...
s u
e ( lice
}

h a l | STANDBY

h b { TABLESPACE tablespace [, tablespace ]...

o d | DATAFILE { 'filename' | filenumber }

sub
[, 'filename' | filenumber ]...
}
}
UNTIL [ CONSISTENT WITH ] CONTROLFILE
}

partition_attributes [ { physical_attributes_clause
| logging_clause
| allocate_extent_clause
| deallocate_unused_clause
| shrink_clause
}
[ physical_attributes_clause
| logging_clause
| allocate_extent_clause
| deallocate_unused_clause
| shrink_clause
]...
]
[ OVERFLOW

Oracle Database 10g: Administration Workshop I D - 64

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
{ physical_attributes_clause
| logging_clause
| allocate_extent_clause
| deallocate_unused_clause
}
[ physical_attributes_clause
| logging_clause
| allocate_extent_clause
| deallocate_unused_clause
]...
]
[ table_compression ]
[ { LOB LOB_item | VARRAY varray }
a ble
modify_LOB_parameters
fe r
[ { LOB LOB_item | VARRAY varray }
modify_LOB_parameters
a ns
]...
n- t r
]
a no
h a s
partition_extended_name
) e.
[ schema.] { table | view }
m
o
[ PARTITION (partition)

g i c.c t Guid
| SUBPARTITION (subpartition)

relo uden
]

a t hash_subpartition_quantity
iw sINS(tablespace[,
partition_level_subpartition { SUBPARTITIONS
l @
[ STORE
h i
e| (subpartition_spec[, tablespace ]...) ]
a
h } se t subpartition_spec ]...)
. b
h to u
o d
(
partition_specs ub ense PARTITION [ partition ]
h a le lic [ table_partition_description ]

h b
b o dpartitioning_storage_clause [ { TABLESPACE tablespace
su | OVERFLOW [ TABLESPACE tablespace ]
| LOB (LOB_item) STORE AS
{ LOB_segname [ (TABLESPACE tablespace) ]
| (TABLESPACE tablespace)
}
| VARRAY varray_item STORE AS LOB LOB_segname
}
[ { TABLESPACE tablespace
| OVERFLOW [ TABLESPACE tablespace ]
| LOB (LOB_item) STORE AS
{ LOB_segname [ (TABLESPACE tablespace)
]
| (TABLESPACE tablespace)
}
| VARRAY varray_item STORE AS LOB
LOB_segname
}
]...
]

Oracle Database 10g: Administration Workshop I D - 65

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
password_parameters { { FAILED_LOGIN_ATTEMPTS
| PASSWORD_LIFE_TIME
| PASSWORD_REUSE_TIME
| PASSWORD_REUSE_MAX
| PASSWORD_LOCK_TIME
| PASSWORD_GRACE_TIME
}
{ expr | UNLIMITED | DEFAULT }
| PASSWORD_VERIFY_FUNCTION
{ function | NULL | DEFAULT }
}

permanent_tablespace_clause { MINIMUM EXTENT integer [ K | M ]


a ble
| BLOCKSIZE integer [ K ]
fe r
| logging_clause
a ns
| FORCE LOGGING
n- t r
| DEFAULT [ table_compression ]
n o
storage_clause
s a
| { ONLINE | OFFLINE }
) ha
|
|
c o m ide.
extent_management_clause
segment_management_clause
| i c. t Gu
flashback_mode_clause
g
relo uden
[ MINIMUM EXTENT integer [ K | M ]
a
| BLOCKSIZE integer [ K ]
iw s St
| logging_clause
@
h a le
e thi
| FORCE LOGGING
| DEFAULT [ table_compression ]

d h .b us storage_clause
o t o
ub ense
| { ONLINE | OFFLINE }
( s | extent_management_clause

hal
e lic | segment_management_clause

h b | flashback_mode_clause

o d ]...

sub
}

physical_attributes_clause [ { PCTFREE integer


| PCTUSED integer
| INITRANS integer
| storage_clause
}
[ PCTFREE integer
| PCTUSED integer
| INITRANS integer
| storage_clause
]...
]

physical_properties { segment_attributes_clause
[ table_compression ]
| ORGANIZATION
{ HEAP
[ segment_attributes_clause ]

Oracle Database 10g: Administration Workshop I D - 66

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
[ table_compression ]
| INDEX
[ segment_attributes_clause ]
index_org_table_clause
| EXTERNAL
external_table_clause
}
| CLUSTER cluster (column [, column ]...)
}

pragma_clause PRAGMA RESTRICT_REFERENCES

le
({ method_name | DEFAULT } ,
{ RNDS | WNDS | RNPS | WNPS | TRUST }
r a b
)
[, { RNDS | WNDS | RNPS | WNPS | TRUST } ]...
ns fe
t r a
no n-
procedure_declaration PROCEDURE name (parameter datatype
s a
h
) e.a
[, parameter datatype ]...)
{ IS | AS } { pl/sql_block | call_spec }
o m
PROCEDURE namegic
.c Guid
procedure_spec
lo en[,t parameter datatype ]...)
(parameteredatatype
r
i w Stud
[ { IS |a AS } call_spec ]

a l e@ this
proxy_authentication
h . bh {|uAUTHENTICATION
se REQUIRED

b o d to { PASSWORD
AUTHENTICATED USING

su cens e
e ( | DISTINGUISHED NAME

h a l li | CERTIFICATE [ TYPE 'type' ]

h b [ VERSION 'version' ]

b o d }

su
}

proxy_clause { GRANT | REVOKE }


CONNECT THROUGH proxy
[ WITH { ROLE { role_name
[, role_name ]...
| ALL EXCEPT role_name
[, role_name ]...
}
| NO ROLES
}
]
[ proxy_authentication ]

qualified_disk_clause search_string
[ NAME disk_name ]
[ SIZE size_clause ]
[ FORCE | NOFORCE ]

Oracle Database 10g: Administration Workshop I D - 67

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
qualified_template_clause template_name
ATTRIBUTES
([ MIRROR | UNPROTECTED ]
[ FINE | COARSE ]
)

query_partition_clause PARTITION BY
{ value_expr[, value_expr ]...
| ( value_expr[, value_expr ]... )

query_table_expression { query_name
| [ schema. ]
a ble
{ table [ { PARTITION (partition)
fe r
| SUBPARTITION (subpartition)
a ns
}
n- t r
no
[ sample_clause ]
| [ sample_clause ]
s a
| @ dblink
] h a
) e.
o m
| { view | materialized view } [ @ dblink ]
}
g i c.c t Guid
relo uden
| (subquery [ subquery_restriction_clause ])

} a
| table_collection_expression
iw s St
le @ hi
h a e t
quiesce_clauses
d h .b QUIESCE
u s RESTRICTED | UNQUIESCE
b o se t o
( u
s cen
range_partitioning PARTITION BY RANGE (column[, column ]...)
a l e li (PARTITION [ partition ]
b h range_values_clause

o d h table_partition_description

sub
[, PARTITION [ partition ]
range_values_clause
table_partition_description
]...
)

range_values_clause VALUES LESS THAN


({ value | MAXVALUE }
[, { value | MAXVALUE } ]...
)

rebalance_diskgroup_clause REBALANCE [ POWER integer ]

rebuild_clause REBUILD
[ { PARTITION partition
| SUBPARTITION subpartition
}
| { REVERSE | NOREVERSE }

Oracle Database 10g: Administration Workshop I D - 68

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
]
[ parallel_clause
| TABLESPACE tablespace
| PARAMETERS ('ODCI_parameters')
| ONLINE
| COMPUTE STATISTICS
| physical_attributes_clause
| key_compression
| logging_clause
]
[ parallel_clause
| TABLESPACE tablespace
| PARAMETERS ('ODCI_parameters')
a ble
| ONLINE
fe r
| COMPUTE STATISTICS
| physical_attributes_clause
a ns
| key_compression
n- t r
| logging_clause
a no
]...
h a s
m ) e.
o
c.c t Guid
records_per_block_clause { MINIMIZE | NOMINIMIZE } RECORDS_PER_BLOCK

g i
recover_clause
a r elo [ dFROM
{ { DISCONNECT e n SESSION ]
| {iw
S tu
TIMEOUT integer | NOTIMEOUT }
@ s
thi | DEFAULT DELAY | DELAY integer }
le| { NODELAY
}
h a e
d h .b ||uNEXT s integer
b o e o
t | parallel_clause
{ EXPIRE integer | NO EXPIRE }

e ( su cens
h a l l i | USING CURRENT LOGFILE
| UNTIL CHANGE integer
h b | THROUGH { [ THREAD integer ] SEQUENCE integer

b o d | ALL ARCHIVELOG
su | { ALL | LAST | NEXT } SWITCHOVER
}
}
[ { DISCONNECT [ FROM SESSION ]
| { TIMEOUT integer | NOTIMEOUT }
}
| { NODELAY | DEFAULT DELAY | DELAY integer }
| NEXT integer
| { EXPIRE integer | NO EXPIRE }
| parallel_clause
| USING CURRENT LOGFILE
| UNTIL CHANGE integer
| THROUGH { [ THREAD integer ] SEQUENCE
integer
| ALL ARCHIVELOG
| { ALL | LAST | NEXT } SWITCHOVER
}
] ...

Oracle Database 10g: Administration Workshop I D - 69

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
recovery_clauses { general_recovery
| managed_standby_recovery
| BEGIN BACKUP
| END BACKUP
}

redo_log_file_spec [ 'filename'
| ('filename' [, 'filename' ]...)
]
[ SIZE size_clause ]
[ REUSE ]

a ble
redo_thread_clauses { ENABLE | DISABLE }
fe r
{ INSTANCE 'instance_name'
a ns
| [ PUBLIC ] THREAD integer
n- t r
no
}

s a
reference_model h
) e.a
REFERENCE reference_spreadsheet_name
ON (subquery)
o m
g i c.c t G]uid
spreadsheet_column_clauses

relo uden
[ cell_reference_options

a t
iw s[Sschema.
references_clause
e @
REFERENCES
l [ON DELETEi
] { object_table | view }

h a [
e th { CASCADE | SET]NULL } ]
(column [, column ]...)

d h .b [uconstraint_state
s
o t o ]

( s ub ense
h a le
referencing_clause
lic REFERENCING

h b { OLD [ AS ] old

b o d | NEW [ AS ] new
| PARENT [ AS ] parent }
s u [ OLD [ AS ] old
| NEW [ AS ] new
| PARENT [ AS ] parent ]...

register_logfile_clause REGISTER
[ OR REPLACE ]
[ PHYSICAL | LOGICAL ]
LOGFILE
[ file_specification
[, file_specification ]...
]
FOR logminer_session_name

relational_properties { column datatype [ SORT ]


[ DEFAULT expr ]
[ inline_constraint
[ inline_constraint ]...
| inline_ref_constraint

Oracle Database 10g: Administration Workshop I D - 70

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
]
| { out_of_line_constraint
| out_of_line_ref_constraint
| supplemental_logging_props
}
}
[, { column datatype [ SORT ]
[ DEFAULT expr ]
[ inline_constraint
[ inline_constraint ]...
| inline_ref_constraint
]
| { out_of_line_constraint
a ble
| out_of_line_ref_constraint
fe r
| supplemental_logging_props
}
a ns
]...
n- t r
a no
relational_table CREATE [ GLOBAL TEMPORARY ] a
h s [ schema.
TABLE
]table
m ) ]e.
o
.c G
[ (relational_properties)
[ ON COMMIT {icDELETE | u id
PRESERVE } ROWS ]
g t
relo uden ] ;
[ physical_properties ]
a
[ table_properties
iw s St
@ hi old_name TO new_name
leRENAME tCOLUMN
rename_column_clause
h a e
d h .b us
o t o
b nse RENAME { PARTITION partition
s u
rename_index_partition
( ice | SUBPARTITION subpartition }
l e l
b ha TO new_name

o d h
sub
rename_partition_subpart RENAME { PARTITION | SUBPARTITION }
current_name TO new_name

replace_type_clause REPLACE [ invoker_rights_clause ] AS OBJECT


(attribute datatype [, attribute datatype
]...
[, element_spec [, element_spec ]... ])

resize_disk_clauses RESIZE
{ ALL [ SIZE size_clause ]
| DISK
disk_name [ SIZE size_clause ]
[, disk_name [ SIZE size_clause ] ]...
| DISKS IN FAILGROUP
failgroup_name [ SIZE size_clause ]
[, failgroup_name [ SIZE size_clause ] ]...
}

Oracle Database 10g: Administration Workshop I D - 71

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
resource_parameters { { SESSIONS_PER_USER
| CPU_PER_SESSION
| CPU_PER_CALL
| CONNECT_TIME
| IDLE_TIME
| LOGICAL_READS_PER_SESSION
| LOGICAL_READS_PER_CALL
| COMPOSITE_LIMIT
}
{ integer | UNLIMITED | DEFAULT }
| PRIVATE_SGA
{ integer [ K | M ] | UNLIMITED | DEFAULT }
}
a ble
fe r
restricted_session_clauses { ENABLE | DISABLE } RESTRICTED SESSION
a ns
n- t r
return_clause
no
{ RETURN datatype [ { IS | AS } call_spec ]
| sqlj_object_type_sig a
}
h a s
m ) e.
RETURN { UPDATED |.c o uid
return_rows_clause
g i c ALLt }GROWS
lo [, expr
reexpr e n ]...
returning_clause RETURNINGa d
tu[, data_item ]...
INTO iw S
@ data_item
s
h a le
e thi
revoke_object_privileges
d h .b {uobject_privilege
s | ALL [ PRIVILEGES ] }

b o e o
t ]...
[, { object_privilege | ALL [ PRIVILEGES ] }

e ( su cens
h a l l i on_object_clause
FROM grantee_clause
h b [ CASCADE CONSTRAINTS | FORCE ]
o d
sub revoke_system_privileges { system_privilege
| role
| ALL PRIVILEGES
}
[, { system_privilege
| role
| ALL PRIVILEGES
}
]...
FROM grantee_clause

rollup_cube_clause { ROLLUP | CUBE } (grouping_expression_list)

routine_clause [ schema. ] [ type. | package. ]


{ function | procedure | method }
[ @dblink_name ]
( [ argument [, argument ]... ] )

Oracle Database 10g: Administration Workshop I D - 72

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
row_movement_clause { ENABLE | DISABLE } ROW MOVEMENT

sample_clause SAMPLE [ BLOCK ]


(sample_percent)
[ SEED (seed_value) ]

schema_object_clause { object_option [, object_option ]... | ALL }


auditing_on_clause

scoped_table_ref_constraint { SCOPE FOR


({ ref_column | ref_attribute })
IS [ schema. ] { scope_table_name | c_alias }
a ble
}
fe r
[, SCOPE FOR
a ns
({ ref_column | ref_attribute })
n- t r
no
IS [ schema. ] { scope_table_name | c_alias
}
s a
]...
h a
o m) ide.
WHEN condition THENcreturn_expr
searched_case_expression
. return_expr
[ WHEN conditionicTHEN G u
l o g n t ]...

{a
re ude | NONE }
security_clause GUARDiw
S t
ALL | STANDBY
le @ hi s
h a e t
segment_attributes_clause
d h .b {|uphysical_attributes_clause
s
o t o TABLESPACE tablespace
b nse | logging_clause
s u
( ice }
l e l
b ha [ physical_attributes_clause
| TABLESPACE tablespace
o d h | logging_clause

sub ]...

segment_management_clause SEGMENT SPACE MANAGEMENT { MANUAL | AUTO }

select_list { *
| { query_name.*
| [ schema. ]
{ table | view | materialized view } .*
| expr [ [ AS ] c_alias ]
}
[, { query_name.*
| [ schema. ]
{ table | view | materialized view } .*
| expr [ [ AS ] c_alias ]
}
]...
}

Oracle Database 10g: Administration Workshop I D - 73

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
set_subpartition_template SET SUBPARTITION TEMPLATE
{ (SUBPARTITION subpartition
[ list_values_clause ]
[ partitioning_storage_clause ]
[, SUBPARTITION subpartition
[ list_values_clause ]
[ partitioning_storage_clause ]...
]
)
| hash_subpartition_quantity
}

set_time_zone_clause SET TIME_ZONE =


a ble
'{ { + | - } hh : mi | time_zone_region }'
fe r
a ns
n- t r
no
shrink_clause SHRINK SPACE [ COMPACT ] [ CASCADE ]

s a
shutdown_dispatcher_clause h
) e.a
SHUTDOWN [ IMMEDIATE ] dispatcher_name
o m
simple_case_expression
g i c.c t Guid
expr WHEN comparison_expr
o en
relcomparison_expr
THEN return_expr

i a
[ WHEN
tud
wTHEN return_expr
S
e @ i s ]...

b h al e th
single_column_for_loop
d h. toFOR u{sdimension_column
u b o s e IN ( { literal

e ( s cen [, literal ]...

h a l li | subquery

h b }

o d )

sub
| [ LIKE pattern ]
FROM literal TO literal
{ INCREMENT | DECREMENT } literal
}

single_table_insert insert_into_clause
{ values_clause [ returning_clause ]
| subquery
}

size_clause integer [ K | M | G | T ]

split_index_partition SPLIT PARTITION partition_name_old


AT (value [, value ]...)
[ INTO (index_partition_description,
index_partition_description
)
]

Oracle Database 10g: Administration Workshop I D - 74

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
[ parallel_clause ]
UPDATE MANUALLY problem importing file
split_table_partition SPLIT PARTITION current_partition
{ AT | VALUES } (value [, value ]...)
[ INTO (partition_spec, partition_spec) ]
[ update_index_clauses ]
[ parallel_clause ]
UPDATE MANUALLY problem importing file
split_table_subpartition SPLIT SUBPARTITION subpartition
VALUES ({ value | NULL }
[, value | NULL ]...)
[ INTO (subpartition_spec,
a ble
subpartition_spec
fe r
)
a ns
]
[ update_index_clauses ]
n- t r
[ parallel_clause ]
a no
h a s
UPDATE MANUALLY problem importing file
sql_statement_clause { { statement_option | ALL
m ) } .]...
}
| ALL e
[, { statement_option o id
| { system_privilege
g i c.c |t ALL
G uALL
PRIVILEGES }

r e l o
[, { system_privilege
e n | PRIVILEGES } ]...

wa Stud ]
}
i
[ auditing_by_clause

a l e@ this
sqlj_object_type
h . bh EXTERNAL
u e NAME java_ext_name LANGUAGE JAVA
sUSING
b o d to (SQLData | CustomDatum | OraData)

su cens e
e (
hal li
sqlj_object_type_attr EXTERNAL NAME 'field_name'

h b
b o dsqlj_object_type_sig RETURN { datatype | SELF AS RESULT }
s u EXTERNAL { VARIABLE NAME
'java_static_field_name'
| NAME 'java_method_sig'
}

standby_database_clauses ( activate_standby_db_clause
| maximize_standby_db_clause
| register_logfile_clause
| commit_switchover_clause
| start_standby_clause
| stop_standby_clause
)
[ parallel_clause ]

start_standby_clause START LOGICAL STANDBY APPLY


[ IMMEDIATE ]
[ NODELAY ]
[ NEW PRIMARY dblink

Oracle Database 10g: Administration Workshop I D - 75

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
| INITIAL [ scn_value ]
| { SKIP FAILED TRANSACTION | FINISH }
]

startup_clauses { MOUNT [ { STANDBY | CLONE } DATABASE ]


| OPEN { [ READ WRITE ]
[ RESETLOGS | NORESETLOGS ]
[ UPGRADE | DOWNGRADE ]
| READ ONLY
}
}

a ble
stop_standby_clause { STOP | ABORT }
fe r
LOGICAL STANDBY APPLY
a ns
n- t r
storage_clause STORAGE o
({ INITIAL integer [ K | M ]
s an
| MINEXTENTS integer) ha
| NEXT integer [ K | M ]

o m ide.
| MAXEXTENTS { integer | UNLIMITED }
c
i c. t Gu
| PCTINCREASE integer
g
relo uden
| FREELISTS integer
a
| FREELIST GROUPS integer
iw s St
| OPTIMAL [ integer [ K | M ]
@
le thi
| NULL
h a e ]

d h .b us | BUFFER_POOL { KEEP | RECYCLE | DEFAULT }


o t o
ub ense
}
( s [ INITIAL integer [ K | M ]

hal
e lic | NEXT integer [ K | M ]
| MINEXTENTS integer
h b | MAXEXTENTS { integer | UNLIMITED }
o d
sub
| PCTINCREASE integer
| FREELISTS integer
| FREELIST GROUPS integer
| OPTIMAL [ integer [ K | M ]
| NULL
]
| BUFFER_POOL { KEEP | RECYCLE | DEFAULT }
]...
)

streaming_clause { ORDER | CLUSTER } BY (column [, column ]...)

subpartition_by_hash SUBPARTITION BY HASH (column [, column ]...)


[ SUBPARTITIONS quantity
[ STORE IN (tablespace [, tablespace
]...) ]
| subpartition_template
]

Oracle Database 10g: Administration Workshop I D - 76

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
subpartition_by_list SUBPARTITION BY LIST (column)
[ subpartition_template ]

subpartition_spec SUBPARTITION [ subpartition ]


[ list_values_clause ]
[ partitioning_storage_clause ]

subpartition_template SUBPARTITION TEMPLATE


(SUBPARTITION subpartition
[ list_values_clause ]
[ partitioning_storage_clause ]
[, SUBPARTITION subpartition
a ble
[ list_values_clause ]
fe r
[ partitioning_storage_clause ]
a ns
]
n- t r
)
o
| hash_subpartition_quantity
s an
) ha
subprogram_declaration { MEMBER | STATIC }
c o m ide.
g i c. t Gu
{ procedure_declaration

relo uden
| function_declaration
| constructor_declaration
} a
iw s St
@
le{ MEMBERth|i STATIC }
h a
subprogram_spec
h . se
b {uprocedure_spec
o d t o | function_spec }

( s ub ense
subqueryle
h a lic [ subquery_factoring_clause ]

h b SELECT

b o d [ hint ]
[ { { DISTINCT | UNIQUE }
s u | ALL
}
]
select_list
FROM table_reference
[, table_reference ]...
[ where_clause ]
[ hierarchical_query_clause ]
[ group_by_clause ]
[ HAVING condition ]
[ model_clause ]
[ { UNION [ ALL ]
| INTERSECT
| MINUS
}
(subquery)
]
[ order_by_clause ]

Oracle Database 10g: Administration Workshop I D - 77

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
subquery_factoring_clause WITH query_name AS (subquery)
[, query_name AS (subquery) ]...

subquery_restriction_clause WITH { READ ONLY


| CHECK OPTION [ CONSTRAINT constraint ]
}

substitutable_column_clause [ ELEMENT ] IS OF [ TYPE ] ([ ONLY ] type)


| [ NOT ] SUBSTITUTABLE AT ALL LEVELS

supplemental_db_logging { ADD | DROP } SUPPLEMENTAL LOG


a ble
{ DATA | supplemental_id_key_clause }
fe r
a ns
supplemental_id_key_clause DATA
n- t r
o
an
({ ALL
| PRIMARY KEY
| UNIQUE
ha s
| FOREIGN KEY )
m ide.
c o
c. t Gu
}
[, { ALL
g i
relo uden
| PRIMARY KEY
a
iw s St
| UNIQUE
@ | FOREIGN KEY

h a le }
e thi
d h .b us
]...

o t)
o
( s ub ense COLUMNS

h a le lic
h b
supplemental_log_grp_clause GROUP log_group

b o d (column [ NO LOG ]
[, column [ NO LOG ] ]...)
s u [ ALWAYS ]

supplemental_logging_props { supplemental_log_grp_clause
| supplemental_id_key_clause
}

supplemental_table_logging { ADD SUPPLEMENTAL LOG


{ supplemental_log_grp_clause
| supplemental_id_key_clause
}
[, SUPPLEMENTAL LOG
{ supplemental_log_grp_clause
| supplemental_id_key_clause
}
]...
| DROP SUPPLEMENTAL LOG
{ supplemental_id_key_clause
| GROUP log_group

Oracle Database 10g: Administration Workshop I D - 78

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
}
[, SUPPLEMENTAL LOG
{ supplemental_id_key_clause
| GROUP log_group
}
]...
}

table_collection_expression TABLE (collection_expression) [ (+) ]

table_compression { COMPRESS | NOCOMPRESS }

a ble
fe r
table_index_clause [ schema. ]table [ t_alias ]
a ns
(index_expr [ ASC | DESC ]
[, index_expr [ ASC | DESC ] ]...) n- t r
[ index_properties ]
a no
h a s
table_partition_description [ segment_attributes_clause
m ) ] e.
[ table_compressionc| o
. Guid
key_compression ]
i
g ntc
[ OVERFLOW [ segment_attributes_clause ] ]
l o
re ude
[ { LOB_storage_clause
a t
| varray_col_properties
} iw
@ s S
h a e thi
le [| LOB_storage_clause
d h .b us]...
varray_col_properties

o t o
b nse ][ partition_level_subpartition ]
s u
a l e ( lice
h bh
b o dtable_partitioning_clauses { range_partitioning
| hash_partitioning
s u | list_partitioning
| composite_partitioning
}

table_properties [ column_properties ]
[ table_partitioning_clauses ]
[ CACHE | NOCACHE ]
[ parallel_clause ]
[ ROWDEPENDENCIES | NOROWDEPENDENCIES ]
[ enable_disable_clause ]
[ enable_disable_clause ]...
[ row_movement_clause ]
[ AS subquery ]

table_reference { ONLY
(query_table_expression)
[ flashback_query_clause ]
[ t_alias ]

Oracle Database 10g: Administration Workshop I D - 79

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
| query_table_expression
[ flashback_query_clause ]
[ t_alias ]
| (join_clause)
| join_clause
}

tablespace_clauses { EXTENT MANAGEMENT LOCAL


| DATAFILE file_specification
[, file_specification ]...
| SYSAUX DATAFILE file_specification

le
[, file_specification ]...
| default_tablespace
r a b
| default_temp_tablespace
| undo_tablespace ns fe
t r a
n-
}

a no
tablespace_group_clause
a s
TABLESPACE GROUP { tablespace_group_name
h
| '' }

m ) e.
o
tablespace_logging_clauses { logging_clause .c
i c t Guid
| [ NO ] FORCEgLOGGING
}
a relo uden
@ iw s St
tablespace_retention_clause le
h a thi { GUARANTEE | NOGUARANTEE }
RETENTION
e
d h .b us
o t o
ub ense | OFFLINE [ NORMAL | TEMPORARY | IMMEDIATE ]
tablespace_state_clauses { ONLINE
( s
h a le lic }

h b | READ { ONLY | WRITE }

o d | { PERMANENT | TEMPORARY }

sub temporary_tablespace_clause TEMPORARY TABLESPACE tablespace


[ TEMPFILE file_specification
[, file_specification ]...
]
[ tablespace_group_clause ]
[ extent_management_clause ]

text [ N | n ]
{ 'c [ c ]...'
| { Q | q }
'quote_delimiter c [ c ]... quote_delimiter'
}

trace_file_clause TRACE
[ AS 'filename' [ REUSE ] ]
[ RESETLOGS | NORESETLOGS ]

Oracle Database 10g: Administration Workshop I D - 80

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
truncate_partition_subpart TRUNCATE { PARTITION partition
| SUBPARTITION subpartition
}
[ { DROP | REUSE } STORAGE ]
[ update_index_clauses [ parallel_clause ] ]

undo_tablespace [ BIGFILE | SMALLFILE ]


UNDO TABLESPACE tablespace
[ TABLESPACE file_specification
[, file_specification ]...
]

a ble
undo_tablespace_clause UNDO TABLESPACE tablespace
fe r
[ DATAFILE file_specification
a n s
]
[, file_specification ]...
n- t r
[ extent_management_clause ]
a no
[ tablespace_retention_clause ]
h a s
m ) e.
o
c.c t Guid
undrop_disk_clause UNDROP DISKS

g i
update_all_indexes_clause
rel(o {uupdate_index_partition
UPDATE INDEXES
a d en
@ iw s S|t update_index_subpartition
[ (index

h a le
e thi ) }
d h .b us )
o
b nse t o
s u
( ice
[, (index ( { update_index_partition
| update_index_subparition
l e l
b ha )
}

o d h )

sub
]...

update_global_index_clause { UPDATE | INVALIDATE } GLOBAL INDEXES

update_index_clauses { update_global_index_clause
| update_all_indexes_clause
}

update_index_partition PARTITION [ partition ]


[ index_partition_description
[ index_subpartition_clause ]
]
[, PARTITION [ partition ]
[ index_partition_description
[ index_subpartition_clause ]
]
]...

Oracle Database 10g: Administration Workshop I D - 81

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
update_index_subpartition SUBPARTITION [ subpartition ]
[ TABLESPACE tablespace ]
[, SUBPARTITION [ subpartition ]
[ TABLESPACE tablespace ]
]...

update_set_clause SET
{ { (column [, column ]...) = (subquery)
| column = { expr | (subquery) | DEFAULT }
}
[, { (column [, column]...) = (subquery)

le
| column = { expr | (subquery) | DEFAULT
}
r a b
}
]... ns fe
t r a
n-
| VALUE (t_alias) = { expr | (subquery) }
}
a no
a s]
UPGRADE [ [NOT ] INCLUDING hDATA
upgrade_table_clause
[ column_propertiesm
) e.
o ]

g i c.c t Guid
using_function_clause
relo u]d[enpackage. | type.
USING [ schema.
a
iw s St
]function_name
@
h a e thi
leUSING INDEX
using_index_clause
d h .b u{s[ schema. ]index
o
b nse t o | (create_index_statement)
( s u e | index_properties
a l e li c }
b h
d h
o using_statistics_type
s ub USING { [ schema. ] statistics_type | NULL }

using_type_clause USING [ schema. ]implementation_type


[ array_DML_clause ]

validation_clauses { VALIDATE REF UPDATE


[ SET DANGLING TO NULL ]
| VALIDATE STRUCTURE
[ CASCADE ]
[ into_clause ]
{ OFFLINE| ONLINE }
}

values_clause VALUES ({ expr | DEFAULT }


[, { expr | DEFAULT } ]...
)

Oracle Database 10g: Administration Workshop I D - 82

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
varray_col_properties VARRAY varray_item
{ [ substitutable_column_clause ]
STORE AS LOB
{ [ LOB_segname ] (LOB_parameters)
| LOB_segname
}
| substitutable_column_clause
}

where_clause WHERE condition

windowing_clause { ROWS | RANGE }


a ble
{ BETWEEN
fe r
{ UNBOUNDED PRECEDING
a ns
| CURRENT ROW
n- t r
| value_expr { PRECEDING | FOLLOWING }
o
}
s an
ha
AND
{ UNBOUNDED FOLLOWING
)
m ide.
| CURRENT ROW
c o
i c. t Gu
| value_expr { PRECEDING | FOLLOWING }
g
relo uden
}
a
| { UNBOUNDED PRECEDING
iw s St
| CURRENT ROW
@
le thi
| value_expr PRECEDING
h a }
e
d h .b }
us
o t o
( s ub ense XMLATTRIBUTES
XML_attributes_clause
h a le lic (value_expr [ AS c_alias ]

h b [, value_expr [ AS c_alias ]...

b o d )

s u
XMLSchema_spec [ XMLSCHEMA XMLSchema_URL ]
ELEMENT { element | XMLSchema_URL # element }

XMLType_column_properties XMLTYPE [ COLUMN ] column


[ XMLType_storage ]
[ XMLSchema_spec ]

XMLType_storage STORE AS
{ OBJECT RELATIONAL
| CLOB [ { LOB_segname [ (LOB_parameters) ]
| LOB_parameters
}
]

XMLType_table CREATE TABLE [ GLOBAL TEMPORARY ] TABLE


[ schema. ]table OF XMLTYPE

Oracle Database 10g: Administration Workshop I D - 83

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Subclause Syntax
[ (oject_properties) ]
[ XMLTYPE XMLType_storage ]
[ XMLSchema_spec ]
[ ON COMMIT { DELETE | PRESERVE } ROWS ]
[ OID_clause ]
[ OID_index_clause ]
[ physical_properties ]
[ table_properties ] ;

XMLType_view_clause OF XMLTYPE
[ XMLSchema_spec ]

le
WITH OBJECT IDENTIFIER
{ DEFAULT | ( expr [, expr ]...) }
r a b
ns fe
t r a
on-
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

Oracle Database 10g: Administration Workshop I D - 84

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
_________________

Appendix E
Acronyms and
Terms
_________________
a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Term Definition
Active session pool Number of current active sessions allowed for a resource group or
subplan
ADDM Automatic Database Diagnostic Monitor
ASM Automatic Storage Management
ASM Automatic Summary Management
ASMM Automatic Shared Memory Management
ASSM Automatic Segment Space Management
ATO Automatic Tuning Optimizer
Automatic PGA Memory A feature of the Oracle database that simplifies and improves the
Management way PGA memory is allocated le
Automatic Shared A feature of the Oracle database that automates the management r a b
Memory Management of the most important shared memory structures used by an ns fe
Oracle database instance t r a
Automatic Storage o n-
A mechanism that provides a vertical integration of the file
Management an
system and the volume manager, specifically built for the Oracle
s
database files ) ha
Automatic Database o m ide.
A utility that performs a top-down instance analysis, identifies
c
Diagnostic Management i c. t Gu
problems and potential causes, and makes recommendations for
g
fixing the problems
a r elo den
Automatic Tuning
Optimizer @ iw s Stu
A database feature that performs various analyses of SQL
performance within the database
Automatic Workload h a le
e thi
An infrastructure that collects, processes, and maintains
Repository d h .b us
performance statistics for problem detection and self-tuning
o t o
( s ub ense purposes
Auxiliary ldatabase A database that is used when creating a duplicate database or
h a e lic performing tablespace point-in-time recovery
h
AWR
b Automatic Workload Repository
b d
o Backup piece
u An individual file that is part of a backup set
s Backup set A copy of one or more data or archived log files. It differs from
image copies in that empty blocks are not stored.
Block change tracking A feature that uses the change tracking writer (CTWR)
background process to record the physical location of all database
changes in a separate file
Block corruption Corruption of a data block. A corrupted data block is a block that
is not in a recognized Oracle format, or whose contents are not
internally consistent.
Block Media Recovery A recovery method that reduces the smallest recoverable unit of
media recovery from a data file to a block
BMR Block Media Recovery
Buffer cache A region of memory that caches blocks of data retrieved from the
database
CFS Cluster File Storage

Oracle Database 10g: Administration Workshop I E - 2


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Term Definition
Change tracking file A file used to store the physical location of database changes
made since the last backup
Channel A link or connection to a target database
CLI Command-line interpreter
Cluster A group of one or more tables that share the same data blocks
CMAN Oracle Connection Manager. It functions as a net traffic firewall
and proxy server.
Control file A file that contains information about the physical structure of the
database, including the locations of all data and redo log files
CRS Cluster Ready Services
Data block The smallest unit of physical storage within the database. Data
blocks contain rows of data, index information, and so on. a ble
Data dictionary cache An area of memory within the shared pool that holds the fe r
a ns
definitions of dictionary objects in memory
n- t r
Data file A file that contains data for the database o
Database Character Set an
A utility that assesses the feasibility of migrating an Oracle
s
Scanner ha
database to a new database character set
)
DBA Database administrator
c o m ide.
DBA c. t Gu
Data block address, which is used to uniquely identify a data
g i
r e lo en
block within the database
DBCA w Stud
a
Database Configuration Assistant
i
DBVERIFY
a e@ this
An external command-line utility that performs a physical data
l
DDL h . bh use
structure integrity check on an offline database
Data definition language. It is the class of SQL statements that
b o d to
su cens e define and manipulate database objects.
DML e ( Data manipulation language. It is the class of SQL statements that
hal li query and manipulate data.
h
EM
b Enterprise Manager
o d
sub emctl Enterprise Manager Control. It is a utility for starting, stopping,
and checking the status of Database Control, the Oracle Agent,
and Oracle Management servers.
Encoded character set A character set that maps numeric codes to characters that a
computer or terminal can display and receive
Enterprise Manager A graphical interface used to manage the database
Database Control Console
EXTPROC External code libraries
FGA Fine-grained auditing
FGAC Fine-Grained Access Control
Flash recovery area A unified storage location for all recovery-related files and
activities in an Oracle database
Flashback buffer An area in memory that stores Flashback Database data
Flashback Database A new recovery method that uses Undo data, instead of Redo
data, to recover the database

Oracle Database 10g: Administration Workshop I E - 3


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Term Definition
Flashback Drop A feature that enables you to undo the effects of a DROP TABLE
statement without resorting to traditional point-in-time recovery
Flashback Table A command that enables you to recover a table and all its
dependent objects from the recycle bin
Flashback Transaction A diagnostic tool that you can use to view changes made to the
Query database at the transaction level
Flashback Versions A query syntax that provides a history of changes made to a row
Query along with the corresponding identifier of the transaction that
made the change
Format mask elements A character literal that describes the format of datetime or
numeric data stored in a character string
Growth trend report Analysis of the growth of database segments a ble
Globalization support A feature set that ensures that utilities and error messages, sort fe r
a ns
order, alphabet, calendar, date, time, money, and numbers
n- t r
Image copy
automatically adapt to the native language
a
A bit-for-bit identical copy of a database file
no
Incarnation h a s
A separate version of a physical database. The incarnation of the
m ) e.
database changes when you open it with the RESETLOGS option,
o
g i c.c t Guid
but you can recover backups from an earlier incarnation so long
r e lo en
as the necessary redo is available.
Index-organized tables w Stud
a
A database structure that has the appearance of a table but stores
i
l e @ his
its data in a B*Tree structure
init.ora or h a t
The initialization parameter file that controls how the database
e
. b
h to u s
instance is configured and run at startup time. Also known as
init<sid>.ora
o d
( s ub ense “parameter file”.

Instance
h a le lic The collection of shared memory and processes used to access the
h b Oracle database
o d
sub IPC
isqlplusctl
Internal Process Communication
Control utility for starting and stopping iSQL*Plus listener
processes
ISV Independent software vendor
Java pool A region of memory in the SGA that is used for all session-
specific Java code and data within the Java Virtual Machine
(JVM)
JDBC Java Database Connectivity
jnnn Job Queue Processes. They execute scheduled jobs.
Keep buffer cache An area of memory in the SGA used to cache data in the buffer
cache for longer periods of time
Language and Character A statistic-based utility for determining the language and
Set File Scanner character set for unknown file text
Large pool An optional memory storage area used for buffering large I/O
requests
LCSSCAN Language and Character Set File Scanner

Oracle Database 10g: Administration Workshop I E - 4


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Term Definition
®
LEGATO NetWorker, Software included with Oracle Database 10g that enables the
Single-Server Version Recovery Manager utility to write to tape drives
Library cache An area of memory within the shared pool that contains the fully
parsed or compiled representations of PL/SQL blocks and SQL
statements
Linguistic sort A feature that produces a sort sequence that matches the
alphabetic sequence of characters, and not their numeric values in
the character encoding scheme
Listener The gateway to the Oracle instance for all nonlocal user
connections
Locale A collection of information about the linguistic and cultural
preferences from a particular region a ble
Locale variants A language-dependent territory definition fe r
LSSV LEGATO® NetWorker, Single-Server Version a ns
n- t r
Media management An interface used by RMAN when writing to or reading from
o
library tapes
s an
Memory Advisor ha
A feature of Enterprise Manager that helps you tune the size of
)
your memory structures
c o m ide.
Memory Manager c. t Gu
A database background process that serves as the SGA memory
g i
(MMAN)
Metric a relo uden
broker and coordinates the sizing of memory components
A measurement of some database or instance characteristic
MML @ iw s St
Media management library
MMON a le thi
Management Monitor Process. This process issues alerts
h e
d h .b us
whenever a metric violates its threshold value. It captures
o t o
( s
National Language
ub ense statistics for SQL objects that have been recently modified.
Parameters and files that determine the locale-specific behavior of
Support
h a le lic the database client and the database server
h
nK
bblock size buffer A region of memory in the SGA, which caches data blocks that
b o d are of a different size than the default database block size. It is
s u used to support transportable tablespaces.
NLS National Language Support
NLS Runtime Library A comprehensive suite of language-independent functions that
allow proper text and character processing and language-
convention manipulations
NLS_LANG An environment variable used to specify the language, territory,
and character set used by a database
NLSRTL National Language Support Runtime Library
NMP Named Pipes
OC4J Oracle Application Server Containers for J2EE
OMF Oracle Managed Files
Optimizer statistics Statistics that describe the database and the objects in the
database, and are used by the query optimizer to choose the best
execution plan for each SQL statement
OUI Oracle Universal Installer

Oracle Database 10g: Administration Workshop I E - 5


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Term Definition
Oracle Locale Builder A feature that provides a graphical user interface through which
you can easily view, modify, and define locale-specific data
Oracle Managed Files A feature of the Oracle database, which manages the creation,
naming, and deletion of Oracle database files within dedicated
areas of the disk
Oracle Net An interface that enables network connections between Oracle
Database 10g and client or middle-tier applications
Oracle Shared Server A database server configuration that allows many user processes
to share a small number of server processes, minimizing the
number of server processes and maximizing the use of available
system resources
ORACLE_BASE Environment variable used to point to the base of the OFA a ble
structure fe r
Environment variable used to identify a directory containing a ns
ORACLE_HOME
n- t r
Oracle software o
ORACLE_SID
s an
Environment variable used to specify the default database
instance name
) ha
Package m ide.
A collection of procedures and function definitions that are
c o
g i c. t Gu
logically related. The procedures and functions are implemented
relo uden
by the package body.
Parallelization a
Allocation of multiple channels for RMAN backup and recovery
iw s St
operations @
PGA a le thi
Program Global Area
h e
PGA Advisor
d h .b us
A feature of Enterprise Manager that gives detailed statistics for
o t o
the work areas and provides recommendations about optimal
( s ub ense
usage of Program Global Area (PGA) memory on the basis of
h a le lic workload characteristics
Pipe
h b An area of memory used by one process to pass information to
b o d another
s u Private SQL area An area of memory in the PGA that contains data such as bind
information and run-time memory structures
Privilege The right to execute a particular type of SQL statement. There are
two basic forms of privileges: object and system.
Proactive Tablespace A feature of Oracle Database 10g that manages tablespace disk
Monitoring space usage
Program Global Area Private memory area for use by a process
Recovery catalog A separate database that keeps historical data concerning backup
activities
Recovery Manager The Oracle utility used to back up and restore database files
Recycle bin A data dictionary table that maintains the relationships between
the original names of dropped objects and their system-generated
names
Recycle buffer cache A region of memory in the SGA, which holds data that is quickly
aged out of the buffer cache

Oracle Database 10g: Administration Workshop I E - 6


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Term Definition
Redo log buffer A region of memory that caches redo information until it can be
written to disk
Redo Log File Sizing A feature of Enterprise Manager that offers redo log file-sizing
Advisor advice
Resource Manager A feature of the Oracle database that gives the Oracle database
server more control over resource management decisions, thus
circumventing problems resulting from inefficient operating
system management
Resumable space A means for suspending, and later resuming, the execution of
allocation large database operations in the event of space allocation failures
RMAN Recovery Manager
RMAN Repository A storage structure that maintains metadata about a database’s a ble
backup and recovery operations fe r
Scheduler a
A new database feature that enables database administrators and ns
n- t r
application developers to control when and where various tasks
o
take place in the database environment
s an
SCN System change number
) ha
Segment Advisor m ide.
An advisor that monitors object space issues and analyzes growth
c o
trends
g i c. t Gu
Segment Resource
Estimator a relo uden
The new segment resource estimation feature that enables you to
estimate the amount of resources that the creation of a new
iw s St
segment would require
@
Server sessions a le thi
The server processes (UNIX) or threads (Windows NT/2000)
h e
d h .b us
invoked by a client utility to connect to the target database
Session memory b o t o
Memory in the PGA that is allocated to hold session variables and
( s u ense other information related to the session
SGA hal
e lic System Global Area. It is the memory area shared by all server
h b and background processes.
b d
o SGA Advisor An advisor that makes recommendations for SGA-related
s u parameter settings
Shared pool A region of memory that caches various constructs that can be
shared among users
Shrink Advisor See the Segment Advisor.
SID System Identifier. It defaults to the database name and uniquely
identifies the instance on a given server.
SQL Structured Query Language
SQL Access Advisor A tool that determines optimal data access path (for example, the
use of indexes and materialized views)
SQL Tuning Advisor A tool that provides tuning advice for SQL statements
Statspack A set of SQL, PL/SQL, and SQL*Plus scripts that allow the
collection, automation, storage, and viewing of performance data.
This feature has been replaced by the Automatic Workload
Repository.
Streams pool An optional region of memory in the SGA that is used by Oracle
Streams

Oracle Database 10g: Administration Workshop I E - 7


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Term Definition
System statistics Statistics that describe the system’s hardware characteristics, such
as I/O and CPU performance and utilization, to the query
optimizer
Tablespace A logical grouping of data files
Target database The database that you are attempting to connect to
Threshold A boundary value against which metric values are compared
Undo Advisor A feature of Enterprise Manager that suggests parameter values
and the amount of additional space that is needed to support
flashback for a specified time
Undo data A copy of original data stored whenever a DML transaction
changes data. Undo data is used to roll back a transaction and to
provide read-consistent views of changing data. a ble
User Global Area An area of memory within the shared pool or large pool that fe r
contains the session information for the Oracle shared server a ns
n- t r
sessions o
UTC an
Universal Time Coordinates. This is a global time stamp in the
s
Uniform Audit Trail.
) ha
VPD Virtual Private Database
c o m ide.
Wait event c. t Gu
Statistics that are incremented by a server process or thread to
g i
a relo uden
indicate that the process had to wait for an event to complete
before being able to continue processing
Work area @ iw s St
A private allocation of memory in the PGA, used for sorts, hash
a le thi
joins, and other operations that are memory intensive
h e
Workload repository
d h .b us
See AWR.
o t o
( s ub ense
h a le lic
h b
b o d
s u

Oracle Database 10g: Administration Workshop I E - 8


Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Next Steps
Continuing Your Education
a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
hal li
h b
o d
sub

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Where Do You Go from Here?

“To stay competitive in the tech industry, never stop


learning. Always be on the lookout for better ways of
doing things and new technologies. Our industry does
not reward people who let themselves stagnate”
–John Hall, Senior Vice President, Oracle University
a ble
Here are a few resources to help you with continuing fe r
a n s
your education. -t r
n on
a
s
h a
) e.
o m
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
hal li
h b
o d
sub

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I F - 2
Continuing Education Resources

The resources to learn more about administering


Oracle Database 10g include:
• Oracle University Web site
• Oracle University University Knowledge Center
• Oracle Technology Network: ble
– Oracle by Example fe r a
a ns
– Oracle Magazine n- t r
o
• Technical support: Oracle MetaLink s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
hal li
h b
o d
sub

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I F - 3
Oracle University

Learn Oracle from Oracle! No one knows Oracle


technology better than Oracle University.
• Worldwide education services
• Consistently high customer satisfaction
• Learn with the format that best suits your needs: ble
– Instructor-Led Inclass Training fe r a
a ns
– Live Web Class n- t r
– Self-Study CD-ROMs a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
iw shttp:// S t www.oracle.com/education
@
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
hal
Oracle University li
b
h University is the world’s largest corporate educator with education centers around
Oracle
o d
sub the globe and has one of the highest customer satisfaction ratings in the industry (over
95%). Oracle University instructors are experts on Oracle technology and can help you get
the most from your software.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I F - 4
Continuing Your Education

• Recommended follow-on classes:


– Oracle Database 10g: Administration Workshop II
– Oracle Database 10g: SQL Fundamentals I & II
– Oracle Database 10g: PL/SQL Fundamentals
• Grid technology specialty courses: le
r a b
– Oracle Enterprise Manager 10g Grid Control
ns fe
– Oracle Database 10g: Real Application Clusters -tra
n
– Oracle Database 10g: Implement Streamsa no
– h a s
Oracle Database 10g: Data Guard Administration
) m ide.
• Other specialty courses c o
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
li
hal Your Education
Continuing
b
h Oracle Database 10g: Administration Workshop II course continues your training as a
The
o d
sub database administrator. You cover advanced database recovery strategies, performance
monitoring and tuning, and distributed data concepts.
In this course, SQL and PL/SQL are discussed. Because both of these topics are vast, you
are provided with only an overview. You can find additional training on these topics that
can enhance your abilities as an administrator.
Oracle recommends that you complete the Oracle Database 10g: Administration
Workshop II course, before beginning specialty courses.
Consult Oracle University’s website for an up-to-date list of all courses. Other specialty
courses include:
• Oracle Database 10g:Security
• Oracle Database 10g:Implement and Administer a Data Warehouse

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I F - 5
Oracle University Knowledge Center

Extend your learning with the Knowledge Center to


gain access to thousands of hours of training on
everything from fundamental SQL to advanced
database topics. Topics of interest include:
• Oracle Database 10g: Manage Jobs with the
Scheduler r a ble
• Oracle Database 10g: Maximize Performance— rans
fe
General Enhancements o n -t
n
• OCA and OCP preparation material as a
m ) h e.
i c .co Guid
l o g nt
r e e
i wa Studhttp://ilearning.oracle.com
a l e@ this
h . bhCopyrightu©s2008,
e
o d t o Oracle. All rights reserved.

( s ub ense
h a le
Oracle University ic
lKnowledge Center
b
h University Knowledge Center contains thousands of hours of content on a variety
Oracle
o d
sub of topics. This content can be accessed 24/7 via the Web and is a great way to refresh your
memory on things that you may not have worked with for a while or to learn about new
concepts.
Additional content for the Oracle University Knowledge Center is being developed
continuously, so make sure to check back often to see what is new.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I F - 6
Oracle Technology Network

Oracle Technology Network is a free resource with


information about the core Oracle software products,
including database, Application Server, Collaboration
Suite, and development tools. You can have access to:
• Technology centers
• Discussion forums r a ble
n s fe
• Software downloads
n - tra
• Online documentation a no
h a s
• Oracle by Example ) e.
o m
• Code samples
g i c.c t Guid
lo en
and much more! are d tu
iw shttp://www.oracle.com/technology
@ S
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
hal
Oracle Technology li Network
b
h Technology Network (OTN) hosts the latest news about Oracle technology and
Oracle
o d
sub products. Additionally, OTN provides peer-to-peer forums, white papers, security
bulletins, and other vital information for the Oracle professional.
In addition to tips, tricks, and techniques for getting the most out of your Oracle software,
you can download that software from OTN. Remember: All software downloads are free,
and each comes with a development license that allows you to use full versions of the
products only when developing and making prototypes your applications.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I F - 7
Oracle Technology Training

a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
hal li
h b
o d
sub

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I F - 8
Oracle by Example

• What is an OBE?
A set of hands-on, step-by-step instructions
• Where can I find them?
http://www.oracle.com//technology/obe
• What is ble
available? fe r a
a ns
Over 100
n- t r
database
a no
OBEs h a s
m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
halExampleli
Oracle by
b
o d h Oracle by Example (OBE) series provides hands-on, step-by-step instructions on how
The
sub to use various new features of Oracle products. OBEs help to reduce the time spent on
learning a new product capability and enhance the users’ understanding of how the feature
can be implemented in their environment. Currently, OBEs are available for the Oracle
database, Oracle Application Server, and Oracle Collaboration Suite. OBEs can be
accessed at http://www.oracle.com/technology/obe.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I F - 9
Oracle Magazine

• Free subscription
• Oracle Magazine Archives
http://www.oracle.com/technology/oramag/index.html

a ble
fe r
a n s
n- t r
a no
h a s
m ) e.
o
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
hal
Oracle Magazine li
b
h the many different types of resources to which you have access from OTN is
Among
o d
sub Oracle Magazine. You can receive your free subscription also by mail.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I F - 10
Oracle Applications Community

Oracle Technology Network is a resource for Oracle


Applications users and implementers. You can have
access to:
• Discussion Forums
• User Groups
r a ble
• Online Chat s fe
tra n
• Documentation n -
• Training a no
h a s
• Upgrade Information m ) e.
o
.c Guid
and much more! gic lo ent
r e
i wa Stud
http://www.oracle.com/technology/community/apps/index.html
a l e@ this
h . bhCopyrightu©s2008,
e
o d t o Oracle. All rights reserved.

( s ub ense
hal
e lic
h b
o d
sub

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I F - 11
Technical Support: Oracle MetaLink

Access to Oracle MetaLink is included as part of your


annual support maintenance fees. In addition to the
most up-to-date technical information available,
MetaLink gives you access to:
• Service requests (SRs)
• Certification matrices r a ble
n s fe
• Technical forums monitored by Oracle experts -tra
• Software patches n on
s a
• Bug reports )h a
c o m ide.
g i c. t Gu
a relo udenhttp://metalink.oracle.com
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
hal
Oracle MetaLink li
b
h MetaLink is your gateway to Oracle’s Support resources. Here, you find answers to
Oracle
o d
sub the most common issues facing Oracle administrators and developers, as well as resources
to solve many of those issues.
Like Oracle Technology Network, MetaLink includes the most recent headlines about
issues that affect the Oracle professional.

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I F - 12
Thank You!

We hope your experience with Oracle University has


been enjoyable. We welcome your feedback on how
we can improve to better meet your needs:
• End-of-course evaluations
• Oracle University Office of Customer Satisfaction
r a ble
• Oracle Education Services s fe
a n
We hope to see you in class again soon. n-tr no
s a
h a
) e.
o m
g i c.c t Guid
a relo uden
@ iw s St
h a le
e thi
d h .b Copyrightu©s2008, Oracle. All rights reserved.
b o e to
e ( su cens
hal
Thank You! li
b
h University’s mission is to enhance the adoption of Oracle technology. Our goal is
Oracle
o d
sub to partner with you, providing information that is pertinent, timely, and relevant to your
needs.
Please take a minute to complete the end-of-course evaluation and let us know how we can
serve you better. In the U.S., feel free to e-mail our office of customer satisfaction at:
[email protected]
If you have questions about continuing your Oracle education, need help finding a class, or
want to arrange for on-site training at your company, contact Oracle Education Services
for assistance. In the U.S., dial 800.529.0165. For contact numbers outside the U.S., visit
the following Web site:
http://www.oracle.com/education/index.html?contact.html
Thanks again and hope to see you in another class!

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I F - 13
a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Index

a ble
fe r
a ns
n- t r
o
s an
) ha
c o m ide.
g i c. t Gu
a relo uden
@ iw s St
h a le
e thi
d h .b us
o t o
( s ub ense
hal
e lic
h b
o d
sub

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
A
ADDM 8-29, 12-2, 12-5, 12-9, 12-10, 12-13, 12-15, 12-16, 12-17, 12-18,
12-19, 12-22, 12-27, 12-28, 12-30, 12-32, 13-11
Alert 1-15, 1-16, 2-18, 4-2, 4-3, 4-5, 4-7, 4-8, 4-15, 4-19,
4-21, 4-24, 4-30, 4-31, 4-32, 4-35, 4-36, 5-18, 10-22, 10-27, 10-28,
12-2, 12-3, 12-5, 12-9, 12-11, 12-15, 12-18, 12-22, 12-23, 12-24, 12-25,
12-26, 12-27, 12-28, 12-29, 12-30, 12-31, 14-21, 16-3, 16-6, 16-8, 17-16
Archive 1-13, 1-15, 2-10, 3-15, 4-30, 5-7, 5-17, 5-27, 6-13,
14-2, 14-3, 14-9, 14-13, 14-19, 14-23, 14-24, 14-25, 14-26, 14-27, 14-28,
15-7, 15-8, 15-11, 15-17, 15-19, 16-8, 16-9, 16-10, 16-11, 16-12, 18-12
ARCn 1-13, 1-23, 14-13 r a ble
ASM 1-6, 1-7, 5-2, 5-11, 5-26, 5-27, 5-28, 5-29, 13-18, 13-19, n s fe
13-20 n - tra
ASMM 13-18, 13-19, 13-20 a no
h a s
ASSM 5-12, 5-13, 12-17, 13-2
m ) e.
o uid
ATO 1-16, 1-17, 1-18, 1-19, 1-21, 1-22, 2-2, 2-3, 2-13,
g i c.c 4-5,G
t 6-24,
e
4-14, 5-5, 5-13, 6-5, 6-6, 6-9, 6-11, 6-12,
r lo6-19, 6-23,
e n
7-10, 7-27, 7-30, 7-37, 8-12, 8-18,i a 8-27,
w8-22, S tud8-30, 9-6, 9-9,
9-10, 9-11, 10-2, 10-5, h a le@
10-6, h is 10-11, 10-19, 10-20, 10-22,
10-8, t10-10,
. b u s e
10-27, 11-2, 11-4,
o h
d 11-20,t12-3,
o 12-22, 13-3, 13-9, 13-19, 14-3, 14-6,
b
su 15-10,
14-10, 14-16, e
ns15-14, 15-16, 15-19, 16-3, 16-4, 16-6, 17-12
e ( c e
li 6-5, 6-13, 8-19, 10-2, 10-3, 10-4, 10-5,
hal 4-16, 6-3,
Audit 2-10,
b
h 10-7, 10-8, 10-11, 10-12, 10-13, 10-14, 10-15, 10-16, 10-17, 10-18, 10-19,
o d
sub 10-20, 10-21, 10-22, 10-23, 10-24, 10-25, 10-26, 10-27, 10-29, 10-30, 11-7,
17-19, 17-23, 17-26
Automatic Shared Memory Management 1-11, 13-2, 13-18, 13-19, 13-20,
13-21, 13-22, 13-28
Automatic Tuning Optimizer 13-9
Automatic Workload Repository 6-5, 12-2, 12-3, 12-4, 12-9, 12-12,
12-31
AWR 6-5, 12-2, 12-3, 12-4, 12-5, 12-9, 12-10, 12-11, 12-12, 12-13,
12-14, 12-15, 12-18, 12-22, 12-30, 13-12

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I Index - 2
B
Backup set 5-27, 15-7, 15-9, 15-10, 15-18
Block 1-10, 1-13, 1-14, 1-17, 1-19, 1-20, 1-21, 1-23, 3-10, 4-12,
4-16, 4-17, 4-30, 4-33, 5-2, 5-3, 5-4, 5-5, 5-7, 5-8, 5-12,
5-13, 5-24, 5-28, 5-29, 7-10, 7-28, 7-29, 7-30, 7-31, 8-13, 8-22,
8-27, 8-29, 8-31, 9-6, 9-7, 9-8, 9-11, 10-20, 11-7, 12-5, 13-24,
14-11, 14-16, 15-6, 15-7, 15-10, 17-7, 17-25, 18-3, 18-7, 18-11, 18-18,
18-28
Block change tracking 5-7, 15-10
Block corruption 4-30
Buffer cache 1-10, 1-11, 1-13, 1-14, 1-23, 4-17, 4-26, 6-13, 11-7, a ble
fe r
12-18, 12-19, 13-18, 13-22, 13-24, 14-11
a ns
n- t r
C
a no
Checkpoint 1-13, 4-25, 5-17, 12-15, 14-2, 14-11, 14-16, 14-17, a
h s
14-27
CKPT 1-13, 1-23, 14-11 m ) e.
o
.c Guid
Cluster 1-6, 1-7, 1-21, 2-5, 2-18, 5-26, 5-27, 7-39,ic 10-14,
g
lo ent
14-3, 18-12, 18-13, 18-29, 18-35 r e
Configuration assistant 2-4, 2-15, 2-19, i a
w3-2, S
3-5,
ud 14-20
t11-8,
l e @ his
Constraint 1-22, 7-2, 7-3, 7-13, a t 7-16, 7-17, 7-18,
h 7-14,se7-15,
. b
h 7-26, u7-34, 7-35, 7-37, 7-41, 7-44, 7-48,
7-19, 7-20, 7-23, o
b nse d7-24, t o
(
7-49, 8-19,s u17-12, e17-16, 17-19, 18-12, 18-13, 18-29
l e l i c
a 1-13, 1-15, 2-9, 2-10, 3-6, 3-11, 3-15, 4-16, 4-21,
hfile
Control
b
o d h 4-22, 4-23, 4-34, 5-7, 5-21, 5-27, 13-4, 14-11, 14-14, 14-15, 14-16,
sub 14-19, 14-20, 14-28, 15-5, 15-6, 15-10, 15-16, 15-17, 15-19, 16-2, 16-3,
16-4, 16-6, 16-7, 16-10, 16-13, 16-14, 17-9, 18-3, 18-6, 18-7, 18-9,
18-10, 18-12
CRS 2-18

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I Index - 3
D
Data block 1-14, 1-17, 1-19, 1-21, 5-3, 5-5, 5-12, 5-13, 9-6,
11-7, 14-11, 15-6, 15-7, 17-7
Data file 1-13, 1-14, 1-15, 1-17, 1-19, 1-20, 2-9, 2-10, 3-3,
3-6, 3-11, 3-15, 4-22, 4-23, 4-26, 4-28, 4-34, 5-2, 5-6, 5-7,
5-11, 5-17, 5-19, 5-21, 5-22, 5-24, 5-25, 5-27, 5-28, 5-29, 6-13,
9-8, 9-15, 11-7, 11-30, 12-25, 14-11, 14-14, 14-15, 14-16, 14-17, 14-19,
15-5, 15-6, 15-7, 15-10, 15-11, 15-16, 15-17, 16-2, 16-3, 16-4, 16-6,
16-10, 16-11, 16-12, 16-13, 16-14, 17-7, 17-9, 18-6, 18-7, 18-10, 18-11,
18-14, 18-25, 18-26, 18-32
Database Control 2-6, 2-18, 4-3, 4-4, 4-5, 4-6, 4-20, 4-24, r a ble
6-6, 6-20, 6-22, 8-12, 10-15, 12-10, 12-11, 12-20, 12-22, 12-23, 12-25, n s fe
12-26, 12-27, 12-29, 16-5, 16-9, 17-18, 18-3, 18-13, 18-16, 18-22 on-
tra
DBA 2-2, 2-3, 2-20, 3-3, 4-5, 4-6, 4-10, 4-11, 4-29, 5-22, s an
ha
5-26, 6-5, 6-9, 6-11, 6-13, 6-15, 6-19, 6-20, 6-21, 7-45,) 7-46,
c o m ide.
7-47, 8-8, 8-12, 8-19, 8-27, 9-9, 9-11, 10-2, 10-3,
g i c. 10-5,
t G u10-8,
10-9, 10-10, 10-11, 10-12, 10-14, 10-18,
a relo10-20,d n 10-27, 10-29, 11-18,
10-25,
e
w 12-11,
11-20, 11-25, 11-30, 12-5, 12-6, i12-10, S tu 12-18, 12-29, 13-3, 14-3,
@ s
a le 14-25,
14-5, 14-6, 14-8, 14-13,h14-14,
e thi 14-26, 15-3, 15-5, 17-12, 17-17,
18-35 d h .b us
o
b 3-2, t o
DBCA 2-4, 2-15,
( s u2-19,e n se3-5, 3-6, 3-7, 3-8, 3-9, 3-10,
a
3-11,
h lic 3-14, 3-15, 3-16, 3-17, 12-30, 14-20
le3-12, 3-13,
h b 1-13, 1-14, 1-23, 14-11, 14-12
b o d
DBWn
s u DDL 5-5, 5-19, 5-28, 7-20, 7-23, 7-25, 8-20, 10-16, 11-3, 11-5,
11-6, 12-8, 17-16, 17-25, 17-28, 18-9, 18-25, 18-26
Dedicated server 11-2, 11-7, 11-26, 11-27, 11-28, 11-30, 11-31
DML 5-16, 5-19, 6-16, 7-14, 7-16, 7-17, 7-19, 7-23, 7-29, 7-41,
8-3, 8-9, 8-19, 8-20, 8-25, 9-2, 9-3, 9-6, 9-17, 10-23, 13-27,
17-11, 17-16, 18-11, 18-12, 18-34

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I Index - 4
E
emctl 2-5, 4-4
Enterprise Manager 1-6, 1-7, 1-10, 1-12, 1-18, 2-4, 2-5, 2-18,
3-7, 3-12, 4-2, 4-3, 4-4, 4-5, 4-6, 4-8, 4-18, 4-20, 4-24,
4-29, 4-30, 4-33, 4-35, 4-36, 5-9, 5-14, 5-25, 6-6, 6-19, 6-20,
6-22, 6-25, 6-27, 7-3, 7-11, 7-12, 7-15, 7-21, 7-22, 7-24, 7-38,
7-42, 8-29, 8-31, 9-15, 10-15, 10-27, 11-2, 11-4, 11-8, 11-12, 11-31,
12-6, 12-7, 12-9, 12-10, 12-11, 12-12, 12-15, 12-20, 12-22, 12-23, 12-25,
12-26, 12-27, 13-2, 13-4, 13-10, 13-26, 13-27, 13-28, 13-29, 14-17, 15-8,
15-9, 15-16, 15-18, 17-10, 17-12, 17-13, 17-14, 17-18, 17-24, 17-27, 18-4,
18-8, 18-22, 18-30 r a ble
Enterprise Manager Database Control 2-18, 4-3, 4-20, 4-24, 6-6, n s fe
6-20, 6-22, 12-10, 12-11, 12-22, 12-23, 18-22 n - tra
Environment variable 2-7, 2-11, 2-12, 3-5, 4-10, 11-19, 18-20, s a
no
18-21 ) ha
c o m ide.
EXTPROC 11-3, 11-15
o ic.
g nt G u
e l
F
i w ar tude
FGA 10-3, 10-8, 10-11, 10-14, 10-18, @ 10-20,
i s S 10-22, 10-23, 10-24,
10-21,
l e h
10-25, 10-26, 10-27, b
. ha se t
17-19
d
Flash recovery areao3-9,
u 15-2, 15-9, 15-10, 15-12,
h14-23,to14-25,
( s
15-19, 15-20,ub17-7,
e n se
17-8
h a
Flashback
leDatabaselic15-19, 17-2, 17-4, 17-5, 17-6, 17-7, 17-8, 17-9,
h b
b d
o 17-10, 17-29
s u Flashback Drop 17-4, 17-5, 17-17, 17-18, 17-19
Flashback Table 7-24, 17-2, 17-5, 17-11, 17-12, 17-14, 17-15, 17-16,
17-17, 17-29
Flashback Transaction Query 17-2, 17-11, 17-12, 17-20, 17-23, 17-26,
17-27, 17-28, 17-29
Flashback Versions Query 17-2, 17-11, 17-12, 17-20, 17-23, 17-24, 17-25,
17-27, 17-29, 17-30
G
Globalization support 2-12, 2-13

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I Index - 5
I
Image copy 15-7, 15-9, 15-12
Incarnation 15-17
Index 1-19, 1-20, 1-21, 2-12, 5-5, 5-15, 5-27, 7-2, 7-3, 7-9,
7-13, 7-14, 7-16, 7-18, 7-23, 7-24, 7-25, 7-26, 7-27, 7-28, 7-29,
7-30, 7-31, 7-32, 7-33, 7-34, 7-35, 7-37, 7-41, 7-42, 7-43, 7-44,
7-47, 7-48, 7-49, 8-23, 10-4, 11-30, 12-5, 12-17, 12-19, 13-9, 13-16,
13-17, 13-26, 13-27, 13-29, 15-10, 17-3, 17-12, 17-16, 17-18, 17-19, 18-11,
18-17, 18-26, 18-29, 18-31
Instance 1-3, 1-7, 1-8, 1-9, 1-10, 1-11, 1-12, 1-13, 1-14,
1-15, 1-21, 2-5, 2-6, 2-10, 2-11, 2-15, 2-18, 3-4, 3-7, 4-1, r a ble
4-3, 4-7, 4-15, 4-17, 4-20, 4-21, 4-22, 4-23, 4-24, 4-25, 4-26, n s fe
4-27, 4-28, 4-29, 4-32, 4-34, 4-36, 6-2, 6-5, 6-13, 6-23, 6-30, n - tra
7-37, 9-4, 9-6, 9-7, 9-9, 9-11, 10-14, 10-19, 11-3, 11-4, 11-9,s a
no
ha 12-29, 13-6,
11-15, 11-16, 11-18, 11-30, 12-5, 12-10, 12-15, 12-19,) 12-25,
c o m ide.
13-24, 13-25, 14-2, 14-4, 14-6, 14-10, 14-11,ic . 14-14,
14-13,
G u 14-15, 14-16,
g t
a relo15-17,
14-17, 14-19, 14-20, 14-23, 14-26, 14-27,
d e n15-19, 16-3, 16-4, 16-5,
iw s Stu
16-6, 16-7, 16-8, 16-10, 16-12, 18-27
@
IPC 11-15 h a le
e thi
h b 4-8,u4-9,
.4-2, s 4-10, 4-11, 4-35,
o
b nsed
iSQL*Plus 2-4, 2-5, 2-15, t o
4-36, 8-9(su
a
isqlplusctl l e 4-9 lice
2-5,
b h
oJ d h
s ub
Java pool 1-10, 1-11, 1-13, 12-19, 13-18
JDBC 1-7, 11-3
L
Large pool 1-10, 1-11, 1-13, 11-27, 11-28, 12-19, 13-18
Library cache 12-18, 13-14, 13-15
Listener 2-5, 2-15, 4-3, 4-6, 4-7, 4-9, 11-2, 11-3, 11-4,
11-5, 11-6, 11-7, 11-8, 11-9, 11-10, 11-11, 11-12, 11-13, 11-14, 11-15,
11-16, 11-18, 11-22, 11-23, 11-25, 11-26, 11-27, 11-31, 11-32, 14-7

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I Index - 6
L
Lock 1-7, 1-10, 1-13, 1-14, 1-17, 1-19, 1-20, 1-21, 1-23, 2-15,
3-10, 3-12, 3-17, 4-12, 4-16, 4-17, 4-30, 4-32, 4-33, 5-2, 5-3,
5-4, 5-5, 5-7, 5-8, 5-12, 5-13, 5-24, 5-28, 5-29, 6-3, 6-4,
6-10, 6-25, 6-28, 7-10, 7-28, 7-29, 7-30, 7-31, 7-41, 7-46, 8-2,
8-3, 8-9, 8-10, 8-13, 8-21, 8-22, 8-23, 8-24, 8-25, 8-26, 8-27,
8-28, 8-29, 8-30, 8-31, 8-32, 8-33, 8-34, 9-6, 9-7, 9-8, 9-11,
10-7, 10-20, 11-7, 12-5, 12-8, 12-15, 13-24, 13-25, 14-6, 14-11, 14-16,
15-6, 15-7, 15-10, 16-4, 17-7, 17-16, 17-25, 18-3, 18-7, 18-11, 18-12,
18-18, 18-28
a ble
M
fe r
Media management library 15-8, 15-9 a ns
n- t r
Memory Advisor 12-19, 13-2, 13-18, 13-21, 13-22, 13-28
a no
Metric 1-6, 4-7, 4-31, 4-32, 5-26, 6-3, 6-8, 10-7, 12-4, 12-9,
h a s
12-14, 12-22, 12-23, 12-24, 12-26, 12-27, 12-29, 13-3 m ) e.
o
MML 15-8
g i c.c t Guid
MMON 1-13, 1-20, 2-5, 2-10, 5-15, 6-3, 6-27,
o 7-8,
rel7-4, e n7-14,
a
iw 11-3, tu d
7-27, 8-10, 8-18, 8-28, 10-14,@
le
10-28,
hi s S 11-13, 11-15, 11-27, 11-30,
t 14-3, 15-8
. b ha 12-29,
12-9, 12-10, 12-15, 12-18,
s e 13-3,
dh 14-16,
MTTR 12-18, 12-19,o14-3, to u14-17
N ( s ub ense
hal
e lic
b Language Support 2-12
National
h
b d
o netca 2-19
s u
NLS 2-11, 2-12, 2-13
NLS_LANG 2-11, 2-12
NMP 6-25, 11-15, 12-27
O
OC4J 2-15, 2-18, 4-10
OMF 3-8, 5-7, 5-21, 14-20, 16-8
Optimizer statistics 8-18, 12-4, 12-5, 12-6, 12-7, 12-8, 12-30
Oracle Managed Files 3-8, 5-7, 14-20
Oracle Net 2-3, 2-4, 2-12, 2-15, 2-19, 3-10, 6-24, 11-1, 11-2,
11-3, 11-4, 11-5, 11-6, 11-8, 11-9, 11-13, 11-14, 11-15, 11-17, 11-18,
11-19, 11-20, 11-21, 11-22, 11-23, 11-25, 11-31, 11-32, 12-15, 14-24
Oracle Shared Server 11-26, 11-28, 11-30

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I Index - 7
O
ORACLE_BASE 2-11, 18-21
ORACLE_HOME 2-7, 2-11, 4-4, 4-9, 4-10, 4-21, 6-28, 10-25, 11-4,
11-16, 11-19, 11-25, 18-21
ORACLE_SID 2-11, 3-14, 18-21
OUI 2-2, 2-4, 2-13, 2-14, 2-15, 2-18, 2-19, 2-20, 4-9
P
Package 2-7, 2-13, 5-13, 6-11, 8-13, 8-16, 8-17, 8-18, 8-19,
10-8, 10-9, 10-10, 10-20, 10-24, 12-6, 12-9, 12-11, 12-21, 13-26, 18-3,
18-13, 18-17, 18-30
a ble
Parallelization 18-33
fe r
PGA 1-10, 1-11, 1-12, 1-23, 4-17, 11-7, 11-27, 11-28, 12-18, 12-19, a ns
n- t r
13-18, 13-22, 13-25
a no
PGA Advisor 12-18, 13-22 a s
PMON 1-13, 1-23, 14-6 m ) h e.
i
Privilege 4-6, 4-23, 5-14, 5-21, 6-2, 6-3, 6-5, 6-6, 6-7,c .co Guid
l o g nt
a r
6-9, 6-11, 6-12, 6-13, 6-14, 6-15, 6-16, e6-17, e 6-19, 6-20,
6-18,
d
6-21, 6-22, 6-23, 6-24, 6-25, @ iw6-29,s 6-31,
6-27,
t u
S 7-23, 7-24, 7-45,
7-46, 10-2, 10-3, 10-5,
le
a 10-8,
h10-6, e hi
t10-9, 10-10, 10-11, 10-12, 10-15,
. b
h 10-25, u s
d
10-16, 10-18, 10-20,
o t o 10-27, 10-29, 12-21, 13-10, 14-5, 14-26, 17-12,
(
18-5, 18-21s ub ense
h
Procedurea lic4-17, 5-13, 6-11, 6-13, 6-16, 6-21, 7-8,
le1-2, 1-21,
h b
b d
o 7-44, 8-10, 8-13, 8-15, 8-16, 8-18, 8-19, 10-5, 10-11, 10-16, 10-20,
s u 10-21, 10-22, 12-11, 12-21, 13-26, 14-3, 17-3
Profile 6-2, 6-3, 6-4, 6-6, 6-7, 6-11, 6-17, 6-23, 6-24,
6-25, 6-26, 6-27, 6-28, 6-29, 6-31, 6-32, 11-13, 11-28, 13-9, 13-10
Program Global Area 1-10, 1-11, 1-23, 4-17, 11-7, 12-19, 13-18,
13-22
R
Recovery Manager 2-4, 2-5, 3-15, 5-27, 11-30, 15-3, 15-4, 15-8
Recycle bin 6-30, 7-24, 14-9, 17-4, 17-17, 17-18, 17-19

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I Index - 8
R
Redo 1-10, 1-13, 1-15, 1-23, 2-9, 2-10, 3-6, 3-15, 4-22, 4-23,
4-26, 4-28, 4-29, 4-32, 5-7, 5-13, 6-13, 8-30, 9-2, 9-8, 9-17,
13-24, 14-2, 14-9, 14-11, 14-12, 14-13, 14-14, 14-15, 14-16, 14-17, 14-18,
14-19, 14-21, 14-22, 14-23, 14-26, 14-27, 14-28, 15-5, 15-16, 15-17, 15-19,
16-2, 16-3, 16-4, 16-5, 16-6, 16-8, 16-9, 16-13, 16-14, 17-7, 17-16,
18-12
Redo log buffer 1-10, 13-24, 14-12
Resource Manager 6-4, 6-24, 12-30
RMAN 1-3, 1-7, 1-8, 2-3, 2-5, 2-8, 3-3, 3-15, 4-2, 4-5,
4-7, 4-16, 4-17, 4-32, 4-33, 4-34, 4-35, 5-7, 5-10, 5-15, 5-26, r a ble
5-27, 6-6, 6-32, 7-18, 7-26, 7-37, 8-9, 8-16, 8-29, 9-6, 9-7, n s fe
10-11, 10-12, 10-16, 10-18, 10-22, 10-26, 12-4, 12-5, 12-9, 12-10, o n -tra
12-13,
12-16, 12-17, 12-18, 12-19, 12-20, 12-32, 13-1, 13-2, 13-3, s a n13-5,
13-4,
)
13-6, 13-7, 13-8, 13-11, 13-15, 13-16, 13-18, 13-23, 13-24,ha13-25, 13-26,
c o m ide.
13-28, 13-29, 14-17, 14-21, 14-22, 15-3, 15-4, i . 15-9,
c15-8, G u 15-10, 15-12,
g t
15-15, 15-18, 16-4, 16-11, 16-12, 18-13,
a relo18-27,
d n 18-29
18-28,
e
Role 2-2, 2-20, 4-10, 4-11, 6-2, 6-3, 6-5, S tu 6-17,
iw 6-7,s 6-11,
@ hi 6-29, 6-31, 6-32, 8-18,
le6-23, t6-25,
6-18, 6-19, 6-20, 6-21, h a
6-22,
e
.b 18-21 s
dh18-20,
10-8, 10-9, 10-10,
b o se to u
S u
(s icen
l e
ha 2-5, 8-18,l 12-7, 12-30, 15-15
Scheduler
b
o d h
Schema 1-3, 1-20, 1-21, 1-22, 1-23, 2-3, 3-9, 3-17, 5-6, 5-13,
s ub
5-14, 5-15, 6-6, 6-12, 6-13, 6-16, 6-18, 6-20, 6-22, 6-24, 6-27,
6-28, 6-32, 7-1, 7-2, 7-3, 7-4, 7-5, 7-11, 7-13, 7-21, 7-24,
7-25, 7-26, 7-34, 7-35, 7-36, 7-37, 7-38, 7-41, 7-44, 7-45, 7-47,
7-48, 7-49, 8-12, 8-14, 8-22, 10-12, 10-19, 10-21, 10-22, 12-6, 12-9,
12-17, 12-19, 13-16, 13-26, 17-13, 17-15, 17-18, 17-20, 18-14, 18-15, 18-16,
18-18, 18-25, 18-26
SCN 10-14, 14-15, 14-16, 14-19, 15-6, 17-8, 17-14, 17-21, 17-23, 17-27
Segment 1-19, 1-20, 1-21, 1-23, 4-17, 4-28, 4-31, 5-3, 5-4,
5-5, 5-12, 5-13, 5-15, 5-20, 5-21, 5-24, 5-28, 6-30, 7-29, 7-31,
9-6, 9-7, 9-9, 9-11, 9-17, 9-18, 12-17, 12-18, 12-19, 12-30, 13-25,
14-9, 17-25, 18-26
Segment Advisor 5-20, 12-17, 12-18, 12-19, 12-30

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I Index - 9
S
Sequence 1-21, 2-12, 6-11, 7-2, 7-3, 7-13, 7-26, 7-37, 7-38,
7-39, 7-40, 7-41, 7-44, 7-47, 7-48, 10-16, 12-11, 12-17, 14-24, 18-15
SGA 1-9, 1-10, 1-11, 1-13, 1-14, 1-23, 4-17, 4-21, 4-26, 6-24,
11-7, 11-27, 11-28, 12-9, 12-10, 12-18, 13-18, 13-19, 13-21, 13-22, 13-25,
14-11
Shared pool 1-10, 1-11, 1-13, 4-17, 11-27, 12-19, 13-18, 13-22
Shared server 3-10, 4-30, 6-24, 11-2, 11-26, 11-27, 11-28, 11-29,
11-30, 11-31
SID 2-3, 2-11, 3-3, 3-7, 3-12, 3-14, 4-4, 4-9, 4-14, 4-15,
4-16, 4-17, 4-19, 4-21, 4-25, 4-30, 4-32, 4-33, 4-34, 5-11, 5-14, r a ble
5-28, 6-12, 6-13, 6-29, 7-4, 7-10, 7-24, 7-27, 7-37, 7-43, 7-47, n s fe
8-7, 8-8, 8-11, 8-31, 9-7, 9-11, 10-5, 10-10, 10-16, 10-23, 10-25, on-
tra
10-28, 11-5, 11-15, 11-16, 11-18, 11-19, 11-22, 12-6, 12-9, s a n12-15,
12-13,
12-17, 12-28, 13-23, 14-12, 15-11, 15-12, 15-16, 15-19, ) a 17-8, 17-16,
h16-12,
c o m ide.
17-19, 17-25, 17-27, 17-28, 18-12, 18-21, 18-27,
g i c. 18-29
t G u
SMON 1-13, 1-23, 4-23
a relo uden
w 12-9,
Snapshot 1-14, 9-9, 9-10, 9-11, 12-3, i12-5, S t 12-10, 12-11,
@ s
hi 13-12
le12-29,t13-11,
12-12, 12-13, 12-15, 12-23,
h a e
d
SQL Access Advisor 12-18, h .b 12-19,u13-2,
s 13-16, 13-17, 13-28
o t o
s
SQL Tuning Advisor
( ub 12-17,
e n se12-18, 12-19, 13-2, 13-9, 13-10, 13-11, 13-12,
a
13-13,
h ic 13-28, 13-29
le13-14, l13-15,
h b
b o d
SQL*Loader 2-4, 2-5, 5-13, 18-2, 18-3, 18-6, 18-7, 18-8, 18-9,
su 18-10, 18-13, 18-17, 18-24, 18-31, 18-34, 18-36
SQL*Plus 1-10, 2-4, 2-5, 2-15, 4-2, 4-3, 4-8, 4-9, 4-10,
4-11, 4-12, 4-13, 4-14, 4-15, 4-19, 4-24, 4-29, 4-30, 4-32, 4-35,
4-36, 6-27, 8-9, 8-15, 12-10, 12-25, 18-3
Statistics 4-32, 8-18, 11-30, 12-2, 12-3, 12-4, 12-5, 12-6, 12-7,
12-8, 12-9, 12-10, 12-12, 12-13, 12-14, 12-15, 12-18, 12-22, 12-30, 12-31,
13-7, 13-9, 13-10, 13-14, 13-23, 13-24, 13-25, 17-16
Streams pool 1-10, 1-11, 1-13, 13-18
SYSAUX 1-18, 5-6, 5-14, 5-16, 6-29, 12-9, 15-17

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I Index - 10
S
SYSTEM 1-5, 1-6, 1-7, 1-8, 1-9, 1-10, 1-12, 1-13, 1-18, 1-19,
1-23, 2-3, 2-5, 2-6, 2-7, 2-8, 2-11, 2-18, 2-20, 3-3, 3-4,
3-7, 3-8, 3-12, 4-4, 4-6, 4-13, 4-17, 4-21, 4-23, 4-29, 4-32,
5-6, 5-7, 5-10, 5-12, 5-13, 5-14, 5-15, 5-16, 5-21, 5-26, 5-27,
5-28, 6-3, 6-5, 6-6, 6-8, 6-9, 6-11, 6-12, 6-13, 6-15, 6-16,
6-18, 6-23, 6-24, 6-25, 6-26, 6-29, 7-4, 7-18, 7-19, 7-20, 7-37,
8-10, 8-18, 8-28, 8-31, 9-3, 9-8, 9-12, 9-15, 10-5, 10-6, 10-7,
10-8, 10-9, 10-10, 10-11, 10-12, 10-13, 10-14, 10-16, 10-17, 10-19, 10-22,
10-26, 10-28, 11-4, 11-7, 11-8, 11-13, 11-22, 11-25, 11-26, 12-3, 12-4,
12-5, 12-11, 12-17, 12-19, 12-22, 12-23, 12-27, 12-28, 13-4, 13-5, 13-8, r a ble
13-22, 13-23, 13-24, 13-25, 14-3, 14-6, 14-7, 14-11, 14-12, 14-15, 14-17, ns
fe
14-26, 15-4, 15-5, 15-6, 15-7, 15-17, 15-18, 16-4, 16-5, 16-6, 16-11, n - tra
o
16-12, 16-14, 17-8, 17-12, 17-16, 17-19, 17-23, 18-4, 18-5, s a n18-14,
18-6,
18-15, 18-21, 18-24, 18-25, 18-31 ) ha
c o m ide.
System statistics 12-4, 12-5 ic.
o g nt G u
e l
T
i w ar tude
Tablespace 1-17, 1-18, 1-19, 1-20,@ 1-21, 1-23,
i s S2-3, 2-10, 3-3,
l e h
t5-6, 5-7, 5-8, 5-10,
3-6, 4-17, 4-22, 4-30,b5-2,
. ha5-3,s5-4,e
5-11, 5-12, 5-13, d h 5-15,
5-14, t o u5-16, 5-17, 5-18, 5-19, 5-20, 5-21,
o
b nse
u5-24,
e (
5-22, 5-23,s c e5-25, 5-28, 5-29, 5-30, 6-2, 6-3, 6-4, 6-6,
l l i
ha 6-13, 6-19, 6-29, 6-30, 6-31, 7-3, 7-12, 7-24, 7-42, 7-47,
6-11,
b
h 9-7, 9-9, 9-11, 9-12, 9-14, 9-15, 9-16, 9-18, 10-26, 11-30, 12-9,
o d
sub 12-19, 12-22, 12-23, 12-25, 12-27, 12-29, 13-27, 14-14, 15-5, 15-6, 15-10,
15-11, 15-16, 15-17, 16-4, 16-6, 16-11, 16-12, 17-9, 17-12, 17-19, 18-3,
18-14, 18-16, 18-25, 18-26, 18-28
Target database 4-6, 18-15, 18-32
Threshold 4-31, 5-18, 9-12, 12-2, 12-4, 12-11, 12-22, 12-23, 12-24,
12-25, 12-27, 12-29, 12-31
Trigger 7-24, 7-25, 7-42, 7-43, 8-2, 8-13, 8-19, 8-20, 8-33,
10-11, 10-16, 10-18, 10-19, 17-12, 18-12, 18-29

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I Index - 11
U
Undo 1-3, 1-21, 4-16, 4-17, 4-28, 4-32, 5-12, 5-13, 5-14, 5-15,
5-21, 6-29, 7-25, 8-9, 8-22, 9-1, 9-2, 9-4, 9-5, 9-6, 9-7,
9-8, 9-9, 9-10, 9-11, 9-12, 9-13, 9-14, 9-15, 9-16, 9-17, 9-18,
12-8, 12-18, 12-19, 12-20, 13-25, 14-8, 14-9, 14-14, 14-15, 15-17, 16-4,
16-6, 16-11, 16-12, 17-4, 17-5, 17-6, 17-8, 17-12, 17-16, 17-17, 17-26,
17-28, 18-28
Undo Advisor 9-2, 9-16, 9-17, 12-18
Undo data 5-21, 7-25, 9-1, 9-2, 9-4, 9-5, 9-6, 9-7, 9-8,
9-9, 9-10, 9-14, 9-17, 12-19, 12-20, 16-12, 17-4, 17-28
UTC 10-14 a ble
fe r
V a n s
n- t r
View 1-7, 1-16, 1-21, 2-3, 2-21, 3-17, 4-2, 4-3, 4-4, 4-5,
a no
h a s
4-7, 4-8, 4-15, 4-18, 4-19, 4-24, 4-30, 4-31, 4-32, 4-33, 4-34,

o m) 7-2, .
4-35, 4-36, 5-9, 5-22, 5-23, 5-24, 5-30, 6-11, 6-30, 6-32,
de
7-3, 7-4, 7-6, 7-13, 7-21, 7-22, 7-23, 7-26, 7-34,
g i c.c7-35, G ui
7-36,
t 7-48, 7-49,
7-37, 7-38, 7-41, 7-42, 7-43, 7-44, 7-45, r e o 7-47,
l7-46, e n
i w a d
tu10-2,
8-12, 8-18, 8-29, 8-34, 9-6, 9-10, 9-15,
@ his S
9-18, 10-5, 10-9,
l e t10-22, 10-24, 10-25, 10-26, 10-29, 10-30,
10-11, 10-12, 10-14, b
. ha 10-20,
10-16,
s e
11-8, 11-32, 12-9, d o u 12-19, 12-21, 12-28, 12-32, 13-2, 13-5,
h12-10,t12-16,
o
b nse
u13-10,
e (
13-8, 13-9,s c e13-13, 13-14, 13-16, 13-17, 13-21, 13-23, 13-25, 13-26,
l l i
ha 13-29, 14-22, 14-28, 15-3, 15-15, 15-19, 15-21, 16-4, 16-14, 17-2,
13-28,
b
h 17-3, 17-4, 17-6, 17-11, 17-13, 17-15, 17-16, 17-17, 17-18, 17-19, 17-20,
o d
sub 17-21, 17-23, 17-24, 17-25, 17-26, 17-29, 17-30, 18-4, 18-5, 18-6, 18-7,
18-13, 18-15, 18-17, 18-30, 18-35, 18-37
VPD 17-19
W
Wait event 4-32, 13-4, 13-5, 13-23
Work area 1-21
Workload repository 6-5, 12-2, 12-3, 12-4, 12-9, 12-12, 12-18,
12-20, 12-31

Unauthorized reproduction or distribution prohibited. Copyright© 2009, Oracle and/or its affiliates.
Oracle Database 10g: Administration Workshop I Index - 12

You might also like