47
                                                                                                                          DBA FAQ   RMAN How do you enable the encryption for RMAN backups? A:If you wish to modify your existing backup environment so that all RMAN backups are encrypted perform the following steps: Set up the Oracle Encryption Wallet Issue the following RMAN command: RMAN> CONFIGURE ENCRYPTION ALGORITHM 'AES256'; -- use 256 bit encryption RMAN> CONFIGURE ENCRYPTION FOR DATABASE ON; -- encrypt backups In catalog database, if some of the blocks are corrupted due to system crash, How will you recover? A:using RMAN BLOCK RECOVER command List some of the RMAN catalog view names which contains the catalog information ? A:RC_DATABASE_INCARNATION RC_BACKUP_COPY_DETAILS RC_BACKUP_CORRUPTION RC_BACKUP-DATAFILE_SUMMARY How do you install the RMAN recovery catalog? A:1) Create connection string at catalog database. 2) At catalog database, create one new user or use existing user and give that user a recovery_catalog_owner privilege. 3) Login into RMAN with connection string a) export ORACLE_SID= b) rman target catalog@connection string 4)rman> create catalog; 5)register database; How do you setup the RMAN tape backups? A:RMAN Target / run { Allocate channel ch1 device type sbt_tape maxpiecesize 4g Format' D_ U_ T_ t'; sql 'alter system switch logfile'; Backup database; backup archivelog from time 'sysdate-7'; Backup Format ' D_CTLFILE_P_ U_ T_ t' Current controlfile; release channel ch1; } This is backup script for Tivoli Backup Server 1 ORAFACT

50199736-FAQ-RMAN

  • Upload
    harssh

  • View
    216

  • Download
    2

Embed Size (px)

Citation preview

Page 1: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   

RMANHow do you enable the encryption for RMAN backups? A:If you wish to modify your existing backup environment so that all RMAN backups are encrypted perform the following steps:Set up the Oracle Encryption WalletIssue the following RMAN command:RMAN> CONFIGURE ENCRYPTION ALGORITHM 'AES256'; -- use 256 bit encryptionRMAN> CONFIGURE ENCRYPTION FOR DATABASE ON; -- encrypt backupsIn catalog database, if some of the blocks are corrupted due to system crash, How will you recover?A:using RMAN BLOCK RECOVER commandList some of the RMAN catalog view names which contains the catalog information ? A:RC_DATABASE_INCARNATION RC_BACKUP_COPY_DETAILS RC_BACKUP_CORRUPTION RC_BACKUP-DATAFILE_SUMMARY How do you install the RMAN recovery catalog? A:1) Create connection string at catalog database.2) At catalog database, create one new user or use existing user and give that user a recovery_catalog_owner privilege.3) Login into RMAN with connection string

a) export ORACLE_SID=b) rman target catalog@connection string4)rman> create catalog;5)register database;How do you setup the RMAN tape backups? A:RMAN Target / run{Allocate channel ch1 device type sbt_tape maxpiecesize 4gFormat' D_ U_ T_ t';sql 'alter system switch logfile';Backup database;backup archivelog from time 'sysdate-7';Backup Format ' D_CTLFILE_P_ U_ T_ t' Current controlfile;release channel ch1;}This is backup script for Tivoli Backup Server

1 ORAFACT

Page 2: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   What are the various tape backup solutions available in the market?A:There are various Media Management Layer (MML) solutions available for Oracle. 1) EMC's Legato Networker Module for Oracle 2) Symantec's Netbackup Database Agent for Oracle 3) IBM's Tivoli Storage Management (TSM) Database Agent 4) and others in the market.What is Channel? How do you enable the parallel backups with RMAN? A:Channel is a link that RMAN requires to link to target database. This link is required when backup and recovery operations are performed and recorded. This channel can be allocated manually or can be preconfigured by using automatic channel allocation. The number of allocated channels determines the maximum degree of parallelism that is used during backup restore or recovery. For example if you allocate 4 channels for a backup operation 4 background processes for the operation can run concurrently. Parallelization of backup sets allocates multiple channels and assigns files to specific channels. You can configure parallel backups by setting a PARALLELISM option of the CONFIGURE command to a value greater than 1 or by manually allocating multiple channels. RMAN> CONFIGURE DEVICE TYPE PARALLELISM 2 BACKUP TYPE TO COMPRESSED BACKUPSET;What is the difference between obsolete RMAN backups and expired RMAN backups?A:The term obsolete does not mean the same as expired. In short obsolete means "not needed " whereas expired means "not found."How do you clone the database using RMAN software? Give brief steps? When do you use crosscheck command?A:Check whether backup pieces proxy copies or disk copies still exist.Two commands available in RMAN to clone database:1) Duplicate2) Restore.Where RMAN keeps information of backups if you are using RMAN without Catalog?A:RMAN keeps information of backups in the control file.CATALOG vs NOCATALOGthe difference is only who maintains the backup records like when is the last successful backup incremental differential etc. In CATALOG mode another database (TARGET database) stores all the information.In NOCATALOG mode controlfile of Target database is responsible.How RMAN improves backup time?A:RMAN backup time consumption is very less than compared to regular online backup as RMAN

2 ORAFACT

Page 3: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   copies only modified blocksAdd channel to improve the performance of rman but it create session on DB and I/O on disk will increase so configure channel at proper number.What is the advantage of RMAN utility?A:Advantage over tradition backup system:1). copies only the filled blocks i.e. even if 1000 blocks is allocated to datafile but 500 are filled with data then RMAN will only create a backup for that 500 filled blocks.2). incremental and accumulative backup.3). catalog and no catalog option.4). detection of corrupted blocks during backup;5). can create and store the backup and recover scripts.6). increase performance through automatic parallelization( allocating channels), less redo generation.Can a schema be restored in oracle 9i RMAN when the schema having numerous table spaces?A:RMAN gives the command to find all the tablespaces and hence the datafiles belonging to different schemas as:REPORT SCHEMA;This command lists all the schemas tablespace names and the corresponding data files. After listing we can restore the datafiles or the tablespaces corresponding to a particular schema.What are the steps required to perform in $ORACLE_HOME for enabling the RMAN backups with netbackup or TSM tape library software?A:1.Install TDPO (default path /usr/tivoli/tsm/client/oracle/)2.Once u installed the TDPO automatically one link is created from TDPO directory to /usr/lib.Now we need to Create soft link between OS to ORACLE_HOMEln -s /usr/lib/libiobk64.a $ORACLE_HOME/lib/libobk.a(very imporatant)3.Uncomment and Modify tdpo.opt file which in /usr/tivoli/tsm/client/oracle/bin/tdpo.opt as followsDSMI_ORC_CONFIG /usr/tivoli/tsm/client/oracle/bin64/dsm.optDSMI_LOG /home/tmp/oracleTDPO_NODE backupTDPO_PSWDPATH /usr/tivoli/tsm/client/oracle/bin644.create dsm.sys file in same path and add the entriesSErvername <Server name >TCPPort 1500passwordacess promptnodename backupenablelanfree yesTCPSERVERADDRESS <Server Address>5.Create dsm.opt file add an entrySErvername <Server name >5.Then take backupRMAN>run

3 ORAFACT

Page 4: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   { allocate channel t1 type 'sbt_tape' parms 'ENV (TDPO_OPTFILE /usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)'; backup database include current controlfile; release channel t1; } How do you identify the block corruption in RMAN database? How do you fix it? A:using v$block_corruption view u can find which blocks corrupted.Rman>> block recover datafile <fileid> block <blockid>;Using the above statement u recover the corrupted blocks.How do you see information about backups in RMAN? A:Use this SQL to checkSQL> SELECT sid,totalwork,sofar FROM v$session_longops WHERE sid=153;Here give SID when back start it will show SIDRMAN> List Backup;What is the significance of incarnation and DBID in the RMAN backups?A:DBIDmeans database id.Incunation means: Database incarnation is effectively a new “version” of the database that happens when you reset the online redo logs using “alter database open resetlogs;”.Database incarnation falls into following category Current, Parent, Ancestor and Siblingi) Current Incarnation: The database incarnation in which the database is currently generating redo.ii) Parent Incarnation: The database incarnation from which the current incarnation branched following an OPEN RESETLOGS operation.iii) Ancestor Incarnation: The parent of the parent incarnation is an ancestor incarnation. Any parent of an ancestor incarnation is also an ancestor incarnation.Sibling Incarnation: Two incarnations that share a common ancestor are sibling incarnations if neither one is an ancestor of the other.Outline the steps for changing the DBID in a cloned environment?A:Mount the databse $export ORACLE_SID test$ nid target system/managerIt will change and automaticaly generate new id and asign it to the database.How do you verify the integrity of the image copy in RMAN environment?A:rman> catalog datafilecopy 'f:testsystem.dbf';rman> backup validate check logical datafile 'f:testsystem.dbf';SQL> SELECT * FROM v$database_block_corruption;

4 ORAFACT

Page 5: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   List atleast 6 advantages of RMAN backups compare to traditional hot backups?A:RMAN has the following advantages over Traditional backups:1. Ability to perform INCREMENTAL backups2. Ability to Recover one block of datafile3. Ability to automatically backup CONTROLFILE and SPFILE4. Ability to delete the older ARCHIVE REDOLOG files, with the new one's automatically.5. Ability to perform backup and restore with parallelism.6. Ability to report the files needed for the backup.7. Ability to RESTART the failed backup, without starting from beginning.8. Much faster when compared to other TRADITIONAL backup strategies.Can RMAN be used to backup flashback logs? A: No. Flashback Logs are not backed up.Flashback Logs are considered to be transient files and cannot be backed up by RMAN. They are not needed for media recovery.Is there a separate background process for writing flashback logs? A: Yes. RVWR (Recovery Writer, a.k.a Flashback Writer) was introduced in Oracle 10g to write flashback data from the Flashback Buffer in the SGA to the flashback database logs on disk.How to list restore points in RMAN?A: You can use either the RC_RESTORE_POINT view in the recovery catalog or the commandLIST RESTORE POINT [ALL|restore_point_name] in RMAN.How do you backup the entire database?A:RMAN> BACKUP DATABASE;How do you backup an individual tablespaces?A:RMAN> CONFIGURE DEFAULT DEVICE TYPE TO DISK;RMAN> BACKUP TABLESPACE system;How do you backup datafiles and control files?A:RMAN> BACKUP DATAFILE 3;RMAN> BACKUP CURRENT CONTROLFILEWhy do need to use the flashback?A: It eliminates restore process and it is faster than traditional point-in-time recovery.When are you not able to Flashback Database?

● The control file has been restored or recreated,● A tablespace has been dropped,● A data file has been shrunk.

5 ORAFACT

