
- •About the Authors
- •Contents at a Glance
- •Contents
- •Table of Exercises
- •Introduction
- •Assessment Test
- •Answers to Assessment Test
- •What Is ASM?
- •Working with the ASM Instance
- •Overview of ASM Data Dictionary Views
- •Using ASM Storage
- •Using RMAN with ASM
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Understanding the Oracle Database as It Relates to Backup and Recovery
- •Performing Oracle Offline Backups
- •Performing Oracle Online Backups
- •Backing Up the Control File
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Performing Incomplete Recoveries
- •Performing Other Types of Recoveries
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Why Use RMAN?
- •Exploring the RMAN Architecture
- •Connecting to RMAN
- •Configuring RMAN for Use
- •Backing Up Your Database with RMAN
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Introducing the Recovery Catalog
- •Creating the Recovery Catalog User and Schema Objects
- •Using a Recovery Catalog
- •Maintaining the Recovery Catalog
- •Using the RMAN Virtual Private Catalog
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •RMAN Database-Recovery Basics
- •Using Image Copies to Recover Your Database
- •Other Basic Recovery Topics
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Switching Between RMAN Incarnations
- •Overview of RMAN Database Duplication
- •Performing an RMAN Tablespace Point-in-Time Recovery
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Overview of Flashback Technology
- •Using Automatic Undo Management
- •Using Flashback Technologies
- •Using Additional Flashback Operations
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Diagnosing the Database
- •Managing Database Performance
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Managing Memory
- •Managing Space
- •Managing Resources
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Automating Tasks with the Scheduler
- •Exploring the Scheduler Architecture
- •Exploring Common Administration Tools
- •Using Scheduler Jobs
- •Using Scheduler Programs
- •Using Schedules
- •Creating Lightweight Jobs
- •Using Job Chains
- •Using Scheduler Windows
- •Creating and Using Job Classes
- •Using Advanced Scheduler Concepts to Prioritize Jobs
- •Using Scheduler Views
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •An Overview of Globalization Support
- •Using NLS Parameters
- •Using Datetime Datatypes
- •Using Linguistic Sorts and Searches
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Lab 1.1: Creating an ASM Instance
- •Lab 1.2: Creating ASM Disk Groups
- •Lab 1.3: Using ASM Disk Groups from a Database
- •Lab 2.2: Putting the Database in ARCHIVELOG Mode
- •Lab 2.3: Executing a Manual Online (Hot) Backup
- •Lab 3.1: Executing a Time-Based Point-in-Time Recovery
- •Lab 3.2: Recovering from Control-File Loss with a Backup Control File
- •Lab 3.3: Recovering from Loss of the Current Online Redo Log
- •Lab 4.1: Creating an RMAN Offline Backup
- •Lab 4.2: Creating an RMAN Incremental Backup
- •Lab 4.3: Creating an Image-Copy Backup
- •Lab 5.1: Implementing RVPC
- •Lab 6.1: Restoring a Datafile Online
- •Lab 6.2: Performing a Change-Based Recovery with RMAN
- •Lab 6.3: Restoring a Control File from an Autobackup
- •Lab 7.1: Monitoring RMAN Backups
- •Lab 7.2: One of My Backups Is Missing!
- •Lab 8.1: Duplicating a Database Using Active Database Duplication
- •Lab 8.2: Duplicating a Database Using Backup-Based Duplication to a Different Point in Time
- •Lab 9.1: Using the Recycle Bin
- •Lab 9.3: Using Flashback Data Archive
- •Lab 10.1: Using Support Workbench to Report a Problem to Oracle Support
- •Lab 11.1: Exporting a Transportable Tablespace
- •Lab 11.2: Testing Resumable Space Allocation
- •Lab 11.3: Manually Configuring the SGA
- •Lab 12.1: Creating a Local External Job
- •Lab 12.2: Creating a Job Window
- •Lab 13.1: Using the Locale Builder to Create a New Linguistic Sort
- •Lab 13.2: Setting NLS Parameters
- •Lab 13.3: Performing Linguistic Sorts
- •What You’ll Find on the CD
- •System Requirements
- •Using the CD
- •Troubleshooting
- •Glossary
- •Index

