Using Your Sybex Electronic Book
T
o realize the full potential of this Sybex electronic book, you must have Adobe Acrobat Reader with
Search installed on your computer. To find out if you have the correct version of Acrobat Reader, click on
the Edit menu—Search should be an option within this menu file. If Search is not an option in the Edit
menu, please exit this application and install Adobe Acrobat Reader with Search from this CD (double-
click rp500enu.exe in the Adobe folder).
Navigation
To search, click the Search Query button on the toolbar
or choose Edit >Search > Query to open the Search window. In
the Adobe Acrobat Search dialog’s text field, type the text you
want to find and click Search.
Use the Search Next button (Control+U) and Search
Previous button (Control+Y) to go to other matches in
the book. The Search command also has powerful tools for
limiting and expanding the definition of the term you are
searching for. Refer to Acrobat's online Help (Help > Plug-In
Help > Using Acrobat Search) for more information.
www.sybex.com
Click here to begin using
your Sybex E lectronic Book!
Search
Navigate through the book by clicking on the headings that appear in the left panel;
the corresponding page from the book displays in the right panel.
San Francisco • London
OCA/OCP:
Oracle9i
SYBEX and the SYBEX logo are either registered trademarks or trademarks of SYBEX Inc. in the United States and/or other
countries.
Screen reproductions produced with FullShot 99. FullShot 99 © 1991–1999 Inbit Incorporated. All rights reserved.
FullShot is a trademark of Inbit Incorporated.
The CD interface was created using Macromedia Director, COPYRIGHT 1994, 1997–1999 Macromedia Inc. For more
information on Macromedia and Macromedia Director, visit .
SYBEX is an independent entity from Oracle Corporation and is not affiliated with Oracle Corporation in any manner. This
publication may be used in assisting students to prepare for an Oracle Certified Professional exam. Neither Oracle Corpo-
ration nor SYBEX warrants that use of this publication will ensure passing the relevant exam. Oracle is either a registered
trademark or a trademark of Oracle Corporation in the United States and/or other countries.
TRADEMARKS: SYBEX has attempted throughout this book to distinguish proprietary trademarks from descriptive terms
by following the capitalization style used by the manufacturer.
The author and publisher have made their best efforts to prepare this book, and the content is based upon final release
software whenever possible. Portions of the manuscript may be based upon pre-release versions supplied by software man-
ufacturer(s). The author and the publisher make no representation or warranties of any kind with regard to the completeness
or accuracy of the contents herein and accept no liability of any kind including but not limited to performance, merchant-
ability, fitness for any particular purpose, or any losses or damages of any kind caused or alleged to be caused directly or
indirectly from this book.
Manufactured in the United States of America
10 9 8 7 6 5 4 3 2 1
Copyright ©2002 SYBEX, Inc., Alameda, CA
www.sybex.com
To Our Valued Readers:
In a CertCities.com article dated December 15, 2001, Oracle certification was ranked #2 in a list
of the “10 Hottest Certifications for 2002.” This shouldn’t come as a surprise, especially when you
consider the fact that the OCP program nearly tripled in size (from 30,000 to 80,000) in the last year.
Oracle continues to expand its dominance in the database market, and as companies begin integrating
Oracle9i systems into their IT infrastructure, you can be assured of high demand for professionals with
the Oracle Certified Associate and Oracle Certified Professional certifications.
tion thereof, without the written consent of SYBEX and the
specific copyright owner(s) of any component software
included on this media.
In the event that the Software or components include specific
license requirements or end-user agreements, statements of
condition, disclaimers, limitations or warranties (“End-User
License”), those End-User Licenses supersede the terms and
conditions herein as to that particular Software component.
Your purchase, acceptance, or use of the Software will con-
stitute your acceptance of such End-User Licenses.
By purchase, use or acceptance of the Software you further
agree to comply with all export laws and regulations of the
United States as such laws and regulations may exist from
time to time.
Software Support
Components of the supplemental Software and any offers
associated with them may be supported by the specific
Owner(s) of that material, but they are not supported by
SYBEX. Information regarding any available support may be
obtained from the Owner(s) using the information provided
in the appropriate read.me files or listed elsewhere on the
media.
Should the manufacturer(s) or other Owner(s) cease to offer
support or decline to honor any offer, SYBEX bears no
responsibility. This notice concerning support for the Soft-
ware is provided for your information only. SYBEX is not the
agent or principal of the Owner(s), and SYBEX is in no way
responsible for providing any support for the Software, nor is
rect, special, incidental, consequential, or other damages
arising out of the use of or inability to use the Software or its
contents even if advised of the possibility of such damage. In
the event that the Software includes an online update feature,
SYBEX further disclaims any obligation to provide this fea-
ture for any specific duration other than the initial posting.
The exclusion of implied warranties is not permitted by some
states. Therefore, the above exclusion may not apply to you.
This warranty provides you with specific legal rights; there
may be other rights that you may have that vary from state to
state. The pricing of the book with the Software by SYBEX
reflects the allocation of risk and limitations on liability
contained in this agreement of Terms and Conditions.
Shareware Distribution
This Software may contain various programs that are distrib-
uted as shareware. Copyright laws apply to both share-
ware and ordinary commercial software, and the copyright
Owner(s) retains all rights. If you try a shareware program
and continue using it, you are expected to register it. Individ-
ual programs differ on details of trial periods, registration,
and payment. Please observe the requirements stated in
appropriate files.
Copy Protection
The Software in whole or in part may or may not be copy-
protected or encrypted. However, in all cases, reselling or
redistributing these files without authorization is expressly
son Joshua. I thank my parents for taking care of the baby and house for the
past five months. Thank you, Shiji, for your endless support and love.
Last, but not least, I thank my colleagues for their support and friendship.
Thank you, Wendy, for understanding me so well and all the help you pro-
vided. Thank you all—you are the best to work with.
—Biju Thomas
I would like to thank all the folks at Sybex that made this a most enjoyable
and rewarding experience, including Elizabeth Campbell and Jeff Kellum,
who reinforced my attention to detail. Thanks go to Biju for not letting me
write too many of these chapters myself. Thanks also to Pat Coleman, who
filled in the gaps from my college writing courses, and to Ashok and Betty for
their insightful comments and suggestions.
This book wouldn’t be possible without the love and support from my
family throughout the long nights and weekends when I still managed to find
time to give the kids a bath and read books before bedtime. I loved every
minute of it.
Thanks also to my professional colleagues, both past and present, who
provided me with inspiration, support, and guidance and pushed me a little
further to take a risk now and then: Joe Johnson, Julie Krause, Karen Kressin,
Chuck Dunbar, and that math teacher in high school, whose name eludes me
at the moment, who introduced me to computers on a DEC PDP-8 with a
teletype and a paper tape reader.
—Bob Bryla
Copyright ©2002 SYBEX, Inc., Alameda, CA
www.sybex.com
Introduction
T
greater access to the industry’s most challenging opportunities. Oracle cer-
tification is the best way to demonstrate your knowledge and skills in Oracle
database systems. The certification tests are scenario-based, which is the
most effective way to assess your hands-on expertise and critical problem-
solving skills.
Copyright ©2002 SYBEX, Inc., Alameda, CA
www.sybex.com
xviii
Introduction
Certification is proof of your knowledge and shows that you have the
skills required to support Oracle core products. The Oracle certification pro-
gram can help a company to identify proven performers who have demon-
strated their skills and who can support the company’s investment in Oracle
technology. It demonstrates that you have a solid understanding of your job
role and the Oracle products used in that role.
OCPs are among the best paid in the IT industry. Salary surveys consis-
tently show the OCP certification to yield higher salaries than other certifi-
cations, including Microsoft, Novell, and Cisco.
So, whether you are beginning a career, changing careers, securing your
present position, or seeking to refine and promote your position, this book
is for you!
Oracle Certifications
Oracle certifications follow a track that is oriented toward a job role. There
are database administration, database operator, and developer tracks. Within
each track, Oracle has a three-tiered certification program:
xix
Oracle9i Certified Database Associate
The role of the database administrator (DBA) has become a key to success in
today’s highly complex database systems. The best DBAs work behind the
scenes, but are in the spotlight when critical issues arise. They plan, create,
maintain, and ensure that the database is available for the business. They are
always watching the databaseµ for performance issues and to prevent
unscheduled downtime. The DBA’s job requires broad understanding of the
architecture of Oracle database and expertise in solving problems.
The Oracle9i Certified Database Associate is the entry-level certification
for the database administration track and is required to advance toward the
more senior certification tiers. This certification requires you to pass two
exams that demonstrate your knowledge of Oracle basics:
1Z0-007: Introduction to Oracle9i: SQL
1Z0-031: Oracle9i Database: Fundamentals I
The 1Z0-007 exam, Introduction to Oracle9i: SQL, is offered on the
Internet. The 1Z0-031 exam, Oracle9i Database: Fundamentals I, is offered
at a Sylvan Prometric facility.
Oracle9i Certified Database Administrator (DBA)
The OCP tier of the database administration track challenges you to dem-
onstrate your continuing experience and knowledge of Oracle technologies.
The Oracle9i Certified Database Administrator certification requires achieve-
Oracle9i: SQL Tuning Workshop
Oracle9i: High Availability in an Internet Environment
Oracle9i: Database: Implement Partitioning
Oracle9i: Real Application Clusters Implementation
Oracle9i: Data Warehouse Administration
Oracle9i: Advanced Replication
Oracle9i: Enterprise Manager
Passing Scores
The 1Z0-031: Oracle9i Database: Fundamentals I exam consists of two
sections—basic and mastery. The passing score for basic section is 71 per-
cent and for mastery section is 56 percent at the time of writing this book.
Please download and read the Oracle9i Certification candidate guide before
taking the exam. The basic section covers the fundamental concepts, and
the mastery section covers more difficult questions, mostly based on practice
(exam 1Z0-031: Oracle9i Database: Fundamentals I)
Copyright ©2002 SYBEX, Inc., Alameda, CA
www.sybex.com
Introduction
xxi
OCP: Oracle9i™ DBA Database Fundamentals II Study Guide(exam 1Z0-032: Oracle9i Database: Fundamentals II)
OCP: Oracle9i™ DBA Performance Tuning
(exam 1Z0-033:
Oracle9i Database: Performance Tuning)
Additionally, these four books are offered in a boxed set:
OCP:
Oracle9i
™
DBA Certification Kit
able to manage space allocation and growth.
Manage data, including its storage, loading, and reorganization.
Manage redo logs, automatic undo, and rollback segments.
Use globalization features to choose a database character set and
National Language Support (NLS) parameters.
Configure Net8 on the server side and the client side.
Use backup and recovery options.
Archive redo log files and hot backups.
Perform backup and recovery operations using Recovery Manager
(RMAN).
Use data dictionary views and set database parameters.
Configure and use multithreaded server (MTS) and Connection
Tune the size of data blocks, the shared pool, the buffer caches,
and rollback segments.
Diagnose contention for latches, locks, and rollback segments.
Tips for Taking the OCP Exam
Use the following tips to help you prepare for and pass each exam.
Each OCP test contains about 55–80 questions to be completed in
90 minutes. Answer the questions you know first so that you do not
run out of time.
The answer choices for many questions on the exam look identical at
first. Read the questions carefully. Do not just jump to conclusions. Be
sure that you clearly understand exactly what each question asks.
Most of the test questions are scenario-based. Some scenarios contain
nonessential information and exhibits. You need to be able to identify
what’s important and what’s not important.
Do not leave any questions unanswered. There is no negative scoring.
After selecting an answer, you can mark a difficult question or one
that you’re unsure of and come back to it later.
).
At the time of this writing, the online 1Z0-007 exam is $90. If you do not
Copyright ©2002 SYBEX, Inc., Alameda, CA
www.sybex.com
Introduction
xxiii
have a credit card to use for payment, you will need to contact Oracle to pur-
chase a voucher. You can pay with a certification voucher, promo codes, or
credit card.
You can take the other exams at any of the more than 800 Sylvan Pro-
metric Authorized Testing Centers around the world. For the location of a
testing center near you, call 1-800-891-3926. Outside the United States and
Canada, contact your local Sylvan Prometric Registration Center. Usually,
you can take the tests in any order.
To register for a proctored Oracle Certified Professional exam at a Sylvan
Prometric test center, do the following:
Determine the number of the exam you want to take.
Register with Sylvan Prometric online at
or,
Discusses the various tools available to DBAs, connecting to
the Oracle database, and startup/shutdown of the database.
Copyright ©2002 SYBEX, Inc., Alameda, CA
www.sybex.com
xxiv
Introduction
Chapter 4
Discusses how to create a database manually as well as how
to use the Database Configuration Assistant. It also discusses the Oracle
data dictionary.
Chapter 5
Explains the uses and contents of the control files and redo
log files.
Chapter 6
Discusses tablespaces and data files. The logical structure
of the tablespace within he database and Oracle Managed Files are dis-
cussed.
Chapter 7
Explains logical storage structures such as blocks, extents,
chapter. Pay extra close attention to any chapter related to questions
you missed in the Assessment Test.
3.
Complete all hands-on exercises in the chapter, referring to the chap-
ter so that you understand the reason for each step you take. If you do
Copyright ©2002 SYBEX, Inc., Alameda, CA
www.sybex.com
Introduction xxv
not have an Oracle database available, be sure to study the examples
carefully. Answer the Review Questions related to that chapter. (The
answers appear at the end of each chapter, after the “Review Ques-
tions” section.)
4.
Note the questions that confuse or trick you, and study those sections
of the book again.
5.
Before taking the exam, try your hand at the Bonus Exams included on
the CD that comes with this book. The questions on these exams
appear only on the CD. This will give you a complete overview of
what you can expect to see on the real test.
6.
Remember to use the products on the CD included with this book. The
electronic flashcards and the Edge Test exam preparation software
have been specifically designed to help you study for and pass your
exam. You can use the electronic flashcards n your Windows com-
puter or on your Palm device.
To learn all the material covered in this book, you’ll need to apply yourself
regularly and with discipline. Try to set aside the same time period every day
to study, and select a comfortable and quiet place to do so. If you work hard,
you will be surprised at how quickly you learn this material. All the best!
How to Contact the Authors
To contact Biju Thomas, you can e-mail him at or visit
his website for DBAs at />To contact Bob Bryla, you can e-mail him at
About the authors
Biju Thomas is an Oracle9i certified professional with eight years of Oracle
database management and application development experience. He has
written articles for Oracle Magazine, Oracle Internals, and Select Magazine.
He maintains a website for DBAs at
Bob Bryla is an Oracle9i certified professional with more than ten years of
database design, database application development, and database adminis-
tration experience in a variety of fields. He is currently an Internet Database
Analyst and DBA at Lands’ End, Inc. in Dodgeville, Wisconsin.
Copyright ©2002 SYBEX, Inc., Alameda, CA
www.sybex.com
Assessment Test
1.
Multiple ____________ can share an SGA.
A.
PMON processes
B.
Server processes
C.
Instances
D.
Databases
E.
Tablespaces
2.
Which component in the following list is not part of the SGA?
A.
D.
Use the ALTER SESSION ENABLE RESTRICTED USERS command.
Copyright ©2002 SYBEX, Inc., Alameda, CA
www.sybex.com
xxviii Assessment Questions
5.
When you connect to a database by using CONNECT SCOTT/TIGER AS
SYSDBA, which schema are you connected to in the database?
A.
SYSTEM
B.
PUBLIC
C.
SYSDBA
D.
SYS
E.
SCOTT
6.
Suppose the database is in the MOUNT state; select two statements from
the options below that are correct.
A.
The control file is open; the database files and redo log files are
closed.
B.
You can query the SGA by using dynamic views.
C.
The control file, data files, and redo log files are open.
D.
The control file, data files, and redo log files are all closed.
C.
Redo log files
D.
Alert log files
10.
What happens when one of the redo members of the next group is
unavailable when LGWR has finished writing the current log file?
A.
Database operation will continue uninterrupted.
B.
The database will hang; do an ALTER DATABASE SWITCH LOGFILE
to skip the unavailable redo log.
C.
The instance will be shut down.
D.
LGWR will create a new redo log member, and the database will
continue to be in operation.
11.
When you multiplex the control file, how many control files can you
have for one database?
A.
Four
B.
Eight
C.
Twelve
D.
Unlimited
12.
Which initialization parameter specifies that no more than the speci-
DB_CREATE_SPFILE
B.
DB_CREATE_FILE_DEST
C.
DB_CREATE_ONLINE_LOG_DEST_n
D.
CONTROL_FILES
15.
The following are the steps required for relocating a data file belong-
ing to the USERS tablespace. Choose the correct order in which the
steps are to be performed.
1.
Copy the file /disk1/users01.dbf to /disk2/users01.dbf
using an operating system command.
2.
ALTER DATABASE RENAME FILE ‘/disk1/users01.dbf’ TO
‘/disk2/users01.dbf’
3.
ALTER TABLESPACE USERS OFFLINE
4.
ALTER TABLESPACE USERS ONLINE
A.
1, 2, 3, 4
B.
3, 1, 2, 4
C.
3, 2, 1, 4
D.
4, 2, 1, 3
Copyright ©2002 SYBEX, Inc., Alameda, CA
B.
DBA_TEMP_FILES
C.
DBA_DATA_FILES
D.
DBA_FREE_SPACE
19.
Which parameter is used to set up the directory for Oracle to create
data files, if you do not specify a file name in the DATAFILE clause
when creating or altering tablespaces?
A.
DB_FILE_CREATE_DEST
B.
DB_CREATE_FILE_DEST
C.
DB_8K_CACHE_SIZE
D.
USER_DUMP_DEST
E.
DB_CREATE_ONLINE_LOG_DEST_1
Copyright ©2002 SYBEX, Inc., Alameda, CA
www.sybex.com
xxxii Assessment Test
20.
Select the invalid statements from the list below regarding undo
segment management. (Choose all that apply.)
A.
ALTER SYSTEM SET UNDO_TABLESPACE = ROLLBACK;
B.
ALTER DATABASE SET UNDO_TABLESPACE = UNDOTBS;
DBA_SEGMENTS
B.
V$SORT_SEGMENT
C.
DBA_TEMP_SEGMENTS
D.
DBA_TABLESPACES
24.
The ALTER INDEX REBUILD command cannot ____________.
A.
Move index to a new tablespace
B.
Change the INITIAL extent size of the index
C.
Collect statistics on the index
D.
Specify a new name for the index
Copyright ©2002 SYBEX, Inc., Alameda, CA
www.sybex.com
Assessment Test xxxiii
25.
Which command do you use to collect statistics for a table?
A.
ALTER TABLE <TABLE_NAME> COMPUTE STATISTICS
B.
ANALYZE TABLE <TABLE_NAME> COMPUTE STATISTICS
C.
ALTER TABLE <TABLE_NAME> COLLECT STATISTICS
D.
ANALYZE TABLE <TABLE_NAME> COLLECT STATISTICS
LIST
D.
COMPOUND
E.
HASH
29.
If you run the ALTER SESSION SET NLS_DATE_FORMAT = ‘DDMMYY’
statement, which dictionary view would you query to see the value of
the parameter?
A.
V$SESSION_PARAMETERS
B.
NLS_SESSION_PARAMETERS
Copyright ©2002 SYBEX, Inc., Alameda, CA
www.sybex.com
xxxiv Assessment Test
C.
NLS_DATABASE_PARAMETERS
D.
V$SESSION
30.
Which NLS parameter can be specified only as an environment
variable?
A.
NLS_LANGUAGE
B.
NLS_LANG
C.
NLS_TERRITORY
D.