Page 6: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   How do you test that your recovery was successful?SQL> SELECT count(*) FROM flashback_table;How do you backup the Flash Recovery Area?A:RMAN> BACKUP RECOVERY FILES;The files on disk that have not previously been backed up will be backed up. They are full and incremental backup sets, control file auto-backups, archive logs, and datafile copies.How to enable Fast Incremental Backup to backup only those data blocks that have changed?A:SQL> ALTER DATABASE enable BLOCK CHANGE TRACKING;How do you set the flash recovery area?A:SQL> ALTER SYSTEM SET db_recovery_file_dest_size = 100G;SQL> ALTER SYSTEM SET db_recovery_file_dest = ‘/u10/oradata/school’;How can you use the CURRENT_SCN column in the V$DATABASE view to obtain the current SCN?A:SQL> SELECT current_scn FROM v$database;How RMAN improves backup time?Add channelto improve the performance of rman, but it create session on DB and I/O on disk will increase, so configure channel at proper numberHow do you see information about backups in RMAN?Use this SQL to checkSQL> SELECT sid,totalwork,sofar FROM v$session_longops WHERE sid=153; Here give SID when back start it will show SIDWhere RMAN keeps information of backups if you are using RMAN without Catalog?CATALOG vs NOCATALOGthe difference is only, who maintains the backup records like,when is the lastsuccessfulbackup, incremental,differential,etc.,In CATALOG mode, another database (TARGET database) stores all the information.In NOCATALOGYou have taken a manual backup of a datafile using o/s. How RMAN will know about it?You have to catalog that manual backup in RMAN's repository by commandRMAN> catalog datafilecopy '/DB01/BACKUP/users01.dbf';restrictions:> Accessible on disk> A complete image copy of a single fileIn catalog database, if some of the blocks are corrupted due to system crash, How will you recover?using RMAN BLOCK RECOVER command

6 ORAFACT

Page 7: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   List advantages of RMAN backups compare to traditional hot backups?RMAN has the following advantages over Traditional backups:1. Ability to perform INCREMENTAL backups2. Ability to Recover one block of datafile3. Ability to automatically backup CONTROLFILE and SPFILE4. Ability to delete the older ARCHIVE REDOLOG filesHow do you identify the expired, active, obsolete backups? Which RMAN command you use?Use command:Rman > crosscheck backup; Rman > crosscheck archivelog all; Rman > list backup;Rman > list archive logallHow do you enable the autobackup for the controlfile using RMAN?issue command at rman prompt..... RMAN> configure controlfile autobackup on;also we can configure controlfile backup format......RMAN> configure controlfile autobackup format for device type diskHow do you identify what are the all the target databases that are being backed-up with RMAN database?You dont have any view to identifiy whether it is backed up or not . The only option is connect to the target database and give list backup, this will give you the backup information with date and timiningWhat is the difference between cumulative incremental and differential incremental backups?Differencial backup: This is the default type of incremental backup which backs up all blocks changed after the most recent backup at level n or lower.Cumulative backup: Backup all blocks cahnged after the most recent backup at level n-1 or lowerExplain how to setup the physical stand by database with RMAN?$ Export ORACLE_SID=TEST $ rman target / RMAN> show all; Using target database controlfile instead of recovery catalog RMAN configuration parameters are: CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 1 DAYS; CONFIGURE BACKUP OPTIMIZATIONWhat is auxiliary channel in RMAN? When do you need this? An auxiliary channel is a link to auxiliary instance. If you do not have automatic channels configured, then before issuing the DUPLICATE command, manually allocate at least one auxiliary channel within the same RUN command. What is backup set? RMAN can also store its backups in an RMAN-exclusive format which is called backup set. A backup set is a collection of backup pieces, each of which may contain one or more datafile backups

What is RMAN and how does one use it?Recovery Manager (or RMAN) is an Oracle provided utility for backing-up, restoring and recovering Oracle Databases. RMAN ships with the database server and doesn't require a separate installation. The RMAN executable is located in your ORACLE_HOME/bin directory.

7 ORAFACT

Page 8: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   What kind of backup are supported by RMAN? Backup Sets Datafiles Copies OS Backup

What is the Flash Recovery Area?A: It is a unified storage location for all recovery-related files and activities in an Oracle Database. It includes Control File, Archived Log Files, Flashback Logs, Control File Autobackups, Data Files, and RMAN files. How do you define a Flash Recovery Area?A: To define a Flash Recovery Area set the following Oracle Initialization Parameters. SQL> ALTER SYSTEM SET db_recovery_file_dest_size = 100G; SQL> ALTER SYSTEM SET db_recovery_file_dest = ‘/u10/oradata/school’; How do you use the V$RECOVERY_FILE_DEST view to display information regarding the flash recovery area?A:SQL> SELECT name, space_limit, space_used, space_reclaimable, number_of_files FROM v$recovery_file_dest; How can you display warning messages?A:SQL> SELECT object_type, message_type, message_level, reason, suggested_action FROM dba_outstanding_alerts; How do you backup the Flash Recovery Area?A:RMAN> BACKUP RECOVERY FILES; The files on disk that have not previously been backed up will be backed up. They are full and incremental backup sets, control file auto-backups, archive logs, and datafile copies. How to use the best practice to use Oracle Managed File (OMF) to let Oracle database to create and manage the underlying operating system files of a database?A:SQL> ALTER SYSTEM SET db_create_file_dest = ‘/u03/oradata/school’; SQL> ALTER SYSTEM SET db_create_online_dest_1 = ‘/u04/oradata/school’; How to enable Fast Incremental Backup to backup only those data blocks that have changed?

8 ORAFACT

Page 9: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   A:SQL> ALTER DATABASE enable BLOCK CHANGE TRACKING; How do you monitor block change tracking?A:SQL> SELECT filename, status, bytes FROM v$block_change_tracking; It shows where the block change-tracking file is located, the status of it and the size. How do you use the V$BACKUP_DATAFILE view to display how effective the block change tracking is in minimizing the incremental backup I/O?A:SQL> SELECT file#, AVG(datafile_blocks), AVG(blocks_read), AVG (blocks_read/datafile_blocks), AVG(blocks) FROM v$backup_datafile WHERE used_change_tracking = ‘YES’ AND incremental_level > 0 GROUP BY file#; If the AVG (blocks_read/datafile_blocks) column is high then you may have to decrease the time between the incremental backups. How do you backup the entire database?A:RMAN> BACKUP DATABASE; How do you backup an individual tablespaces?A:RMAN> CONFIGURE DEFAULT DEVICE TYPE TO DISK; RMAN> BACKUP TABLESPACE system; How do you backup datafiles and control files?A:RMAN> BACKUP DATAFILE 3; RMAN> BACKUP CURRENT CONTROLFILE; Use a fast recovery without restoring all backups from their backup location to the location specified in the controlfile.A:RMAN> SWITCH DATABASE TO COPY; RMAN will adjust the control file so that the data files point to the backup file location and then starts recovery. Why use Rman ?A. 1. No Extra Costs.. It is available free.2.RMAN introduced in Oracle 8 it has become simpler with new version and easier

9 ORAFACT

Page 10: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   that user managed backups.3.Proper Security4.You are 100% sure your database has been backed up .5.It contains details of backup taken in the central repository6.Facility of Testing validity of backups also command like cross check to checkthe status of backup.7.Oracle 10g has got further optimized incremental backups with has resulted inimprovement of performance during backup8.and recovery time9.Parrallel operation are supported10.Better Querying facility for knowing different details of backup.11.No Extra redo generated when backup is taken. compared to online backup12.Without rman.which results in saving of space in hard disk.13.RMAN is an intelligent tool14.Maintains repository of backup metadata.15.Remembers backup locations16.Knows what needs backup set locations17.Knows what needs to be backed up18.Knows what is required for recovery19.Know what backups are redundant20.It handles database corruptionsOracle Enhancement for Rman in 10gA. 1.Flash Recovery Area2.Incrementally Updated Backups3.Faster Incremental Backups4.SWITCH DATABASE COMMAND.5.Binary Compression6.Global Scripting7.Duration Clause8.Configure This9.Oracle Enhancement for Rman in 10g10.Automatic Channel Failover11.Compress Backup Sets12.Recovery Through Reset Logs13.Cross Backup SetsGlobal ScriptingA.RMAN> print script full_backup to file 'my_script_file.txt'Oracle Database 10g provides a new concept of global scripts, which you can executeagainst any database registered in the recovery catalog, as long as your RMAN client isconnected to the recovery catalog and a target database simultaneously.CPISOLUTION.COMRMAN> create global script global_full_backup

10 ORAFACT

