OCA/OCP Oracle Database 11g All-in-One Exam Guide 666 Understanding Asynchronous and Synchronous I/O When RMAN reads or writes data, the I/O operations are either synchronous or asynchronous. A synchronous I/O operation limits a server process from performing more than one operation at a time. It must wait for one operation to finish before another can start. As you might expect, an asynchronous operation can initiate an I/O operation and immediately perform other operations, including initiating another I/O operation. You can use initialization parameters to control the type of I/O operations. For tape backups, you can set BACKUP_TAPE_IO_SLAVES to TRUE to configure backups for asynchronous operations. Otherwise, set it to FALSE for synchronous operations. The default is FALSE. For disk backups, most modern operating systems support native asynchronous I/O. However, if your operating system does not support it, you can still set BACKUP_ TAPE_IO_SLAVES to TRUE and direct Oracle to simulate asynchronous I/O by setting DBWR_IO_SLAVES to a nonzero value. This allocates four backup disk I/O slaves to simulate RMAN asynchronous I/O operations. Monitoring Asynchronous I/O To monitor asynchronous I/O operations, you use the dynamic performance view V$BACKUP_ASYNC_IO. The key columns to watch are the following: • IO_COUNT Number of I/Os performed on the file • LONG_WAITS Number of times the backup or restore process had to tell the OS to wait for the I/O to complete • SHORT_WAIT_TIME_TOTAL Total time, in hundredths of a second, taken for nonblocking polling for I/O completion • LONG_WAIT_TIME_TOTAL Total time, in hundredths of a second, taken while blocking waits for I/O completion The largest ratio of LONG_WAITS to IO_COUNT is a likely bottleneck in the backup process. SHORT_WAIT_TIME_TOTAL and LONG_WAIT_TIME_TOTAL are also indicators of a bottleneck if they are nonzero. This example identifies two input files with nonzero ratios: SQL> select long_waits / io_count waitcountratio, filename 2 from v$backup_async_io 3 where long_waits / io_count > 0 4 order by long_waits / io_count desc 5 ; WAITCOUNTRATIO FILENAME .248201439 /u01/oradata/bkup/6bjmt1e3_1_1 .2 /u01/app/oracle/flash_recovery_area/HR/a utobackup/2008_07_31/o1_mf_s_661554862_% u_.bkp SQL> For these two files, you may consider increasing the multiplexing to decrease or eliminate the wait times when backing them up. Chapter 17: Advanced RMAN Facilities 667 PART III Monitoring Synchronous I/O The dynamic performance view V$BACKUP_SYNC_IO will help you identify bottlenecks in synchronous I/O operations, as well as the progress of backup jobs. You use the column DISCRETE_BYTES_PER_SECOND to view the I/O rate of the operation. You then compare that rate to the maximum rate of the output device, such as a tape drive. If the rate is significantly lower, you can tune the process to improve the throughput of the backup operation by parallelization or increasing the level of multiplexing for the channel. EXAM TIP If you are using synchronous I/O but you have set BACKUP_ DISK_IO_SLAVES to TRUE, then the I/O performance is monitored in V$BACKUP_ASYNC_IO. Two-Minute Drill Identify Situations That Require an RMAN Recovery Catalog • If you have several databases to back up, and you want to use stored scripts, then a recovery catalog is highly recommended based on Oracle best practices. • Having a centralized metadata repository permits easy backup reporting because you can use one set of RC_ views in one database to query backup information. • There is no limit to the time for which a catalog will store metadata regarding backups: this makes it possible to automate restore operations involving backups taken at any time in the past. Create and Configure a Recovery Catalog • The three basic steps for creating a recovery catalog are 1) choose a new or existing database, 2) create the recovery catalog owner, and 3) create the catalog itself. • The predefined role RECOVERY_CATALOG_OWNER includes all privileges necessary to manage a recovery catalog, such as ALTER SESSION, CREATE SESSION, and CREATE TABLE. • You use the CREATE CATALOG command to create the recovery catalog. Synchronize the Recovery Catalog • The initial synchronization of the recovery catalog uses the target database controlfile. • Each database to be backed up needs to be registered with the recovery catalog using the REGISTER DATABASE command. • The catalog will resync with the controlfile-based repository automatically as necessary. OCA/OCP Oracle Database 11g All-in-One Exam Guide 668 Create and Use RMAN Stored Scripts • You create stored scripts with either the CREATE SCRIPT or CREATE GLOBAL SCRIPT command. • Local scripts are available only for the target database. • Global scripts are available for any target database or even when you are not connected to any target database. • You execute a global or local script within a RUN block. • You execute scripts with the EXECUTE [GLOBAL] SCRIPT command. Back Up the Recovery Catalog • The recovery catalog database is backed up like any other database in your environment. Create and Use a Virtual Private Catalog • A virtual private catalog facilitates the separation of duties among several DBAs. • One or more virtual private catalogs share the same base recovery catalog. • You grant the RECOVERY_CATALOG_OWNER role to each Oracle user account that will own a virtual private catalog. • The base recovery catalog owner can grant permissions on existing registered databases to virtual private catalog owners using the GRANT CATALOG command. • Once you grant a user the RECOVERY_CATALOG_OWNER role, the user creates the virtual catalog with the CREATE VIRTUAL CATALOG command. • The virtual private catalog owner uses REGISTER DATABASE to register a new database, just as a base recovery catalog user would. • You can query the DBINC data dictionary view to determine the databases accessible to the virtual private catalog owner. Create a Duplicate Database • The database connected to as the target will be duplicated to the database connected to as the auxiliary. • Preparing to create a duplicate database includes creating a password file, ensuring network connectivity, and creating an initialization parameter file for the auxiliary instance. Chapter 17: Advanced RMAN Facilities 669 PART III • The initialization parameter DB_FILE_NAME_CONVERT specifies the file system mapping for datafile and tempfile names; the initialization parameter LOG_FILE_NAME_CONVERT specifies the file system mapping for online redo log files. • The RMAN command for performing database duplication is DUPLICATE TARGET DATABASE. You can specify FROM ACTIVE DATABASE in the DUPLICATE command to create the copy from an online database instead of from a database backup. • The duplicate database has a new DBID, even if it has the same database name as the source database. Use a Duplicate Database • A duplicate database can be used to test backup and recovery procedures without affecting the availability of the source database. • You can use a duplicate database to test a database upgrade or test performance of application upgrades. • You can export one or more tables from a duplicate database and import it back into the production database as a secondary recovery method. Restore a Database onto a New Host • The instance must be started in NOMOUNT mode, possible with a dummy parameter file. • The backups and archivelogs must be available on the new host. Perform Disaster Recovery • The Oracle home must be installed at the DR site. • If the current online redo log files cannot be transferred to the DR site, an incomplete recovery must be performed. Identify the Situations That Require TSPITR • TSPITR is useful when one or more corrupt or missing tables are isolated to a single tablespace and have minimal or no dependencies with objects in other tablespaces. • You cannot use TSPITR to recover a dropped tablespace or to recover a renamed tablespace to a point in time before it was renamed. OCA/OCP Oracle Database 11g All-in-One Exam Guide 670 Perform Automated TSPITR • The recovery set is the group of datafiles containing the tablespaces to be recovered; the auxiliary set is a set of other datafiles required to recover the datafiles in the recovery set, such as the SYSTEM tablespace. • The auxiliary destination is a temporary work area used by RMAN to store auxiliary set files, log files, and a copy of the controlfile. • RMAN drops the auxiliary instance and deletes all auxiliary files at the completion of TSPITR. • You use the data dictionary view TS_PITR_CHECK to discover dependencies between the objects in the tablespace to be recovered and objects in other tablespaces, and the data dictionary view TS_PITR_OBJECTS_TO_BE_ DROPPED to determine objects you will lose after TSPITR completes. • You perform TSPITR in RMAN using the RECOVER TABLESPACE command with the UNTIL TIME and AUXILIARY DESTINATION clauses. • After TSPITR is complete, you need to bring the tablespace back online. Monitor RMAN Sessions and Jobs • You can join V$SESSION with V$PROCESS to identify the operating system processes associated with each RMAN channel. • The RMAN command SET COMMAND ID helps you to distinguish processes for different backup jobs in V$SESSION. • Use V$SESSION_LONGOPS to monitor the status of RMAN jobs that run for more than six seconds; the view contains both detail rows and aggregate rows for each RMAN job. • You must set the initialization parameter STATISTICS_LEVEL to TYPICAL or ALL before RMAN will record job status information in V$SESSION_LONGOPS. Tune RMAN • You can allocate up to 255 channels per RMAN session, and each channel can read up to 64 datafiles in parallel. • You can calculate the level of multiplexing by using this formula: min(MAXOPENFILES, min(FILESPERSET, files_per_channel)) • You tune the BACKUP command by using the MAXPIECESIZE, FILESPERSET, MAXOPENFILES, and BACKUP DURATION parameters. • The BACKUP parameter BACKUP DURATION can be set to MINIMIZE TIME to perform the backup as quickly as possible or MINIMIZE LOAD to reduce the I/O demands on the database. Chapter 17: Advanced RMAN Facilities 671 PART III Configure RMAN for Asynchronous I/O • You set the initialization parameter BACKUP_TAPE_IO_SLAVES to TRUE to configure tape backups for asynchronous operations. • Setting the initialization parameter DBWR_IO_SLAVES allocates four backup disk I/O slave process to simulate RMAN asynchronous I/O operations. • Use the dynamic performance view V$BACKUP_ASYNC_IO to monitor asynchronous RMAN operations. Self Test 1. Which of the following are good reasons to use a recovery catalog instead of the target database controlfile? (Choose three.) A. You can keep stored scripts in the recovery catalog. B. You save space in the controlfile of the target database used for RMAN backup information. C. A recovery catalog is easier to maintain than a controlfile in each target database. D. The recovery catalog can report on the tablespaces and datafiles in the target database at any point in time since the recovery catalog was created. E. A recovery catalog can be used to manage RMAN information for more than one database. 2. If you do not use a recovery catalog, what data dictionary or dynamic performance views must you query to retrieve RMAN backup information? (Choose the best answer.) A. The V$ views on each target such as V$BACKUP_SET and V$DATAFILE_ COPY B. The RC_ views on each target C. The DBA_ views on each target D. V$CONTROLFILE 3. Which statement is true about RMAN local and global scripts? (Choose the best answer.) A. A local script is available only for a single target database. B. A global script references a list of commands in an external file. C. A local script references a list of commands in an external file. D. A global script can execute commands against many target databases simultaneously. E. A local script is available only to the user that created it. A global script is available to all users. OCA/OCP Oracle Database 11g All-in-One Exam Guide 672 4. You create and execute a stored local script using the following commands: create script full_backup { backup as compressed backupset database; delete noprompt obsolete; } execute script full_backup; What happens when you run these commands? (Choose the best answer.) A. The script does not run because it must be executed within a RUN block. B. A full backup occurs and all previous backups and archived redo logs outside of the retention period or retention policy are deleted. C. The script creation step fails because you must explicitly allocate one or more channels with a stored script. D. The script does not run because you must specify a target database when you use a local script. 5. The virtual catalog database owner VPC1 has the RECOVERY_CATALOG_ OWNER privilege on the database CATDB2 in addition to the RMAN REGISTER DATABASE privilege. Which of the following sets of commands will allow an 11g RMAN client to create a virtual catalog, register a new database DW, and create a full database backup? A. RMAN> connect catalog vpc1/vpc1pwd@dw RMAN> create virtual catalog; RMAN> connect target system/syspwd@catdb2; RMAN> register database; RMAN> backup database; B. RMAN> connect catalog vpc1/vpc1pwd@catdb2 RMAN> exec catowner.dbms_rcvcat.create_virtual_catalog; RMAN> connect target system/syspwd@dw; RMAN> register database; RMAN> backup database; C. RMAN> connect catalog vpc1/vpc1pwd@catdb2 RMAN> create virtual catalog; RMAN> connect target system/syspwd@dw; RMAN> grant catalog for database DW to vpc1; RMAN> backup database; D. RMAN> connect catalog vpc1/vpc1pwd@catdb2 RMAN> create virtual catalog; RMAN> connect target system/syspwd@dw; RMAN> register database; RMAN> backup database; Chapter 17: Advanced RMAN Facilities 673 PART III 6. To create a duplicate database, put the following steps in the correct order: 1. Start the auxiliary instance as NOMOUNT. 2. Allocate auxiliary channels if necessary. 3. Run the RMAN DUPLICATE command. 4. Create a password file for the auxiliary instance. 5. Ensure network connectivity to the auxiliary instance. 6. Open the auxiliary instance. 7. Start the source database in MOUNT or OPEN mode. 8. Create an initialization parameter file for the auxiliary instance. 9. Create backups or copy existing backups and archived log files to a common location accessible by the auxiliary instance. A. 5, 4, 8, 1, 7, 9, 3, 2, 6 B. 4, 5, 8, 1, 7, 9, 2, 3, 6 C. 4, 5, 8, 1, 7, 9, 3, 2, 6 D. 5, 4, 1, 8, 7, 9, 2, 3, 6 7. You can use TSPITR for which of the following scenarios? (Choose two answers.) A. You accidentally drop the USERS tablespace. B. You dropped two columns in a table. C. You renamed a tablespace and want to recover the tablespace with the old name. D. A user deleted most of the rows in a table that does not have any dependencies on objects in other tablespaces. 8. Identify the step you must perform manually after using automated TSPITR in RMAN. (Choose the best answer.) A. Bring the recovered tablespace(s) online. B. Resync the recovery catalog. C. Delete the temporary files created in the auxiliary location. D. Create a text-based initialization parameter file for the auxiliary instance. 9. Which of the following two dynamic performance views can you use to identify the relationship between Oracle server sessions and RMAN channels? (Choose two answers.) A. V$PROCESS and V$SESSION B. V$PROCESS and V$BACKUP_SESSION C. V$PROCESS and V$BACKUP_ASYNC_IO D. V$BACKUP_ASYNC_IO and V$SESSION E. V$BACKUP_SYNC_IO and V$BACKUP_ASYNC_IO OCA/OCP Oracle Database 11g All-in-One Exam Guide 67 4 10. The initialization parameters in your database are set as follows: BACKUP_TAPE_IO_SLAVES = TRUE LARGE_POOL_SIZE = 50M JAVA_POOL_SIZE = 75M PGA_AGGREGATE_TARGET = 20M Identify the correct statement regarding where RMAN allocates the memory buffers for tape backup. (Choose the best answer.) A. RMAN uses the Java pool in the SGA. B. RMAN uses the shared pool in the SGA. C. RMAN allocates memory from the large pool in the PGA. D. RMAN allocates memory from the large pool in the SGA. Self Test Answers 1. þ A, D, and E. Using a recovery catalog allows you to create and maintain stored scripts. In addition, it keeps a running history of all changes to the database tablespaces and datafiles because the recovery catalog was created. Finally, you can store recovery information for more than one database in a recovery catalog. ý B and C. B is not a good reason to use a recovery catalog because the RMAN repository information is always stored in the controlfile even if you use a recovery catalog. C is also not a good reason, because a recovery catalog requires more setup and maintenance in addition to a backup of another database. Also, the controlfile is simpler to manage, and its size can be controlled with the parameter CONTROL_FILE_RECORD_KEEP_TIME. It is much simpler to export a copy of the controlfile whenever the database structure changes using ALTER DATABASE BACKUP CONTROLFILE TO TRACE. 2. þ A. When you do not use a recovery catalog, information about RMAN backups is available on each individual target in dynamic performance views such as V$BACKUP_SET and V$DATAFILE_COPY. These views are sourced from the target database controlfile. ý B, C, and D. B is wrong because the RC_ views exist only in the database containing the recovery catalog. C is wrong because the DBA_ views do not maintain RMAN information. D is wrong because V$CONTROLFILE contains only the locations of each copy of the target database’s controlfile. 3. þ A. A local script is available only to the connected target database at the time the script was created. ý B, C, D, and E. B and C are wrong because both global and local scripts are stored in the recovery catalog. D is wrong because any script operates on Chapter 17: Advanced RMAN Facilities 675 PART III one database at a time. E is wrong because both local and global scripts are available to any user that authenticates with the recovery catalog. 4. þ A. Stored scripts, whether they are local or global, must be run within a RUN block as follows: run {execute script full_backup;} ý B, C, and D. B is wrong because a script must be enclosed in a RUN block. C is wrong because you can include a channel allocation or use the default channel in the RUN command containing the EXECUTE SCRIPT command. D is wrong because both local and global scripts apply only to the currently connected target database. 5. þ D. To create the virtual catalog, you connect to the base catalog, create the virtual catalog, connect to the target database, register the database, and finally back it up. You need to create the virtual catalog only once, and each target database needs to be registered only once. Subsequent backup operations can occur after connecting to the base catalog and the target database. ý A, B, and C. A is wrong because the base catalog and virtual catalog are on the instance with the service name CATDB2, not the target database DW. B is wrong because EXEC CATOWNER.DBMS_RCVCAT.CREATE_VIRTUAL_ CATALOG is only for pre-11g clients and must be run by the virtual catalog owner at a SQL> prompt. C is wrong because GRANT CATALOG FOR DATABASE DW TO VPC1 must be run by the base catalog owner and only if the database is already registered in the base catalog. 6. þ B. These steps are in the correct order. ý A, C, and D are in the wrong order. 7. þ B and D. You can use TSPITR to recover from DDL changes to a table; in addition, you can recover a table that has corrupted or erroneously altered rows. TSPITR is also useful if the table is dropped with the PURGE option and therefore not reclaimable from the recycle bin. þ A and C. A is wrong because you cannot use TSPITR for dropped tablespaces. C is wrong because you cannot use TSPITR to recover the tablespace with a previous name; in other words, the tablespace was renamed at some point in the past. 8. ý A. This step must be performed manually after RMAN completes the automated portion of TSPITR. þ B, C, and D. B is wrong because the resync will occur automatically when necessary. C is wrong because RMAN automatically shuts down the auxiliary instance and removes all temporary files used for the recovery operation. D is wrong because you need to manually create a text-based initialization parameter file for duplicating a database, but not for TSPITR. . of from a database backup. • The duplicate database has a new DBID, even if it has the same database name as the source database. Use a Duplicate Database • A duplicate database can be used. catalog owner. Create a Duplicate Database • The database connected to as the target will be duplicated to the database connected to as the auxiliary. • Preparing to create a duplicate database. V$BACKUP_ASYNC_IO and V$SESSION E. V$BACKUP_SYNC_IO and V$BACKUP_ASYNC_IO OCA/ OCP Oracle Database 11g All-in-One Exam Guide 67 4 10. The initialization parameters in your database are set as follows: BACKUP_TAPE_IO_SLAVES