102
Oracle9i DBA Fundamentals I

Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Embed Size (px)

Citation preview

Page 1: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Page 2: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

ii Oracle9i DBA Fundamentals I ©1997 - 2003 Technology Framers, LLC. All rights reserved. No part of this material may be reproduced without the express written permission from Technology Framers, LLC.

Page 3: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Oracle9i DBA Fundamentals I George Trujillo Published by ITCourseware, LLC, 7245 South Havana St., Suite 100, Centennial, CO 80112 Editor: Rick Sussenbach Assistant Editor: Jan Waleri Copyright © 2004 by Technology Framers, LLC. Portions Copyright © ITCourseware, LLC. All rights reserved. No part of this book may be reproduced or utilized in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage retrieval system, without permission in writing from the publisher. Inquiries should be addressed to ITCourseware, LLC, 7245 South Havana St., Suite 100, Centennial, CO 80112, (303) 302-5280. All brand names, product names, trademarks, and registered trademarks are the property of their respective owners.

Version 1.9.1

©1997 - 2003 Technology Framers, LLC. iii

All rights reserved. No part of this material may be reproduced without the express written permission from Technology Framers, LLC.

Page 4: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

iv Oracle9i DBA Fundamentals I ©1997 - 2003 Technology Framers, LLC. All rights reserved. No part of this material may be reproduced without the express written permission from Technology Framers, LLC.

Page 5: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students will design and create a server using the Optimal Flexible Architecture (OFA), configure logical and physical structures, set up database and user security, add and administer users, and monitor and tune main server areas. New Oracle9i features such as Oracle Managed Files, Automatic segment management, undo tablespaces, default temporary tablespaces, dynamic memory configuration and server parameter files will be covered.. Best practices and techniques are emphasized throughout the class. Each student will create a toolkit of administration scripts for database management and tuning by the end of this class. This class will also address issues for DBAs having to support Oracle8i and Oracle9i databases..

Prerequisites Students must have completed the five-day Oracle8i or Oracle9i introduction course or at least six months working in an Oracle technical environment. Students must walk into the class with a understanding of relational database concepts, SQL and PL/SQL programming skills and a solid understanding of Oracle schema objects (tables, views, sequences, synonyms, procedures, functions and packages).

Objectives

Upon completion of this course, students will understand: ♦ The Oracle9i Server architecture and how it works ♦ The benefits of the Optimal Flexible Architecture ♦ Debugging the server and solving problems using the Oracle Data Dictionary ♦ Dynamic memory configuration ♦ Automatic segment space management ♦ Management of logical and physical storage structures (tablespaces, data files and schema

objects) ♦ The main features of Oracle server and user security ♦ Different types of server configurations (JServer, Shared Server, RAC, replication, etc.) ♦ Oracle utilities (export, import, SQL*Plus and SQL*Loader) ♦ Function-based indexes, index-organized tables, and reverse indexes ♦ Rule-based optimization and new features of the cost-based optimizer ♦ Oracle managed files ♦ Main areas of an Oracle9i server to monitor and performance tune

Duration Five days

©1997 - 2003 Technology Framers, LLC. v

All rights reserved. No part of this material may be reproduced without the express written permission from Technology Framers, LLC.

Page 6: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

vi Oracle9i DBA Fundamentals I ©1997 - 2003 Technology Framers, LLC. All rights reserved. No part of this material may be reproduced without the express written permission from Technology Framers, LLC.

Page 7: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Understanding the Oracle9i Server Architecture 1-1

Chapter Overview ................................................................................................................1-1 Responsibilities of a DBA.....................................................................................................1-3 Changing DBA Environments.............................................................................................1-4 What is an Oracle Server?...................................................................................................1-6 Oracle Versioning.................................................................................................................1-7 Server Architectural Overview ...........................................................................................1-8 Operating System Environment..........................................................................................1-8 Operating System Environment..........................................................................................1-9 Important Subdirectories in ORACLE_HOME .............................................................1-10 Oracle Product Subdirectories ..........................................................................................1-11 Oracle Instance Components.............................................................................................1-12 Database Files .....................................................................................................................1-13 Control Files........................................................................................................................1-14 Redo Log Files ....................................................................................................................1-15 Redo Log Files (continued) ................................................................................................1-16 Logical Storage Structures ................................................................................................1-17 Oracle Block Sizes ..............................................................................................................1-18 Blocks, Extents, and Segments ..........................................................................................1-19 Different Types of Segments..............................................................................................1-20 Tablespaces .........................................................................................................................1-21 Logical Structural Design ..................................................................................................1-22 System Change Numbers ...................................................................................................1-23 Different Versions of Oracle..............................................................................................1-24 Oracle8.0 – The Object-Relational Release......................................................................1-25 Oracle Ceilings....................................................................................................................1-26 Additional Database Limits ...............................................................................................1-27 Oracle8i – The Internet Release ........................................................................................1-28 Oracle9i Release 1– The eBusiness Database...................................................................1-29 Oracle9i Release 2– The Object-Relational OLAP Database.........................................1-30 Oracle Products and Architectures...................................................................................1-31 DBA Management Pack.....................................................................................................1-32 Understanding your Oracle Server Layout .....................................................................1-33 Review Questions................................................................................................................1-34 Review Question Answers..................................................................................................1-35 Summary .............................................................................................................................1-36 Exercises ..............................................................................................................................1-37

©1997 - 2003 Technology Framers, LLC. vii

All rights reserved. No part of this material may be reproduced without the express written permission from Technology Framers, LLC.

Page 8: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Oracle Memory Structures and Processes 2-1

Chapter Overview................................................................................................................ 2-1 Oracle Instance Review ....................................................................................................... 2-3 Database Buffer Cache ........................................................................................................ 2-4 Database Buffer Cache ........................................................................................................ 2-5 The LRU and Dirty Lists..................................................................................................... 2-6 Server Processes and the Buffer Cache.............................................................................. 2-7 DBWR and the Buffer Cache.............................................................................................. 2-8 MTTR and Checkpoint intervals ....................................................................................... 2-9 Checkpoints ........................................................................................................................ 2-10 Determining When Checkpoints Occur........................................................................... 2-11 Methods for Controlling Check pointing......................................................................... 2-12 Methods for Controlling Check pointing (2) ................................................................... 2-13 V$INSTANCE_RECOVERY View.................................................................................. 2-14 Calculating Checkpointing................................................................................................ 2-15 MTTR Advisor ................................................................................................................... 2-16 Minimal I/O Recovery ....................................................................................................... 2-17 Defining Multiple DB Cache Buffer Pools ....................................................................... 2-18 Defining the Database Buffer Pools (Oracle8i style)....................................................... 2-19 Database Buffer Pool Parameters (Oracle8i style) ......................................................... 2-20 The Buffer Pool Parameter ............................................................................................... 2-21 Defining Storage for Buffer Pools .................................................................................... 2-22 Calculating the Hit Ratio for Buffer Pools ...................................................................... 2-23 Calculating Buffer Pool Sizes............................................................................................ 2-24 Latch Contention ............................................................................................................... 2-25 Caching Tables ................................................................................................................... 2-26 Calculating Cache Usage of Schema Objects .................................................................. 2-27 Redo Log Buffer Cache ..................................................................................................... 2-28 Shared Pool Area ............................................................................................................... 2-29 Large Pool Area ................................................................................................................. 2-30 Large Pool Parameters ...................................................................................................... 2-31 Java Pool Size ..................................................................................................................... 2-32 The Oracle JVM................................................................................................................. 2-33 Impacting Server Process Memory .................................................................................. 2-34 Background Processes ....................................................................................................... 2-35 Required Background Processes ...................................................................................... 2-36 Additional Background Processes .................................................................................... 2-37 Listing Processes ................................................................................................................ 2-38 Review Questions ............................................................................................................... 2-39 Summary............................................................................................................................. 2-40 Exercises ............................................................................................................................. 2-41

viii Oracle9i DBA Fundamentals I ©1997 - 2003 Technology Framers, LLC. All rights reserved. No part of this material may be reproduced without the express written permission from Technology Framers, LLC.

Page 9: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I Server Processes and Executing SQL 3-1

Chapter Overview ................................................................................................................3-1 Server Processes ...................................................................................................................3-3 Program Global Areas .........................................................................................................3-4 User Global Area ..................................................................................................................3-5 Dedicated Server Architecture ............................................................................................3-6 Shared Server Architecture.................................................................................................3-7 The Shared Server Architecture .........................................................................................3-8 Deprecated Parameters........................................................................................................3-9 Shared Server Parameters.................................................................................................3-10 The Parse Phase..................................................................................................................3-11 Execution Plan Phase .........................................................................................................3-12 Execution and Fetch Phase................................................................................................3-13 Processing DML Statements..............................................................................................3-14 Rule-based and Cost-based Optimizers............................................................................3-15 Tuning Parallel Query .......................................................................................................3-16 Tuning Parallel Query .......................................................................................................3-17 Parallel DML ......................................................................................................................3-18 Parallel DML Restrictions .................................................................................................3-19 Summary .............................................................................................................................3-20 Exercises ..............................................................................................................................3-21

Using the Data Dictionary 4-1

Chapter Overview ................................................................................................................4-1 What is the Oracle Data Dictionary?..................................................................................4-3 Base Tables and Static Views in the Data Dictionary .......................................................4-4 Dynamic Views in the Data Dictionary ..............................................................................4-5 ALL_% Static Views............................................................................................................4-6 DBA_% Static Views...........................................................................................................4-9 USER_% Static Views ......................................................................................................4-13 USER_% Static Views ......................................................................................................4-13 Additional Views.................................................................................................................4-16 V$ Dynamic Views..............................................................................................................4-17 GV$ Dynamic Views ..........................................................................................................4-21 GV$ Dynamic Views ..........................................................................................................4-22 Useful Database Data Dictionary Views...........................................................................4-23 Looking at Data Dictionary Views....................................................................................4-24 Review Questions................................................................................................................4-25 Review Question Answers..................................................................................................4-26 Summary .............................................................................................................................4-27 Exercises ..............................................................................................................................4-28

©1997 - 2003 Technology Framers, LLC. ix

All rights reserved. No part of this material may be reproduced without the express written permission from Technology Framers, LLC.

Page 10: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Starting and Shutting Down an Oracle Server 5-1

Chapter Overview................................................................................................................ 5-1 Database Utilities ................................................................................................................. 5-3 The Server Manager Tool (Obsolete in Oracle9i)............................................................. 5-4 SQL*Plus Features .............................................................................................................. 5-5 SQL*Plus Commands.......................................................................................................... 5-6 Additional Commands......................................................................................................... 5-7 The Parameter File .............................................................................................................. 5-8 Oracle Universal Installer ................................................................................................... 5-9 Oracle Universal Installer ................................................................................................. 5-10 The Database Configuration Assistant ............................................................................ 5-11 Setting up a Parameter File .............................................................................................. 5-12 Important Parameters for Database Creation ................................................................ 5-13 Starting an Oracle Server ................................................................................................. 5-14 The STARTUP command ................................................................................................. 5-15 Startup and Shutdown Privileges ..................................................................................... 5-16 Shutdown Steps .................................................................................................................. 5-17 SHUTDOWN Command Options .................................................................................... 5-18 ALTER DATABASE Command ...................................................................................... 5-19 ALTER DATABASE Examples ....................................................................................... 5-20 Alert and Trace Files ......................................................................................................... 5-21 Working with Data Dictionary Views .............................................................................. 5-22 Dynamic versus Static Parameters................................................................................... 5-23 Which Parameters are Dynamic versus Static Parameters ........................................... 5-24 Dynamic versus Static Parameters................................................................................... 5-25 Review Questions ............................................................................................................... 5-26 Review Question Answers ................................................................................................. 5-27 Summary............................................................................................................................. 5-28 Exercises ............................................................................................................................. 5-29

Server Parameter File 6-1

Chapter Overview................................................................................................................ 6-1 Definition of the Server Parameter File (SPFILE) ........................................................... 6-1 Definition of the Server Parameter File (SPFILE) ........................................................... 6-3 Operation of the SPFILE .................................................................................................... 6-4 Operation of the SPFILE (2)............................................................................................... 6-5 Steps for Creating an SPFILE ............................................................................................ 6-6 Creating an SPFILE ............................................................................................................ 6-7 Changing Parameters in the SPFILE................................................................................. 6-8 Changing Parameters in the SPFILE (2)........................................................................... 6-9 Changing Parameters in the SPFILE - Examples........................................................... 6-10 Backing up the SPFILE..................................................................................................... 6-11 Gathering Information About Parameters...................................................................... 6-12 SPFILE FAQs..................................................................................................................... 6-13 Summary............................................................................................................................. 6-14

x Oracle9i DBA Fundamentals I ©1997 - 2003 Technology Framers, LLC. All rights reserved. No part of this material may be reproduced without the express written permission from Technology Framers, LLC.

Page 11: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Summary(2) ........................................................................................................................6-15 Review Questions................................................................................................................6-16 Exercises ..............................................................................................................................6-19

Dynamic Memory Management 7-1

Chapter Overview ................................................................................................................7-1 Setting up SQL Work Areas................................................................................................7-1 Setting up SQL Work Areas................................................................................................7-3 Defining Automatic PGA Memory Management ..............................................................7-4 SQL Work Areas versus the PGA Aggregate Target........................................................7-5 Setting the PGA Target Memory Size ................................................................................7-6 Displaying Workarea Information .....................................................................................7-7 Using a PGA Workarea .......................................................................................................7-8 Dynamic SGA .......................................................................................................................7-9 Granules ..............................................................................................................................7-10 Granules (continued)..........................................................................................................7-11 Changing the Database Buffer Cache...............................................................................7-12 Changing the Database Buffer Cache...............................................................................7-13 V$BUFFER_POOL............................................................................................................7-14 Changing the Shared Pool Size .........................................................................................7-15 Database Buffer Cache Parameters..................................................................................7-16 Multiple Database Buffer Caches .....................................................................................7-17 Deprecated Parameters......................................................................................................7-18 Advisory Parameter ...........................................................................................................7-19 V$DB_CACHE_ADVICE .................................................................................................7-20 Summary .............................................................................................................................7-21 Exercises ..............................................................................................................................7-22

Managing Tablespaces and Data Files 8-1