Page 11: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   { backup database plus archivelog;delete obsolete;delete global script ‘full_backup’;List Script Names;Run { Execute Global Script global_backup_db;}Global RMAN ScriptsAuto Backp of Control fileA.Whenever there is a structure change ,Aditonally It Supports1.Backup of Server Parameter File2.Parrallel Operation Supported3.Extensive Reporting Available4.Scripting5.Duplex Backup sets6.Corrupt Block Detection7.Backup archive LogsSpeed Of Backup DevicesA.The maximum speed at which a backup can run will be dictated by:Max Mb/Sec = min(disk read Mb/s, tape write Mb/s)It is not possible to make a backup to go faster than this, period.Identifying RMAN ProcessesProblemAn RMAN backup job is running too long. You would like to identify and monitor the RMANprocesses associated with the backup job.SolutionInspect RMAN’s output messages to your terminal to identify your session identifier (SID). Ifyou’re sending output to a log file, then look for the session ID in that file.When you start an RMAN job, you should see output similar to this on your screen. In thisexample, the SID is 146:allocated channel: ORA_DISK_1channel ORA_DISK_1: sid=146 devtype=DISKNext, use the V$SESSION and V$PROCESS views to identify which database serversessions correspond to RMAN channels:SQL> SELECT b.sid, b.serial#, a.spid, b.client_info2 FROM v$process a, v$session b3 WHERE a.addr = b.paddr4 AND b.client_info LIKE '%rman%';This output shows that there is currently one RMAN channel allocated:SID SERIAL# SPID CLIENT_INFO---------- ---------- ------------ -------------------------146 29 4376 rman channel=ORA_DISK_1How It Works

11 ORAFACT

Page 12: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   When you first connect to RMAN, Oracle will start two sessions and two corresponding OSprocesses. There will also be a session and process started for each subsequent channel thatis allocated. You can monitor and view these channel processes via the V$SESSION andV$PROCESS views.The SID and SERIAL# values are useful when querying from other V$ views where youwant to select and return rows just for your session identifier or serial number (and not hundredsof unrelated rows). The SPID column in V$PROCESS identifies the OS process ID.You can also use set command id to label a process. This will help you identify a channelprocess if you have many RMAN jobs running at the same time. You must put set command idafter the allocate channel command, or your specified identifier will not be included in theCLIENT_INFO output. This example sets the command ID to my_session:RMAN> run{2> allocate channel d1 type disk;3> set command id to 'my_session';4> backup database;5> }The output (of the previous SQL statement) now includes the ID of my_session:SID SERIAL# SPID CLIENT_INFO---------- ---------- ------------ ------------------------------146 29 4376 id=my_session,rman channel=d1Measuring Backup PerformanceProblemYou want to determine whether backups are taking longer and longer.SolutionUse information in V$RMAN_BACKUP_JOB_DETAILS for statistics on backups. Thefollowingquery displays the time taken for recent backup jobs:SQL> SELECT session_recid, input_bytes_per_sec_display,2 output_bytes_per_sec_display,3 time_taken_display, end_time4 FROM v$rman_backup_job_details5 ORDER BY end_time;You should see output similar to the following:SESSION_RECID INPUT_BYTES_PER OUTPUT_BYTES_PE TIME_TAKEN_DISPLAYEND_TIME------------- --------------- --------------- -------------------- ---------1096 8.60M 7.69M 00:14:25 20-DEC-061101 1.88M 1.78M 00:42:03 21-DEC-061110 9.59M 8.56M 00:14:56 22-DEC-061114 9.75M 8.71M 00:14:52 23-DEC-061116 10.73M 9.58M 00:14:31 24-DEC-06This output indicates that there might have been some sort of a snafu on December 21,possibly related to the sun being directly over the tropic of Capricorn at the time of the

12 ORAFACT

Page 13: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   backup. Seriously, the job showing a duration of 42 minutes is most likely the result of a DBAdoing some experimentation and running several backups interactively, from the commandprompt, during one connected session, whereas the other sessions were small backup jobsthat connected, ran the backup, and then disconnected from RMAN.How It WorksMeasuring the duration of your backups provides a good starting point from which you canbegin tuning your RMAN backups. The V$RMAN_BACKUP_JOB_DETAILS view contains aplethora of information about backup durations and I/O rates.Tuning Media RecoveryProblemYou want to manually adjust the degree of parallelism that Oracle uses for media recovery tomatch the number of CPUs on your database server.SolutionStarting with Oracle Database 10g, when you issue an RMAN recover command from eitherwithin RMAN or within SQL*Plus, Oracle’s default behavior is to automatically perform mediarecovery operations in parallel. However, if you want to override this default behavior, you canuse the recover parallel or recover noparallel command. This next line of code instructsOracle to spawn four parallel processes to apply redo:RMAN> recover database parallel 4;If you don’t want Oracle to recover in parallel, then specify the noparallel clause asshown here:RMAN> recover database noparallel;How It WorksOrdinarily you don’t need to adjust the degree of parallelism for media recovery. This isbecause Oracle automatically parallelizes media recovery for you. Oracle determines thenumber of parallel processes to spawn for media recovery from the initialization parametercpu_count. This parameter is set by default to the number of CPUs on your database server.For example, if your server has two CPUS, then by default cpu_count will be set to 2 whenyou create your database. For this server, Oracle will spawn two processes to apply redo anytimeyou issue a recover command (from either RMAN or SQL*Plus).Oracle’s documentation states that systems with efficient asynchronous I/O see little benefitfrom parallel media recovery. You should test whether adjusting the degree of parallelismimproves performance before you attempt this in a production environment.Note :The initialization parameter recovery_parallelism has no effect on media recovery. Therecovery_parallelism parameter affects only crash recovery.Slowing RMAN DownProblemYou’ve noticed that your application performance degrades when the RMAN backups are running.You want to reduce RMAN’s I/O rate so that it spreads out its impact on the system over aperiod of time.SolutionUse one of the following to control RMAN’s I/O rate:

13 ORAFACT

Page 14: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   • The backup duration ... minimize load command• The rate clause of the allocate channel or configure channel commandUsing backup duration ... minimize loadUse the backup duration ... minimize load command to evenly distribute RMAN I/Oover a period of time. This example shows how to spread the I/O of an RMAN backup over a45-minute period:RMAN> backup duration 00:45 minimize load database;RMAN will report the time taken for the backup operation in the output, as shown in thissnippet:channel ORA_DISK_1: throttle time: 0:44:43Finished backup at 10-MAR-07Using rateYou can also use the rate clause of the allocate channel command or the configure channelcommand to control RMAN’s I/O rate. This example configures channel 1 to have a maximumread rate of 5MB per second:RMAN> configure channel 1 device type disk rate=5M;The rate can be set using M, K, or G (for megabytes, kilobytes, and gigabytes).How It WorksThe duration clause specifies the amount of time you want an RMAN backup to take. Whenyou use the minimize load clause, this instructs RMAN to spread out the I/O load over theduration of the specified time. When minimizing the load, RMAN will monitor and adjust theI/O rate so that the resources are consumed evenly across the duration of the backup. The formatfor the time value of the duration clause is HH:MM (HH is hours and MM is minutes). Youmust specify the hour and colon components of the time even if the hour component is zero.If a backup does not complete within the specified duration period, then RMAN will abortthe backup. If you are running backup commands from within a run{} block, then RMAN willnot execute subsequent commands. You can use the partial clause to instruct RMAN to continuerunning subsequent commands within a run{} block (even if the backup doesn’t finishin the specified time).In this example, the partial clause instructs RMAN to execute all subsequent commandsin the run{} block even if the first command doesn’t finish within the specified time:RMAN {2> backup duration 1:00 partial minimize load database;3> backup archivelog all;3> backup current controlfile;4> }Whether you use the partial clause or not, RMAN will still consider any backup sets thatwere created successfully (before the time limit was exceeded) to be usable for restore operations.If you want to force RMAN to include only one datafile per backup set, then you can usethe filesperset parameter as shown here:RMAN> backup duration 01:00 minimize load database filesperset 1;When you set the filesperset parameter to 1, it forces RMAN to create each backup setwith only one datafile within it. Any backup sets that complete before the duration time isexceeded will be marked as successful.

14 ORAFACT

Page 15: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   Note: Oracle does not recommend using backup duration ... minimize load when using tapedevices. When using minimize load, RMAN could reduce its I/O to a rate that is too low to keepthe tape device streaming.Configure Retention policy to redundancy 3;A.All backups older than the most recent backup that satisfied the above conditions areobsolete.The recovery window always keeps in pace with the current time.Specifying redundancy by using the CONFIGURE RETENTION POLICY TOREDUNDANCY command:The REDUNDANCY parameter specifies that any number of backups or copies beyonda specified number does not need to be retained.For example, the CONFIGURE RETENTION POLICY TO REDUNDANCY 3; commandspecifies that a maximum of three backups or copies of a data file or control file can beretained. Redundancy is the default type of retention policy.Block Media RecoveryA.Allows specified blocks to be recovered without affecting the entire datafile.. It is onlyintended for use where a known and limited number of block is affected. This results ina reduced mean time to recover (MTTR) and higher availability as only the affectedblocks are offline during operationThe information regarding which block has to be recovered in found inThe alert log file, Trace File,Analyze Table Command, Dbverifyutility,V$Backup_Corruption & V$Copy_Corruption command.Example of Using Block Recovery in RMAN.BLOCKRECOVER DATAFILE 3 BLOCK 121;What is RMAN ?Recovery Manager (RMAN) is a utility that can manage your entire Oracle backup and recoveryactivities.Which Files must be backed up?Database Files (with RMAN)Control Files (with RMAN)Offline Redolog Files (with RMAN)INIT.ORA (manually)Password Files (manually)When you take a hot backup putting Tablespace in begin backup mode, Oracle records SCN # fromheader of a database file. What happens when you issue hot backup database in RMAN at block levelbackup? How does RMAN mark the record that the block has been backed up ? How does RMANknow what blocks were backed up so that it doesn't have to scan them again?In 11g, there is Oracle Block Change Tracking feature. Once enabled; this new 10g feature records themodified since last backup and stores the log of it in a block change tracking file. During backupsRMAN uses the log file to identify the specific blocks that must be backed up. This improves RMAN's

15 ORAFACT

Page 16: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   performance as it does not have to scan whole datafiles to detect changed blocks.Logging of changed blocks is performed by the CTRW process which is also responsible for writingdata to the block change tracking file. RMAN uses SCNs on the block level and the archived redo logsto resolve any inconsistencies in the datafiles from a hot backup. What RMAN does not require is toput the tablespace in BACKUP mode, thus freezing the SCN in the header. Rather, RMAN keeps thisinformation in either your control files or in the RMAN repository (i.e., Recovery Catalog).What are the Architectural components of RMAN?1.RMAN executable2.Server processes3.Channels4.Target database5.Recovery catalog database (optional)6.Media management layer (optional)7.Backups, backup sets, and backup piecesWhat are Channels?A channel is an RMAN server process started when there is a need to communicate with an I/O device,such as a disk or a tape. A channel is what reads and writes RMAN backup files. It is through theallocation of channels that you govern I/O characteristics such as:Type of I/O device being read or written to, either a disk or an sbt_tapeNumber of processes simultaneously accessing an I/O deviceMaximum size of files created on I/O devicesMaximum rate at which database files are readMaximum number of files open at a timeWhy is the catalog optional?Because RMAN manages backup and recovery operations, it requires a place to store necessaryinformation about the database. RMAN always stores this information in the target database controlfile. You can also store RMAN metadata in a recovery catalog schema contained in a separate database.The recovery catalogschema must be stored in a database other than the target database.What does complete RMAN backup consist of ?A backup of all or part of your database. This results from issuing an RMAN backup command. Abackup consists of one or more backup sets.What is a Backup set?A logical grouping of backup files -- the backup pieces -- that are created when you issue an RMANbackup command. A backup set is RMAN's name for a collection of files associated with a backup. Abackup set is composed of one or more backup pieces.What is a Backup piece?A physical binary file created by RMAN during a backup. Backup pieces are written to your backup

16 ORAFACT

Page 17: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   medium, whether to disk or tape. They contain blocks from the target database's datafiles, archivedredo log files, and control files. When RMAN constructs a backup piece from datafiles, there are aseveral rules that it follows:A datafile cannot span backup setsA datafile can span backup pieces as long as it stays within one backup setDatafiles and control files can coexist in the same backup setsArchived redo log files are never in the same backup set as datafiles or control files RMAN is the onlytool that can operate on backup pieces. If you need to restore a file from an RMAN backup, you mustuse RMAN to do it. There's no way for you to manually reconstruct database files from the backuppieces. You must use RMAN to restore files from a backup piece.What are the benefits of using RMAN?1.Incremental backups that only copy data blocks that have changed since the last backup.2. Tablespaces are not put in backup mode, thus there is noextra redo log generation during onlinebackups.3. Detection of corrupt blocks during backups.4. Parallelization of I/O operations.5. Automatic logging of all backup and recovery operations.6. Built-in reporting and listing commands.What 1 is the advantage of RMAN utility?1). copies only the filled blocks i.e. even if 1000 blocks is allocated to datafile but 500 are filled withdata then RMAN will only create a backup for that 500 filled blocks.2). incremental and accumulative backup.3). catalog and no catalog option.4). detection of corrupted blocks during backup;5). can create and store the backup and recover scripts.6). increase performance through automatic parallelization( allocating channels) less redo generation.How RMAN improves backup time?RMAN backup time consumption is very less than compared to regular online backup as RMANcopies only modified blocksCan you take Offline backups using RMAN?RMAN Offline Backup is possiableRecall that an offline backup is a backup of the database while it is not running. Hence, to perform ourbackup we will shutdown the database from RMAN and then mount the database. We will perform thebackup. Once the backup is complete we will restart the database again. Here is an example of thisprocess:RMAN>shutdown immediateRMAN>startup mountRMAN>backup database;RMAN>sql ’alter database open’;

17 ORAFACT