718 Appendix A n Lab Exercises
13.Bring the datafile online using the RMAN sql command calling the SQL statement alter database datafile online.
RMAN> sql ‘alter database datafile 4 online’; sql statement: alter database datafile 4 online
The datafile has been restored online and the lab is complete.
Lab 6.2: Performing a Change-Based Recovery with RMAN
In this activity, you will restore the database to a specific SCN, or system change number. This activity builds on the backup done in Exercise 4.2 in Chapter 4. You should have completed Exercise 4.2 prior to executing this activity. Please note that the output you experience from this exercise will probably differ from the output shown here.
1.Start SQL*Plus.
C:\oracle>sqlplus sys as sysdba
SQL*Plus: Release 11.1.0.6.0 - Production on Fri Oct 3 00:35:25 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved.
Enter password:
2.The database should already be started. If not, start it with the startup command. To determine the current SCN, issue the following query:
SQL> select current_scn from v$database; CURRENT_SCN
-----------
1095172
This is the SCN that we will recover to. Your SCN is likely to be very different.
3.Start RMAN. We will assume you are not using a recovery catalog during this exercise.
C:\oracle>rman target=/
Recovery Manager: Release 11.1.0.6.0 - Production on Fri Oct 3 00:37:44 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved.
4.To prepare for the restore, put the database in MOUNT mode with the startup force mount RMAN command.
RMAN> startup force mount Oracle instance started

Lab 6.2: Performing a Change-Based Recovery with RMAN |
719 |
||
database mounted |
|
|
|
Total System Global Area |
364081152 |
bytes |
|
Fixed Size |
1333228 |
bytes |
|
Variable Size |
289409044 |
bytes |
|
Database Buffers |
67108864 |
bytes |
|
Redo Buffers |
6230016 |
bytes |
|
5.Issue the restore database until scn command to restore the database to the SCN identified in step 3. In our case, the command will be restore database until scn 1095172; your command will have a different change number.
RMAN> restore database until scn 1095172; Starting restore at 10/03/2008 11:48:17
using target database control file instead of recovery catalog allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=155 device type=DISK
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set channel ORA_DISK_1: restoring datafile 00001 to C:\ORACLE\ORADATA\ORCL\SYSTEM01.DBF
channel ORA_DISK_1: restoring datafile 00002 to C:\ORACLE\ORADATA\ORCL\SYSAUX01.DBF
channel ORA_DISK_1: restoring datafile 00003 to C:\ORACLE\ORADATA\ORCL\UNDOTBS01.DBF
channel ORA_DISK_1: restoring datafile 00004 to C:\ORACLE\FLASH_RECOVERY_AREA\ORCL\DATAFILE\O1_MF_USERS_4G2Q1YTC_.DBF channel ORA_DISK_1: reading from backup piece C:\ORACLE\FLASH_RECOVERY_AREA\ORCL\BACKUPSET\2008_10_03 \O1_MF_NNNDF_TAG20081003T001928_4GCGCQQ4_.BKP
channel ORA_DISK_1:
piece handle=C:\ORACLE\FLASH_RECOVERY_AREA\ORCL\BACKUPSET\2008_10_03 \O1_MF_NNNDF_TAG20081003T001928_4GCGCQQ4_.BKP tag=TAG20081003T001928 channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:07:25 Finished restore at 10/03/2008 11:55:44
6.Recover the database with the recover database until scn command. Our command would be recover database until scn 1095172; your command will have a different date and time.
RMAN> recover database until scn 1095172; Starting recover at 10/03/2008 11:57:24