Chapter Overview ................................................................................................................8-1 Review Logical and Physical Structure Relationships......................................................8-3 Tablespaces ...........................................................................................................................8-4 Different Types of Tablespaces ...........................................................................................8-5 The SYSTEM Tablespace....................................................................................................8-6 CREATE TABLESPACE Command.................................................................................8-7 CREATE TABLESPACE Clauses......................................................................................8-8 Locally-Managed Tablespaces ............................................................................................8-9 Locally Managed Tablespace Options..............................................................................8-10 Advantages of Locally Managed Tablespaces .................................................................8-11 ALTER TABLESPACE syntax: .......................................................................................8-12 Temporary Tablespaces.....................................................................................................8-13 CREATE TEMPORARY TABLESPACE Command....................................................8-14 Temporary Segments .........................................................................................................8-15 Tablespaces and Temporary Segments ............................................................................8-16

©1997 - 2003 Technology Framers, LLC. xi

All rights reserved. No part of this material may be reproduced without the express written permission from Technology Framers, LLC.

Page 12: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Database Default Temporary Tablespace........................................................................ 8-17 Creating a Default Temporary Tablespace ..................................................................... 8-18 More on Temporary Tablespaces..................................................................................... 8-19 Read-only Tablespaces ...................................................................................................... 8-20 Viewing Active Transactions ............................................................................................ 8-21 Coalescing Dictionary Managed Tablespaces ................................................................. 8-22 Using the ALTER TABLESPACE command ................................................................. 8-23 Taking Tablespaces ONLINE and OFFLINE................................................................. 8-24 Tablespace Offline Options............................................................................................... 8-25 Renaming a Data File ........................................................................................................ 8-26 Adding More Space to a Database ................................................................................... 8-27 Autoextending a Data File................................................................................................. 8-28 DROP TABLESPACE Command.................................................................................... 8-29 DROP TABLESPACE Command (continued) ............................................................... 8-30 Dictionary-Managed Tablespaces .................................................................................... 8-31 Creating Dictionary-Managed Tablespaces .................................................................... 8-32 Dictionary-Managed Temporary Tablespaces ................................................................ 8-33 Dictionary versus Locally Managed Tablespaces ........................................................... 8-34 Converting Dictionary and Local Tablespaces ............................................................... 8-35 Migrating the Tablespace Management Type................................................................. 8-36 Data Dictionary Views....................................................................................................... 8-37 Review Questions ............................................................................................................... 8-38 Summary............................................................................................................................. 8-39 Exercises ............................................................................................................................. 8-40

Managing Rollback Segments 9-1

Chapter Overview................................................................................................................ 9-1 Managing Before-Image Data............................................................................................. 9-3 Rollback Segments ............................................................................................................... 9-4 Private versus Public Rollback Segments.......................................................................... 9-5 Typical Layout for Rollback Segments.............................................................................. 9-6 Second Rollback Segment in SYSTEM.............................................................................. 9-7 Space Usage .......................................................................................................................... 9-8 Sizing Rollback Segments.................................................................................................... 9-9 The OPTIMAL Parameter................................................................................................ 9-10 CREATE ROLLBACK SEGMENT Command ............................................................. 9-11 ALTER/DROP ROLLBACK SEGMENT Commands .................................................. 9-12 Using the SET TRANSACTION Command.................................................................... 9-13 Data Dictionary Views for Rollback Segments ............................................................... 9-14 More on Rollback Segments ............................................................................................. 9-15 Recommendations for Rollback Segments ...................................................................... 9-16 Data Dictionary Views for Rollback Segments ............................................................... 9-17 Review Questions ............................................................................................................... 9-18 Summary............................................................................................................................. 9-19 Exercise ............................................................................................................................... 9-20

xii Oracle9i DBA Fundamentals I ©1997 - 2003 Technology Framers, LLC. All rights reserved. No part of this material may be reproduced without the express written permission from Technology Framers, LLC.

Page 13: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I Tablespace Management 10-1

Chapter Overview ..............................................................................................................10-1 Automatic Undo Management ..........................................................................................10-1 Automatic Undo Management ..........................................................................................10-3 Creating an Undo Tablespace ...........................................................................................10-4 Automatic Mode for Managing Undo Space....................................................................10-5 Automatic Undo Initialization Parameters ......................................................................10-6 The UNDO_RETENTION Parameter..............................................................................10-7 Creating an Undo Tablespace ...........................................................................................10-8 Defining an Undo Tablespace When Creating a Database.............................................10-9 Determining the Size of the Undo Tablespace Data File...............................................10-10 Determining the Size of the Undo Tablespace Data File (2) .........................................10-11 Dropping an Undo Tablespace........................................................................................10-12 Switching Undo Tablespaces ...........................................................................................10-13 Data Dictionary Views for Undo Information ...............................................................10-14 Undo versus Rollback Segments .....................................................................................10-15 Multiple Block Size Support............................................................................................10-16 Multiple Block Size Support (2) ......................................................................................10-17 Setting up Multiple Block Sizes.......................................................................................10-18 Setting up Multiple Block Sizes (2) .................................................................................10-19 Information About Block Sizes .......................................................................................10-20 Summary ...........................................................................................................................10-21 Review Questions..............................................................................................................10-23 Exercises ............................................................................................................................10-26

Segment Management 11-1

Chapter Overview ..............................................................................................................11-1 High Throughput Systems.................................................................................................11-1 High Throughput Systems.................................................................................................11-3 Automatic Segment-Space Management..........................................................................11-4 Creating Tablespaces Using Automatic Segment-Space Management .........................11-5 Space Management.............................................................................................................11-6 Creating Objects in Automatic Segment-Space Managed Tablespaces ........................11-7 Creating Objects in Automatic Segment-Space Managed Tablespaces (2)...................11-8 Space Deallocation With Automatic Segment-Space Management...............................11-9 The DBMS_SPACE Package...........................................................................................11-10 The SPACE_USAGE Parameters...................................................................................11-11 Example using SPACE_USAGE.....................................................................................11-12 Space Deallocation Statements........................................................................................11-13 Viewing Space Usage Information ..................................................................................11-14 Summary ...........................................................................................................................11-15 Review Questions..............................................................................................................11-19 Exercises ............................................................................................................................11-22

©1997 - 2003 Technology Framers, LLC. xiii

All rights reserved. No part of this material may be reproduced without the express written permission from Technology Framers, LLC.

Page 14: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Managing Tables 12-1

Chapter Overview.............................................................................................................. 12-1 Creating Tables .................................................................................................................. 12-3 Creating Table Syntax....................................................................................................... 12-4 Create the SALE_TAB Table ........................................................................................... 12-5 ROWIDs ............................................................................................................................. 12-6 Creating Segments in Tablespaces ................................................................................... 12-7 Column Datatypes.............................................................................................................. 12-8 Column Datatypes.............................................................................................................. 12-9 Column Datatypes............................................................................................................ 12-10 Different Types of Tables ................................................................................................ 12-11 Global Temporary Tables ............................................................................................... 12-12 Clustered Tables............................................................................................................... 12-13 Database Block................................................................................................................. 12-14 Block Utilization Parameters .......................................................................................... 12-15 Row Migration and Chaining ......................................................................................... 12-16 Storage Clause Options ................................................................................................... 12-17 Storage Clause Parameters ............................................................................................. 12-18 Storage Clause Examples ................................................................................................ 12-19 Managing Extent Growth................................................................................................ 12-20 Moving Tables .................................................................................................................. 12-21 Removing Data From Tables .......................................................................................... 12-22 Renaming Tables.............................................................................................................. 12-23 Modifying Column Definitions ....................................................................................... 12-24 Defining Columns to be Unused ..................................................................................... 12-25 Dropping Columns........................................................................................................... 12-26 Segment High Water Mark and Segment Header ........................................................ 12-27 Calculate the HWM of a Segment .................................................................................. 12-28 More ALTER TABLE Examples ................................................................................... 12-29 Online Table Redefinitions.............................................................................................. 12-30 DBMS_REDEFINITION Package ................................................................................. 12-31 Redefining a Table ........................................................................................................... 12-32 Validate Structure Online ............................................................................................... 12-33 The TRUNCATE Command........................................................................................... 12-34 Data Dictionary Views for Tables................................................................................... 12-35 Listing of Columns for Main Views................................................................................ 12-36 Review Questions ............................................................................................................. 12-37 Summary........................................................................................................................... 12-38 Exercises ........................................................................................................................... 12-39

xiv Oracle9i DBA Fundamentals I ©1997 - 2003 Technology Framers, LLC. All rights reserved. No part of this material may be reproduced without the express written permission from Technology Framers, LLC.

Page 15: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Managing Indexes 13-1

Chapter Overview ..............................................................................................................13-1 Index Types .........................................................................................................................13-3 B*-tree Indexes ...................................................................................................................13-4 Creating B*-Tree Indexes..................................................................................................13-5 Index Attributes..................................................................................................................13-6 Maintaining Indexes...........................................................................................................13-7 Maintaining Indexes (continued) ......................................................................................13-8 Keep B*Tree Indexes Balanced.........................................................................................13-9 Keep B*Tree Indexes Balanced.......................................................................................13-10 Composite Indexes............................................................................................................13-11 Creating a Composite Index ............................................................................................13-12 Skip Scans .........................................................................................................................13-13 Reverse Key Indexes.........................................................................................................13-14 Reverse Key Indexes (continued) ....................................................................................13-15 Bitmap Indexes .................................................................................................................13-16 Bitmap Indexes .................................................................................................................13-17 Cluster (B*Tree) Indexes .................................................................................................13-18 Cluster (B*Tree) Indexes (continued).............................................................................13-19 Index Organized Tables ...................................................................................................13-20 Index Organized Tables (continued) ..............................................................................13-21 Function-Based Indexes ...................................................................................................13-22 Function-based Indexes (continued) ...............................................................................13-23 Domain Indexes ................................................................................................................13-24 Domain Index Overview ..................................................................................................13-25 Index Options....................................................................................................................13-26 Index Options (continued) ...............................................................................................13-27 Index Maintenance ...........................................................................................................13-28 Analyzing the Index..........................................................................................................13-29 Rebuilding the Index ........................................................................................................13-30 Rebuilding the Index (2) ..................................................................................................13-31 Online Index Rebuilds......................................................................................................13-32 Index Organized Table High Availability Features ......................................................13-33 Examples of IOT Online Operations ..............................................................................13-34 Coalescing the Index ........................................................................................................13-35 Bitmap Join Indexes.........................................................................................................13-36 Multiple Bitmap Join Indexes – How They Work.........................................................13-37 Bitmap Join Indexes – An Example................................................................................13-38 Bitmap Join Indexes – Restrictions.................................................................................13-39 Indexes on Primary Keys.................................................................................................13-41 Export and Import of Indexes .........................................................................................13-42 SQL*Loader and Indexes ................................................................................................13-43 Review Questions..............................................................................................................13-44 Summary ...........................................................................................................................13-45 Exercises ............................................................................................................................13-46

©1997 - 2003 Technology Framers, LLC. xv

All rights reserved. No part of this material may be reproduced without the express written permission from Technology Framers, LLC.

Page 16: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Managing Constraints 14-1

Chapter Overview.............................................................................................................. 14-1 Data Integrity ..................................................................................................................... 14-3 Different Types of Constraints.......................................................................................... 14-4 Inline Constraints............................................................................................................... 14-5 Out-of-Line Constraints .................................................................................................... 14-6 Constraint Names............................................................................................................... 14-7 Primary Key Constraints .................................................................................................. 14-8 Foreign Key Constraints ................................................................................................... 14-9 Foreign Key Constraints (Examples) ............................................................................. 14-10 Foreign Key Constraints (continued)............................................................................. 14-11 Unique Constraints .......................................................................................................... 14-12 Not Null Constraints ........................................................................................................ 14-13 Check Constraints............................................................................................................ 14-14 Viewing Constraint Information .................................................................................... 14-15 Constraints can be Deferred ........................................................................................... 14-16 Enabling and Disabling Constraints .............................................................................. 14-17 Creating a Deferred Constraint...................................................................................... 14-18 Setting Deferred Constraints .......................................................................................... 14-19 Setting the RELY Flag..................................................................................................... 14-20 Additional Constraint Features ...................................................................................... 14-21 Explicit Index Definition ................................................................................................. 14-22 More on the USING INDEX Statement ......................................................................... 14-23 USING INDEX Syntax .................................................................................................... 14-24 USING INDEX Example................................................................................................. 14-25 Dropping or Disabling Constraints and Indexes........................................................... 14-26 Reducing Locking on Foreign Key Tables..................................................................... 14-27 Caching Primary Key Values ......................................................................................... 14-28 Review Questions ............................................................................................................. 14-29 Summary........................................................................................................................... 14-30 Exercises ........................................................................................................................... 14-31

Administration of Control Files 15-1

Chapter Overview.............................................................................................................. 15-1 Control File Contents ........................................................................................................ 15-3 Working with Control Files .............................................................................................. 15-4 Multiplexing Control Files ................................................................................................ 15-5 The CREATE CONTROLFILE Command.................................................................... 15-6 Log Sequence Numbers ..................................................................................................... 15-7 Reviewing Checkpoints ..................................................................................................... 15-8 Reviewing Checkpoint Events .......................................................................................... 15-9 Instance Recovery ............................................................................................................ 15-10 Managing Checkpointing ................................................................................................ 15-11 Multiple DBWR IO Processes......................................................................................... 15-12 DB_BLOCK_CHECKING ............................................................................................. 15-13

xvi Oracle9i DBA Fundamentals I ©1997 - 2003 Technology Framers, LLC. All rights reserved. No part of this material may be reproduced without the express written permission from Technology Framers, LLC.

Page 17: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

DB_BLOCK_CHECKSUM.............................................................................................15-14 FAST_START_PARALLEL_ROLLBACK ..................................................................15-15 Summary ...........................................................................................................................15-16 Exercises ............................................................................................................................15-17

Administration of Redo Log Files 16-1

Chapter Overview ..............................................................................................................16-1 Review of Redo Log Files...................................................................................................16-3 Writing to Redo Log Files..................................................................................................16-4 Adding and Clearing Online Redo Log Files ...................................................................16-5 Dropping Online Redo Log Files.......................................................................................16-6 Renaming Online Redo Log Files .....................................................................................16-7 Archivelog Mode.................................................................................................................16-8 Setting up Archiving ..........................................................................................................16-9 Mandatory or Optional Destinations..............................................................................16-10 Managing Archive Destinations ......................................................................................16-11 Changing the ArchiveLog Mode .....................................................................................16-12 Dynamic Archive Parameters .........................................................................................16-13 ARCHIVE LOG LIST Command ..................................................................................16-14 Data Dictionary Views for Redo Log Files.....................................................................16-15 Review Questions..............................................................................................................16-16 Summary ...........................................................................................................................16-17 Exercises ............................................................................................................................16-18

Oracle Managed Files 17-1