Page 18: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   How do you see information about backups in RMAN?List Backup;What is a Recovery Catalog?A recovery catalog is a set of tables and views that Recovery Manager (RMAN) uses to store metadata(information about a database structure, archived redo logs, backup sets, and data file copies) about atarget database (database that RMAN backups or restores). RMAN uses this metadata to conduct itsbackup, recovery, and maintenance operations. Recovery catalog is optional, i.e., if a recovery catalogis not created, RMAN uses the target database’s control file to store the metadata about the targetdatabase. Although RMAN can conduct all major backup and recovery operations by using the controlfile, some RMAN commands work only if a recovery catalog exists.Should you place Recovery C 1 atalog in the Same DB?No ,Recovery catalog should be place in separated databasefor security reason as recommended by oracle.we can use RMAN without RC,by using Target Database controlfile.Can you use RMAN without Recovery catalog?Yes we can use rman without recovery catalog as the metadata information is stored in controlfileCan you take Image Backups using RMAN?yes we can take image backup using rman by issuing the following commandRMAN> backup as copy database;Can you use Back upsets created by RMAN with any other utility?No. The backup Sets created by RMAN utility cannot be used in other utility other than RMAN.Where RMAN keeps information of backups if you are using RMAN without Catalog?RMAN keeps information of backups in the control fileYou have taken a manual backup of a datafile using o/s. How RMAN will know about it?you should use CATALOG command to make RMAN know about it Catalog datafile'/path' if catalogis usedCan you start and shutdown DB using RMAN?When an RMAN procedure requires that your database be started, shut down or brought to MOUNT orNOMOUNT state, you can use the RMAN client to start up and shut down the target database. Thefollowing example uses the RMAN SHUTDOWN and STARTUP commands to shut the targetdatabase down cleanly, and then mount it in preparation for a backup:% rman TARGET /RMAN> SHUTDOWN IMMEDIATE # closes database consistentlyRMAN> STARTUP MOUNT

18 ORAFACT

Page 19: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   Is it possible to take backup of catalog database using RMAN? If Yes, How?Answer: Yes, you can perform backup of catalog database using RMAN with below steps:1. Start the RMAN with NOCATALOG option.2. Run the recovery catalog database in ARCHIVELOG mode.3. set the retention policy to a REDUNDANCY value greater than 1.4. Backup the database onto two separate media(disk and tape), You can use BACKUP COPIES 2.5. Don't use another recovery catalog as the repository for these backups.6. configure the controlfile autoback feature to ON.You have taken a manual backup of a datafile using o/s. How RMAN will know about it?Answer: You have to catalog those backups with RMAN using catalog.Can a schema be restored in oracle 9i RMAN when the schema having numerous table spaces?Answer: RMAN gives the command to find all the tablespaces and hence the datafiles belonging todifferent schemas as:RMAN>REPORT SCHEMA;This command lists all the schemas tablespace names and the corresponding data files.After listing we can restore the datafiles or the tablespaces corresponding to a particular schema.What is the significance of incarnation and DBID in the RMAN backups?DBID means database id.Incunation means: Database incarnation is effectively a new “version” of the database that happenswhen you reset the online redo logs using “alter database open resetlogs;”.Database incarnation falls into following category Current Parent Ancestor and Siblingi) Current Incarnation: The database incarnation in which the database is currently generating redo.ii) Parent Incarnation: The database incarnation from which the current incarnation branched followingan OPEN RESETLOGS operation.iii) Ancestor Incarnation: The parent of the parent incarnation is an ancestor incarnation. Any parent ofan ancestor incarnation is also an ancestor incarnation.iv) Sibling Incarnation: Two incarnations that share a common ancestor are sibling incarnations ifneither one is an ancestor of the other.You loss one datafile and DB is running in ARCHIVELOG mode. You have full database backup of 1week old and partial backup of this datafile which is just 1 day old. From which backup should yourestore this file?Answer: Partail BackupSome datafiles were there on a secondary disk and that disk has become damaged and it will takesome days to get a new disk. How will you recover from this situation?Answer: check whether there is sufficient space available in Primary disk. If it so, Restore the files in itand recover the datafiles. or you have to mount to another server file system.Only some blocks are damaged in a datafile. Can you just recover these blocks if you are usingRMAN?

19 ORAFACT

Page 20: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   Answer: query the SELECT * FROM V$DATABASE_BLOCK_CORRUPTION view and get thestatus. From the RMAN prompt execute the Blockrecover command by mention the File#,Block#,Blocks.Some user has accidentally dropped one table and you realize this after two days. Can you recoverthis table if the DB is running in ARCHIVELOG mode?Answer: we can use Flashback with time based option.Can you use Backupsets created by RMAN with any other utility?Answer: No.Can we do Offline backups with RMAN ? How?Answer: Yes we can do it RMAN regardless of Archive Log/NO Archive log modes. Startup thedatabse in Mount stage and take the full backup .How RMAN improves backup time?Answer: RMAN improving this by allocation by more channels and also Rman backups the modifiedblocks only.if we loss our catalog in our RMAN setup then what is the procedure to recover the catalog ?Answer: Even the catalog is lost, target conrol files have the metadata of this catalog. we can restorethis particular catalog from the catalog DB (Tablespace/ Datafile) from the backup and recover it.How does RMAN perform corruption detection?Answer: Corruption detection is actually performed by the Oracle server.RMAN does NOT perform the backup, but just directs the server to backup a specified list of datafiles.During backup, the Oracle server detects certain types of corruptions.If a block is detected as newly corrupted, it will be identified as such in the alert log and also in thedatabase controlfile. You can view this information by querying the V$COPY_CORRUPTION orV$BACKUP_CORRUPTION views.Can I perform Block Media Recovery (BMR) if I did not use RMAN for backups?Answer: If you have image copies or OS backups of the datafiles you can perform BMR. You must firstregister the datafile image copies or OS backups to RMAN as well as the current archive log and alllogs since the image backup time. This can be accomplished by using the RMAN CATALOGcommand.15. Answer:Yes. Infact a configuration many customers may choose, is to create the Recovery Catalog inthe same database that stores the Oracle Enterprise Manager repository.I have noticed the shadow (or server) processes spawned for "allocate channel" command wouldn'tgo away after rman completed and released the channel (at least the message in RMAN showed theywere released), I noticed the shadow stayed for at least 8 minutes. I did wait for too long. As soon as I

20 ORAFACT

Page 21: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   exit from rman, they disappeared. Were they waiting pmon to clean them up? How long does thisusually take?Server processes for channels will not disappear until RMAN exists. The idea is that these processeswill be reused for further backup jobs.Can RMAN backup Real Application Cluster databases?Answer: Absolutely. RMAN can be configured to connect to all nodes within the cluster to parallelizethe backup of the database files and archive logs. If files need to be restored, using set AUTOLOCATEON alerts RMAN to search for backed up files and archive logs on all nodes.Is there any method to encrypt a Recovery Manager(RMAN) backup while the backup is beingwritten out to tape?Answer: RMAN does not use an explicit encryption method, although the binary format of backup filesoffers some security.What is the recommended method for backing up the RMAN repository?Here is how we recommend deploying the Recovery Catalog:* It should be a separate database, not contained in any of the target databases whose backup data itcontains.* Create a new schema in the Enterprise Manager Database to house the Recovery Manager catalog* High availability of the catalog can be achieved by any of the following techniques:o standy databaseo replicationo maintaining two separate Recovery Catalog databases: one is kept in sync as it is used foreveryday production operation, and the other is kept in sync manually, by periodically issuing theRESYNC CATALOG command.* Use RMAN to back up the Recovery Catalog database, but for these backups, start RMAN withthe NOCATALOG option, so that the backup repository for the Recovery Catalog is its own controlfile. The CONTROL_FILE_RECORD_KEEP_TIME parameter should be set to a value which is highenough to store an adequate amount of historical backup data for the Recovery Catalog.* Back up the Recovery Catalog controlfile, so that you can restore it if you ever need to restore theRecovery Catalog.How do you run a RMAN script using an OS file?There are two ways to do this.1. To run the script and connect in the same command (as you might want to do in a CRON job):rman target / nocatalog cmdfile "fullback.rmn"this will startup RMAN, connect to the target database, and run the script fullback.rmn2. If already in an RMAN session, from the RMAN prompt: @fullback.rmnYou can find some sample scripts in $ORACLE_HOME/rdbms/demo. Search for rman*.sh.HOW TO TURN ON BLOCK CHECKING?The aim is to detect, very early the presence of corrupt blocks in the database. This has a slightperformance overhead, but Checksums allow Oracle to detect early corruption caused byunderlying disk, storage system, or I/O system problems.

21 ORAFACT

Page 22: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   SQL> alter system set db_block_checking = true scope=both;Can you use Backupsets created by RMAN with any other utility?NO, Backup sets which are only created and accessed throughRMAN, are the only form in which RMAN can write backups tomedia managers such as tape drives and tape libraries.ONLY SOME BLOCKS ARE DAMAGED IN A DATAFILE,HOW TO RECOVER USING RMAN?RMAN> BLOCKRECOVER DATAFILE <datafile path> BLOCK <block id>;HOW RMAN IMPROVES BACKUP TIME?Adding channel to improve the performance of rman but it create session on DB and I/O on diskwill increase so configure channel at proper number.RMAN-06089: ARCHIVED LOG XYZ NOT FOUND OR OUT OF SYNC WITH CATALOG?Execute from RMAN: RMAN> change archivelog all validate;WHAT IS THE USE OF FORMAT_STRING IN RMAN?%d The name of the database.%t The backup set time stamp.%s The backup set number.%D The current day of the month (in format DD)RMAN ADVANTAGES?* only the used blocks can be backed up.* detected the corrupted blocks.* space and time saves.* full database,tablespace,controlfile can be taken separately* less redo generated.• incremental backup.HOW DO YOU SEE INFORMATION ABOUT BACKUPS IN RMAN?RMAN> List Backup;HOW DO YOU IDENTIFY WHAT ARE THE ALL THE TARGET DATABASES THAT ARE BEING BACKEDUPWITH RMAN DATABASE?You dont have any view to identifiy whether it is backed up or not . The only option is connect tothe target database and give list backup this will give you the backup information with date andtimining.RMAN> list backup;List of Backup Sets===================BS Key Type LV Size Device Type Elapsed Time Completion Time------- ---- -- ---------- ----------- ------------ ---------------WHAT IS INCARNATION IN RMAN?Database incarnation is effectively a new “version” of the database that happenswhen you reset the online redo logs using “alter database open resetlogs;”.Database incarnation falls into following category Current and Parent.i) Current Incarnation: The database incarnation in which the database is currently generating

22 ORAFACT

Page 23: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   redo.ii) Parent Incarnation: The database incarnation from which the current incarnation branchedfollowing an OPEN RESETLOGS operation.LIST SOME OF THE RMAN CATALOG VIEW NAMES WHICH CONTAINS THECATALOG INFORMATION ?RC_DATABASE_INCARNATIONRC_BACKUP_COPY_DETAILSRC_BACKUP_CORRUPTIONRC_BACKUP_DATAFILE_SUMMARY to name a fewWHAT IS FRA ? WHEN DO YOU USE THIS ?Flash Recovery Area:* Flash recovery area where you can store not only the traditional componentsfound in a backup strategy such as control files archived log files andRecovery Manager (RMAN) datafile copies but also a number of other filecomponents such as flashback logs.* The flash recovery area simplifies backupoperations and it increases the availability of the database because manybackup and recovery operations using the flash recovery area can be performedwhen the database is open and available to users.* Because the space in the flash recovery area is limited by theinitialization parameter DB_ RECOVERY_FILE_DEST_SIZE13) * Server processes* Channels* Target database* Recovery catalog database (optional)* Media management layer (optional)* Backups, backup sets, and backup pieces.WHAT DOES COMPLETE RMAN BACKUP CONSIST OF ?A backup of all or part of your database. This results from issuing an RMAN backup command.A backup consists of one or more backup sets.WHAT IS A BACKUP SET?A logical grouping of backup files -- the backup pieces -- that are created when you issue anRMAN backup command. A backup set is RMAN's name for a collection of files associated witha backup. A backup set is composed of one or more backup pieces.WHAT IS A BACKUP PIECE?* A physical binary file created by RMAN during a backup.* Backup pieces are written to your backup medium, whether to disk or tape.* They contain blocks from the target database's datafiles, archived redo log files, and control