720 Appendix A n Lab Exercises
using channel ORA_DISK_1 starting media recovery
archived log for thread 1 with sequence 3 is already on disk as file C:\ORACLE\PRODUCT\11.1.0\DB_1\RDBMS\ARC00003_0667012858.001 archived log for thread 1 with sequence 4 is already on disk as file C:\ORACLE\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2008_10_03 \O1_MF_1_4_4GCMC8GV_.ARC
archived log for thread 1 with sequence 1 is already on disk as file C:\ORACLE\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2008_10_03 \O1_MF_1_1_4GCO4G15_.ARC
archived log file name=C:\ORACLE\PRODUCT\11.1.0\DB_1\RDBMS\ARC00003_0667012858.001 thread=1 sequence=3
archived log file name=C:\ORACLE\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2008_10_03 \O1_MF_1_4_4GCMC8GV_.ARC thread=1 sequence=4
media recovery complete, elapsed time: 00:00:28 Finished recover at 10/03/2008 11:57:54
7.Open the database with the alter database open resetlogs command.
RMAN> alter database open resetlogs; database opened
The database is open. This concludes the exercise.
Lab 6.3: Restoring a Control File from an Autobackup
In this activity, we will simulate loss of a control file and subsequent recovery. This activity builds on the backup done in Exercise 4.2. We assume that you have configured control-file autobackups as done in Exercise 4.1. You should have completed Exercises 4.1 and 4.2 prior to executing this activity. Please note that the output you experience from this exercise will probably differ from the output shown here.
1.Start SQL*Plus.
C:\oracle>sqlplus sys as sysdba
SQL*Plus: Release 11.1.0.6.0 - Production on Fri Oct 3 00:35:25 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved.
Enter password:

Lab 6.3: Restoring a Control File from an Autobackup |
721 |
2.The database should be started. If not, start the database with the startup force command. From the SQL*Plus prompt, determine the current location of the database control files by issuing the query select name from v$controlfile;.
SQL> select name from v$controlfile; NAME
------------------------------------
C:\ORACLE\ORADATA\ORCL\CONTROL01.CTL
C:\ORACLE\ORADATA\ORCL\CONTROL02.CTL
C:\ORACLE\ORADATA\ORCL\CONTROL03.CTL
3.Shut down the database and exit SQL*Plus.
SQL> shutdown immediate Database closed. Database dismounted.
ORACLE instance shut down. SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
4.From the OS, remove all of the database control files.
C:\oracle>del C:\ORACLE\ORADATA\ORCL\CONTROL01.CTL C:\oracle>del C:\ORACLE\ORADATA\ORCL\CONTROL02.CTL C:\oracle>del C:\ORACLE\ORADATA\ORCL\CONTROL03.CTL
5.Start RMAN.
C:\oracle>rman target=/
Recovery Manager: Release 11.1.0.6.0 - Production on Fri Oct 3 00:37:44 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved. connected to target database (not started)
6.Try to start up the database. What error do you get?
RMAN> startup
Oracle instance started
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================

722 Appendix A n Lab Exercises
RMAN-03002: failure of startup command at 10/03/2008 12:09:57
ORA-00205: error in identifying control file, check alert log for more info
7.Issue the restore controlfile from autobackup command from RMAN to restore the control files.
RMAN> restore controlfile from autobackup; Starting restore at 10/03/2008 12:10:24
using target database control file instead of recovery catalog allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=155 device type=DISK
recovery area destination: c:\oracle\flash_recovery_area database name (or database unique name) used for search: ORCL channel ORA_DISK_1: AUTOBACKUP C:\ORACLE\FLASH_RECOVERY_AREA\ORCL\AUTOBACKUP\2008_09_28 \O1_MF_S_666651824_4G0KDSG5_.BKP found in the recovery area
AUTOBACKUP search with format “%F” not attempted because DBID was not set channel ORA_DISK_1: restoring control file from AUTOBACKUP C:\ORACLE\FLASH_RECOVERY_AREA\ORCL\AUTOBACKUP\2008_09_28 \O1_MF_S_666651824_4G0KDSG5_.BKP
channel ORA_DISK_1: control file restore from AUTOBACKUP complete output file name=C:\ORACLE\ORADATA\ORCL\CONTROL01.CTL
output file name=C:\ORACLE\ORADATA\ORCL\CONTROL02.CTL output file name=C:\ORACLE\ORADATA\ORCL\CONTROL03.CTL Finished restore at 10/03/2008 12:10:33
8.Mount the database.
RMAN> alter database mount; database mounted
released channel: ORA_DISK_1
9.Recover the database with the recover database command.
RMAN> recover database;
Starting recover at 10/03/2008 14:03:49
Starting implicit crosscheck backup at 10/03/2008 14:03:49 allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=150 device type=DISK Crosschecked 3 objects
Finished implicit crosscheck backup at 10/03/2008 14:03:54 Starting implicit crosscheck copy at 10/03/2008 14:03:54 using channel ORA_DISK_1
Finished implicit crosscheck copy at 10/03/2008 14:03:54