Chapter Overview ..............................................................................................................17-1 Why Use Oracle Managed Files? ......................................................................................17-1 Why Use Oracle Managed Files? ......................................................................................17-3 The Mechanism of OMF....................................................................................................17-4 OMF Data Files ..................................................................................................................17-5 OMF Naming Conventions................................................................................................17-6 O9iR2 OMF Naming Conventions....................................................................................17-7 DB_CREATE_FILE_DEST ..............................................................................................17-8 DB_CREATE_ONLINE_LOG_DEST_n.........................................................................17-9 Using OMF in Database Creation...................................................................................17-10 Using OMF in Database Creation (2) .............................................................................17-11 Using OMF in Database Creation (3) .............................................................................17-12 OMF and Online Redo Log Files ....................................................................................17-13 OMF and Online Redo Log Files (2)...............................................................................17-14 OMF, Data Files, and Tablespaces .................................................................................17-15 OMF, Data Files, and Tablespaces (2)............................................................................17-16 Renaming OMF Data Files ..............................................................................................17-17 More on Renaming OMF Data Files ..............................................................................17-18 OMF and Control Files ....................................................................................................17-19

©1997 - 2003 Technology Framers, LLC. xvii

All rights reserved. No part of this material may be reproduced without the express written permission from Technology Framers, LLC.

Page 18: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

OMF and Control Files (2).............................................................................................. 17-20 OMF and Control Files (3).............................................................................................. 17-21 OMF and Control Files (4).............................................................................................. 17-22 Summary........................................................................................................................... 17-23 Review Questions ............................................................................................................. 17-24 Review Questions (2)........................................................................................................ 17-25 Exercises ........................................................................................................................... 17-26

Managing Users and Profiles 18-1

Chapter Overview.............................................................................................................. 18-1 Creating Users.................................................................................................................... 18-3 CREATE USER Command .............................................................................................. 18-4 Assigning Quotas to Users................................................................................................. 18-5 CREATE USER Examples................................................................................................ 18-6 ALTER USER Command ................................................................................................. 18-7 ALTER USER Examples .................................................................................................. 18-8 Protecting the System Tablespace .................................................................................... 18-9 Creating Profiles .............................................................................................................. 18-10 CREATE PROFILE Example ........................................................................................ 18-11 Database Resource Limits ............................................................................................... 18-12 Security Guidelines. ......................................................................................................... 18-13 Review Questions ............................................................................................................. 18-14 Summary........................................................................................................................... 18-15 Exercises ........................................................................................................................... 18-16

Security Administration 19-1

Chapter Overview.............................................................................................................. 19-1 System Privileges................................................................................................................ 19-3 System Privileges................................................................................................................ 19-4 Roles .................................................................................................................................... 19-7 Granting Privileges ............................................................................................................ 19-8 Viewing System Privileges................................................................................................. 19-9 Granting Object Privileges.............................................................................................. 19-10 Privileges and the User Group PUBLIC........................................................................ 19-11 Revoking System Privileges and Roles........................................................................... 19-12 Object Privileges .............................................................................................................. 19-13 Database Authentication ................................................................................................. 19-14 Predefined Roles............................................................................................................... 19-15 Setting up a Role .............................................................................................................. 19-16 Parent versus Child Roles ............................................................................................... 19-17 Working with Default Roles............................................................................................ 19-18 Secure Application Role .................................................................................................. 19-19 Secure Application Role Example .................................................................................. 19-20 Enabling and Disabling Roles ......................................................................................... 19-21

xviii Oracle9i DBA Fundamentals I ©1997 - 2003 Technology Framers, LLC. All rights reserved. No part of this material may be reproduced without the express written permission from Technology Framers, LLC.

Page 19: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Guidelines and Standards for Roles ...............................................................................19-22 Additional Security Features...........................................................................................19-23 Review Questions..............................................................................................................19-24 Summary ...........................................................................................................................19-25 Exercises ............................................................................................................................19-26

Additional Security Features 20-1

Chapter Overview ..............................................................................................................20-1 Enhanced Security..............................................................................................................20-3 Password Management ......................................................................................................20-4 Password Management Features ......................................................................................20-5 Password Management Features ......................................................................................20-5 Password Resource Limits.................................................................................................20-6 Password Complexity.........................................................................................................20-7 Setting up Password Management....................................................................................20-8 Defining a Profile with Password Limits..........................................................................20-9 Defining a Profile for a User............................................................................................20-10 Information about Password Management....................................................................20-11 Data Encryption ...............................................................................................................20-12 Encryption: Random Key Generation............................................................................20-13 Summary ...........................................................................................................................20-14 Exercises ............................................................................................................................20-15

Oracle Utilities and Managing Data 21-1

Chapter Overview ..............................................................................................................21-1 Oracle Utilities ....................................................................................................................21-3 The Export Utility ..............................................................................................................21-4 Export Modes......................................................................................................................21-5 Export Parameters .............................................................................................................21-6 Export Parameters (continued).........................................................................................21-7 Export Parameters (continued).........................................................................................21-8 Export Examples ................................................................................................................21-9 Import Utility....................................................................................................................21-10 Executing the Import Utility............................................................................................21-11 Import Parameters ...........................................................................................................21-12 Import Parameters ...........................................................................................................21-13 More on the Import Utility ..............................................................................................21-14 Rebuilding a Database .....................................................................................................21-15 Logical Backups................................................................................................................21-16 Using Multiple Export Dump Files .................................................................................21-17 Using a Query Filter on Export.......................................................................................21-18 Exporting Outlines ...........................................................................................................21-19 Transportable Tablespaces..............................................................................................21-20 Steps to Transport a Tablespace .....................................................................................21-21

©1997 - 2003 Technology Framers, LLC. xix

All rights reserved. No part of this material may be reproduced without the express written permission from Technology Framers, LLC.

Page 20: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Self Containing Tablespaces ........................................................................................... 21-22 New 9i Features in Oracle Utilities ................................................................................. 21-23 Exporting Statistics.......................................................................................................... 21-24 Importing Statistics.......................................................................................................... 21-25 New Parameters for Export and Import........................................................................ 21-26 Tablespace Level Exports................................................................................................ 21-27 Direct-Load Inserts .......................................................................................................... 21-28 SQL*Loader ..................................................................................................................... 21-29 SQL*Loader Files ............................................................................................................ 21-30 Conventional versus Direct Path Loads......................................................................... 21-31 SQL*Loader Parameters ................................................................................................ 21-32 The Control File ............................................................................................................... 21-33 Things to consider ............................................................................................................ 21-34 DBVERIFY....................................................................................................................... 21-35 Loadjava and Dropjava................................................................................................... 21-36 Review Questions ............................................................................................................. 21-37 Summary........................................................................................................................... 21-38 Exercises ........................................................................................................................... 21-39

Creating an Oracle Instance and Database 22-1

Chapter Overview.............................................................................................................. 22-1 Preparation for Creating a Database ............................................................................... 22-3 Requirements for a Minimal Database ............................................................................ 22-4 Methods for Creating an Oracle Database ...................................................................... 22-5 Steps for Creating a Database .......................................................................................... 22-6 Steps for Creating a Database .......................................................................................... 22-6 Steps for Creating a Database (continued) ...................................................................... 22-7 Setup for UNIX .................................................................................................................. 22-8 Setup for NT ....................................................................................................................... 22-9 Setup for NT (continued)................................................................................................. 22-10 Setup for NT (continued)................................................................................................. 22-11 Removing Oracle Servers and Software ........................................................................ 22-12 Removing Oracle Servers and Software (continued).................................................... 22-13 Things to Consider When Creating a Database............................................................ 22-14 Optimal Flexible Architecture ........................................................................................ 22-15 Follow OFA Guidelines ................................................................................................... 22-16 Optimal Flexible Architecture Requirements ............................................................... 22-17 Optimal Flexible Architecture Rules.............................................................................. 22-18 Example OFA Layout...................................................................................................... 22-19 OFA Directory Layouts................................................................................................... 22-20 OFA Database Layouts.................................................................................................... 22-21 File Naming Conventions ................................................................................................ 22-22 The CREATE DATABASE Command.......................................................................... 22-23 CREATE DATABASE Example (Unix) ........................................................................ 22-24 CREATE DATABASE Example (Windows)................................................................. 22-25 Creating a Oracle9i Database Script.............................................................................. 22-26

xx Oracle9i DBA Fundamentals I ©1997 - 2003 Technology Framers, LLC. All rights reserved. No part of this material may be reproduced without the express written permission from Technology Framers, LLC.

Page 21: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

What is Created? ..............................................................................................................22-27 Preinstalled Users .............................................................................................................22-28 Preinstalled Roles .............................................................................................................22-29 After Database Creation ..................................................................................................22-30 Scripts run at Database Creation Time..........................................................................22-31 Additional Scripts run at Database Creation Time.......................................................22-32 Managing PL/SQL Packages...........................................................................................22-33 Troubleshooting Database Creation ...............................................................................22-34 Review Questions..............................................................................................................22-35 Summary ...........................................................................................................................22-36 Exercises ............................................................................................................................22-37

©1997 - 2003 Technology Framers, LLC. xxi

All rights reserved. No part of this material may be reproduced without the express written permission from Technology Framers, LLC.

Page 22: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

xxii Oracle9i DBA Fundamentals I ©1997 - 2003 Technology Framers, LLC. All rights reserved. No part of this material may be reproduced without the express written permission from Technology Framers, LLC.

Page 23: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Understanding the Oracle9i Server Architecture

Chapter Overview

To manage, optimize, and troubleshoot an Oracle9i server environment, database administrators must have a solid understanding of the Oracle architecture. This chapter will introduce the major components that make up an Oracle system. The major components are covered in detail in following chapters.

This chapter objective is to introduce students to the Oracle world. This chapter will not cover topics in depth. Students should sit back and just get a feel for the world of an Oracle database. Details will be covered in more depth in following chapters.

At the end of this chapter, students will understand:

Main components of the Oracle9i Server architecture

Server concepts and terminology

The difference between an Oracle instance and database

Logical and Physical storage structures

The benefits of different Oracle architectures

The benefits of the Optimal Flexible Architecture

© 2004 ITCourseware, LLC Understanding the Oracle9i Server Architecture 1-1

Page 24: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

1-2 Oracle9i DBA Fundamentals I © 2004 ITCourseware, LLC

Page 25: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Understanding the Oracle9i Server Architecture

Responsibilities of a DBA

Depending on the environment, an Oracle database administrator (DBA) may be responsible for:

Designing the logical and physical structures. Creating the instance and database for an Oracle Server. Managing users and security. Managing storage and growth. Performance tuning the Oracle Server. Backup and recovery. Network administration. Disaster recovery planning. Capacity planning and benchmarking. Supporting applications (performance tuning SQL statements and

applications). Everything that can be addressed in your job description under “other

duties as will be assigned.”

Notes

A DBA may have different responsibilities depending upon the company, type of database, and the position. Most DBAs are responsible for several of the tasks listed above. A number of trends are impacting DBAs:

• Databases are growing significantly in size, complexity, and utilization. 700 GB databases and larger with full time Internet activity are now common.

• DBAs have to manage a much larger number of users as Internet databases become more popular (thousands - millions of users), including large activity spikes.

• Databases have to run in a full time environment, support more users worldwide and in different time zones.

• It is becoming common to have data stored in non-traditional relational datatypes (pictures, maps, digital signatures, legal documents, chemical structures, etc.)

© 2004 ITCourseware, LLC Understanding the Oracle9i Server Architecture 1-3

Page 26: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Changing DBA Environments

Environments that DBAs work in are also changing significantly.

• Large corporations are looking at using smaller production DBA teams to manage critical areas such as tuning, storage and backup/recovery. The projects are using more application DBAs to support users, security, application development, etc.

• More development teams are working with application DBAs versus the traditional production DBA teams used years ago.

• In the past organizations had a tendency to throw hardware at performance problems. Organizations are now trying to do more with less and are requiring DBAs to be more resourceful in addressing tuning issues.

Large companies are trying to leverage junior DBAs and minimize the costs of senior DBAs.

• More 3rd party software is being used to help junior level DBAs manage Oracle systems. Software companies such as CA, Quest, BMC, etc. offer enterprise management and development suites for Oracle.

• Beginning in Oracle9iR2, the Oracle Enterprise Manager (OEM) is becoming a strong tool for Oracle database management. Previous releases of OEM were not robust enough.

Older versions of Oracle used client/server solutions. Today more and more companies are looking at n-tier solutions with application servers. Client server is dying it just does not know it.

More Oracle development shops are using Java and XML versus the traditional environments of PL/SQL, C, PowerBuilder, Forte, Oracle Forms, etc.

1-4 Oracle9i DBA Fundamentals I © 2004 ITCourseware, LLC

Page 27: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Understanding the Oracle9i Server Architecture

Managing Different Types of Databases

Today's DBAs are often responsible for managing multiple databases. These databases can fall into different types and categories.

A Data Warehouse is a type of Decision Support System (DSS). These systems:

Typically load large volumes of data and then perform complex queries. Very few if any DML transactions are executed.

Are denormalized for performance.

Data accuracy and response time of large reports are primary issues. Large sorts are usually performed on the data.

A data mart is a subset of a data warehouse. The data in a data mart is usually divided based upon business unit, geographical area, product line, etc.

Online Analytical Processing (OLAP) is a multidimensional database that is used to perform complex analysis of the data.

An Online Transaction Processing (OLTP) is more of a transaction-based system. These systems:

Typically perform numerous small DML transactions with concurrent users.

Data availability, concurrency, speed and recovery are primary issues.

Hybrid systems are some combination of DSS and OLTP systems. Production systems are live systems being accessed by users. Ideally no

development is occurring on these systems. The production database can be a different version of Oracle than the test and

development databases.

Test systems are used to validate new software versions, security implementations and features. Benchmarking and capacity planning are also performed on test systems. Ideally test systems are created by cloning the production systems.

Development systems are used by programmers and DBAs for the development of new applications and software components.

© 2004 ITCourseware, LLC Understanding the Oracle9i Server Architecture 1-5

Page 28: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

What is an Oracle Server?

An Oracle server is an Object-Relational OLAP database management system.

Made up of an instance and a database. An Oracle instance contains memory structures and background processes that

maintain the state of the server.

An Oracle database contains the physical files that hold all information for the Oracle system.

The Oracle Database Administrator (DBA) is responsible for configuring, managing, maintaining, and tuning an Oracle server.

There can be specialization in the following areas: (Tuning, Security, Backup/Recovery, Application, Storage, Real Application Clusters, Java, Replication, Shared Server Architecture, and Application Server).

A session connection is established between a user process and an Oracle server. A Server Process manages the communication between the user process and the Oracle Server.