23 ORAFACT

Page 24: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   files. When RMAN constructs a backup piece from datafiles, there are a several rules that itfollows:

● A datafile cannot span backup sets● A datafile can span backup pieces as long as it stays within one backup set● Datafiles and control files can coexist in the same backup sets● Archived redo log files are never in the same backup set as datafiles or control files

RMAN is the only tool that can operate on backup pieces. If you need to restore a file froman RMAN backup, you must use RMAN to do it. There's no way for you to manuallyreconstruct database files from the backup pieces. You must use RMAN to restore filesfrom a backup piece.HOW TO ENABLE FAST INCREMENTAL BACKUP IN RMAN?Now we can enable block change trackingSQL> alter database enable block change tracking;Database altered.SQL> alter database enable block change tracking using file ‘/home/oracle/change.trc’;NOW,SQL> select * from v$block_change_tracking;STATUS FILENAME BYTES———- ————————————————– ———-ENABLED /home/oracle/change.trc 11599872change traking writter ctwr process writes the information in that file.....WHAT IS THE USE OF V$SESSION_LONGOPS ?Displays the status of various operations that run for longer than 6 seconds (in absolute time).These operations currently include many backup and recovery functions, statistics gathering, andquery execution, and more operations are added for every Oracle release.VARIOUS CROSSCHECK COMMANDS ?RMAN> CROSSCHECK BACKUP;RMAN> CROSSCHECK COPY;RMAN> CROSSCHECK backup of database;RMAN> CROSSCHECK backup of controlfile;RMAN> CROSSCHECK archivelog all;WHAT IS THE USE OF CONFIG RECOVERY WINDOW COMMAND ?Ensure that RMAN retains all backups needed to recover the database to any point in time in thelast 7 days:RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;

HOW TO CONNECT TO OTHER SERVER TO THE TARGET DATABASE IN RMAN?$rman target sys/target_pwd@db01

WHAT PARAMETER SPECIFIES DURATION OFTHE RMAN INFORMATION TO BE

24 ORAFACT

Page 25: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   STORED IN CONTROLFILE?control_file_record_keep_timeHOW CAN WE LIST HE CURRENT CONFIGURATION OF THE TARGET DATABASE INRMAN?Using REPORT COMMANDREPORT SCHEMAHOW CAN WE GET THE DETAILED REPORT OF THE BACKUP SETSLIST COMMAND.CAN WE MAKE A IMAGE COPY OF THE WHOLE DATABASE?YES,.....STEPSSTARTUP MOUNTREPORT SCHEMACOPY DATAFILE1 TO '/BACKUP/DF2.CPY'(for all datafiles)LIST COPYHOW CAN WE DETECT BLOCK CORRUPTIONby querrying views V$BACKUP_CORRUPTION and V$COPY_CORRUPTION.When you take a hot backup putting Tablespace in begin backup mode, Oracle records SCN #from header of a database file. What happens when you issue hot backup database in RMAN atblock level backup? How does RMAN mark the record that the block has been backed up ? Howdoes RMAN know what blocks were backed up so that it doesn't have to scan them again?In 11g, there is Oracle Block Change Tracking feature. Once enabled; this new 10g featurerecords the modified since last backup and stores the log of it in a block change trackingfile. During backups RMAN uses the log file to identify the specific blocks that must bebacked up. This improves RMAN's performance as it does not have to scan wholedatafiles to detect changed blocks.Logging of changed blocks is performed by the CTRW process which is also responsiblefor writing data to the block change tracking file. RMAN uses SCNs on the block leveland the archived redo logs to resolve any inconsistencies in the datafiles from a hotbackup. What RMAN does not require is to put the tablespace in BACKUP mode, thusfreezing the SCN in the header. Rather, RMAN keeps this information in either yourcontrol files or in the RMAN repository (i.e., Recovery Catalog).why we use dbid in rmanWhen you have multiple databases you have to set your DBID (Database Id) which isunique to each database. You have to set this before you do any restore operation fromRMAN.

25 ORAFACT

Page 26: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   

how can we remove the invalid backup pieces from the backup setscrosscheck backupdelete expired backupWhat is auxiliary channel in RMAN? When do you need this?An auxiliary channel is a link to auxiliary instance. If you do not have automatic channels configuredthen before issuing the DUPLICATE command manually allocate at least one auxiliary channel withinthe same RUN command.When a Duplicate Database created or tablespace point in time recovery is performed Auxiliarydatabase is used. this database can either on the same host or a different host.what are different encryption modes in rmantransparentmode ,dual mode and password modehow can we recover corrupted blocks .Rman>block recover datafile <dbfileid> block <blockid>;how can we make a backupset unavailableLIST BACKUPSET bs_key;CHANGE BACKUPSET bs_key UNAVAILABLE;does RMAN delete Standby ArchivelogsSQL> select thread#, sequence#, ARCHIVED, APPLIED, STATUS fromv$archived_log;THREAD# SEQUENCE# ARC APP S---------- --- --- -1 1 YES NO D1 2 YES NO D::1 1636 YES NO A1 1637 YES NO A--But if you check, it shows that APPLIED shows as status NO even from the 1st sequence.how can we restore from last week backuprun {restore controlfile from autobackup;sql 'alter database mount';SET UNTIL TIME "TO_DATE('define_time','yyyy-mm-dd:hh24:mi:ss')";restore database;recover database;sql 'alter database open resetlogs';}

26 ORAFACT

Page 27: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   

how can we take automatic controlfile backupRMAN does it automatically if you set CONTROLFILE AUTOBACKUP ON on RMAN configurationwhat view helps to create equal sized backup sets determining the no.of blocks in each datafilev$backup_datafilehow can we retrieve info about archive logs in backupsetsv$backup_redologhow can we monitor the progress of backups and copiesv$session_longops20.which files are recoverable because of unrecoverable operationsreport unrecoverable.What is the advantage of RMAN utility?Advantage over tradition backup system:1). copies only the filled blocks i.e. even if 1000 blocks is allocated to datafile but 500 are filled withdata then RMAN will only create a backup for that 500 filled blocks.2). incremental and accumulative backup.3). catalog and no catalog option.4). detection of corrupted blocks during backup;5). can create and store the backup and recover scripts.6). increase performance through automatic parallelization( allocating channels), less redo generation.What is auxiliary channel in RMAN? When do you need this?An auxiliary channel is a link to auxiliary instance. If you do not have automatic channels configuredthen before issuing the DUPLICATE command manually allocate at least one auxiliary channel withinthe same RUN command.When a Duplicate Database created or tablespace point in time recovery is performed Auxiliarydatabase is used. this database can either on the same host or a different host.RUN{ALLOCATE AUXILIARY CHANNEL ch1 DEVICE TYPE sbt;ALLOCATE AUXILIARY CHANNEL aux1 DEVICE TYPE DISK;ALLOCATE AUXILIARY CHANNEL aux2 DEVICE TYPE DISK;ALLOCATE AUXILIARY CHANNEL aux3 DEVICE TYPE DISK;.DUPLICATE TARGET DATABASE TO dupdb;}What is Channel? How do you enable the parallel backups with RMAN?Channel is a link that RMAN requires to link to target database. This link

27 ORAFACT

Page 28: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   is required when backup and recovery operations are performed and recorded.This channel can be allocated manually or can be preconfigured by usingautomatic channel allocation.The number of allocated channels determines the maximum degree ofparallelism that is used during backup restore or recovery. For example ifyou allocate 4 channels for a backup operation 4 background processes for theoperation can run concurrently.RMAN> CONFIGURE DEVICE TYPE PARALLELISM 2 BACKUP TYPE TO COMPRESSEDBACKUPSET;Can you take online backup of a Control file if yes, how?RMAN>backup current controlfile;Should you take the backup of Logfiles if the database is running in ARCHIVELOG mode?Yes,RMAN>backup archivelog all;How do you see information about backups in RMAN?RMAN>list backup;Can you use RMAN without Recovery catalog?YES, Then controlfile behaves has a recovery catalog.How RMAN improves backup time?Add channel to improve the performance of rman but it create session on DB and I/O on disk willincrease so configure channel at proper number.Can you take Offline backups using RMAN?YES,but put the database is in mount state.Should you place Recovery Catalog in the Same DB?Recovery catalog can be in the same database. but itsrecommended by oracle that we need to have recovery catalogin other DBWhich is more efficient Incremental Backups using RMAN or Incremental Export?RMAN in more efficient than incremental Export12)How do you find out from the RMAN catalog if a particular archive log has been backed-up?RMAN> list archivelog all;

How do you add new database to catalog database?Follow the following steps to register the new database in catalogRMAN>connect taget username/password@ connect_string catalogcataloguser/password@connect_string

28 ORAFACT

Page 29: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   RMAN>register databaseHow do you find out from the RMAN catalog if a particular archive log has been backed-up?RMAN>list archivelog all;Can I have my target database on a Sun box and the recovery catalog on a WinNT machine?A: Yes.Why do tablespaces not require hot backup mode or extra logging when using RMan for backups?A: To understand why RMAN does not require extra logging or backup mode, you must first understand whythose features are required for non-RMAN online backups.A non-RMAN online backup consists of a non-Oracle tool, such as cp or dd, backing up a datafile at the sametime that DBWR is updating the file. We can't prevent the tool from reading a particular block at the exact sametime that DBWR is updating that block. When that happens, the non-Oracle tool might read a block in a halfupdatedstate, so that the block which is copied to the backup media might only have been updated in its firsthalf, while the second half contains older data. This is called a "fractured block". If this backup needs to berestored later, and that block needs to be recovered, recovery will fail because that block is not usable.The 'alter tablespace begin backup' command is our solution for the fractured block problem. When a tablespaceis in backup mode, and a change is made to a data block, instead of logging just the changed bytes to the redolog, we also log a copy of the entire block image before the change, so that we can reconstruct this block ifmedia recovery finds that this block was fractured. That block image logging is what causes extra redo to begenerated while files are in backup mode.The reason that RMAN does not require extra logging is that it guarantees that it will never back up a fracturedblock. We can make that guarantee because we know the format of Oracle data blocks, and we verify that eachblock that we read is complete before we copy it to the backup. If we read a fractured block, we read the blockagain to obtain a complete block before backing it up. non-Oracle tools are not able to do the same thing becausethey do not know how to verify the contents of an Oracle data block. Backup mode has another effect, which isto 'freeze' the checkpoint in the header of the file until the file is removed from backup mode. We do this becausewe cannot guarantee that the third-party backup tool will copy the file header prior to copying the data blocks.RMAN does not need to freeze the file header checkpoint because we know the order in which we will read theblocks, which enables us to capture a known good checkpoint for the file.Registering a database gives error messages including:ORA-04067: not executed, stored procedure "SYS.DBMS_BACKUP_RESTORE" does not existA: An error message stack like the following indicates that CATPROC.SQL did NOT execute successfully on thetarget database, as required before attempting backups of that target database.RMAN-00569: ================error message stack follows================RMAN-00600: internal error, arguments [10053] [1] [] [] []RMAN-03008: error while performing automatic resync of recovery catalogRMAN-07004: unhandled exception during command execution on channel defaultRMAN-10032: unhandled exception during execution of job step 1: ORA-04067: not executed,stored procedure "SYS.DBMS_BACKUP_RESTORE" does not existORA-01403: no data foundORA-06512: at line 221RMAN-10035: exception raised in RPC: ORA-04067: not executed, stored procedure"SYS.DBMS_BACKUP_RESTORE" does not existRMAN-10031: ORA-4067 occurred during call to DBMS_BACKUP_RESTORE.GETPARM

