
- •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

Lab 5.1: Implementing RVPC |
713 |
Lab 5.1: Implementing RVPC
In this lab, you will implement RMAN virtual private catalog (RVPC) in the recovery catalog.
1.First you need to create the RVPC database account. Log into the recovery-catalog database as a privileged user (for example, SYS) and issue the create user command.
C:\Documents and Settings\Robert>sqlplus rcat_user/rcat_user@rcat SQL*Plus: Release 11.1.0.6.0 - Production on Tue Sep 16 20:33:07 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining
and Real Application Testing options
SQL> create user rcat_001 identified by rcat_001 2 default tablespace rcat_data
3 quota unlimited on rcat_data; User created.
2.Grant the recovery_catalog_owner privilege to the new user. Here is an example of this operation:
SQL> grant recovery_catalog_owner to rcat_001; Grant succeeded.
3.Create the virtual catalog. To do this, you log into RMAN and use the create virtual catalog command, as shown in this example:
C:\Documents and Settings\Robert>rman catalog=rcat_001/rcat_001@rcat Recovery Manager: Release 11.1.0.6.0 - Production
on Tue Sep 16 20:30:04 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved. connected to recovery catalog database
RMAN> Create virtual catalog;
found eligible base catalog owned by RCAT_USER
created virtual catalog against base catalog owned by RCAT_USER
4.Now that you have created the RVPC account, you need to indicate to the recoverycatalog database which databases this account will have access too. Log into RMAN

714 Appendix A n Lab Exercises
and connect to the recovery catalog. Use the grant command and register the ORCL database to rcat_001.
C:\Documents and Settings\Robert>rman catalog=rcat_user/rcat_user@rcat Recovery Manager: Release 11.1.0.6.0 - Production
on Tue Sep 16 20:25:32 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved. connected to recovery catalog database
RMAN> grant catalog for database orcl to rcat_001; Grant succeeded.
5.Query the RC_DATABASE view and see that only the ORCL database can be seen in the RVPC.
C:\Documents and Settings\Robert>sqlplus rcat_001/rcat_001@rcat SQL*Plus: Release 11.1.0.6.0 - Production on Tue Sep 16 20:33:07 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining and Real Application
Testing options
SQL> Select name from rc_database; NAME
--------
ORCL
Lab 6.1: Restoring a Datafile Online
In this activity, we will restore a datafile while the rest of the database is online. 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.Log into the database as SYS using SQL*Plus.
C:\oracle>set oracle_sid=orcl C:\oracle>sqlplus sys as sysdba
SQL*Plus: Release 11.1.0.6.0 - Production on Fri Oct 3 00:31:07 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved.
Enter password: Connected to:

Lab 6.1: Restoring a Datafile Online |
715 |
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining
and Real Application Testing options SQL>
2.Determine the location of the database datafiles and their associated FILE_ID’s.
SQL> select file_id, file_name from dba_data_files; FILE_ID FILE_NAME
------- ---------------------------------------------------------------
4 C:\ORACLE\FLASH_RECOVERY_AREA\ORCL\DATAFILE\O1_MF_USERS_4G2Q1YTC_.DBF
3 C:\ORACLE\ORADATA\ORCL\UNDOTBS01.DBF
2 C:\ORACLE\ORADATA\ORCL\SYSAUX01.DBF
1 C:\ORACLE\ORADATA\ORCL\SYSTEM01.DBF
3.Shut down the database.
SQL> shutdown abort ORACLE instance shut down.
4.Exit SQL*Plus.
SQL> quit
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 C:\oracle>
5.From the operating prompt, delete one of the database datafiles listed in step 3. Make sure, before you delete the file, that you note its datafile number, the filename, and the location. In our example, we will delete datafile 4, which is the datafile associated with the USERS tablespace.
C:\oracle>Del C:\ORACLE\FLASH_RECOVERY_AREA\ORCL\DATAFILE\O1_MF_USERS_4G2Q1YTC_.DBF
6.Log into the database as SYS using 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:
Connected to an idle instance.

716 Appendix A n Lab Exercises
7.Start the database. Notice the error that you receive.
SQL> startup
ORACLE instance started. |
|
|
Total System Global Area |
364081152 |
bytes |
Fixed Size |
1333228 |
bytes |
Variable Size |
264243220 |
bytes |
Database Buffers |
92274688 |
bytes |
Redo Buffers |
6230016 |
bytes |
Database mounted. |
|
|
ORA-01157: cannot identify/lock data file 4 - see DBWR trace file ORA-01110: data file 4: ‘C:\ORACLE\FLASH_RECOVERY_AREA\ORCL\DATAFILE\O1_MF_USERS_4G2Q1YTC_.DBF’
8.Use the alter database datafile offline command to take datafile 4 offline.
SQL> Alter database datafile 4 offline; Database altered.
9.Open the database with the alter database open command. Exit SQL*Plus after the database has opened.
SQL> Alter database datafile 4 offline; Database altered.
SQL> alter database open; Database altered.
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
10.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. connected to target database (not started)
11.Restore database datafile 4 with the restore datafile command.
RMAN> restore datafile 4;
Starting restore at 10/03/2008 02:16:38

Lab 6.1: Restoring a Datafile Online |
717 |
|
using target database control file instead of |
recovery catalog |
|
allocated channel: ORA_DISK_1 |
|
|
channel ORA_DISK_1: SID=133 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 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:00:03 |
|
Finished restore at 10/03/2008 02:16:42 |
|
|
12.Recover datafile 4 with the recover datafile command.
RMAN> recover datafile 4;
Starting recover at 10/03/2008 02:17:53 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:01 Finished recover at 10/03/2008 02:17:55