Notes A user can log into the host operating system and then execute an application or tool that establishes a connection to the Oracle server (single or two-task architecture). A user can start an application or tool on a separate computer from the Oracle server. Network software establishes a connection with the Oracle server (client-server architecture). A listener process must be up and running on the Oracle server platform to recognize the network connection. Oracle supports Net8, IIOP, and HTTP listeners. A user can start an application or tool on a local machine and then establish a connection with a middle-tier server. The middle-tier server (i.e. Oracle9i Application Server Release 2) then connects to the Oracle server over a network connection (3-tier architecture).

1-6 Oracle9i DBA Fundamentals I © 2004 ITCourseware, LLC

Page 29: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Understanding the Oracle9i Server Architecture

Oracle Versioning

An Oracle version can contain up to five numbers:

9.2.0.1.0 Version number Platform specific

patch-set number

New features release number

Patch set number

Maintenance release number

Recent major Oracle Releases:

Oracle 7.3 (Relational) No longer supported at end of year 2000

Oracle 8.0 (Object-relational) Released 1997. 8.0.6 is the terminal release.

The Oracle8i (Internet platform) 8i Release 1 (8.1.5) - 1998

8i Release 2 (8.1.6) - 1999

8i Release 3 (8.1.7) – 2000, 8i Release 3 (8.1.7.1) – 2001, (8.1.7.2 – spring 2001)

Oracle 9i Release 1 (8.2) - (eBusiness Release) Released August of 2001. 9i was initially intended to be 8.2 but was too large to

be considered a new features release

Oracle 9i Release2 (Object-Relational OLAP database) • Released May 2002.

• Oracle10G was released in the fall of 2003.

© 2004 ITCourseware, LLC Understanding the Oracle9i Server Architecture 1-7

Page 30: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Server Architectural Overview The following diagram highlights the primary components found in Oracle servers.

1-8 Oracle9i DBA Fundamentals I © 2004 ITCourseware, LLC

Page 31: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Understanding the Oracle9i Server Architecture

Operating System Environment

The following operating system environment variables must be set to run an Oracle system. These are the minimum parameters necessary to connect to an Oracle Instance.

The ORACLE_HOME contains the directory path where the Oracle software is installed. ORACLE_HOME has subdirectories containing Oracle software and products.

Example: /app/oracle/product/9.2.0.

The ORACLE_SID is the unique identifier for the Oracle instance.

Example: fin, orcl, db1.

An operating system variable PATH must include the $ORACLE_HOME/bin directory. The bin directory contains the Oracle executable programs.

Notes

Optional environmental variables include ORACLE_BASE and ORA_NLS33. ORACLE_BASE is recommended for OFA compliant systems (example: /app/oracle). ORA_NLS33 must be set if the character set USA7ASCII is not used. UTF8 is often used for databases that need to support globalization. Additional environmental parameters can be set to configure an Oracle environment. For example, the CLASSPATH variable needs to be set for the Oracle9i JVM. Check your installation manual if you are installing additional features beyond the core Oracle database.

To customize a DBA environment for SQL*Plus, set the SQLPATH variable.

© 2004 ITCourseware, LLC Understanding the Oracle9i Server Architecture 1-9

Page 32: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Important Subdirectories in ORACLE_HOME

The following list contains some of the important subdirectories below ORACLE_HOME. Be aware there are slight naming differences between operating systems.

Directory Description admin Administration directory for instance administration files Apache Files supporting the HTTP Apache Web server bin Contains all Oracle executables Classes Files containing Java classes dbs Contains initialization file scripts and sql.bsq script doc Documentation readme files lib Product libraries install Installation programs and files jar Java jar files javavm Files for the Oracle9i JVM (renamed to Enterprise Java Engine) jdbc Files supporting Java Database Connectivity jlib Java class libraries supporting EWT, Swing, … jsp Java Server Pages ldap Files supportingOracle9i’s Lightweight Directory Access Protocol network Oracle Network product files oci C programming API’s supporting the Oracle Call Interface plsql PL/SQL environment rdbms/admin Administration scripts and files sqlj SQLJ environment for embedded Java sqlplus SQL*plus environment xdk Files supporting the XDK environment

Notes

APIs are Application Programming Interfaces.

1-10 Oracle9i DBA Fundamentals I © 2004 ITCourseware, LLC

Page 33: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Understanding the Oracle9i Server Architecture

Oracle Product Subdirectories

Each product subdirectory also contains a number of subdirectories.

Some of the product subdirectories are: admin, demo, doc, install, lib, mesg, and log

New product directories supporting the Internet platform include: Apache, classes, jar, javavm, jdbc, jlib, jsp, ldap, oo40, sqlj, xdk

With Oracle’s Universal Installer (Java-based GUI), there is now a much more consistent layout of the Oracle software directories across multiple platforms (Solaris, Linux, AIX, HP, Compaq Tru64, XP/Windows 2000/NT, etc.).

DBAs should begin moving away from the traditional orainst program and begin using the Oracle Universal Installer.

The Universal Installer can install and remove products similarly to orainst but with more functionality and flexibility.

Since orainst and the Oracle Universal installer both use different audit and log files, it is not recommended to use both.

Exercise

Use the exercises at the end of this chapter to help get familiar with the Oracle environment for this classroom. They can be done now or they can wait till the end of the chapter.

© 2004 ITCourseware, LLC Understanding the Oracle9i Server Architecture 1-11

Page 34: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Oracle Instance Components

System Global Area (SGA) is the area of shared memory allocated during startup to maintain information about the current state of the Oracle server. The SGA shared memory is divided into the following areas:

Database buffer caches. Redo log cache. Shared pool area. Large pool (recommended if using Shared Server Architecture, Parallel

Query, or Recovery Manager). Java pool area (used for Java stored procedures).

The main (standard) Oracle background processes are: SMON, PMON, DBWR, LGWR, RECO, ARCH, CKPT, and Listener.

The Oracle instance is the combination of the SGA shared memory and background processes.

Notes

A database (physical files) maps to a single instance unless the system is running a parallel server environment. The Real Application Cluster (RAC) has an INSTANCE_NAME and a SERVICE_NAME for identification. An Oracle system contains server processes. Server processes execute the code for a user process. These server processes manage the connectivity between user processes and the instance. A user process executes the code of an application program accessing an Oracle server. User processes are usually applications or Oracle tools. Example user processes include Oracle Forms, C programs, Visual Basic, Powerbuilder, SQL*Plus, and Oracle Enterprise Manager (OEM). Every Oracle instance has a unique identifier defined by the operating system variable ORACLE_SID.

1-12 Oracle9i DBA Fundamentals I © 2004 ITCourseware, LLC

Page 35: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Understanding the Oracle9i Server Architecture

Database Files

An Oracle database is made up of different types of files.

The file types listed below are the minimum (and we do mean bare minimum) files required to define a database:

An initialization file contains the Oracle system variables and their definitions. These definitions determine the configuration at startup.

One control file is needed to maintain the mapping of all external files and the internal state of the system.

At least one data file (system datafile) is required to bring up an Oracle system. This system datafile will contain all of the system tables. The system tables maintain all information about the database.

A minimum of two redo log groups is necessary to manage system changes.

A redo log group is made up of one or more redo log files.

Notes A simple Oracle database can be brought online with the above minimum configuration. This minimum configuration should only be used as a base configuration. The init.ora file is also referred to as the p-file, initialization, or parameter file. The control file contains the necessary information to maintain database integrity. The system data file contains the system tables. These tables contain the data dictionary (database metadata), privileges, before-image information, and schema data. The redo log files maintain information about all changes made to the database. This information is used to help rebuild the database in case of failure.

Additional files that are often used in Oracle databases include archived redo log files and a password file. The archived redo log files contain off-line copies of previous changes made to a system. The password file is used for authentication of users with special privileges.

Every database has a unique identifier defined by the DB_NAME variable. This variable is defined in the init.ora configuration file. The ORACLE_SID and the DB_NAME are usually the same name for a single instance environment.

© 2004 ITCourseware, LLC Understanding the Oracle9i Server Architecture 1-13

Page 36: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Control Files

Every database must have at least one control file. The control file maintains information about the database. The control file maintains information about the:

Names and physical mapping and names of all data files and online redo log files.

Database name and the database creation date and time. Current log sequence number and checkpoint information.

The initialization parameter CONTROL_FILES defines the location and names of all control files. If more than one control file is listed with the CONTROL_FILES parameter, the files will be multiplexed (mirrored). Initialization file:

CONTROL_FILES = /oradata/fin/disk1/control_ORD01.ctl, /oradata/fin/disk2/control_ORD02.ctl …

Notes Control Files:

The control file is created when the database is created. It is highly recommended to have a minimum of two control files, on separate disks with every database The size of the control files is relatively small. For this reason, most DBAs prefer to have three or four control files defined for a database. Checkpoints:

When a checkpoint occurs, Oracle writes all data changes to the data files to keep the data files and the redo log files synchronized. When a redo log group fills up and Oracle switches to the next redo log group a checkpoint occurs. Checkpoints will be covered in more detail in a following chapter.

1-14 Oracle9i DBA Fundamentals I © 2004 ITCourseware, LLC

Page 37: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Understanding the Oracle9i Server Architecture

Redo Log Files

An Oracle database records all changes made to data. These changes are stored in redo log files. Redo log files are used to recover the database in case of media (disk) failure.

The LGWR process writes data changes from the redo log cache to the files in the current redo log group.

Redo log files are organized into redo log groups. A redo log group is a collection of mirrored redo log files.

Every redo log file in a group is a mirror of the other files in the group. For each committed transaction, the LGWR process will write the changes

to every redo log file in the current redo log group.

When a transaction is committed:

The LGWR process will read the redo entries from the log buffer and write them to the redo log files (fast commit).

A unique number called the System Change Number (SCN) will be generated for each committed transaction.

Notes

A database must have a minimum of two redo log groups. Each redo log group can have multiple log file members that are mirrored by Oracle. A typical database will have 20 redo log groups or more. Mirroring redo log file members is highly recommended. The redo log files tied to an instance are referred to as a thread of redo log files. Most instances have a single thread of redo log files. A Real Application Cluster (RAC) environment has multiple threads of redo log files. The RAC is an Oracle system running multiple instances connected to a single database (beyond scope of this course).

© 2004 ITCourseware, LLC Understanding the Oracle9i Server Architecture 1-15

Page 38: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Redo Log Files (continued)

The information in the redo log files is used to recover an Oracle system in case of failure. All redo log groups are written to in a circular fashion. Scenario for two log groups:

One of the groups will be the current redo log group. The log files for the current group are written to sequentially until full. When the log files are full for a redo log group, Oracle will perform a log

switch and begin writing to the next redo log group. A log switch can be performed manually with the ALTER SYSTEM SWITCH

LOGFILE command.

When the next redo log group fills up, Oracle will, again, perform a log switch and start writing over the files in the first redo log group.

A log sequence number is generated for every redo log file in a group during a log switch (look at the ARCHIVE_LOG_FORMAT parameter or the ARCHIVE LOG LIST command).

The log sequence number is used to identify redo log files in a group. Since all redo log files in a group are mirrored, each redo log file in a

group will have the same log sequence number.

Notes When the DBWR process cleans the dirty data buffers in the database buffer cache by writing them to the data files, a checkpoint occurs. Checkpoints synchronize the data files and redo log files to minimize the time required to perform instance recovery. A checkpoint also occurs when the redo log files in a group fills up or the ALTER TABLESPACE SYSTEM BEGIN BACKUP command is executed during a hot backup. (Checkpoints are covered in detail in a following chapter.) The redo log files belonging to a single instance are referred to as a thread of redo log files.

1-16 Oracle9i DBA Fundamentals I © 2004 ITCourseware, LLC

Page 39: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Understanding the Oracle9i Server Architecture

Logical Storage Structures

A data block is made up of a specific number of bytes. An extent is a number of contiguous data blocks acquired in a single allocation.

A segment is a logical grouping of extents allocated for a specific database object (data, index, rollback, temporary).

A tablespace is a logical storage unit used to group logical structures (schemas) together. A tablespace can span multiple data files in the database.

Each database user has an associated schema. A schema is the collection of logical structures which the user owns. Schema objects:

Include tables, views, procedures, functions, packages, synonyms, sequences, clusters and database links.

Give users access to the database information.

© 2004 ITCourseware, LLC Understanding the Oracle9i Server Architecture 1-17

Page 40: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Oracle Block Sizes

An Oracle9i database supports a standard block size and up to four additional block sizes.

The standard database block size is defined at database creation time with the DB_BLOCK_SIZE in the initialization file.

The default data block size (e.g. 8KB) for the specific operating system will be used if DB_BLOCK_SIZE is not defined.

Once the database is created, the standard block size cannot be changed. It is recommended to make the Oracle block size a multiple of the

operating system block size (i.e. 2K, 4K… 32K).

It is a little early to begin discussing multiple block sizes. The rest of the chapter will focus on core concepts. Managing multiple block sizes will be covered in depth later in the course.

Notes

Oracle began supporting multiple block sizes in a database with Oracle9i Release 1.

1-18 Oracle9i DBA Fundamentals I © 2004 ITCourseware, LLC

Page 41: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Understanding the Oracle9i Server Architecture

Blocks, Extents, and Segments

Oracle manages data in storage units called data blocks. Oracle performs I/O operations in block size units. Oracle reads blocks not records.

Relationship between blocks, extents and segments:

Notes

The minimum and maximum Oracle block size depends on the operating system. The Oracle block size has a significant impact on performance and storage efficiency. Properly setting the physical characteristics of extents and blocks can have a significant impact on performance (covered later). When most data operations involve a few records (OLTP systems), the block size should be smaller (i.e. 4k or 8k block sizes). When a large number of records are accessed on a regular basis (DSS) the block size should be larger (16k or 32k block sizes).

© 2004 ITCourseware, LLC Understanding the Oracle9i Server Architecture 1-19

Page 42: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Different Types of Segments

A data segment stores data. The different types of data segments include:

Regular, partitioned, clustered and global temporary data segments.

An index segment stores the indexed values along with the physical address (rowid) where the indexed value can be found.

Regular, bit-mapped, reverse, partitioned, and IOT index segments.

An undo segment stores before-image data. Every block modified with an insert, update, or delete is stored in an undo segment. Undo segments replaced rollback segments beginning in 9i.

A temporary (sort) segment is used as a workspace area for SQL commands performing sorts during execution. A temporary segment is used to store sorting information if there is not enough room in memory (determined by SORT_AREA_SIZE).

Notes