Diffarance between increamental and cumulative backups

29 ORAFACT

Page 30: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   A differential backup, which backs up all blocks changed after the most recent incremental backup atlevel 1 or. 0A cumulative backup, which backs up all blocks changed after the most recent incremental backup atlevel 0.Incremental backups are differential by default.Recovering a block using RMANIf we can restore a few blocks rather than an entire file we only need few blocks.We even dont need to bring the data file offline.Syntax for it as followsBlock Recover datafile 8 block 22;Give me some of the RMAN catalog view names which contains the catalog information ?Ans:RC_DATABASE_INCARNATIONRC_BACKUP_COPY_DETAILSRC_BACKUP_CORRUPTIONRC_BACKUP_DATAFILE_SUMMARY to name a fewWhat is RMAN ?Recovery Manager (RMAN) is a utility that can manage your entire Oracle backup and recoveryactivities.Diffarance b/t, When you take a hot backup putting Tablespace in begin backup mode andRMAN backupOracle records SCN # from header of a database file. What happens when you issue hot backupdatabase in RMAN at block level backup? How does RMAN mark the record that the block hasbeen backed up ? How does RMAN know what blocks were backed up so that it doesn't have toscan them again?In 11g, there is Oracle Block Change Tracking feature. Once enabled; this new 10g featurerecords the modified since last backup and stores the log of it in a block change tracking file.During backups RMAN uses the log file to identify the specific blocks that must be backed up.This improves RMAN's performance as it does not have to scan whole datafiles to detect changedblocks.Logging of changed blocks is performed by the CTRW process which is also responsible for writingdata to the block change tracking file. RMAN uses SCNs on the block level and the archived redologs to resolve any inconsistencies in the datafiles from a hot backup. What RMAN does notrequire is to put the tablespace in BACKUP mode, thus freezing the SCN in the header. Rather,RMAN keeps this information in either your control files or in the RMAN repository (i.e.,Recovery Catalog).What are the Architectural components of RMAN?1.RMAN executable2.Server processes3.Channels4.Target database5.Recovery catalog database (optional)6.Media management layer (optional)

30 ORAFACT

Page 31: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   7.Backups, backup sets, and backup piecesWhat are Channels?A channel is an RMAN server process started when there is a need to communicate with an I/Odevice, such as a disk or a tape. A channel is what reads and writes RMAN backup files. It isthrough the allocation of channels that you govern I/O characteristics such as:· Type of I/O device being read or written to, either a disk or an sbt_tape· Number of processes simultaneously accessing an I/O device· Maximum size of files created on I/O devices· Maximum rate at which database files are read· Maximum number of files open at a timeWhy is the catalog optional?Because RMAN manages backup and recovery operations, it requires a place to store necessaryinformation about the database. RMAN always stores this information in the target databasecontrol file. You can also store RMAN metadata in a recovery catalog schema contained in aseparate database. The recovery catalogschema must be stored in a database other than the target database.What does complete RMAN backup consist of ?A backup of all or part of your database. This results from issuing an RMAN backup command. Abackup consists of one or more backup sets.What is a Backup set?A logical grouping of backup files thebackup pieces thatare created when you issue anRMAN backup command. A backup set is RMAN's name for a collection of files associated with abackup. A backup set is composed of one or more backup pieces.What is a Backup piece?A physical binary file created by RMAN during a backup. Backup pieces are written to yourbackup medium, whether to disk or tape. They contain blocks from the target database'sdatafiles, archived redo log files, and control files. When RMAN constructs a backup piece fromdatafiles, there are a several rules that it follows:· A datafile cannot span backup sets· A datafile can span backup pieces as long as it stays within one backup set· Datafiles and control files can coexist in the same backup sets· Archived redo log files are never in the same backup set as datafiles or control files RMANis the only tool that can operate on backup pieces. If you need to restore a file from anRMAN backup, you must use RMAN to do it. There's no way for you to manuallyreconstruct database files from the backup pieces. You must use RMAN to restore filesfrom a backup piece.What are the benefits of using RMAN?1 Incremental backups that only copy data blocks that have changed since the last backup.2. Tablespaces are not put in backup mode, thus there is noextra redo log generationduring online backups.

31 ORAFACT

Page 32: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   3. Detection of corrupt blocks during backups.4. Parallelization of I/O operations.5. Automatic logging of all backup and recovery operations.6. Builtinreporting and listing commands.what is recovery catalog?Recovery catalog holds RMAN repository data for one or more databases in a separate databaseschema, in addition to using the control files of the databases.Start by creating a database schema (usually called rman). Assign an appropriate tablespace to itand grant it the recovery_catalog_owner role. Look at this example:sqlplus sys/ as sysdbaSQL> create user rman identified by rman;SQL> alter user rman default tablespace tools temporary tablespace temp;SQL> alter user rman quota unlimited on tools;SQL> grant connect, resource, recovery_catalog_owner to rman;SQL> exit;Next, log in to rman and create the catalog schema. Prior to Oracle 8i this was done by runningthe catrman.sql script.> rman catalog rman/rmanRMAN> create catalog tablespace tools;RMAN> exit;You can now continue by registering your databases in the catalog. Look at this example:rman catalog rman/rman target backdba/backdbaRMAN> register database;You want to retain only last 3 backups of datafiles. How do you go for it in RMAN?CONFIGURE RETENTION POLICY TO REDUNDANCY 3how many days RMAN keeps the information in controlfile?It is depends upon the retention polocy we configuredWhich Files must be backed up?Database Files (with RMAN)Control Files (with RMAN)Offline Redolog Files (with RMAN)INIT.ORA (manually)Password Files (manually)How to take differential incremental and cumulative backups in RMAN?RMAN>backup incremental level2 database;RMAN>backup incremental level 1 database;Using RMAN how to restore a database in archivelogrman target /RMAN>startup mountRMAN>restore databaseRMAN>recover database

32 ORAFACT

Page 33: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   RMAN>alter database open16.How to checkup backups,pieces in RMAN?RMAN>crosscheck backupset of database;RMAN>crosscheck copy;17.How to configure channels in RMAN?RMAN>configure channel device type disk format '/d01/backup/%U';18.How to configure retention policy in RMAN?RMAN>configure retention policy to recovery window of 7 days;what is meant by DBMS_RCVCAT and DBMS_RCVMANthese are internal, undocumented packages created by the create catalaog commandDBMS_RCVMAN is create din the target database by the scripts dbmsrman.sql and prvtrmns.plbwhich are called by catproc.sqlDBMS_RCVCAT is used by recovery manager to maintain information in the recovery catalog andDBMS_RCVMAN quesries the controlfile or recovery catalogwhat is REPORT command in RMANwhat files need to be backupRMAN>report need backupwhich backups can be deltedRMAN>report obsolete;What is RMAN and how does one use it?Recovery Manager (or RMAN) is an Oracle provided utility for backingup,restoring andrecovering Oracle Databases. RMAN ships with the database server and doesn't require aseparate installation. The RMAN executable is located in your ORACLE_HOME/bindirectory.In fact RMAN, is just a Pro*C application that translates commands to a PL/SQLinterface. The PL/SQL calls are stallically linked into the Oracle kernel, and does notrequire the database to be opened (mapped from the ?/rdbms/admin/recover.bsq file).RMAN can do offlineand onlinedatabase backups. It cannot, however, write directly totape, but various 3rdpartytools (like Veritas, Omiback, etc) can integrate with RMAN tohandle tape library management.RMAN can be operated from Oracle Enterprise Manager, or from command line. Here arethe command line arguments:Argument Value Descriptiontargetquotedstringconnectstringfor target databasecatalog quotedstringconnectstring

33 ORAFACT

Page 34: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   for recovery catalognocatalog none if specified, then no recovery catalogcmdfile quotedstringname of input command filelog quotedstringname of output message log filetrace quotedstringname of output debugging message log fileappend none if specified, log is opened in append modedebug optionalargsactivate debuggingmsgno none show RMANnnnnprefix for all messagessend quotedstringsend a command to the media managerpipe string building block for pipe namestimeout integer number of seconds to wait for pipe inputHereis an example:[oracle@localhost oracle]$ rmanRecovery Manager: Release 10.1.0.2.0 ProductionCopyright (c) 1995, 2004, Oracle. All rights reserved.RMAN> connect target;connected to target database: ORCL (DBID=1058957020)RMAN> backup database;...How does one backup and restore a database using RMAN?The biggest advantage of RMAN is that it only backup used space in the database. RMANdoesn't put tablespaces in backup mode, saving on redo generation overhead. RMAN willrereaddatabase blocks until it gets a consistent image of it. Look at this simple backupexample.rman target sys/*** nocatalogrun {allocate channel t1 type disk;backupformat '/app/oracle/backup/%d_t%t_s%s_p%p'(database);release channel t1;}Example RMAN restore:rman target sys/*** nocatalogrun {

34 ORAFACT

Page 35: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   allocate channel t1 type disk;# set until time 'Aug 07 2000 :51';restore tablespace users;recover tablespace users;release channel t1;}The examples above are extremely simplistic and only useful for illustrating basicconcepts. By default Oracle uses the database controlfiles to store information aboutbackups. Normally one would rather setup a RMAN catalog database to store RMANmetadata in. Read the Oracle Backup and Recovery Guide before implementing anyRMAN backups.Note: RMAN cannot write image copies directly to tape. One needs to use a thirdpartymedia manager that integrates with RMAN to backup directly to tape. Alternatively onecan backup to disk and then manually copy the backups to tape.How does one backup and restore archived log files?One can backup archived log files using RMAN or any operating system backup utility.Remember to delete files after backing them up to prevent the archive log directory fromfilling up. If the archive log directory becomes full, your database will hang! Look at thissimple RMAN backup scripts:RMAN> run {2> allocate channel dev1 type disk;3> backup4> format '/app/oracle/archback/log_%t_%sp%p'5> (archivelog all delete input);6> release channel dev1;7> }The "delete input" clause will delete the archived logs as they as backedup.List all archivelog backups for the past 24 hours:RMAN> LIST BACKUP OF ARCHIVELOG FROM TIME 'sysdate1';Here is a restore example:RMAN> run {2> allocate channel dev1 type disk;3> restore (archivelog low logseq 78311 high logseq 78340 thread 1 all);4> release channel dev1;5> }How does one create a RMAN recovery catalog?Start by creating a database schema (usually called rman). Assign an appropriatetablespace to it and grant it the recovery_catalog_owner role. Look at this example:sqlplus sysSQL> create user rman identified by rman;SQL> alter user rman default tablespace tools temporary tablespace temp;SQL> alter user rman quota unlimited on tools;

35 ORAFACT

