Covers Both the 1Z0-051 and 1Z0-052 Exams!
Includes Real-World Scenarios, Hands-On Exercises,
and Leading-Edge Exam Prep Software Featuring:
• Custom Test Engine
• Hundreds of Sample Questions
• Electronic Flashcards for PCs, Pocket PCs,
and Palm Handhelds
ã Entire Book in PDF
OCA
Oracle Database 11g
Administrator Certied
Associate
STUDY GUIDE
đ
Exams 1Z0-051
and 1Z0-052
SERIOUS SKILLS.
Biju Thomas
OCA: Oracle Database 11g Administrator Certified
Associate Study Guide
1Z0-051 Exam Objectives
Objective
Chapter
Retrieving Data Using the SQL SELECT Statement
List the capabilities of SQL SELECT statements
1
Execute a basic SELECT statement
1
Restricting and Sorting Data
Limit the rows that are retrieved by a query
Sort the rows that are retrieved by a query
Use ampersand substitution to restrict and sort output at runtime
1
1
1
Using Single-Row Functions to Customize Output
Describe various types of functions available in SQL
Use character, number, and date functions in SELECT statements
2
2
Using Conversion Functions and Conditional Expressions
Describe various types of conversion functions that are available in SQL
Use the TO_CHAR, TO_NUMBER, and TO_DATE conversion functions
Apply conditional expressions in a SELECT statement
2
2
2
Reporting Aggregated Data Using the Group Functions
Identify the available group functions
Describe the use of group functions
Group data by using the GROUP BY clause
Include or exclude grouped rows by using the HAVING clause
3
3
3
3
Displaying Data from Multiple Tables
Write SELECT statements to access data from more than one table using
equijoins and nonequijoins
Join a table to itself by using a self-join
View data that generally does not meet a join condition by using outer joins
Generate a Cartesian product of all rows from two or more tables
4
4
4
4
Using Subqueries to Solve Queries
Define subqueries
Describe the types of problems that the subqueries can solve
List the types of subqueries
Write single-row and multiple-row subqueries
Exam specifications and content are subject to change at any time without
prior notice and at Oracle’s sole discretion. Please visit Oracle’s website ( http://
education.oracle.com) for the most current information on their exam content.
4
4
4
4
Objective
Chapter
Using the Set Operators
Describe set operators
Use a set operator to combine multiple queries into a single query
Control the order of rows returned
4
4
4
Manipulating Data
Describe each data manipulation language (DML) statement
Insert rows into a table
Update rows in a table
Delete rows from a table
Control transactions
5
5
5
5
5
Using DDL Statements to Create and Manage Tables
Categorize the main database objects
Review the table structure
List the data types that are available for columns
Create a simple table
Explain how constraints are created at the time of table creation
Describe how schema objects work
6
6
6
6
6
6
Creating Other Schema Objects
Create simple and complex views
Retrieve data from views
Create, maintain, and use sequences
Create and maintain indexes
Create private and public synonyms
7
7
7
7
7
1Z0-052 Exam Objectives
Objective
Chapter
Exploring the Oracle Database Architecture
Explain the Memory Structures
Describe the Process Structures
Overview of Storage Structures
8
8
8
Preparing the Database Environment
Identify the tools for Administering an Oracle Database
Plan an Oracle Database installation
Install the Oracle software by using Oracle Universal Installer (OUI)
8
8
8
Objective
Chapter
Creating an Oracle Database
Create a database by using the Database Configuration Assistant (DBCA)
9
Managing the Oracle Instance
Setting database initialization parameters
Describe the stages of database startup and shutdown
Using alert log and trace files
Using data dictionary and dynamic performance views
9
9
9
9
Configuring the Oracle Network Environment
Configure and Manage the Oracle Network
Using the Oracle Shared Server architecture
11
11
Managing Database Storage Structures
Overview of tablespace and datafiles
Create and manage tablespaces
Space management in tablespaces
10
10
10
Administering User Security
Create and manage database user accounts
Grant and revoke privileges
Create and manage roles
Create and manage profiles
12
12
12
12
Managing Schema Objects
Create and Modify tables
Manage Constraints
Create indexes
Create and use temporary tables
10
10
10
10
Managing Data and Concurrency
Manage data using DML
Identify and administer PL/SQL objects
Monitor and resolve locking conflicts
13
13
13
Managing Undo Data
Overview of Undo
Transactions and undo data
Managing undo
13
13
13
Implementing Oracle Database Security
Database Security and Principle of Least Privilege
Work with Standard Database Auditing
Exam specifications and content are subject to change at any time without
prior notice and at Oracle’s sole discretion. Please visit Oracle’s website ( http://
education.oracle.com) for the most current information on their exam content.
12
12
Objective
Chapter
Database Maintenance
Use and manage optimizer statistics
Use and manage Automatic Workload Repository (AWR)
Use advisory framework
Manage Alerts and Thresholds
14
14
14
14
Performance Management
Use Automatic Memory Management
Use Memory Advisors
Troubleshoot invalid and unusable objects
14
14
14
Intelligent Infrastructure Enhancements
Use the Enterprise Manager Support Workbench
Managing Patches
17
17
Backup and Recovery Concepts
Identify the types of failure that can occur in an Oracle database
Describe ways to tune instance recovery
Identify the importance of checkpoints, redo log files, and archived log files
Overview of flash recovery area
Configure ARCHIVELOG mode
16
16
15
15
15
Performing Database Backups
Create consistent database backups
Back up your database without shutting it down
Create incremental backups
Automate database backups
Manage backups, view backup reports and monitor the flash recovery area
15
15
15
15
15
Performing Database Recovery
Overview of Data Recovery Advisor
Use Data Recovery Advisor to Perform recovery (Control file, Redo log file,
and Data file)
16
16
Moving Data
Describe and use methods to move data (Directory objects, SQL*Loader,
External Tables)
Explain the general architecture of Oracle Data Pump
Use Data Pump Export and Import to move data between Oracle databases
17
17
17
OCA
Oracle Database 11g
Administrator
Certified Associate
®
Study Guide
OCA
Oracle Database 11g
Administrator
Certified Associate
®
Study Guide
Biju Thomas
Disclaimer: This eBook does not include ancillary media that was packaged with the
printed version of the book.
Acquisitions Editor: Jeff Kellum
Development Editor: Denise Santoro Lincoln
Technical Editors: Arup Nanda and Bob Bryla
Production Editor: Eric Charbonneau
Copy Editor: Kim Wimpsett
Production Manager: Tim Tate
Vice President and Executive Group Publisher: Richard Swadley
Vice President and Publisher: Neil Edde
Media Project Manager 1: Laura Moss-Hollister
Media Associate Producer: Josh Frank
Media Quality Assurance: Kit Malone
Book Designer: Judy Fung
Compositor: Craig Johnson, Happenstance Type-O-Rama
Proofreader: Candace English
Indexer: Ted Laux
Project Coordinator, Cover: Lynsey Stanford
Cover Designer: Ryan Sneed
Copyright © 2009 by Wiley Publishing, Inc., Indianapolis, Indiana
Published simultaneously in Canada
ISBN: 978-0-470-39512-7
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means,
electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108
of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization
through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA
01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008,
or online at />Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with
respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including
without limitation warranties of fitness for a particular purpose. No warranty may be created or extended by sales or
promotional materials. The advice and strategies contained herein may not be suitable for every situation. This work
is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional
services. If professional assistance is required, the services of a competent professional person should be sought. Neither
the publisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Web site is
referred to in this work as a citation and/or a potential source of further information does not mean that the author or
the publisher endorses the information the organization or Web site may provide or recommendations it may make. Further, readers should be aware that Internet Web sites listed in this work may have changed or disappeared between when
this work was written and when it is read.
For general information on our other products and services or to obtain technical support, please contact our Customer
Care Department within the U.S. at (877) 762-2974, outside the U.S. at (317) 572-3993 or fax (317) 572-4002.
Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available
in electronic books.
Library of Congress Cataloging-in-Publication Data
Thomas, Biju.
OCA : Oracle database 11g administrator certified associate study guide (1Z0-051 and 1Z0-052) / Biju Thomas. — 1st ed.
p. cm.
ISBN 978-0-470-39512-7 (paper/cd-rom)
1. Electronic data processing personnel—Certification. 2. Database management—Examinations—Study guides. 3.
Oracle (Computer file) I. Title.
QA76.3.T5136 2009
005.75’75—dc22
2008052085
TRADEMARKS: Wiley, the Wiley logo, and the Sybex logo are trademarks or registered trademarks of John Wiley & Sons,
Inc. and/or its affiliates, in the United States and other countries, and may not be used without written permission. Oracle
is a registered trademark of Oracle Corporation and/or its affiliates. All other trademarks are the property of their
respective owners. Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book.
10 9 8 7 6 5 4 3 2 1
Dear Reader,
Thank you for choosing OCA: Oracle Database 11g Administrator Certified Associate
Study Guide (1ZO-051 and 1ZO-052). This book is part of a family of premium-quality
Sybex books, all of which are written by outstanding authors who combine practical
experience with a gift for teaching.
Sybex was founded in 1976. More than thirty years later, we’re still committed to producing consistently exceptional books. With each of our titles we’re working hard to set a
new standard for the industry. From the paper we print on, to the authors we work with,
our goal is to bring you the best books available.
I hope you see all that reflected in these pages. I’d be very interested to hear your comments and get your feedback on how we’re doing. Feel free to let me know what you think
about this or any other Sybex book by sending me an email at , or if you
think you’ve found a technical error in this book, please visit .
Customer feedback is critical to our efforts at Sybex.
Best regards,
Neil Edde
Vice President and Publisher
Sybex, an Imprint of Wiley
To the loving memory of my father
To Joshua and Jeanette
Acknowledgments
Thanks first to Jeff Kellum and to Sybex for their faith in me to write this book. I would also
like to thank the following wonderful people at Sybex for their support, patience with my
slipping schedules, and good work: Denise Santoro Lincoln (developmental editor) for her
valuable comments, thoughtful edits, patience, and making sure the chapters have a smooth
flow; Eric Charbonneau (production editor) for making sure the various pieces of the book tie
together; Candace English for proofreading; and Pete Gaughan for managing the project.
I thank Kim Wimpsett (copy editor) for her edits and making sure the same standard is
followed across the book. I’m sure her edits made a difference to the look and feel of the chapters. I also thank Sybex and authors of the Introduction to Oracle9i SQL and Oracle Database 10g Administration I study guides for letting me reuse content from their books.
I am very fortunate and honored to have Arup Nanda as the technical editor. Thank you
very much for all your valuable suggestions and for pointing out the errors and inaccuracies in
the book. Your comments are invaluable. Thank you, Bob Bryla, for tech-reviewing the book
and making sure the chapters are technically accurate.
I could not have completed this book without the endless support and love of my wife,
Shiji. Thank you for engaging and taking care of the kids while I spent nights and weekends in
front of the computer.
Last but not least, I thank all my colleagues and management at OneNeck IT Services for
their friendship and support. My special thanks to Joe Hanna for all the encouragement.
About the Author
Biju Thomas is an Oracle 7.3, Oracle8, Oracle8i, Oracle9i, Oracle 10g, and Oracle 11g OCP
certified professional. He is also a certified Oracle Database SQL Expert. Biju has been developing and administering Oracle databases since 1993, starting with Oracle version 6. He is
a senior database consultant at OneNeck IT Services Corporation (www.oneneck.com) and
resides in Keller, Texas. He maintains a website for DBAs at www.bijoos.com/oracle.
Contents at a Glance
Introduction
xxv
SQL Fundamentals I Assessment Test
xxxv
Administration I Assessment Test
li
Part I
Oracle Database 11g: SQL Fundamentals I
1
Chapter 1
Introducing SQL
3
Chapter 2
Using Single-Row Functions
Chapter 3
Using Group Functions
147
Chapter 4
Using Joins and Subqueries
197
Chapter 5
Manipulating Data
251
Chapter 6
Creating Tables and Constraints
287
Chapter 7
Creating Schema Objects
341
Part II
Oracle Database 11g: Administration I
Chapter 8
Introducing Oracle Database 11g Components
and Architecture
391
Chapter 9
Creating an Oracle 11g Database
449
Chapter 10
Allocating Database Storage and Creating Schema Objects 523
Chapter 11
Understanding Network Architecture
591
Chapter 12
Implementing Security and Auditing
661
Chapter 13
Managing Data and Undo
717
Chapter 14
Maintaining the Database and Managing Performance
765
Chapter 15
Implementing Database Backups
839
Chapter 16
Recovering the Database
889
Chapter 17
Moving Data and Using EM Tools
935
Appendix
About the Companion CD
63
389
1003
Glossary
1007
Index
1029
Contents
Introduction
xxv
SQL Fundamentals I Assessment Test
xxxv
Administration I Assessment Test
li
Part I
Oracle Database 11g: SQL Fundamentals I
1
Introducing SQL
3
Chapter
1
SQL Fundamentals
SQL Tools: SQL*Plus
Oracle Datatypes
Operators and Literals
Writing Simple Queries
Using the SELECT Statement
Limiting Rows
Sorting Rows
Using Expressions
Accepting Values at Runtime
Using Substitution Variables
Saving a Variable for a Session
Using Positional Notation for Variables
Summary
Exam Essentials
Review Questions
Answers to Review Questions
Chapter
2
4
6
15
20
23
24
28
38
43
47
47
49
50
51
52
53
61
Using Single-Row Functions
63
Single-Row Function Fundamentals
Functions for NULL Handling
Using Single-Row Character Functions
Character Function Overview
Character Function Descriptions
Using Single-Row Numeric Functions
Numeric Function Overview
Numeric Function Descriptions
Using Single-Row Date Functions
Date-Format Conversion
Date-Function Overview
Date-Function Descriptions
Using Single-Row Conversion Functions
Conversion-Function Overview
Conversion-Function Descriptions
64
65
68
68
70
80
80
82
90
91
91
92
101
102
103
xvi
Contents
Using Other Single-Row Functions
Miscellaneous-Function Overview
Miscellaneous-Function Descriptions
Summary
Exam Essentials
Review Questions
Answers to Review Questions
Chapter
3
4
Using Group Functions
147
Group-Function Fundamentals
Utilizing Aggregate Functions
Grouping Data with GROUP BY
Group-Function Overview
Group-Function Descriptions: Part 1
Group-Function Descriptions: Part 2
Limiting Grouped Data with HAVING
Creating Superaggregates with CUBE and ROLLUP
Nesting Functions
Summary
Exam Essentials
Review Questions
Answers to Review Questions
Chapter
123
123
124
136
137
138
144
148
149
150
154
156
163
176
177
184
187
187
188
195
Using Joins and Subqueries
197
Writing Multiple-Table Queries
Inner Joins
Cartesian Joins
Outer Joins
Other Multiple-Table Queries
Using Set Operators
The UNION Operator
The UNION ALL Operator
The INTERSECT Operator
The MINUS Operator
Putting It All Together
Subqueries
Single-Row Subqueries
Multiple-Row Subqueries
Subquery Returns No Rows
Correlated Subqueries
Scalar Subqueries
Multiple-Column Subqueries
Subqueries in Other DML Statements
Summary
Exam Essentials
198
199
208
210
214
216
217
218
219
219
219
221
222
223
226
227
228
235
236
238
238
Contents
xvii
Review Questions
Answers to Review Questions
Chapter
5
6
Manipulating Data
251
Using DML Statements
Inserting Rows into a Table
Updating Rows in a Table
Deleting Rows from a Table
Merging Rows
Understanding Transaction Control
Savepoints and Partial Rollbacks
Data Visibility
Summary
Exam Essentials
Review Questions
Answers to Review Questions
Chapter
240
249
252
253
259
263
265
267
269
271
274
274
276
285
Creating Tables and Constraints
Database Objects Overview
Schema Objects
Built-in Datatypes
Character Datatypes
Numeric Datatypes
Date and Time Datatypes
Date Arithmetic
Binary Datatypes
Row ID Datatypes
Creating Tables
Naming Tables and Columns
Specifying Default Values for Columns
Adding Comments
Creating a Table from Another Table
Modifying Tables
Adding Columns
Modifying Columns
Renaming Columns
Dropping Columns
Dropping Tables
Renaming Tables
Making Tables Read-Only
Managing Constraints
Creating Constraints
Dropping Constraints
Enabling and Disabling Constraints
Deferring Constraint Checks
287
288
289
290
291
294
295
299
301
302
303
303
306
308
308
310
310
313
314
314
316
316
317
319
319
324
325
327
xviii
Contents
Summary
Exam Essentials
Review Questions
Answers to Review Questions
Chapter
7
331
332
333
338
Chapter
341
Creating and Modifying Views
Using Defined Column Names
Creating Views with Errors
Creating Read-Only Views
Creating Constraints on Views
Modifying Views
Dropping a View
Using Views
Creating and Managing Sequences
Creating and Dropping Sequences
Using Sequences
Altering Sequences
Creating and Managing Synonyms
Creating and Dropping Synonyms
Resolving Object References
Creating and Managing Indexes
How Indexes Work
Using B-Tree Indexes
Using Bitmap Indexes
Dropping Indexes
Summary
Exam Essentials
Review Questions
Answers to Review Questions
Part II
Creating Schema Objects
342
344
345
346
347
347
349
350
360
360
361
365
366
367
369
371
371
372
373
373
378
379
380
386
Oracle Database 11g: Administration I
8
389
Introducing Oracle Database 11g
Components and Architecture
391
Oracle Database Fundamentals
Relational Databases
Oracle Database 11g Objects
Interacting with Oracle 11g
Oracle 11g Architecture
User Processes
The Oracle Instance
Oracle Storage Structures
392
393
394
395
398
400
402
415
Contents
xix
Installing Oracle 11g
Review the Documentation
Review the System Requirements
Plan Your Install
Using the Oracle Universal Installer
Summary
Exam Essentials
Review Questions
Answers to Review Questions
Chapter
9
424
424
424
425
430
440
441
442
446
Creating an Oracle 11g Database
449
Using DBCA to Create Oracle 11g Databases
Invoking the Database Configuration Assistant
Configuring an Oracle Database Using the DBCA
Deleting an Oracle Database Using the DBCA
Managing Database Templates Using the DBCA
Working with Oracle 11g Metadata
Data Dictionary Views
Dynamic Performance Views
Managing Initialization-Parameter Files
Locating the Default Parameter File
Modifying Initialization-Parameter Values
Starting Up and Shutting Down an Oracle Instance
Starting Up an Oracle 11g Database
Shutting Down an Oracle 11g Database
Monitoring the Database Alert Log
Summary
Exam Essentials
Review Questions
Answers to Review Questions
Chapter
10
450
451
481
482
483
485
485
487
488
493
493
498
498
503
506
514
515
516
520
Allocating Database Storage and Creating Schema
Objects
523
Tablespaces and Data Files Overview
Managing Tablespaces
Identifying Default Tablespaces
Creating and Maintaining Tablespaces
Obtaining Tablespace Information
Managing Data Files
Performing Operations on Data Files
Using the Oracle Managed Files Feature
Querying Data-File Information
524
526
526
527
541
546
546
550
555