A segment is put in a specific tablespace. Extents are allocated as data is added to the segment. The extents may or may not be contiguous. The blocks inside of extents are contiguous. A DBA should separate data, index, rollback, and temporary segments into separate storage areas. Segments containing extents of similar sizes should be stored together. Storing extents of different sizes in the same tablespace greatly increases the probability of fragmentation. Segments can span multiple data files. Extents and data blocks cannot span a physical data file. Different type segments or segments of different life spans should not be stored in the same tablespace. A global temporary data segment is similar but different than a temporary sort segment (trying to create excitement and curiosity for later in the course).

1-20 Oracle9i DBA Fundamentals I © 2004 ITCourseware, LLC

Page 43: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Understanding the Oracle9i Server Architecture

Tablespaces

Tablespaces are the main storage components. Tablespaces:

Store database objects. Manage and control disk allocation. Hold multiple schemas. Allow segments to span multiple files. Control disk space allocation for database data. Can assign specific space quotas on tablespaces for database users. Control the availability of data by taking individual tablespaces online or

offline. Simplify administration of data. Distribute disk I/O to optimize performance.

Oracle supports two types of tablespaces:

Locally-managed (first available in 8i, extended in 9i). Dictionary (version 7 and earlier, slowly going away).

Notes

Tablespaces can be added and deleted from a database. Disk files for tablespaces can have their size increased and decreased within guidelines. Additional data files can be added to tablespaces.

Tablespaces are used to store:

• Data (regular, clustered, partitioned, temporary, and index-organized).

• Indexes (regular, bit-mapped, and partitioned).

• Temporary data (sort segments).

• Before image data (undo segments). Old style rollback segments are still supported through Oracle9i Release2.

© 2004 ITCourseware, LLC Understanding the Oracle9i Server Architecture 1-21

Page 44: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Logical Structural Design

The following is an example of a layout of tablespaces for a small database.

Tools_i

Tools

Temp_lrg

TempUNDO

Hr_i

Hr_data

Fin_i

Fin_data

Users

System

Notes

The following is a simple example of how tablespaces are used to logically divide a database design. A database may have additional application, rollback, temporary, and index tablespaces.

• System - contains the data dictionary with all the Oracle system tables and views • Users - users can create database objects for a development or test environment • Fin_data - contains financial data • Fin_i - contains indexes for financial tables • Hr_data - contains human resource data • Hr_I - contains indexes for human resource tables • Undo - contains standard undo segments • Temp - contains temporary segments for normal sort operations • Temp_lrg - contains temporary segments for large sort operations • Tools - contains tables for supporting Oracle tools and third party tools • Tools_i - contains indexes for tools tables

1-22 Oracle9i DBA Fundamentals I © 2004 ITCourseware, LLC

Page 45: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Understanding the Oracle9i Server Architecture

System Change Numbers

A System Change Number (SCN) is a unique identifier for each transaction. SCNs increase over time. Oracle stores committed and uncommitted transactions in redo log files.

SCNs are used in data file headers, control files, block headers, transaction tables, and redo records.

The beginning SCN in a redo log file is referred to as the low SCN. The last SCN in a redo log file is the high SCN.

When a tablespace is taken offline in normal mode, an offline SCN can be viewed in the dictionary object ts$. The offline SCN will be zero if the tablespace is taken offline in immediate or temporary mode.

A stop SCN will be recorded in the control file for each data file when a tablespace is taken offline.

Notes

V$LOG_HISTORY view has information about the log sequence number and the low and high SCN.

© 2004 ITCourseware, LLC Understanding the Oracle9i Server Architecture 1-23

Page 46: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Different Versions of Oracle

Oracle software has changed dramatically over the last several releases to support the features necessary for enterprise databases.

In most companies an Oracle DBA can be on a team responsible for supporting tens or hundreds of databases.

These databases may be running different versions of Oracle8 or Oracle9 or even Oracle7 databases.

A DBA will likely need to support multiple versions of Oracle.

The following pages will describe some of the high level differences between different versions of the last few releases in Oracle.

At this point in the course, students should just understand that Oracle comes in different versions with significantly differences in functionality. The detail of these differences is beyond the scope of this introductory course.

1-24 Oracle9i DBA Fundamentals I © 2004 ITCourseware, LLC

Page 47: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Understanding the Oracle9i Server Architecture

Oracle8.0 – The Object-Relational Release

Oracle7 was a primary platform for over eight years. It was a stable, reliable and very successful version. However, a version 7 database did not scale to support Internet and Enterprise databases.

Oracle7 is no longer supported by Oracle.

There are still Oracle7 databases in production.

Some of the features added by the Oracle8.0 (The Object-Relational Release) include:

Significantly increased scalability to support tens of terabytes.

Improved performance to support tens of thousands of users who need fast access.

New backup and recovery features using Recovery Manager.

Object-relational features (user-defined datatypes, LOBS, REFs, Varrays, Nested Tables).

Partitioned tables and indexes.

Index-organized tables and reverse key indexes.

Resource management.

Advanced queuing.

New networking functionality with Net8.

Password management.

New Oracle8 Rowid and DBMS_ROWID package.

New datatypes to support complex data models.

New feature functionality supporting Replication and the Oracle Parallel Server.

© 2004 ITCourseware, LLC Understanding the Oracle9i Server Architecture 1-25

Page 48: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Oracle Ceilings

As systems grow to tens of terabytes or petabytes (1,000,000,000,000,000), organizations will need their database architectures to grow along with them. Oracle can support large scale systems.

The following is a list of some of the Oracle ceilings:

CHAR data type can be up to 2000 bytes (V7 limit was 255). VARCHAR2 can be up to 4000 bytes (V7 limit was 2000). NCHAR can be up to 2000 bytes. NVARCHAR2 can be up to 4000 bytes. An index can have up to 32 indexed columns (V7 limit was 16). Initial extent is 2 blocks. A tablespace can have up to approximately 1022 data files. The database architecture physical limit is approximately 500 petabytes. The maximum number of tablespaces is approximately 64k. Maximum extents is 2 GB. A table can hold up to 1000 columns. Redo log files minimum size is 50K. The maximum size is O.S.

dependent (usually 2GB).

Notes

These limits are approximate and depend on individual operating systems. These new ceilings will allow Oracle8 to support larger OLTP, DSS, data warehouse, and Internet applications.

The number of data files that can be added to a tablespace is determined by the operating system limit. Oracle also imposes a data file limit that is specific for a particular hardware platform.

1-26 Oracle9i DBA Fundamentals I © 2004 ITCourseware, LLC

Page 49: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Understanding the Oracle9i Server Architecture

Additional Database Limits

These additional limits are provided to give a perspective of the scalability of Oracle.

Advanced Queuing Processes 10 per instance. I/O Slave Processes (DBWR, LGWR) 15 per background process

Job Queue Processes 10 per instance Locks Unlimited Number of users and roles 2,147,483,638 Rows per table Unlimited Sessions 32K (impacted by PROCESSES and

SESSIONS initialization parameters). Shared server processes and dispatchers. Limited by PROCESSES and SESSIONS

initialization parameters. SGA O.S.-dependent; usually 2 to 4 GB for 32-bit

environments, and > 4 GB for 64-bit environments.

SQL statement limit 64K Stored packages Between 2000 – 3000 lines.

Desupported features mean they no longer work in Oracle.

Deprecated features still work in Oracle but they being removed in a future release.

© 2004 ITCourseware, LLC Understanding the Oracle9i Server Architecture 1-27

Page 50: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Oracle8i – The Internet Release

It is important to understand that there are significant differences in features between releases (i.e. 8.1.5 – 8.1.6 – 8.1.7, 9iR1 – 9iR2). Release differences can be much more than bug fixes and patches.

The following is an example of some of the differences that can exist between releases. (This does not include all of the differences between releases.)

8.1.5 (8iR1) 8.1.6 (8iR2) 8.1.7 (8iR3) Java Virtual Machine Function-based indexes Servlets and Servlet engine Java Stored Procedures Temporary tables Java Server Pages Enterprise JavaBeans Fine-grained access control PL/SQL Server Pages CORBA and IIOP Log Miner and block repair Internet File System Object Request Broker Materialized views Native Java Compiler JDBC and SQLJ Autonomous transactions iCache Hash and composite partitioning

Invoker's rights HTTP listener

Hash and Composite partitioning (8.1.5) Function-based indexes and temporary tables (8.1.6) Fine-grained access control (8.1.6) New PL/SQL features, such as autonomous transactions, native Dynamic SQL,

etc. (8.1.6) New server and administration features, such as (8.1.5 – 8.1.6) locally-managed

tablespaces, dropping columns, Log Miner, Corrupt Block Management, new optimizer enhancements, stored outlines, shared cursors, DBMS_STATS, STATSPACK, ALTER TABLE MOVE, ALTER INDEX REBUILD ONLINE, Large Pool Area (8.1.5), and Java Pool Area (8.1.5)

Data warehouse features, such as (8.1.5 – 8.1.6) summary management (materials views, dimensions, and summary advisor), temporary tables, deferred constraints (8.1.5), transportable tablespaces, and temporary LOBs,

Security features, such as (8.1.6): data encryption, unique schemas, shared schema, n-tier authentication/authorization, invoker's rights, fine-grained access, application context, database triggers, and logon triggers

(8.1.5 – 8.1.6) Improved efficiency and functionality of the multi-threaded server, Standby database, recoverability, Oracle Parallel Server (cache fusion 8.1.7), and Replication

1-28 Oracle9i DBA Fundamentals I © 2004 ITCourseware, LLC

Page 51: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Understanding the Oracle9i Server Architecture

Oracle9i Release 1– The eBusiness Database

Oracle9i is a major new release with over 450 new features added.

Some of the goals of Oracle9i include:

Unlimited scalability. 9i is almost twice as scalable as 8i. Reduce management cost by 50%. Mainframe availability and security. Unbreakability features Enhanced performance features Tighter integration of Oracle products:

Oracle9i Application Server Release2.

Oracle Portal.

XML. Some of these new features added in Oracle9i : Enhanced Globalization New date and time datatypes Fractional seconds Enhancements to Resource Mgmt. Schema enhancements Performance Enhancements Automatic segment mgmt. Major Performance Enhancements XML functionality

SQL and PL/SQL enhancements New Data Warehousing Features Data Guard Real Application Clusters Flashback query Dynamic reconfiguration Enhanced Replication Improved Shared server Arch. Enhancements to OEM Integra

Undo tablespaces Multiple block sizes Oracle Managed Files Workspaces Server Parameter file Dynamic memory mgmt. Improved Online redefinition New Security Features New features in export/import Internet development Oracle Net Services Oracle streams

© 2004 ITCourseware, LLC Understanding the Oracle9i Server Architecture 1-29

Page 52: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Oracle9i Release 2– The Object-Relational OLAP Database

Oracle9i Release 2 added significant functionality to Oracle9i Release 1.

Some of the new features in Oracle9i Release 2 include:

Oracle streams supports the distribution of data, transactions and events in a data stream that can be propagated with a database or to a different database.

Oracle OLAP functionality and data mining is integrated into the Oracle database.

Oracle XML DB integrates XML and database functionality in Oracle9i. Oracle9i database Java Virtual Machine is JDK 1.3.1 compliant. Oracle9i supports the Microsoft .Net environment. Windows support for

Windows (XP, Windows 2000, NT). Support for composite range-list partitioning. Significantly improved Oracle Enterprise Manager (OEM) interfaces and

functionality. New built-in intelligent advisories for server performance tuning. System tablespace can be locally-managed. Server-side PL/SQL and Java debugging. Flashback Query support using SQL

Enhanced features in: Data Guard, RAC, Workspaces, Security, backup and recovery, Shared Server,

LogMiner, Table functions, Net services, Internet File System, Oracle Spatial, XML and Windows integration.

1-30 Oracle9i DBA Fundamentals I © 2004 ITCourseware, LLC

Page 53: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Understanding the Oracle9i Server Architecture

Oracle Products and Architectures

Oracle offers a number of different architectures. Some of the database versions and architectures include:

Oracle Lite. Personal Oracle. Standard (Workgroup) Oracle. Enterprise version.

Java option (JVM) – no additional cost.

Shared Server Architecture – no additional cost.

Oracle Streams – new enhanced form of replication.

Shared Server Architecture replacement for Multi-Threaded Server (MTS).

Real Application Clusters (RAC) replacement for Oracle Parallel server (OPS).

Advanced Security Option.

Notes

The Oracle Enterprise Edition is extendable with the following options: • Partitioning (supports very large tables and indexes) • Real Application Cluster (allows multiple instances to share the same database) • Oracle Enterprise Manager Packs (Diagnostics, Tuning and Change Management

Packs) • Advanced Security Option (encryption, data integrity checking, authentication, third

party services)

© 2004 ITCourseware, LLC Understanding the Oracle9i Server Architecture 1-31

Page 54: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

DBA Management Pack

The following tools are available with the Oracle Enterprise Manager:

Instance Manager. Security Manager. Storage Manager. Schema Manager. SQL*Plus Worksheet. Data Management Tools. Backup Management Tools.

There are Oracle management tools (at an additional cost) for helping a DBA analyze, tune, and manage change in the database environment.

Diagnostics Pack Tuning Pack Change Management Pack

Performance Manager Oracle Expert Database Alter

Capacity Planner SQL Analyze Database Propagate

TopSessions Tablespace Manager Database Diff

Advanced Events Database Capture

Oracle Trace and Data Viewer

Database Quick Change

Lock Manager Plan Manager

Trace Data Viewer

There are also numerous third party (Quest, BMC, CA, Embarcadero, etc.) management tools available.

1-32 Oracle9i DBA Fundamentals I © 2004 ITCourseware, LLC

Page 55: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Understanding the Oracle9i Server Architecture

Understanding your Oracle Server Layout

The following will help you understand your Oracle layout on UNIX. Look at Oracle environmental variables.

$ env |grep $ORACLE Look at Oracle processes associated with your ORACLE_SID.

$ ps –ef |grep $ORACLE_SID Display information on Oracle directories.

$ echo $ORACLE_HOME $ ls –CF $ORACLE_HOME

Look at important directories in your ORACLE_HOME directory. $ ls $ORACLE_HOME/dbs $ ls $ORACLE_HOME/rdbms/admin

Look at my disk layout. $ df -h

The following will help you understand your Oracle layout on Windows.

• Regedit will display information on Oracle environmental variables. Look at values for ORACLE_SID, ORACLE_HOME, ORACLE_BASE, etc.

HKEY_LOCAL_MACHINE | SOFTWARE | ORACLE | HOME0

• Control Panel | System will display information on our PATH variable and additional Oracle system variables.