Page 36: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   SQL> grant connect, resource, recovery_catalog_owner to rman;SQL> exit;Next, log in to rman and create the catalog schema. Prior to Oracle 8i this was done byrunning the catrman.sql script.rman catalog rman/rmanRMAN> create catalog tablespace tools;RMAN> exit;You can now continue by registering your databases in the catalog. Look at this example:rman catalog rman/rman target backdba/backdbaRMAN> register database;One can also use the "upgrade catalog;" command to upgrade to a new RMANrelease, or the "drop catalog;" command to remove an RMAN catalog. Thesecommands need to be entered twice to confirm the operation.How does one integrate RMAN with thirdpartyMedia Managers?The following Media Management Software Vendors have integrated their mediamanagement software with RMAN (Oracle Recovery Manager):· Veritas NetBackup http://www.veritas.com/· EMC Data Manager (EDM) http://www.emc.com/· HP OMNIBack/ DataProtector http://www.hp.com/· IBM's Tivoli Storage Manager (formerly ADSM) http://www.tivoli.com/storage/· EMC Networker http://www.emc.com/· BrightStor ARCserve Backup http://www.ca.com/us/datalossprevention.aspx· Sterling Software's SAMS:Alexandria (formerly from Spectralogic) http://www.sterling.com/sams/· SUN's Solstice Backup http://www.sun.com/software/whitepapers/backupnstorage/· CommVault Galaxy http://www.commvault.com/· etc...The above Media Management Vendors will provide first line technical support (andinstallation guides) for their respective products.A complete list of supported Media Management Vendors can be found at:http://www.oracle.com/technology/deploy/availability/htdocs/bsp.htmWhen allocating channels one can specify Media Management spesific parameters. Hereare some examples:

36 ORAFACT

Page 37: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   Netbackup on Solaris:allocate channel t1 type 'SBT_TAPE'PARMS='SBT_LIBRARY=/usr/openv/netbackup/bin/libobk.so.1';Netbackup on Windows:allocate channel t1 type 'SBT_TAPE' send "NB_ORA_CLIENT=client_machine_name";Omniback/ DataProtector on HPUX:allocate channel t1 type 'SBT_TAPE' PARMS='SBT_LIBRARY=/opt/omni/lib/libob2oracle8_64bit.sl';or:allocate channel 'dev_1' type 'sbt_tape' parms'ENV=OB2BARTYPE=Oracle8,OB2APPNAME=orcl,OB2BARLIST=machinename_orcl_archlogs)';How does one clone/duplicate a database with RMAN?The first step to clone or duplicate a database with RMAN is to create a new INIT.ORAand password file (use the orapwd utility) on the machine you need to clone the databaseto. Review all parameters and make the required changed. For example, set theDB_NAME parameter to the new database's name.Secondly, you need to change your environment variables, and do a STARTUPNOMOUNT from sqlplus. This database is referred to as the AUXILIARY in the scriptbelow.Lastly, write a RMAN script like this to do the cloning, and call it with "rman cmdfiledupdb.rcv":connect target sys/secure@origdbconnect catalog rman/rman@catdbconnect auxiliary /run {set newname for datafile 1 to '/ORADATA/u01/system01.dbf';set newname for datafile 2 to '/ORADATA/u02/undotbs01.dbf';set newname for datafile 3 to '/ORADATA/u03/users01.dbf';set newname for datafile 4 to '/ORADATA/u03/indx01.dbf';set newname for datafile 5 to '/ORADATA/u02/example01.dbf';allocate auxiliary channel dupdb1 type disk;set until sequence 2 thread 1;duplicate target database to dupdblogfileGROUP 1 ('/ORADATA/u02/redo01.log') SIZE 200k REUSE,GROUP 2 ('/ORADATA/u03/redo02.log') SIZE 200k REUSE;}The above script will connect to the "target" (database that will be cloned), the recoverycatalog (to get backup info), and the auxiliary database (new duplicate DB). Previousbackups will be restored and the database recovered to the "set until time" specified inthe script.Notes: the "set newname" commands are only required if your datafile names will

37 ORAFACT

Page 38: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   different from the target database.The newly cloned DB will have its own unique DBID.Can one restore RMAN backups without a CONTROLFILE and RECOVERYCATALOG?Details of RMAN backups are stored in the database control files and optionally aRecovery Catalog. If both these are gone, RMAN cannot restore the database. In such asituation one must extract a control file (or other files) from the backup pieces written outwhen the last backup was taken. Let's look at an example:Let's take a backup (partial in our case for ilustrative purposes):$ rman target / nocatalogRecovery Manager: Release 10.1.0.2.0 64bitProductionCopyright (c) 1995, 2004, Oracle. All rights reserved.connected to target database: ORCL (DBID=1046662649)using target database controlfile instead of recovery catalogRMAN> backup datafile 1;Starting backup at 20AUG04allocated channel: ORA_DISK_1channel ORA_DISK_1: sid=146 devtype=DISKchannel ORA_DISK_1: starting full datafile backupsetchannel ORA_DISK_1: specifying datafile(s) in backupsetinput datafile fno=00001 name=/oradata/orcl/system01.dbfchannel ORA_DISK_1: starting piece 1 at 20AUG04channel ORA_DISK_1: finished piece 1 at 20AUG04piece handle=/flash_recovery_area/ORCL/backupset/2004_08_20/o1_mf_nnndf_TAG20040820T153256_0lczd9tf_.bkp comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:45channel ORA_DISK_1: starting full datafile backupsetchannel ORA_DISK_1: specifying datafile(s) in backupsetincluding current controlfile in backupsetincluding current SPFILE in backupsetchannel ORA_DISK_1: starting piece 1 at 20AUG04channel ORA_DISK_1: finished piece 1 at 20AUG04piece handle=/flash_recovery_area/ORCL/backupset/2004_08_20/o1_mf_ncsnf_TAG20040820T153256_0lczfrx8_.bkp comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:04Finished backup at 20AUG04[/code]Now, let's destroy one of the control files:

38 ORAFACT

Page 39: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   SQL> show parameters CONTROL_FILESNAME TYPE VALUEcontrol_files string /oradata/orcl/control01.ctl,/oradata/orcl/control02.ctl,/oradata/orcl/control03.ctlSQL> shutdown abort;ORACLE instance shut down.SQL> ! mv /oradata/orcl/control01.ctl /tmp/control01.ctl</pre>Now, let's see if we can restore it. First we need to start the databaase in NOMOUNTmode:SQL> startup NOMOUNTORACLE instance started.Total System Global Area 289406976 bytesFixed Size 1301536 bytesVariable Size 262677472 bytesDatabase Buffers 25165824 bytesRedo Buffers 262144 bytes</pre>Now, from SQL*Plus, run the following PL/SQL block to restore the file:DECLAREv_devtype VARCHAR2(100);v_done BOOLEAN;v_maxPieces NUMBER;TYPE t_pieceName IS TABLE OF varchar2(255) INDEX BY binary_integer;v_pieceName t_pieceName;BEGINDefinethe backup pieces... (names from the RMAN Log file)v_pieceName(1) :='/flash_recovery_area/ORCL/backupset/2004_08_20/o1_mf_ncsnf_TAG20040820T153256_0lczfrx8_.bkp';v_pieceName(2) :='/flash_recovery_area/ORCL/backupset/2004_08_20/o1_mf_nnndf_TAG20040820T153256_0lczd9tf_.bkp';v_maxPieces := 2;Allocatea channel... (Use type=>null for DISK, type=>'sbt_tape' for TAPE)v_devtype := DBMS_BACKUP_RESTORE.deviceAllocate(type=>NULL, ident=>'d1');Restorethe first Control File...DBMS_BACKUP_RESTORE.restoreSetDataFile;CFNAMEmist be the exact path and filename of a controlfile taht was backedupDBMS_BACKUP_RESTORE.restoreControlFileTo(cfname=>'/app/oracle/oradata/orcl/co

39 ORAFACT

Page 40: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   ntrol01.ctl');dbms_output.put_line('Start restoring '||v_maxPieces||' pieces.');FOR i IN 1..v_maxPieces LOOPdbms_output.put_line('Restoring from piece '||v_pieceName(i));DBMS_BACKUP_RESTORE.restoreBackupPiece(handle=>v_pieceName(i),done=>v_done, params=>null);exit when v_done;END LOOP;Deallocatethe channel...DBMS_BACKUP_RESTORE.deviceDeAllocate('d1');EXCEPTIONWHEN OTHERS THENDBMS_BACKUP_RESTORE.deviceDeAllocate;RAISE;END;/Let's see if the controlfile was restored:SQL> ! ls l/oradata/orcl/control01.ctlrwr1oracle dba 3096576 Aug 20 16:45 /oradata/orcl/control01.ctl[/code]We should now be able to MOUNT the database and continue recovery...SQL> ! cp /oradata/orcl/control01.ctl /oradata/orcl/control02.ctlSQL> ! cp /oradata/orcl/control01.ctl /oradata/orcl/control03.ctlSQL> alter database mountSQL> recover database using backup controlfile;ORA00279:change 7917452 generated at 08/20/2004 16:40:59 needed for thread 1ORA00289:suggestion :/flash_recovery_area/ORCL/archivelog/2004_08_20/o1_mf_1_671_%u_.arcORA00280:change 7917452 for thread 1 is in sequence #671Specify log: {<RET>=suggested | filename | AUTO | CANCEL}/oradata/orcl/redo02.logLog applied.Media recovery complete.Database altered.SQL> alter database open resetlogs;Database altered.What are the Advantage over tradition backup system?Advantage over tradition backup system:

40 ORAFACT

Page 41: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   1). copies only the filled blocks i.e. even if 1000 blocks is allocated to datafile but 500 arefilled with data then RMAN will only create a backup for that 500 filled blocks.2). incremental and accumulative backup.3). catalog and no catalog option.4). detection of corrupted blocks during backup;5). can create and store the backup and recover scripts.6). increase performance through automatic parallelization( allocating channels), lessredo generation.how many days RMAN retain the info in controlfil?Depending upon the retention polocy it will retain the copiesHow do you install the RMAN recovery catalog?Steps to be followed:1 Create connection string at catalog database.2 At catalog database, create one new user or use existing user and give that user arecovery_catalog_owner privilege.3 Login into RMAN with connection string.What are the differences between EBU and RMAN?Enterprise Backup Utility (EBU) is a functionally rich, high performance interface forbacking up Oracle7 databases. It is sometimes referred to as OEBU for Oracle EnterpriseBackup Utility. The Oracle Recovery Manager (RMAN) utility that ships with Oracle8and above is similar to Oracle7's EBU utility. However, there is no direct upgrade pathfrom EBU to RMAN.How does one create a RMAN recovery catalog?Start by creating a database schema (usually called rman). Assign an appropriatetablespace to it and grant it the recovery_catalog_owner role. Look at this example:sqlplus sysSQL>create user rman identified by rman;SQL> alter user rman default tablespace tools temporary tablespace temp;SQL> alter user rman quota unlimited on tools;SQL> grant connect, resource, recovery_catalog_owner to rman;SQL> exit;Next, log in to rman and create the catalog schema. Prior to Oracle 8i this was done byrunning the catrman.sql script. rman catalog rman/rmanRMAN>create catalog tablespace tools;RMAN> exit;You can now continue by registering your databases in the catalog. Look at this example:rman catalog rman/rman target backdba/backdbaRMAN> register database;How can a group in a cross products be visually distinguished from a group

41 ORAFACT