© 2004 ITCourseware, LLC Understanding the Oracle9i Server Architecture 1-33

Page 56: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Review Questions

1. Which is the most correct answer for an Oracle tablespace?

A. A tablespace stores files.

B. A tablespace stores extents.

C. A tablespace manages security of tables.

D. A tablespace stores redo log files.

2. A System Change Number (SCN) is a unique identifier for each:

A. New incarnation of the database

B. Redo log file

C. Version of an Oracle patch applied to the Oracle software

D. Committed transaction

3. A minimal configuration must have the following files:

A. One init.ora, one data file, two redo log groups, and one control file

B. One init.ora, one data file, one redo log group, one password file, and one control file

C. One init.ora, one data file, two redo log files, archive files, and two control files

D. One init.ora, two data files, one redo log file, one password, and one control file

4. The purpose of a redo log file is to:

A. Save the undo information used to restore original data after a ROLLBACK

B. Store rollback segment data

C. Recover the database in case of failure

5. The following OS environmental variables must be set to bring up a database:

A. ORACLE_HOME, ORACLE_SID, PATH

B. ORACLE_HOME, ORACLE_SID, ORACLE_BASE, ORACLE_NLS33

C. ORACLE_HOME, ORACLE_SID, PATH, ORACLE_BASE

D. ORACLE_HOME, ORACLE_SID, PATH, ORACLE_TERM

1-34 Oracle9i DBA Fundamentals I © 2004 ITCourseware, LLC

Page 57: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Understanding the Oracle9i Server Architecture

Review Question Answers

1. Which is the most correct answer for an Oracle tablespace?

B. A tablespace stores extents.

2. A System Change Number (SCN) is a unique identifier for each:

D. Committed transaction

3. A minimal configuration must have the following files:

A. One initialization file, one data file, two redo log groups, and one control file

4. The purpose of a redo log file is to:

C. Recover the database in case of failure

5. The following OS environmental variables must be set to bring up a database:

A. ORACLE_HOME, ORACLE_SID, PATH

© 2004 ITCourseware, LLC Understanding the Oracle9i Server Architecture 1-35

Page 58: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Summary

The first step in becoming a DBA is to understand the concepts, terminology and components of an Oracle server.

The Oracle server is portable across different platforms (operating systems and software). • The data dictionary views are consistent across different environments. • The same background processes and memory components are used on different

platforms.

The Oracle server can be configured for a lot of different options (a few are listed below). • Oracle Parallel Server (Real Application Clusters in Oracle9i) • Replication • JServer • Partitioning • Materialized views and snapshots • Shared server (Multi-threaded Server in Oracle8) • Data guard in Oracle9i (Standby databases in Oracle8)

Oracle provides a lot of management tools to simplify administration. Some examples of Oracle tools include: Oracle Enterprise Manager (OEM), the DBA Management Packs, Database Configuration Assistant, the Net8 Assistant, etc. A number of third party companies have also written a lot of products to be used with Oracle due to Oracle's popularity as a database management system.

An Oracle instance is made up of a shared memory area (system global area) and Oracle background processes (SMON, PMON, DBWR, LGWR, CKPT, ARCH, RECO, etc.).

Every Oracle database requires the following files: • Initialization parameter file (initora or spfile) • Control file(s) • Data file(s) • Redo log files • Archived log files (optional)

1-36 Oracle9i DBA Fundamentals I © 2004 ITCourseware, LLC

Page 59: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Understanding the Oracle9i Server Architecture

Exercises

This is a class exercise to get you comfortable with the environment that you will be using in class this week.

1. With the instructor's assistance, determine the location of your ORACLE_HOME directory structure. A standard configuration on NT may have ORACLE_HOME in: D:\oracle\ora92

A standard configuration on Unix may have ORACLE_HOME in: /opt/oracle/9.2.0

Review the subdirectories of ORACLE_HOME to get familiar with the installation. The rdbms/admin subdirectory contains a lot of the scripts you will be using in class. Look at the files in the bin subdirectory: This contains the executable programs you will be using this week.

$ORACLE_HOME/rdbms/admin (Unix) %ORACLE_HOME%\rdbms\admin (NT or Windows 2000)

Location of the initialization file: $ORACLE_HOME/dbs (Unix) C:\Oracle\admin\orc9\pfile (NT or Windows 2000) i.e. orc9 – is the ORACLE_SID name

2. Look at the current settings of your operating system environmental variables (ORACLE_SID, ORACLE_HOME, PATH).

a) At the Unix prompt type the env command to look at your environmental variables. $ env | grep ORACLE

b) On NT/Windows 2000, use the following steps to get information about your environmental variables. (BE CAREFUL, not to change anything in the registry.) At the operating system level on NT, Click ‘Start’, ‘Run’. Type in Regedit and press enter. Select Edit from the Menu Bar, then Find. Type in ‘ORACLE_HOME’ and do the search. Type in ‘ORACLE_SID’ and do the search. Then, click on the START button on the desktop. Go to Settings | Control Panel. Then, select the SYSTEM icon. Click on the Environment Tab and look at the PATH search variable. You should see the ORACLE_HOME\bin directory in the search path.

© 2004 ITCourseware, LLC Understanding the Oracle9i Server Architecture 1-37

Page 60: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

3. With your instructor's assistance, find the physical files that make up your database. Configurations may be different but here is a sample location on NT and Unix.

D:\oracle\oradata\orcl (NT) /local/oracle/oradata/orcl (Unix)

You can also do a search on files that end in .dbf or .ctl to help you find the database files.

4. See if Oracle is running on the operating system.

$ ps –ef | grep $ORACLE_SID (Unix)

NT: Control-ALT-DELETE, then when Task Manager comes up, click on the Processes tab and look for oracle.exe. On NT the background processes run as threads of the oracle.exe process.

1-38 Oracle9i DBA Fundamentals I © 2004 ITCourseware, LLC

Page 61: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Server Parameter File

Chapter Overview

When a server parameter file is used, the need to manually update the text initialization file to make parameter changes persistent no longer exists. The changes are automatically recorded for the current instance, if desired, and can then be used the next time the instance is started without modification to the initialization text file.

Oracle9i has advanced self-tuning features that allow it to make automatic adjustments to some of the initialization parameters. This feature can only be taken advantage of when the server parameter file is in use. Using the server parameter file can significantly reduce and simplify parameter administration, especially in the Oracle Real Application Cluster environment. More self-tuning features are being added in Oracle10g.

At the end of this chapter, students will understand:

What the server parameter file is

How the server parameter file operates

How to create a server parameter file

How to alter parameters in the server parameter file

How to set the scope for initialization parameters

How to gather information about initialization parameters

©2004 ITCourseware, LLC Server Parameter File 6-1

Page 62: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

6-2 Oracle9i DBA Fundamentals I ©2004 ITCourseware, LLC

Page 63: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Server Parameter File

Definition of the Server Parameter File (SPFILE)

A new server parameter file (SPFILE) can be used to store instance parameter values.

The SPFILE is a server side initialization file.

SPFILE stands for server parameter file.

The SPFILE is a binary file that is created by Oracle.

It is built from a traditional pfile using the CREATE SPFILE statement.

Initialization parameters in the SPFILE are persistent and automatically updated.

Dynamically changed parameters remain in effect through shutdown and restart of the database.

Dynamically changed parameters are written to the SPFILE when they are changed.

Notes

Beginning with Oracle 9i Release 2, RMAN backs up the SPFILE automatically by default. In Oracle9i Release 1 the SPFILE must by updated manually.

©2004 ITCourseware, LLC Server Parameter File 6-3

Page 64: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Operation of the SPFILE

Oracle automatically uses the SPFILE at startup if no pfile is specified.

A pfile can be specified without causing changes to the SPFILE.

The pfile is specified with the startup command as in previous Oracle releases: SQL> STARTUP pfile=initORACLE_SID.ora

The SPFILE is located in the same place as the pfile: UNIX - $ORACLE_HOME\dbs

Windows - ORACLE_HOME\database

When an Oracle instance starts up with an SPFILE, the instance stays connected to the SPFILE while it is running.

An init.ora file is only read once at system startup and is not used again once the instance is running.

The SPFILE is a single point of failure with Oracle9i.

It takes a while for a DBA to transition from an init.ora file to a SPFILE.

6-4 Oracle9i DBA Fundamentals I ©2004 ITCourseware, LLC

Page 65: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Server Parameter File

Operation of the SPFILE (2)

At startup, if no initialization file is specified, Oracle will search for an initialization file in the default directory in the following order:

SPFILEORACLE_SID.ora

SPFILE.ora

InitORACLE_SID.ora

To start the database with a pfile or SPFILE that is not stored in the default directory, a one-line SPFILE can be placed in the default directory as follows: SPFILE=<path_to_spfile>

The IFILE initialization parameter to redirect the database to another location for its initialization file will not work with the SPFILE. The initialization parameter must be SPFILE.

The IFILE initialization parameter will still work with the pfile.

©2004 ITCourseware, LLC Server Parameter File 6-5

Page 66: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Steps for Creating an SPFILE

To create a server parameter file, follow these steps:

First, a copy of the initialization file must be present on the machine where the server is hosted.

If the initialization file is stored on a client it must be copied to the server host.

If Real Application Clusters are in use, all the pfiles must be combined into one pfile on one host.

Details of this can be found in the Oracle documentation publication: Oracle9i Real Application Clusters Installation and Configuration, Release 1 (9.0.1), Part Number A89868-02

The database does not have to be open, nor the instance started for the CREATE SPFILE command to be issued.

The database can be in exclusive mode or it can be open.

The CREATE SPFILE command is issued – from SQL*Plus or a similar tool.

The user issuing the command must be logged in with the SYSOPER or SYSDBA role.

Oracle uses the default location and generates a default name if the location and/or name are not specified.

If the default location and name are used, the STARTUP command can be used with no other parameters.

If another location and/or name are specified, then the startup command must include the location and/or name of the SPFILE.

Using the default name and location will make administration easier and is recommended

Comments in the original text initialization file are ignored unless they are on the same line as a parameter.

Comments on the same line as a parameter are preserved in the SPFILE as comments.

6-6 Oracle9i DBA Fundamentals I ©2004 ITCourseware, LLC

Page 67: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Server Parameter File

Creating an SPFILE

Syntax: CREATE SPFILE [= 'spfile_name'] FROM PFILE [= 'pfile_name'];

Example: SQL> CREATE SPFILE FROM PFILE;

The V$SPPARAMETER view will display the contents of an SPFILE.

The Database Configuration Assistant (used by the Universal Installer) creates an SPFILE automatically at database creation time.

If an SPFILE is created with the same name as one that already exists, the old one will be overwritten without warning.

This can occur in the case where an SPFILE is being created by a user with the SYSDBA role who is "connected to an idle instance" through SQL*Plus.

If the CREATE SPFILE command is issued for the current instance, an error will result: SQL> CREATE SPFILE FROM PFILE; CREATE SPFILE FROM PFILE * ERROR at line 1: ORA-32002: cannot create SPFILE already being used by the instance

©2004 ITCourseware, LLC Server Parameter File 6-7

Page 68: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Changing Parameters in the SPFILE

To change the parameters in the SPFILE, the ALTER SYSTEM command is used with the SET clause. The SET clause has three keywords:

SCOPE - This keyword specifies where the parameter change is to take place and has three settings.

MEMORY (default for init.ora file)

SPFILE

BOTH (default for SPFILE file)

1. (SCOPE=MEMORY) The parameter change is effective for the current instantiation.

It is not persistent to future instantiations.

The SPFILE is not updated.

It is only available for dynamic parameters and is not available for static parameters.

It is the default specification if a text initialization file (a pfile) was used to start up the instance.

2. (SCOPE=SPFILE) The parameter change is updated to the SPFILE.

Since the SPFILE is updated with the new information, the change is passed to future instantiations of the instance and is persistent from then on.

The change is not applied to the current instantiation, only to future ones.

This specification produces the same result for both for both dynamic and static parameters.

The SPFILE scope specification is only available if the instance was started with an SPFILE.

6-8 Oracle9i DBA Fundamentals I ©2004 ITCourseware, LLC

Page 69: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Server Parameter File

Changing Parameters in the SPFILE (2)

3. SCOPE=BOTH The changes are recorded in memory and the SPFILE simultaneously.

This specification causes the parameter change to become effective immediately on the current instance.

This specification also causes the parameter change to be persistent and passed to future instantiations of the instance.

It is available for dynamic parameters only. It cannot be used with static parameters.

It is the default if the instance was started with an SPFILE.

The BOTH scope specification is only available if the instance was started with an SPFILE.

There are two other keywords that can be used with the SET clause of the ALTER SYSTEM command to change parameters in the SPFILE:

1. DEFERRED - This keyword specifies when the parameter change will take place.

When this keyword is used, the parameter changes go into effect at the start of any future sessions.

2. COMMENT

A comment can be recorded to the SPFILE along with the parameter change with this keyword.

It is available for use when either SPFILE or BOTH are specified for the SCOPE keyword.

If an instance is brought up with an init.ora file, the MEMORY scope is the only one that can be used.

©2004 ITCourseware, LLC Server Parameter File 6-9

Page 70: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Changing Parameters in the SPFILE - Examples

Example of setting a parameter to be used only for the current instance: SQL> ALTER SYSTEM SET LOG_CHECKPOINTS_TO_ALERT=TRUE SCOPE=MEMORY; SQL> ALTER SYSTEM SET sort_area_size=524288 COMMENT='updated by Karen' SCOPE=memory;

Example of setting a parameter to be used only for the current session: SQL> ALTER SESSION SET sort_area_size=524288; COMMENT='updated by Karen' SCOPE=memory;

Static parameters can only be set by using the scope of SPFILE. This scope requires the instance be started using the spfile and not an init.ora file. SQL> ALTER SYSTEM SET log_buffer=65536 SCOPE=SPFILE;

When a parameter takes a list of settings, the new setting completely overwrites the old setting.

Optional settings that are specified in the old setting that are not to be changed in the new setting must still be re-specified to be included in the new setting.

Notes

If the parameter uses a Boolean value, it must be specifically set to either TRUE or FALSE.

6-10 Oracle9i DBA Fundamentals I ©2004 ITCourseware, LLC

Page 71: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Server Parameter File

Backing up the SPFILE

A pfile can be backed up from an SPFILE using the CREATE PFILE [filespec] FROM SPFILE [filespec]; command.

The pfile and SPFILE filespec specifications are optional.

If no filespec is specified, Oracle will use the filespec for the default SPFILE that is currently in use and Oracle will generate a default pfile filespec.

Comments contained in the SPFILE are preserved in the pfile.

The newly created pfile can be used to start the instance with the PFILE option in the future.

It can be used as a backup SPFILE.

It can be edited and a new SPFILE created from the edited version.

Example: SQL> CREATE PFILE FROM SPFILE;

©2004 ITCourseware, LLC Server Parameter File 6-11

Page 72: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Gathering Information About Parameters

To get information about parameters, there are several methods.

The V$PARAMETER and V$PARAMETER2 dynamic views show information about current parameters.

The V$PARAMETER2 view is supposed to be easier to read.

The V$SPPARAMETER dynamic view shows the contents of the SPFILE.

If the SPFILE was not used to start the instance, this view will show all NULL values.

If the SPFILE is in use, only values that have been specified will be shown.

Parameters that are using defaults will be shown with NULL in the value column.

The SQL*Plus command SHOW PARAMETER <string> can also be used as in previous versions of Oracle.

6-12 Oracle9i DBA Fundamentals I ©2004 ITCourseware, LLC

Page 73: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Server Parameter File

SPFILE FAQs

What happens when an error occurs while the SPFILE is open?

If an error occurs while Oracle is accessing the SPFILE it will take the following action depending on the circumstance:

If an error occurs during startup Oracle terminates with an error and the instance is not started.

If an error occurs during parameter updates, Oracle reports an error, aborts the current update and does not allow any further updates to the SPFILE during the current instantiation.

In this case, the instance must be shutdown and restarted with a recovered SPFILE before Oracle will allow updates to the SPFILE.

Can the SPFILE be edited?

Do not edit the SPFILE directly.

The SPFILE may be viewed with an ordinary text editor.

Editing the SPFILE with a text editor and then saving the edited version will corrupt the file and it will be unusable the next time the instance is restarted.

Editing an SPFILE that is in use may cause the instance that is using it to crash.

How often should the SPFILE be backed up to a pfile?

The SPFILE should always be backed up after any permanent changes are made so that the instance can always be restarted with the same parameter settings using the PFILE option in an emergency.

RMAN (Recovery Manager) can be used to make backups of the SPFILE, beginning with 9i Release 2.

©2004 ITCourseware, LLC Server Parameter File 6-13

Page 74: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Summary

1. The SPFILE is a server side initialization file.

a. SPFILE stands for server parameter file.

b. The SPFILE is a binary file that is created by Oracle.

c. It is built from a traditional pfile using the CREATE PFILE statement.

2. Oracle automatically uses the SPFILE at startup if no pfile is specified.

a. A pfile can be specified without causing changes to the SPFILE.

3. To create a server parameter file, follow these steps:

a. First, a copy of the initialization file must be present on the machine where the server is hosted.

b. The CREATE SPFILE command is issued – from SQL*Plus or a similar tool.

c. The Database Configuration Assistant (used by the Universal Installer) creates an SPFILE automatically at database creation time.

4. To change the parameters in the SPFILE, the ALTER SYSTEM command is used with the SET clause. The SET clause has three keywords:

a. SCOPE - This keyword specifies where the parameter change is to take place and has three settings.

i. SCOPE=MEMORY The parameter change is effective for the current instantiation.

ii. SCOPE=SPFILE The parameter change is updated to the SPFILE.

iii. SCOPE=BOTH The changes are recorded in memory and the SPFILE simultaneously.

b. DEFERRED - This keyword specifies when the parameter change will take place.

i. When this keyword is used, the parameter changes go into effect at the start of any future sessions.

c. COMMENT

6-14 Oracle9i DBA Fundamentals I ©2004 ITCourseware, LLC

Page 75: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Server Parameter File

Summary(2)

i. A comment can be recorded to the SPFILE along with the parameter change with this keyword.

ii. It is available for use when either SPFILE or BOTH are specified for the SCOPE keyword.

5. A pfile can be backed up from an SPFILE using the CREATE SPFILE [filespec] FROM SPFILE [filespec]; command.

6. To get information about parameters, there are several methods.

a. The V$PARAMETER and V$PARAMETER2 dynamic views show information about current parameters.

b. The V$SPPARAMETER dynamic view shows the contents of the SPFILE.

c. The SQL*Plus command SHOW PARAMETER <string> can also be used as in previous versions of Oracle.

7. Do not edit the SPFILE directly.

a. The SPFILE may be viewed with an ordinary text editor.

b. Editing the SPFILE with a text editor and then saving the edited version will corrupt the file and it will be unusable the next time the instance is restarted.

©2004 ITCourseware, LLC Server Parameter File 6-15

Page 76: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Review Questions

1. Where is a pfile normally stored?

a. On the server

b. On the client

c. On the laptop

d. In the database

e. Any of the above

2. The pfile is a

a. Text file.

b. Binary file.

c. Doc file.

d. Read-only file.

3. The SPFILE is a

a. Text file.

b. Binary file.

c. Doc file.

d. Read-only file.

4. SCOPE=MEMORY will

a. Update the pfile.

b. Not update the SPFILE.

c. Not update the pfile.

d. Update the SPFILE.

6-16 Oracle9i DBA Fundamentals I ©2004 ITCourseware, LLC

Page 77: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Server Parameter File

Review Questions (2)

5. The DEFERRED keyword causes parameter changes to be

a. Effective immediately.

b. Effective the next time the instance is started.

c. Effective for the next transaction.

d. Effective for the next session.

6. Comments in a pfile will be written to the SPFILE if

a. They are on a line that starts with two dashes (--).

b. They are on a line that starts with REM.

c. They are on a line that starts with a parameter.

d. Comments in a pfile are not written to an SPFILE.

e. A, b and c are correct.

7. You cannot create an SPFILE from an existing pfile if the instance is not started.

a. TRUE

b. FALSE

8. If you change only one option of several in a complex parameter

a. Only that one option is changed.

b. The change is ignored.

c. A fatal error is generated and the system crashes.

d. All the options are overwritten.

©2004 ITCourseware, LLC Server Parameter File 6-17

Page 78: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Review Questions (3)

9. If you edit an SPFILE that is in use and then save it

a. The changes become effective the next time the instance is restarted.

b. The changes become effective immediately.

c. The file might be corrupted and must be checked for accuracy.

d. The file becomes corrupt and the instance might crash.

10. How does the DBA change a non-Boolean parameter back to its default?

a. Use the ALTER SYSTEM SET command and specify either TRUE or FALSE.

b. Use the ALTER SYSTEM SET command and specify the default setting.

c. Use the ALTER SYSTEM SET command and specify empty single quotes.

d. Open the SPFILE with a favorite text editor, delete the parameter and then re-save the file.

e. All of the above

11. To get information about parameters, a DBA can use

a. The V$PARAMETER view

b. The V$PARAMETER2 view

c. The V$SPPARAMETER view

d. The SQL*Plus SHOW PARAMETER command

e. All of the above

6-18 Oracle9i DBA Fundamentals I ©2004 ITCourseware, LLC

Page 79: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Server Parameter File

Exercises

These exercises start by assuming you are not working with an SPFILE.

1. Log onto Oracle9i as SYSDBA through SQL*Plus and check to see if your database is started. If it is, execute a shutdown immediate.

SQL> SELECT count(*) 2 FROM dict; COUNT(*) ---------- 1098

The database is open. SQL> SHUTDOWN IMMEDIATE Database closed. Database dismounted. ORACLE instance shut down.

The instance is shutdown.

2. Create an SPFILE. SQL> CREATE SPFILE FROM PFILE; File created.

3. Startup the instance and open the database. SQL> STARTUP ORACLE instance started. Total System Global Area 143421512 bytes Fixed Size 282696 bytes Variable Size 134217728 bytes Database Buffers 8388608 bytes Redo Buffers 532480 bytes Database mounted. Database opened.

©2004 ITCourseware, LLC Server Parameter File 6-19

Page 80: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

4. Create a backup of the SPFILE. Store the backup as c:\temp\initSID.ora. Create the c:\temp directory using O/S commands if it does not already exist.

SQL> CREATE PFILE='C:\TEMP\INITORC9.ORA' 2 FROM SPFILE; File created.

5. Open the new pfile and verify its contents. If you open the file in Windows you may need to use Wordpad versus Notepad. A partial listing is shown:

*.background_dump_dest='C:\oracle\admin\orc9\bdump' *.compatible='9.0.0' *.control_files='C:\oracle\oradata\orc9\CONTROL01.CTL','C:\oracle\oradata\orc9\CONTROL02.CTL','C:\oracle\oradata\orc9\CONTROL03.CTL' *.core_dump_dest='C:\oracle\admin\orc9\cdump' *.db_block_size=4096 *.db_cache_size=5000000 *.db_domain='coloradosales.com' *.db_name='orc9' *.dispatchers='(PROTOCOL=TCP)(SER=MODOSE)','(PROTOCOL=TCP)(PRE=oracle.aurora.server.GiopServer)','(PROTOCOL=TCP)(PRE=oracle.aurora.server.SGiopServer)' *.fast_start_mttr_target=300 *.instance_name='orc9' *.java_pool_size='58720256' *.large_pool_size='1048576' *.open_cursors=300 *.processes=150 *.remote_login_passwordfile='EXCLUSIVE' *.shared_pool_size=58720256 *.sort_area_size=524288 *.timed_statistics=TRUE

6-20 Oracle9i DBA Fundamentals I ©2004 ITCourseware, LLC

Page 81: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Server Parameter File

6. Open the SPFILE and look at it. A partial listing is shown (most of the binary

information translates to underscores): C:\oracle\ora90\database\SPFILEORC9.ORA: ________________________________________________________________________________‡_________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________*.background_dump_dest='C:\oracle\admin\orc9\bdump' *.compatible='9.0.0' *.control_files='C:\oracle\oradata\orc9\CONTROL01.CTL','C:\oracle\oradata\orc9\CONTROL02.CTL','C:\oracle\oradata\orc9\CONTROL03.CTL' *.core_dump_dest='C:\oracle\admin\orc9\cdump' *.db_block_size=4096 *.db_cache_size=5000000 *.db_domain='coloradosales.com' *.db_name='orc9' *.dispatchers='(PROTOCOL=TCP)(SER=MODOSE)','(PROTOCOL=TCP)(PRE=oracle.aurora.server.GiopServer)','(PROTOCOL=TCP)(PRE=oracle.aurora.server.SGiopServer)' *.fast_start_mttr_target=300 *.instance_name='orc9' *.java_pool_size='58720256' *.large_pool_size='1048576' *.open_cursors=300 *.processes=150 *.remote_login_passwordfile='EXCLUSIVE' *.shared_pool_size=58720256 *.sort_area_size=524288 *.timed_statistics=TRUE *.undo_management='AUTO' *.undo_tablespace='UNDOTBS' *.user_dump_dest='C:\oracle\admin\orc9\udump' *.utl_file_dir='C:\oracle\ora90\oradata\orc9'

©2004 ITCourseware, LLC Server Parameter File 6-21

Page 82: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

7. Use the query shown to select the settings for the multi threaded server from the V$SPPARAMETER view. These parameters still work in Oracle9i but they have been deprecated.

SQL> SELECT SUBSTR(name,1,30) name, SUBSTR(value,1,10) value, isspecified FROM v$spparameter WHERE name LIKE '%mts%'; NAME VALUE ISSPEC ------------------------------ ---------- ------ mts_dispatchers FALSE mts_servers FALSE mts_max_servers FALSE mts_max_dispatchers FALSE mts_circuits FALSE mts_sessions FALSE mts_service FALSE mts_listener_address FALSE mts_multiple_listeners FALSE 9 rows selected.

Why are the values all NULL?

What does the column heading ISSPECIFIED mean?

What is the main difference in this view from the V$PARAMETER and the V$PARAMETER2 views? (Hint: execute the SQL*Plus DESCRIBE command on the three views to see the rest of the columns – Why would there be a column heading called SID in the V$SPPARAMETER view?)

6-22 Oracle9i DBA Fundamentals I ©2004 ITCourseware, LLC

Page 83: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Server Parameter File

8. Use the query shown to select the settings for the multi threaded server from the V$PARAMETER view. These parameters still work in Oracle9i but they have been deprecated.

SQL> SELECT SUBSTR(name,1,22) name, SUBSTR(value,1,55) value 2 FROM v$parameter 3 WHERE name LIKE '%mts%'; NAME VALUE ---------------------- ------------------------------------------------mts_dispatchers (PROTOCOL=TCP)(SER=MODOSE), PROTOCOL=TCP) mts_servers 1 mts_max_servers 20 mts_max_dispatchers 5 mts_circuits 170 mts_sessions 165 mts_service orc9 mts_listener_address mts_multiple_listeners FALSE 9 rows selected.

©2004 ITCourseware, LLC Server Parameter File 6-23

Page 84: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

6-24 Oracle9i DBA Fundamentals I ©2004 ITCourseware, LLC

Page 85: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Administration of Control Files

Chapter Overview

This chapter will teach how to administer control log files. Students will learn what is in a control file and what are the issues of managing them. How to control checkpointing will also be covered.

Managing control files is a very simple process if they are setup properly.

At the end of this chapter, students will understand:

The purpose of the control files

What information is stored in a control file

The setup for control files

Which data dictionary views have information about control files

Setting up multiplexing for control files

Ways to manage checkpointing

Log sequence numbers

©2004 ITCourseware, LLC Administration of Control Files 15-1

Page 86: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

15-2 Oracle9i DBA Fundamentals I ©2004 ITCourseware, LLC

Page 87: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Administration of Control Files

Control File Contents

The control files are:

Continuously updated during database use. Necessary to mount, open, and run a database. Used during recovery operations since they contain state information.

A database control file stores the following information:

Database name and id. Physical locations and names of all data files and redo log files. Database creation date and time. Tablespace names. Checkpoint information. Log sequence information. Log history. Recovery manager data.

Notes

Recovery techniques of control files are addressed in the 9i Backup and Recovery Course.

©2004 ITCourseware, LLC Administration of Control Files 15-3

Page 88: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Working with Control Files

Control files are relatively small in size compared to other files. The size of control files are determined by the following initialization parameters:

MAXINSTANCES MAXDATAFILES MAXLOGFILES MAXLOGMEMBERS MAXLOGHISTORY

The following data dictionary views contain information about control files:

V$PARAMETER V$CONTROLFILE V$CONTROLFILE_RECORD_SECTION

It is recommended to have a minimum of two mirrored control files. Three or four control files are preferable.

Display information about control files: qcontrol.sql SQL> COLUMN name FORMAT A50 SQL> SELECT name, STATUS FROM v$controlfile;

Notes

The command ALTER DATABASE BACKUP CONTROLFILE TO TRACE can be used to create a script that will rebuild control files. This script is stored in a user trace file.