Page 42: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   that does not form a cross product?A group that forms part of a cross product will have a thicker border.Changes to the ALTER DATABASE END BACKUP Command Youcan issue theALTER DATABASE END BACKUP command when the database is open.Change-Aware Incremental Backups - By using a new type of log file to track blocks that havechanged in the database, Recovery Manager (RMAN) can avoid scanning the entire datafile during anincremental backup. Instead, the amount of data scanned is proportional to the amount of data changed.Automated Disk-Based Backup and Recovery - This release supports automated disk-basedbackup and recovery. The result is a simplified and unified storage location for backups, archivelogs,and any other files needed for Oracle recovery. It also provides automatic deletion of the files after theyhave been successfully backed up by RMAN, and the equivalent of a disk cache for tape, whichreduces the time needed to restore a file from tape. It reduces the risk of an out-of-space condition ondisk by deleting files that are no longer necessary for successful database recovery.RMAN Database Dropping and Deregistration - The new DROP DATABASE andUNREGISTER DATABASE RMAN commands remove the database and its entry from the RMANrecovery catalog.Automated TSPITR Instantiation - This feature automatically creates the auxiliary instanceneeded to perform tablespace point-in-time recovery (TSPITR) and incorporates the RMAN TSPITRoperations.Simplified Recovery Manager Cataloging of Backup Files - You can now catalog RMANproprietary backup metadata into a backup repository. If a backup is overwritten in the control file, or abackup file is moved to a new location on disk, then you can easily uncatalog the backup metadatafrom the repository.

FLASHBACK How do you set the flash recovery area?A:SQL> ALTER SYSTEM SET db_recovery_file_dest_size = 100G; SQL> ALTER SYSTEM SET db_recovery_file_dest = ‘/u10/oradata/school’; How do you gather information regarding the flash recovery area?A:SQL> SELECT name, space_limit, space_used, space_reclaimable, number_of_files FROM v$recovery_file_dest; What is the flashback?

42 ORAFACT

Page 43: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   A: The flashback gives users the capability to query past version of schema objects, query historical data, and perform change analysis. How it works?A: Every transaction logically generates a new version of the database. You can navigate through these versions to find an error and its cause. Why do need to use the flashback?A: It eliminates restore process and it is faster than traditional point-in-time recovery. What is its architecture?A: Now, one more log was added as Flashback Database log. The Oracle database server regularly logs before images of data blocks in the Flashback Database logs from Flashback buffer in the SGA Oracle memory. The Flashback Database must be enabled. When it is enabled, the new RVWR (Recovery Version Writer) background process will be started. The RVWR background process sequentially writes Flashback Database data from the flashback buffer to the Flashback Database logs which are circularly reused. How do you configure Flashback Database?A:Assuming: The database is in archive mode. The database flash recovery area was configured. Set the database flashback retention time target. SQL> ALTER SYSTEM SET db_flashback_retention_target = 2880; -- Ex: for two days. Enable Flashback Database. Before altering your database, the database must be in MOUNT EXCLUSIVE mode, ARCHIVELOG mode, and the Flashback be enabled. To check whether it is enable do the following SQL statement. SQL> SELECT flashback_on FROM v$database ; SQL> ALTER DATABASE FLASHBACK ON; If you disable the flashback (OFF), all existing Flashback Database logs are deleted automatically. How do you Flashback a database?A: The FLASHBACK DATABASE command force the database back to a past time or SCN. See the following examples: SQL> FLASHBACK DATABASE TO TIMESTAMP (sysdate-5/24); -- Go back 5 hours from now. SQL> FLASHBACK DATABASE TO SCN 65473; How do you monitor Flashback Database?A: Use the V$FLASHBACK_DATABASE_LOG view to display the approximate lowest SCN and time to which you can flash back your database. SQL> SELECT oldest_flashback_scn, oldest_flashback_time FROM v$flashback_database_log;

43 ORAFACT

Page 44: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   How do you use the V$FLASHBACK_DATABASE_LOG view to determine how much disk space is needed to meet the current flashback retention target?A:SQL> SELECT estimated_flashback_size, flashback_size FROM v$flashback_database_log; How do you use the V$FLASHBACK_DATABASE_STAT view to monitor the overhead of logging flashback data?A: You can use this to adjust the retention time or the flash recovery area size. SQL> SELECT * FROM v$flashback_database_stat; How do you exclude a tablespace from flashback database?A: If you do not want the USER tablespace to be included to log Flashback Database data, do the following SQL statement. SQL> ALTER TABLESPACE users FLASHBACK OFF; When are you not able to Flashback Database?A:

1. The control file has been restored or recreated, 2. A tablespace has been dropped, 3. A data file has been shrunk, and 4. A RESETLOSG operation is required.

How can you query the content of the recycle bin by using the DBA_RECYCLEBIN view?A:SQL> SELECT * FROM dba_recyclebin WHERE can_undrop = ‘YES’; SQL> SHOW RECYCLEBIN How do you restore from recycle bin?A: Use the FLASHBACK TABLE command to recover a table and all its possible dependent objects form the recycle bin. SQL> DROP TABLE iself.emp; SQL> SELECT original_name, object_name, type, ts_name, dropttime, related, space FROM dba_recyclebin WHERE original_name = ‘EMP’; SQL> FLASHBACK TABLE emp TO BEFORE DROP; SQL> FLASHBACK TABLE emp TO BEFORE DROP RENAME TO employee; SQL> FLASHBACK TABLE emp TO TIMESTAMP to_timestamp (’14:45’,’HH24:MI’); How do you reclaim the recycle bin?A: By using PURG option.

44 ORAFACT

Page 45: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   SQL> PURGE TABLE emp; -- Purges the specified table. SQL> PURGE TABLESPACE scott_ts USER scott; -- All the Scott’s objects. SQL> PURGE RECYCLEBIN; -- Purges all user objects. SQL> PURGE DBA_RECYCLEBIN; -- Purges all the objects. How can you perform queries on the database as of a certain clock time or SCN?A:SQL> SELECT versions_xid, sal, versions_operation FROM emp VERSIONS BETWEEN TIMESTAMP sysdate-10/24 AND sysdate WHERE empno = 100; How can you use the CURRENT_SCN column in the V$DATABASE view to obtain the current SCN?A:SQL> SELECT current_scn FROM v$database; How can you enforce to guaranteed UNDO retention?A: You can do one of the following SQL statements. SQL> CREATE UNDO TABLESPACE my_undotbs1 DATAFILE ‘my_undotbs01.dbf’ SIZE 10G AUTOEXTEND ON RETENTION GUARANTEE; SQL> ALTER TABLESPACE my_undotbs1 RETENTION GUARANTEE; How can you check the UNDO retention?A:SQL> SELECT tablespace_name, retention FROM dba_tablespaces; How can you recover deleted file?A:Connect as sysdba and flashback the table. SQL> CONNECT / AS SYSDBA Use the FLASHBACK TABLE command to recover a table and all its possible dependent objects form the recycle bin. Check what do you have in your recycle bin. SQL> SELECT original_name, object_name, type, ts_name, dropttime, related, space FROM dba_recyclebin WHERE original_name = ‘FLASHBACK_TABLE’ / SQL> FLASHBACK TABLE iself.emp TO BEFORE DROP; How do you test that your recovery was successful?A:

45 ORAFACT

Page 46: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   SQL> SELECT count(*) FROM flashback_tableManaging the Recycle BinIf the tables are not really dropped in this process--therefore not releasing the tablespace--whathappens when the dropped objects take up all of that space?A.The answer is simple: that situation does not even arise. When a tablespace is completely filledup with recycle bin data such that the datafiles have to extend to make room for more data, thetablespace is said to be under "space pressure." In that scenario, objects are automaticallypurged from the recycle bin in a first-in-first-out manner. The dependent objects (such asindexes) are removed before a table is removed.Similarly, space pressure can occur with user quotas as defined for a particular tablespace. Thetablespace may have enough free space, but the user may be running out of his or her allottedportion of it. In such situations, Oracle automatically purges objects belonging to that user inthat tablespace.In addition, there are several ways you can manually control the recycle bin. If you want to purgethe specific table named TEST from the recycle bin after its drop, you could issuePURGE TABLE TEST;or using its recycle bin name:PURGE TABLE "BIN$04LhcpndanfgMAAAAAANPw==$0";This command will remove table TEST and all dependent objects such as indexes, constraints,and so on from the recycle bin, saving some space. If, however, you want to permanently drop anindex from the recycle bin, you can do so using:purge index in_test1_01;which will remove the index only, leaving the copy of the table in the recycle bin.Sometimes it might be useful to purge at a higher level. For instance, you may want to purge allthe objects in recycle bin in a tablespace USERS. You would issue:PURGE TABLESPACE USERS;You may want to purge only the recycle bin for a particular user in that tablespace. Thisapproach could come handy in data warehouse-type environments where users create and dropmany transient tables. You could modify the command above to limit the purge to a specific useronly:PURGE TABLESPACE USERS USER SCOTT;A user such as SCOTT would clear his own recycle bin withPURGE RECYCLEBIN;You as a DBA can purge all the objects in any tablespace usingPURGE DBA_RECYCLEBIN;As you can see, the recycle bin can be managed in a variety of different ways to meet yourspecific needs.How do I determine how far back in time I can flash back to?The actual earliest time to which you could rewind your database using flashback technology is determined by querying the V$FLASHBACK_DATABASE_LOG view. The V$FLASHBACK_DATABASE_LOG view can also help you decide how much space needed in the flash recovery area for flashback logs to rewind back a specified number of hours.

46 ORAFACT

Page 47: 50199736-FAQ-RMAN

                                                                                                                                                                                                                                                   DBA FAQ   

Once I flashback the database, can I flash it back further in time?You can issue a Flashback Database command and then open the database READ-ONLY. This will allow you to verify this is the point in which you want to open and start working again. Until you open the database with a reset logs operation, you can roll-forwards and backwards using the recover database until and flashback commands. Is referential integrity maintained during a flashback table operation? Referential integrity can be enforced by Oracle via constraints. Flashback Table enforces those constraints for all dependencies. If you do not enforce referential integrity with software, then it is a manual process. Can I turn off the Recycle Bin feature? No. The recycle bin feature is on by default. Flashback Drop is a non-intrusive feature. Objects in the Recycle Bin will be automatically purged by the space reclamation process if

5. a user creates a new table or adds data that causes their quota to be exceeded. 6. the tablespace needs to extend its file size to accommodate create/insert operations.

A PURGE operation can be issued by any use to remove their objects from the recycle bin.How far back in time can I view the versions of a row? You can view all the versions of a row for as long as you have undo information retained in the undo tablespace to satisfy the specified timestamps or SCN. How far back can I rewind my database?There are 2 limiting factors to how far back in time you can rewind. Specify the how far back to rewind. The setting of the DB_FLASHBACK_RETENTION_TARGET initialization parameter determines, indirectly, how much flashback data that Oracle should keep. This limit is contingent upon sufficient space existing in the flash recovery area. Flash Recovery Area. Flashback Database utilizes the Flash Recovery Area to organize and manage the flashback logs. If you do not allocated enough space to the Flash Recovery Area, then you will be limited to how far back in time you will be able to rewind. Does any of our competitors have any similar feature/product like Flashback Query? Thanks to our superior multiversioning read consistency technology, Oracle is the only database product with such a capability. Does Flashback Database Support all data types? Yes. All data that is located in the database is supported. Do you have to enable the Flash Recovery Area to activate Flashback Database? Yes. Flashback Database utilizes the Flash Recovery Area to organize and manage the flashback logs.

47 ORAFACT