15-4 Oracle9i DBA Fundamentals I ©2004 ITCourseware, LLC

Page 89: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Administration of Control Files

Multiplexing Control Files

The initialization parameter CONTROL_FILES is used to define the database control files.

CONTROL_FILES=(/u03/oradata/control/control01.ctl)

If more than one file is listed, the files will be multiplexed. # init.ora file … CONTROL_FILES=(/u03/oradata/fin/control/control01.ctl, /u04/oradata/fin/control/control02.ctl, /u05/oradata/fin/control/control03.ctl)

During database creation, all the files defined by CONTROL_FILES will be created and mirrored automatically.

Notes

The multiplexed files should be stored on separate disks and controllers.

To add or remove control files:

• Shut down the database normally.

• If adding a control file, use an operating system copy command to copy a good control file to another location.

• Modify the CONTROL_FILES parameter in the initialization file to reflect the control file changes.

• Start up the database.

• Run a query on V$CONTROLFILE to see if the new changes took effect.

©2004 ITCourseware, LLC Administration of Control Files 15-5

Page 90: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

The CREATE CONTROLFILE Command

To create a script that will rebuild a control file from scratch: SQL> ALTER DATABASE BACKUP CONTROLFILE TO TRACE;

The backup script will be stored in a trace file in the directory defined by the USER_DUMP_DEST initialization parameter.

This backup script builds the CREATE CONTROLFILE command for the server.

The database must be mounted or open to create a control file or to create the script in a trace file. Example script if database is in archivelog mode:

SQL> CONNECT SYS/ORACLE AS SYSDBA SQL> STARTUP NOMOUNT SQL> CREATE CONTROLFILE REUSE DATABASE NORESETLOGS ARCHIVELOG MAXLOGFILES 64 MAXLOGMEMBERS 4 MAXDATAFILES 1000 MAXINSTANCES 1 MAXLOGHISTORY 1012 LOGFILE GROUP 1 '/oracle/dbs/t1_log01a.log' SIZE 10M, GROUP 2 '/oracle/dbs/t1_log02a.log' SIZE 10M DATAFILE '/disk1/oracle/fin/data_01.dbf', '/disk1/oracle/fin/temp_01.dbf', '/disk1/oracle/fin/rbs_01.dbf', '/disk1/oracle/fin/idx_01.dbf', CHARACTER SET WE8DEC; SQL> RECOVER DATABASE; SQL> ALTER SYSTEM ARCHIVE LOG ALL; SQL> ALTER DATABASE OPEN;

15-6 Oracle9i DBA Fundamentals I ©2004 ITCourseware, LLC

Page 91: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Administration of Control Files

Log Sequence Numbers

A log switch is when LGWR stops writing to one redo log group and moves to the next log group.

A log sequence number is used to mark a set of redo log entries to a redo log group.

The first log sequence number is one. Each time a log switch occurs, the log sequence number will be incremented by one.

All file members in a group will have the same log sequence number. The current log sequence number is stored in all data file headers and the control files.

The ALTER SYSTEM command can force a log switch to occur.

Look at the current log sequence number and log group and then perform a log switch. SQL> ARCHIVE LOG LIST; SQL> SELECT group#, status

FROM v$log; SQL> CONNECT sys/oracle AS sysdba SQL> ARCHIVE LOG LIST; SQL> ALTER SYSTEM switch logfile; SQL> ARCHIVE LOG LIST; SQL> SELECT group#, status FROM v$log;

©2004 ITCourseware, LLC

Display current logsequence

Display current log group

Display new log

Display new log group

Administration of Control Files 15-7

Page 92: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Reviewing Checkpoints

During a database checkpoint, the DBWR process will write all dirty buffers in the database buffer cache to the data files.

The headers of all data files and control files will be updated after the checkpoint completes. This is performed by the CKPT process.

When the LOG_CHECKPOINTS_TO_ALERT parameter is set to true, checkpoint information is written to the alert file.

The default value is set to FALSE. This is helpful for evaluating the frequency of checkpoints. LOG_CHECKPOINTS_TO_ALERT is a dynamic parameter.

SQL> ALTER SYSTEM SET log_checkpoints_to_alert = true; System altered.

Checkpoints will not occur on offline or read-only tablespaces.

If checkpoint events occur:

Too frequently, excessive disk writes will occur. Over infrequent time intervals, instance recovery time frames will increase.

Notes

A DBA should monitor the LGWR trace file and the ALERT file to look for messages indicating LGWR has to wait for a log group because a checkpoint has not finished.

15-8 Oracle9i DBA Fundamentals I ©2004 ITCourseware, LLC

Page 93: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Administration of Control Files

Reviewing Checkpoint Events

A checkpoint occurs:

When an instance is shutdown in normal, transactional, or immediate mode. A checkpoint does not occur during a shutdown abort.

At every log switch event. When a DBA executes an ALTER SYSTEM CHECKPOINT command.

FAST_START_MTTR_TARGET and the size of redo log files should control checkpointing in Orace9i.

These initialization parameters were used in previous versions of Oracle to control checkpointing:

LOG_CHECKPOINT_INTERVAL The LOG_CHECKPOINT_INTERVAL specifies the number of redo blocks to be

filled between checkpoints. The blocks are in operating system blocks, not database units.

LOG_CHECKPOINT_TIMEOUT The LOG_CHECKPOINT_TIMEOUT specifies the number of seconds between

checkpoints. The default is zero. A zero value will disable time based checkpoints (not recommended).

DB_BLOCK_MAX_DIRTY_TARGET (desupported in Oracle9i) FAST_START_IO_TARGET (deprecated in Oracle9i)

Notes

The OEM Backup Manager can be used to force log switches and checkpoints.

©2004 ITCourseware, LLC Administration of Control Files 15-9

Page 94: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Instance Recovery

Instance recovery is performed to synchronize the database between data and redo log files after an instance crash.

Instance recovery does not require any special actions from the DBA. The instance recovery steps include:

Start the instance. Wait for the database to open for users. Review the alert log file and trace files to understand the reason for the failure.

A DBA must look at a number of different factors to understand how to optimize instance recovery:

Alert log and background trace files. Role of SMON and PMON. Rolling forward (redo) and rolling back (undo).

Notes

Deferred rollback improves instance recovery by returning blocks to users faster during instance recovery. Fast-start parallel rollback parameter FAST_START_PARALLEL_ROLLBACK and improve instance recovery by running in parallel. The following views can be used to monitor parallel recovery:

V$FAST_START_SERVERS V$FAST_START_TRANSACTIONS

STATE PID UNDOBLKSDONE

USN SLT SQL UNDOBLKSDONE UNDOBLKSTOTAL CPUTIME

15-10 Oracle9i DBA Fundamentals I ©2004 ITCourseware, LLC

Page 95: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Administration of Control Files

Managing Checkpointing

Checkpointing has an impact on a number of different areas in the Oracle Server.

The level of optimization of checkpointing with Oracle can be controlled a number of different ways.

Initialization parameters: FAST_START_MTTR_TARGET (recommended)

LOG_CHECKPOINT_INTERVAL

LOG_CHECKPOINT_TIMEOUT

FAST_START_IO_TARGET (deprecated)

Manually: ALTER SYSTEM CHECKPOINT

Background processes: LGWR_IO_SLAVES

DBWR_IO_SLAVES

Physically: Size of redo log files

Notes DB_BLOCK_MAX_DIRTY_TARGET is no longer available in Oracle9i. DB_BLOCK_MAX_DIRTY_TARGET was used to define the number of dirty buffers in the buffer cache.

• It indirectly specifies the number of blocks that must be read during instance recovery.

• The default is the number of buffers in the database buffer cache.

• FAST_START_IO_TARGET in Oracle8i was better to use than DB_BLOCK_MAX_DIRTY_TARGET in Oracle8i.

©2004 ITCourseware, LLC Administration of Control Files 15-11

Page 96: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Multiple DBWR IO Processes

The DBWR_IO_SLAVES is used to define the number of I/O slaves to be used by database writer. The default is 0.

If DBWR_IO_SLAVES is set to a value greater than zero, the number of I/O slaves used by the ARCH process, LGWR process and Recovery Manager are set to 4.

Setting multiple database writer I/O slaves can simulate asynchronous I/O on platforms that do not support asynchronous I/O or implement it inefficiently.

Setting multiple database writer I/O slaves can still be set even when asynchronous I/O is being used. In this scenario, the I/O slaves will use asynchronous I/O.

Defining multiple database writer I/O slaves can increase I/O throughput even if asynchronous I/O is supported.

DB_WRITER_PROCESSES defines the initial number of database writer processes for an instance.

An instance can be configured with DBWR_IO_SLAVES or DB_WRITER_PROCESSES, but not both.

Notes

The range of values for DBWR_IO_SLAVES depends on the operating system. The range of values for DB_WRITER_PROCESSES is 1-10.

15-12 Oracle9i DBA Fundamentals I ©2004 ITCourseware, LLC

Page 97: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Administration of Control Files

DB_BLOCK_CHECKING

The DB_BLOCK_CHECKING parameter is used perform block checking for transaction managed blocks.

The default value of DB_BLOCK_CHECKING is set to FALSE.

It is advantageous to have early detection of corrupt blocks.

There is a minimal impact on performance. It is recommended to set to TRUE.

The ALTER SESSION and ALTER SYSTEM DEFERRED commands can be used to change the parameter at run time.

DB_BLOCK_CHECKING and events 10210 and 10211:

This provides more flexibility than events 10210 and 10211. DB_BLOCK_CHECKING is designed to replace events 10210 and 10211. Setting DB_BLOCK_CHECKING to TRUE will override the setting of events 10210 and 10211.

©2004 ITCourseware, LLC Administration of Control Files 15-13

Page 98: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

DB_BLOCK_CHECKSUM

DB_BLOCK_CHECKSUM is a dynamic parameter that will have the system perform checksums before writing a block.

When set to TRUE, a checksum will be verified for every block written to disk.

DBWn and Direct Loader will perform a checksum and will store the checksum in the cache header of every block when the block is written it to disk.

Direct loader will perform a checksum and will store the result in the cache header of every block when the block is written it to disk.

The ALTER SYSTEM command can be used to change the value of DB_BLOCK_SUM.

Default is set to FALSE.

The checksum will be verified when a block is read-only if the last write of the block stored a checksum.

Setting DB_BLOCK_CHECKSUM to TRUE can generate performance overhead.

Notes

The following init.ora parameters are obsolete in 8.1.3: • DB_BLOCK_CHECKPOINT_BATCH • DB_BLOCK_LRU_EXTENDED_STATISTICS • DB_BLOCK_LRU_STATISTICS • DB_FILE_SIMULTANEOUS_WRITES

15-14 Oracle9i DBA Fundamentals I ©2004 ITCourseware, LLC

Page 99: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Administration of Control Files

FAST_START_PARALLEL_ROLLBACK

The FAST_START_PARALLEL_ROLLBACK dynamic parameter is used to control the degree of parallelism used for rolling back during instance recovery.

This parameter will set the maximum number of parallel server processes that will be started up to perform rollback.

The FAST_START_PARALLEL_ROLLBACK parameter can be set to:

FALSE LOW (2 x # of CPUs) HIGH (4 x # of CPUs)

This parameter determines how many parallel server processes to start up during instance recovery.

©2004 ITCourseware, LLC Administration of Control Files 15-15

Page 100: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

Summary

The LRU list keeps track of the most and least recently used blocks in the buffer cache.

The Dirty list contains pointers to blocks that have been modified but not written to disk.

Free buffers are blocks in the buffer cache available for reuse.

Dirty buffers have been modified so their contents are different than the image of the data on disk. The contents of a dirty block must be written to disk before they can be reused.

Pinned buffers are memory blocks that are currently in use.

The LOG_CHECKPOINT_INTERVAL specifies the number of redo blocks to be filled between checkpoints. The blocks are in operating system blocks, not database units.

The LOG_CHECKPOINT_TIMEOUT specifies the number of seconds between checkpoints. The default is zero. A zero value will disable time based checkpoints (not recommended).

DB_BLOCK_CHECKSUM is a dynamic parameter that will have the system perform checksums before writing a block.

The DB_BLOCK_CHECKING parameter is used perform block checking for transaction managed blocks.

The DBWR_IO_SLAVES is used to define the number of I/O slaves to be used by database writer. The default is 0.

DB_BLOCK_MAX_DIRTY_TARGET defines the number of dirty buffers in the buffer cache. It indirectly specifies the number of blocks that must be read during instance recovery. The default is the number of buffers in the database buffer cache.

FAST_START_IO_TARGET will provide a more accurate boundary on the number of IOs to be recovered than DB_BLOCK_MAX_DIRTY_TARGET.

FAST_START_IO_TARGET defines the amount of data blocks that need to be processed during instance recovery.

The FAST_START_PARALLEL_ROLLBACK parameter can be set to: • FALSE • LOW (2 x # of CPUs) • HIGH (4 x # of CPUs)

15-16 Oracle9i DBA Fundamentals I ©2004 ITCourseware, LLC

Page 101: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Administration of Control Files

Exercises

1. Enable the following parameters in your initialization file. DB_BLOCK_CHECKSUM = TRUE FAST_START_PARALLEL_ROLLBACK = LOW DBWR_IO_SLAVES = 4 LOG_CHECKPOINTS_TO_ALERT=TRUE

Shutdown and restart your system to use the new initialization parameters. Execute the ALTER SYSTEM SWITCH LOGFILE a few times. Then verify Oracle is writing checkpointing information to the alert.log file.

2. Build a script that will create a control file for your current database. SQL> ALTER DATABASE BACKUP CONTROLFILE TO TRACE;

Look in your trace file directory for the trace file created by this command. At the bottom of the trace file you will find the CREATE CONTROLFILE command. The parameter USER_DUMP_DEST will tell you where the trace file was created. The date and time stamp will help you verify that you have the correct file.

3. Add two control files to your database: Shutdown the Oracle server completely. Go to the init.ora file and add to files to your CONTROL_FILES parameter. Copy a good file to the new locations you just defined. Then startup your instance. Verify the new control files using V$CONTROLFILE.

4. Remove the control files from your system and then bring the system back up. You will use similar steps as in exercise 3.

©2004 ITCourseware, LLC Administration of Control Files 15-17

Page 102: Oracle9i DBA Fundamentals I - · PDF fileOracle9i DBA Fundamentals I Course Description Overview This class will develop the key fundamental skills necessary to be an Oracle DBA. Students

Oracle9i DBA Fundamentals I

15-18 Oracle9i DBA Fundamentals I ©2004 ITCourseware, LLC