You are on page 1of 47

DBAFAQ

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

ORAFACT

DBAFAQ 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) Duplicate 2) 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 NOCATALOG the 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

DBAFAQ copies only modified blocks Add 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_HOME ln -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 follows DSMI_ORC_CONFIG /usr/tivoli/tsm/client/oracle/bin64/dsm.opt DSMI_LOG /home/tmp/oracle TDPO_NODE backup TDPO_PSWDPATH /usr/tivoli/tsm/client/oracle/bin64 4.create dsm.sys file in same path and add the entries SErvername <Server name > TCPPort 1500 passwordacess prompt nodename backup enablelanfree yes TCPSERVERADDRESS <Server Address> 5.Create dsm.opt file add an entry SErvername <Server name > 5.Then take backup RMAN>run 3 ORAFACT

DBAFAQ { 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 check SQL> SELECT sid,totalwork,sofar FROM v$session_longops WHERE sid=153; Here give SID when back start it will show SID RMAN> 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 Sibling i) 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/manager It 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;

ORAFACT

DBAFAQ 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 backups 2. Ability to Recover one block of datafile 3. Ability to automatically backup CONTROLFILE and SPFILE 4. 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 command LIST 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 CONTROLFILE Why 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.

ORAFACT

DBAFAQ

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 number How 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 SID Where 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 NOCATALOG You 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 file In catalog database, if some of the blocks are corrupted due to system crash, How will you recover? using RMAN BLOCK RECOVER command

ORAFACT

DBAFAQ 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 files How 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 logall How 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 disk How 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 timining What 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 lower Explain 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 OPTIMIZATION 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 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.

ORAFACT

DBAFAQ 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

DBAFAQ 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

DBAFAQ that user managed backups. 3.Proper Security 4.You are 100% sure your database has been backed up . 5.It contains details of backup taken in the central repository 6.Facility of Testing validity of backups also command like cross check to check the status of backup. 7.Oracle 10g has got further optimized incremental backups with has resulted in improvement of performance during backup 8.and recovery time 9.Parrallel operation are supported 10.Better Querying facility for knowing different details of backup. 11.No Extra redo generated when backup is taken. compared to online backup 12.Without rman.which results in saving of space in hard disk. 13.RMAN is an intelligent tool 14.Maintains repository of backup metadata. 15.Remembers backup locations 16.Knows what needs backup set locations 17.Knows what needs to be backed up 18.Knows what is required for recovery 19.Know what backups are redundant 20.It handles database corruptions Oracle Enhancement for Rman in 10g A. 1.Flash Recovery Area 2.Incrementally Updated Backups 3.Faster Incremental Backups 4.SWITCH DATABASE COMMAND. 5.Binary Compression 6.Global Scripting 7.Duration Clause 8.Configure This 9.Oracle Enhancement for Rman in 10g 10.Automatic Channel Failover 11.Compress Backup Sets 12.Recovery Through Reset Logs 13.Cross Backup Sets Global Scripting A.RMAN> print script full_backup to file 'my_script_file.txt' Oracle Database 10g provides a new concept of global scripts, which you can execute against any database registered in the recovery catalog, as long as your RMAN client is connected to the recovery catalog and a target database simultaneously. CPISOLUTION.COM RMAN> create global script global_full_backup 10 ORAFACT

DBAFAQ { backup database plus archivelog; delete obsolete; delete global script full_backup; List Script Names; Run { Execute Global Script global_backup_db;} Global RMAN Scripts Auto Backp of Control file A.Whenever there is a structure change ,Aditonally It Supports 1.Backup of Server Parameter File 2.Parrallel Operation Supported 3.Extensive Reporting Available 4.Scripting 5.Duplex Backup sets 6.Corrupt Block Detection 7.Backup archive Logs Speed Of Backup Devices A.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 Processes Problem An RMAN backup job is running too long. You would like to identify and monitor the RMAN processes associated with the backup job. Solution Inspect RMANs output messages to your terminal to identify your session identifier (SID). If youre 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 this example, the SID is 146: allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=146 devtype=DISK Next, use the V$SESSION and V$PROCESS views to identify which database server sessions correspond to RMAN channels: SQL> SELECT b.sid, b.serial#, a.spid, b.client_info 2 FROM v$process a, v$session b 3 WHERE a.addr = b.paddr 4 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_1 How It Works 11 ORAFACT

DBAFAQ When you first connect to RMAN, Oracle will start two sessions and two corresponding OS processes. There will also be a session and process started for each subsequent channel that is allocated. You can monitor and view these channel processes via the V$SESSION and V$PROCESS views. The SID and SERIAL# values are useful when querying from other V$ views where you want to select and return rows just for your session identifier or serial number (and not hundreds of 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 channel process if you have many RMAN jobs running at the same time. You must put set command id after the allocate channel command, or your specified identifier will not be included in the CLIENT_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=d1 Measuring Backup Performance Problem You want to determine whether backups are taking longer and longer. Solution Use information in V$RMAN_BACKUP_JOB_DETAILS for statistics on backups. The following query 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_time 4 FROM v$rman_backup_job_details 5 ORDER BY end_time; You should see output similar to the following: SESSION_RECID INPUT_BYTES_PER OUTPUT_BYTES_PE TIME_TAKEN_DISPLAY END_TIME ------------- --------------- --------------- -------------------- --------1096 8.60M 7.69M 00:14:25 20-DEC-06 1101 1.88M 1.78M 00:42:03 21-DEC-06 1110 9.59M 8.56M 00:14:56 22-DEC-06 1114 9.75M 8.71M 00:14:52 23-DEC-06 1116 10.73M 9.58M 00:14:31 24-DEC-06 This 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

DBAFAQ backup. Seriously, the job showing a duration of 42 minutes is most likely the result of a DBA doing some experimentation and running several backups interactively, from the command prompt, during one connected session, whereas the other sessions were small backup jobs that connected, ran the backup, and then disconnected from RMAN. How It Works Measuring the duration of your backups provides a good starting point from which you can begin tuning your RMAN backups. The V$RMAN_BACKUP_JOB_DETAILS view contains a plethora of information about backup durations and I/O rates. Tuning Media Recovery Problem You want to manually adjust the degree of parallelism that Oracle uses for media recovery to match the number of CPUs on your database server. Solution Starting with Oracle Database 10g, when you issue an RMAN recover command from either within RMAN or within SQL*Plus, Oracles default behavior is to automatically perform media recovery operations in parallel. However, if you want to override this default behavior, you can use the recover parallel or recover noparallel command. This next line of code instructs Oracle to spawn four parallel processes to apply redo: RMAN> recover database parallel 4; If you dont want Oracle to recover in parallel, then specify the noparallel clause as shown here: RMAN> recover database noparallel; How It Works Ordinarily you dont need to adjust the degree of parallelism for media recovery. This is because Oracle automatically parallelizes media recovery for you. Oracle determines the number of parallel processes to spawn for media recovery from the initialization parameter cpu_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 when you create your database. For this server, Oracle will spawn two processes to apply redo anytime you issue a recover command (from either RMAN or SQL*Plus). Oracles documentation states that systems with efficient asynchronous I/O see little benefit from parallel media recovery. You should test whether adjusting the degree of parallelism improves performance before you attempt this in a production environment. Note :The initialization parameter recovery_parallelism has no effect on media recovery. The recovery_parallelism parameter affects only crash recovery. Slowing RMAN Down Problem Youve noticed that your application performance degrades when the RMAN backups are running. You want to reduce RMANs I/O rate so that it spreads out its impact on the system over a period of time. Solution Use one of the following to control RMANs I/O rate: 13 ORAFACT

DBAFAQ The backup duration ... minimize load command The rate clause of the allocate channel or configure channel command Using backup duration ... minimize load Use the backup duration ... minimize load command to evenly distribute RMAN I/O over a period of time. This example shows how to spread the I/O of an RMAN backup over a 45-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 this snippet: channel ORA_DISK_1: throttle time: 0:44:43 Finished backup at 10-MAR-07 Using rate You can also use the rate clause of the allocate channel command or the configure channel command to control RMANs I/O rate. This example configures channel 1 to have a maximum read 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 Works The duration clause specifies the amount of time you want an RMAN backup to take. When you use the minimize load clause, this instructs RMAN to spread out the I/O load over the duration of the specified time. When minimizing the load, RMAN will monitor and adjust the I/O rate so that the resources are consumed evenly across the duration of the backup. The format for the time value of the duration clause is HH:MM (HH is hours and MM is minutes). You must 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 abort the backup. If you are running backup commands from within a run{} block, then RMAN will not execute subsequent commands. You can use the partial clause to instruct RMAN to continue running subsequent commands within a run{} block (even if the backup doesnt finish in the specified time). In this example, the partial clause instructs RMAN to execute all subsequent commands in the run{} block even if the first command doesnt 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 that were 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 use the 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 set with only one datafile within it. Any backup sets that complete before the duration time is exceeded will be marked as successful. 14 ORAFACT

DBAFAQ Note: Oracle does not recommend using backup duration ... minimize load when using tape devices. When using minimize load, RMAN could reduce its I/O to a rate that is too low to keep the tape device streaming. Configure Retention policy to redundancy 3; A.All backups older than the most recent backup that satisfied the above conditions are obsolete. The recovery window always keeps in pace with the current time. Specifying redundancy by using the CONFIGURE RETENTION POLICY TO REDUNDANCY command: The REDUNDANCY parameter specifies that any number of backups or copies beyond a specified number does not need to be retained. For example, the CONFIGURE RETENTION POLICY TO REDUNDANCY 3; command specifies that a maximum of three backups or copies of a data file or control file can be retained. Redundancy is the default type of retention policy. Block Media Recovery A.Allows specified blocks to be recovered without affecting the entire datafile.. It is only intended for use where a known and limited number of block is affected. This results in a reduced mean time to recover (MTTR) and higher availability as only the affected blocks are offline during operation The information regarding which block has to be recovered in found in The alert log file, Trace File,Analyze Table Command, Dbverify utility,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 recovery activities. 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 # from header of a database file. What happens when you issue hot backup database in RMAN at block level backup? How does RMAN mark the record that the block has been backed up ? How does 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 feature records 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 15 ORAFACT

DBAFAQ 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 writing data to the block change tracking file. RMAN uses SCNs on the block level and the archived redo logs to resolve any inconsistencies in the datafiles from a hot backup. What RMAN does not require 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 executable 2.Server processes 3.Channels 4.Target database 5.Recovery catalog database (optional) 6.Media management layer (optional) 7.Backups, backup sets, and backup pieces What 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 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 time Why is the catalog optional? Because RMAN manages backup and recovery operations, it requires a place to store necessary information about the database. RMAN always stores this information in the target database control file. You can also store RMAN metadata in a recovery catalog schema contained in a separate database. The recovery catalog schema 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. 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 an RMAN backup command. A backup set is RMAN's name for a collection of files associated with a 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 16 ORAFACT

DBAFAQ medium, whether to disk or tape. They contain blocks from the target database's datafiles, archived redo log files, and control files. When RMAN constructs a backup piece from datafiles, 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 RMAN is the only tool that can operate on backup pieces. If you need to restore a file from an RMAN backup, you must use RMAN to do it. There's no way for you to manually reconstruct database files from the backup pieces. 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 online backups. 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 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. How RMAN improves backup time? RMAN backup time consumption is very less than compared to regular online backup as RMAN copies only modified blocks Can you take Offline backups using RMAN? RMAN Offline Backup is possiable Recall that an offline backup is a backup of the database while it is not running. Hence, to perform our backup we will shutdown the database from RMAN and then mount the database. We will perform the backup. Once the backup is complete we will restart the database again. Here is an example of this process: RMAN>shutdown immediate RMAN>startup mount RMAN>backup database; RMAN>sql alter database open;

17

ORAFACT

DBAFAQ 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 a target database (database that RMAN backups or restores). RMAN uses this metadata to conduct its backup, recovery, and maintenance operations. Recovery catalog is optional, i.e., if a recovery catalog is not created, RMAN uses the target databases control file to store the metadata about the target database. Although RMAN can conduct all major backup and recovery operations by using the control file, 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 database for security reason as recommended by oracle. we can use RMAN without RC,by using Target Database control file. Can you use RMAN without Recovery catalog? Yes we can use rman without recovery catalog as the metadata information is stored in controlfile Can you take Image Backups using RMAN? yes we can take image backup using rman by issuing the following command RMAN> 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 file You 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 catalog is used Can you start and shutdown DB using RMAN? When an RMAN procedure requires that your database be started, shut down or brought to MOUNT or NOMOUNT state, you can use the RMAN client to start up and shut down the target database. The following example uses the RMAN SHUTDOWN and STARTUP commands to shut the target database down cleanly, and then mount it in preparation for a backup: % rman TARGET / RMAN> SHUTDOWN IMMEDIATE # closes database consistently RMAN> STARTUP MOUNT

18

ORAFACT

DBAFAQ 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 to different 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 happens when you reset the online redo logs using alter database open resetlogs;. Database incarnation falls into following category Current Parent Ancestor and Sibling i) 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. iv) Sibling Incarnation: Two incarnations that share a common ancestor are sibling incarnations if neither one is an ancestor of the other. You loss one datafile and DB is running in ARCHIVELOG mode. You have full database backup of 1 week old and partial backup of this datafile which is just 1 day old. From which backup should you restore this file? Answer: Partail Backup Some datafiles were there on a secondary disk and that disk has become damaged and it will take some 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 it and 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 using RMAN? 19 ORAFACT

DBAFAQ Answer: query the SELECT * FROM V$DATABASE_BLOCK_CORRUPTION view and get the status. 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 recover this 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 the databse 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 modified blocks 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 restore this 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 the database controlfile. You can view this information by querying the V$COPY_CORRUPTION or V$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 first register the datafile image copies or OS backups to RMAN as well as the current archive log and all logs since the image backup time. This can be accomplished by using the RMAN CATALOG command. 15. Answer:Yes. Infact a configuration many customers may choose, is to create the Recovery Catalog in the same database that stores the Oracle Enterprise Manager repository. I have noticed the shadow (or server) processes spawned for "allocate channel" command wouldn't go away after rman completed and released the channel (at least the message in RMAN showed they were released), I noticed the shadow stayed for at least 8 minutes. I did wait for too long. As soon as I 20 ORAFACT

DBAFAQ exit from rman, they disappeared. Were they waiting pmon to clean them up? How long does this usually take? Server processes for channels will not disappear until RMAN exists. The idea is that these processes will 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 parallelize the backup of the database files and archive logs. If files need to be restored, using set AUTOLOCATE ON 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 being written out to tape? Answer: RMAN does not use an explicit encryption method, although the binary format of backup files offers 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 it contains. * 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 database o replication o maintaining two separate Recovery Catalog databases: one is kept in sync as it is used for everyday production operation, and the other is kept in sync manually, by periodically issuing the RESYNC CATALOG command. * Use RMAN to back up the Recovery Catalog database, but for these backups, start RMAN with the NOCATALOG option, so that the backup repository for the Recovery Catalog is its own control file. The CONTROL_FILE_RECORD_KEEP_TIME parameter should be set to a value which is high enough 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 the Recovery 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.rmn 2. If already in an RMAN session, from the RMAN prompt: @fullback.rmn You 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 slight performance overhead, but Checksums allow Oracle to detect early corruption caused by underlying disk, storage system, or I/O system problems. 21 ORAFACT

DBAFAQ 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 through
RMAN, are the only form in which RMAN can write backups to media 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 disk will 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 BACKEDUP 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 timining.
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 happens when 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

DBAFAQ redo. ii) Parent Incarnation: The database incarnation from which the current incarnation branched following an OPEN RESETLOGS operation. LIST SOME OF THE RMAN CATALOG VIEW NAMES WHICH CONTAINS THE CATALOG INFORMATION ? RC_DATABASE_INCARNATION RC_BACKUP_COPY_DETAILS RC_BACKUP_CORRUPTION RC_BACKUP_DATAFILE_SUMMARY to name a few WHAT IS FRA ? WHEN DO YOU USE THIS ? Flash Recovery Area: * Flash recovery area where you can store not only the traditional components found in a backup strategy such as control files archived log files and Recovery Manager (RMAN) datafile copies but also a number of other file components such as flashback logs. * The flash recovery area simplifies backup operations and it increases the availability of the database because many backup and recovery operations using the flash recovery area can be performed when the database is open and available to users. * Because the space in the flash recovery area is limited by the initialization parameter DB_ RECOVERY_FILE_DEST_SIZE 13) * 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 an RMAN backup command. A backup set is RMAN's name for a collection of files associated with a 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

DBAFAQ files. When RMAN constructs a backup piece from datafiles, 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 RMAN is the only tool that can operate on backup pieces. If you need to restore a file from an RMAN backup, you must use RMAN to do it. There's no way for you to manually reconstruct database files from the backup pieces. You must use RMAN to restore files from a backup piece. HOW TO ENABLE FAST INCREMENTAL BACKUP IN RMAN? Now we can enable block change tracking SQL> 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 11599872 change 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, and query 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 the last 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

DBAFAQ

STORED IN CONTROLFILE? control_file_record_keep_time HOW CAN WE LIST HE CURRENT CONFIGURATION OF THE TARGET DATABASE IN RMAN? Using REPORT COMMAND REPORT SCHEMA HOW CAN WE GET THE DETAILED REPORT OF THE BACKUP SETS LIST COMMAND. CAN WE MAKE A IMAGE COPY OF THE WHOLE DATABASE? YES,.....STEPS STARTUP MOUNT REPORT SCHEMA COPY DATAFILE1 TO '/BACKUP/DF2.CPY'(for all datafiles) LIST COPY HOW CAN WE DETECT BLOCK CORRUPTION by 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 at block level backup? How does RMAN mark the record that the block has been backed up ? How does 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 feature records 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 changed blocks. Logging of changed blocks is performed by the CTRW process which is also responsible for writing data to the block change tracking file. RMAN uses SCNs on the block level and the archived redo logs to resolve any inconsistencies in the datafiles from a hot backup. What RMAN does not require 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). why we use dbid in rman When you have multiple databases you have to set your DBID (Database Id) which is unique to each database. You have to set this before you do any restore operation from RMAN.
25 ORAFACT

DBAFAQ

how can we remove the invalid backup pieces from the backup sets crosscheck backup delete expired backup
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 configured then before issuing the DUPLICATE command manually allocate at least one auxiliary channel within the same RUN command. When a Duplicate Database created or tablespace point in time recovery is performed Auxiliary database is used. this database can either on the same host or a different host. what are different encryption modes in rman transparentmode ,dual mode and password mode how can we recover corrupted blocks . Rman>block recover datafile <dbfileid> block <blockid>; how can we make a backupset unavailable
LIST BACKUPSET bs_key;

CHANGE BACKUPSET bs_key UNAVAILABLE; does RMAN delete Standby Archivelogs SQL> select thread#, sequence#, ARCHIVED, APPLIED, STATUS from v$archived_log; THREAD# SEQUENCE# ARC APP S ---------- --- --- 1 1 YES NO D 1 2 YES NO D :: 1 1636 YES NO A 1 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 backup run { 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

DBAFAQ how can we take automatic controlfile backup RMAN does it automatically if you set CONTROLFILE AUTOBACKUP ON on RMAN configuration what view helps to create equal sized backup sets determining the no.of blocks in each datafile v$backup_datafile how can we retrieve info about archive logs in backupsets v$backup_redolog how can we monitor the progress of backups and copies v$session_longops 20.which files are recoverable because of unrecoverable operations report 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 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. 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 configured then before issuing the DUPLICATE command manually allocate at least one auxiliary channel within the same RUN command. When a Duplicate Database created or tablespace point in time recovery is performed Auxiliary database 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

DBAFAQ 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. RMAN> CONFIGURE DEVICE TYPE PARALLELISM 2 BACKUP TYPE TO COMPRESSED BACKUPSET; 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 will increase 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 its recommended by oracle that we need to have recovery catalog in other DB Which is more efficient Incremental Backups using RMAN or Incremental Export? RMAN in more efficient than incremental Export 12)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 catalog RMAN>connect taget username/password@ connect_string catalog cataloguser/password@connect_string 28 ORAFACT

DBAFAQ RMAN>register database How 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 why those 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 same time that DBWR is updating the file. We can't prevent the tool from reading a particular block at the exact same time that DBWR is updating that block. When that happens, the non-Oracle tool might read a block in a halfupdated state, so that the block which is copied to the backup media might only have been updated in its first half, while the second half contains older data. This is called a "fractured block". If this backup needs to be restored 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 tablespace is in backup mode, and a change is made to a data block, instead of logging just the changed bytes to the redo log, we also log a copy of the entire block image before the change, so that we can reconstruct this block if media recovery finds that this block was fractured. That block image logging is what causes extra redo to be generated 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 fractured block. We can make that guarantee because we know the format of Oracle data blocks, and we verify that each block that we read is complete before we copy it to the backup. If we read a fractured block, we read the block again to obtain a complete block before backing it up. non-Oracle tools are not able to do the same thing because they do not know how to verify the contents of an Oracle data block. Backup mode has another effect, which is to 'freeze' the checkpoint in the header of the file until the file is removed from backup mode. We do this because we 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 the blocks, 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 exist A: An error message stack like the following indicates that CATPROC.SQL did NOT execute successfully on the target 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 catalog RMAN-07004: unhandled exception during command execution on channel default RMAN-10032: unhandled exception during execution of job step 1: ORA-04067: not executed, stored procedure "SYS.DBMS_BACKUP_RESTORE" does not exist ORA-01403: no data found ORA-06512: at line 221 RMAN-10035: exception raised in RPC: ORA-04067: not executed, stored procedure "SYS.DBMS_BACKUP_RESTORE" does not exist RMAN-10031: ORA-4067 occurred during call to DBMS_BACKUP_RESTORE.GETPARM

Diffarance between increamental and cumulative backups 29 ORAFACT

DBAFAQ A differential backup, which backs up all blocks changed after the most recent incremental backup at level 1 or. 0 A cumulative backup, which backs up all blocks changed after the most recent incremental backup at level 0. Incremental backups are differential by default. Recovering a block using RMAN If 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 follows Block Recover datafile 8 block 22; Give me some of the RMAN catalog view names which contains the catalog information ? Ans:RC_DATABASE_INCARNATION RC_BACKUP_COPY_DETAILS RC_BACKUP_CORRUPTION RC_BACKUP_DATAFILE_SUMMARY to name a few
What is RMAN ? Recovery Manager (RMAN) is a utility that can manage your entire Oracle backup and recovery activities. Diffarance b/t, When you take a hot backup putting Tablespace in begin backup mode and RMAN backup Oracle records SCN # from header of a database file. What happens when you issue hot backup database in RMAN at block level backup? How does RMAN mark the record that the block has been backed up ? How does 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 feature records 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 changed blocks. Logging of changed blocks is performed by the CTRW process which is also responsible for writing data to the block change tracking file. RMAN uses SCNs on the block level and the archived redo logs to resolve any inconsistencies in the datafiles from a hot backup. What RMAN does not require 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 executable 2.Server processes 3.Channels 4.Target database 5.Recovery catalog database (optional) 6.Media management layer (optional)

30

ORAFACT

DBAFAQ
7.Backups, backup sets, and backup pieces What 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 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 time Why is the catalog optional? Because RMAN manages backup and recovery operations, it requires a place to store necessary information about the database. RMAN always stores this information in the target database control file. You can also store RMAN metadata in a recovery catalog schema contained in a separate database. The recovery catalog schema 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. 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 an RMAN backup command. A backup set is RMAN's name for a collection of files associated with a 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 files. When RMAN constructs a backup piece from datafiles, 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 RMAN is the only tool that can operate on backup pieces. If you need to restore a file from an RMAN backup, you must use RMAN to do it. There's no way for you to manually reconstruct database files from the backup pieces. 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 online backups.

31

ORAFACT

DBAFAQ
3. Detection of corrupt blocks during backups. 4. Parallelization of I/O operations. 5. Automatic logging of all backup and recovery operations. 6. Builtin reporting and listing commands. what is recovery catalog? Recovery catalog holds RMAN repository data for one or more databases in a separate database schema, in addition to using the control files of the databases. Start by creating a database schema (usually called rman). Assign an appropriate tablespace to it and grant it the recovery_catalog_owner role. Look at this example: sqlplus sys/ as sysdba SQL> 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 running the catrman.sql script. > rman catalog rman/rman RMAN> 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/backdba RMAN> 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 3 how many days RMAN keeps the information in controlfile? It is depends upon the retention polocy we configured 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) 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 archivelog rman target / RMAN>startup mount RMAN>restore database RMAN>recover database

32

ORAFACT

DBAFAQ
RMAN>alter database open 16.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_RCVMAN these are internal, undocumented packages created by the create catalaog command DBMS_RCVMAN is create din the target database by the scripts dbmsrman.sql and prvtrmns.plb which are called by catproc.sql DBMS_RCVCAT is used by recovery manager to maintain information in the recovery catalog and DBMS_RCVMAN quesries the controlfile or recovery catalog what is REPORT command in RMAN what files need to be backup RMAN>report need backup which backups can be delted RMAN>report obsolete;

What is RMAN and how does one use it? Recovery Manager (or RMAN) is an Oracle provided utility for backingup, 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. In fact RMAN, is just a Pro*C application that translates commands to a PL/SQL interface. The PL/SQL calls are stallically linked into the Oracle kernel, and does not require the database to be opened (mapped from the ?/rdbms/admin/recover.bsq file). RMAN can do offline and online database backups. It cannot, however, write directly to tape, but various 3rdparty tools (like Veritas, Omiback, etc) can integrate with RMAN to handle tape library management. RMAN can be operated from Oracle Enterprise Manager, or from command line. Here are the command line arguments: Argument Value Description target quotedstring connectstring for target database catalog quotedstring connectstring 33 ORAFACT

DBAFAQ for recovery catalog nocatalog none if specified, then no recovery catalog cmdfile quotedstring name of input command file log quotedstring name of output message log file trace quotedstring name of output debugging message log file append none if specified, log is opened in append mode debug optionalargs activate debugging msgno none show RMANnnnn prefix for all messages send quotedstring send a command to the media manager pipe string building block for pipe names timeout integer number of seconds to wait for pipe input Here is an example: [oracle@localhost oracle]$ rman Recovery Manager: Release 10.1.0.2.0 Production Copyright (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. RMAN doesn't put tablespaces in backup mode, saving on redo generation overhead. RMAN will reread database blocks until it gets a consistent image of it. Look at this simple backup example. rman target sys/*** nocatalog run { allocate channel t1 type disk; backup format '/app/oracle/backup/%d_t%t_s%s_p%p' (database); release channel t1; } Example RMAN restore: rman target sys/*** nocatalog run { 34 ORAFACT

DBAFAQ 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 basic concepts. By default Oracle uses the database controlfiles to store information about backups. Normally one would rather setup a RMAN catalog database to store RMAN metadata in. Read the Oracle Backup and Recovery Guide before implementing any RMAN backups. Note: RMAN cannot write image copies directly to tape. One needs to use a thirdparty media manager that integrates with RMAN to backup directly to tape. Alternatively one can 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 from filling up. If the archive log directory becomes full, your database will hang! Look at this simple RMAN backup scripts: RMAN> run { 2> allocate channel dev1 type disk; 3> backup 4> 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 appropriate tablespace to it and grant it the recovery_catalog_owner role. Look at this example: sqlplus sys SQL> 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

DBAFAQ 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 running the catrman.sql script. rman catalog rman/rman RMAN> 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/backdba RMAN> register database; One can also use the "upgrade catalog;" command to upgrade to a new RMAN release, or the "drop catalog;" command to remove an RMAN catalog. These commands need to be entered twice to confirm the operation. How does one integrate RMAN with thirdparty Media Managers? The following Media Management Software Vendors have integrated their media management 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 (and installation 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.htm When allocating channels one can specify Media Management spesific parameters. Here are some examples: 36 ORAFACT

DBAFAQ 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_a rchlogs)'; 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.ORA and password file (use the orapwd utility) on the machine you need to clone the database to. Review all parameters and make the required changed. For example, set the DB_NAME parameter to the new database's name. Secondly, you need to change your environment variables, and do a STARTUP NOMOUNT from sqlplus. This database is referred to as the AUXILIARY in the script below. Lastly, write a RMAN script like this to do the cloning, and call it with "rman cmdfile dupdb.rcv": connect target sys/secure@origdb connect catalog rman/rman@catdb connect 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 dupdb logfile GROUP 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 recovery catalog (to get backup info), and the auxiliary database (new duplicate DB). Previous backups will be restored and the database recovered to the "set until time" specified in the script. Notes: the "set newname" commands are only required if your datafile names will 37 ORAFACT

DBAFAQ different from the target database. The newly cloned DB will have its own unique DBID. Can one restore RMAN backups without a CONTROLFILE and RECOVERY CATALOG? Details of RMAN backups are stored in the database control files and optionally a Recovery Catalog. If both these are gone, RMAN cannot restore the database. In such a situation one must extract a control file (or other files) from the backup pieces written out when 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 / nocatalog Recovery Manager: Release 10.1.0.2.0 64bit Production Copyright (c) 1995, 2004, Oracle. All rights reserved. connected to target database: ORCL (DBID=1046662649) using target database controlfile instead of recovery catalog RMAN> backup datafile 1; Starting backup at 20AUG04 allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=146 devtype=DISK channel ORA_DISK_1: starting full datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset input datafile fno=00001 name=/oradata/orcl/system01.dbf channel ORA_DISK_1: starting piece 1 at 20AUG04 channel ORA_DISK_1: finished piece 1 at 20AUG04 piece handle= / flash_recovery_area/ORCL/backupset/2004_08_20/o1_mf_nnndf_TAG20040820T153256_0 lczd9tf_.bkp comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:45 channel ORA_DISK_1: starting full datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset including current controlfile in backupset including current SPFILE in backupset channel ORA_DISK_1: starting piece 1 at 20AUG04 channel ORA_DISK_1: finished piece 1 at 20AUG04 piece handle= / flash_recovery_area/ORCL/backupset/2004_08_20/o1_mf_ncsnf_TAG20040820T153256_0l czfrx8_.bkp comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:04 Finished backup at 20AUG04[/ code] Now, let's destroy one of the control files: 38 ORAFACT

DBAFAQ SQL> show parameters CONTROL_FILES NAME TYPE VALUE control_ files string /oradata/orcl/control01.ctl, /oradata/orcl/control02.ctl, /oradata/orcl/control03.ctl SQL> 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 NOMOUNT mode: SQL> startup NOMOUNT ORACLE instance started. Total System Global Area 289406976 bytes Fixed Size 1301536 bytes Variable Size 262677472 bytes Database Buffers 25165824 bytes Redo Buffers 262144 bytes</pre> Now, from SQL*Plus, run the following PL/SQL block to restore the file: DECLARE v_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; BEGIN Define the backup pieces... (names from the RMAN Log file) v_pieceName(1) := '/flash_recovery_area/ORCL/backupset/2004_08_20/o1_mf_ncsnf_TAG20040820T15325 6_0lczfrx8_.bkp'; v_pieceName(2) := '/flash_recovery_area/ORCL/backupset/2004_08_20/o1_mf_nnndf_TAG20040820T1532 56_0lczd9tf_.bkp'; v_maxPieces := 2; Allocate a channel... (Use type=>null for DISK, type=>'sbt_tape' for TAPE) v_devtype := DBMS_BACKUP_RESTORE.deviceAllocate(type=>NULL, ident=>'d1'); Restore the first Control File... DBMS_BACKUP_RESTORE.restoreSetDataFile; CFNAME mist be the exact path and filename of a controlfile taht was backedup DBMS_BACKUP_RESTORE.restoreControlFileTo(cfname=>'/app/oracle/oradata/orcl/co 39 ORAFACT

DBAFAQ ntrol01.ctl'); dbms_output.put_line('Start restoring '||v_maxPieces||' pieces.'); FOR i IN 1..v_maxPieces LOOP dbms_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; Deallocate the channel... DBMS_BACKUP_RESTORE.deviceDeAllocate('d1'); EXCEPTION WHEN OTHERS THEN DBMS_BACKUP_RESTORE.deviceDeAllocate; RAISE; END; / Let's see if the controlfile was restored: SQL> ! ls l /oradata/orcl/control01.ctl rwr1 oracle 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.ctl SQL> ! cp /oradata/orcl/control01.ctl /oradata/orcl/control03.ctl SQL> alter database mount SQL> recover database using backup controlfile; ORA00279: change 7917452 generated at 08/20/2004 16:40:59 needed for thread 1 ORA00289: suggestion : /flash_recovery_area/ORCL/archivelog/2004_08_20/o1_mf_1_671_%u_.arc ORA00280: change 7917452 for thread 1 is in sequence #671 Specify log: {<RET>=suggested | filename | AUTO | CANCEL} /oradata/orcl/redo02.log Log 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

DBAFAQ 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. how many days RMAN retain the info in controlfil? Depending upon the retention polocy it will retain the copies How 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 a recovery_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 for backing up Oracle7 databases. It is sometimes referred to as OEBU for Oracle Enterprise Backup Utility. The Oracle Recovery Manager (RMAN) utility that ships with Oracle8 and above is similar to Oracle7's EBU utility. However, there is no direct upgrade path from EBU to RMAN. How does one create a RMAN recovery catalog? Start by creating a database schema (usually called rman). Assign an appropriate tablespace to it and grant it the recovery_catalog_owner role. Look at this example: sqlplus sys SQL>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 running the catrman.sql script. rman catalog rman/rman RMAN>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/backdba RMAN> register database; How can a group in a cross products be visually distinguished from a group 41 ORAFACT

DBAFAQ 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 You can issue the ALTER 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 have changed in the database, Recovery Manager (RMAN) can avoid scanning the entire datafile during an incremental 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-based backup 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 they have been successfully backed up by RMAN, and the equivalent of a disk cache for tape, which reduces the time needed to restore a file from tape. It reduces the risk of an out-of-space condition on disk by deleting files that are no longer necessary for successful database recovery. RMAN Database Dropping and Deregistration - The new DROP DATABASE and UNREGISTER DATABASE RMAN commands remove the database and its entry from the RMAN recovery catalog. Automated TSPITR Instantiation - This feature automatically creates the auxiliary instance needed to perform tablespace point-in-time recovery (TSPITR) and incorporates the RMAN TSPITR operations. Simplified Recovery Manager Cataloging of Backup Files - You can now catalog RMAN proprietary backup metadata into a backup repository. If a backup is overwritten in the control file, or a backup file is moved to a new location on disk, then you can easily uncatalog the backup metadata from 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

DBAFAQ 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

DBAFAQ 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

DBAFAQ SQL> PURGE TABLE emp; -- Purges the specified table. SQL> PURGE TABLESPACE scott_ts USER scott; -- All the Scotts 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

DBAFAQ SQL> SELECT count(*) FROM flashback_table Managing the Recycle Bin If the tables are not really dropped in this process--therefore not releasing the tablespace--what happens 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 filled up with recycle bin data such that the datafiles have to extend to make room for more data, the tablespace is said to be under "space pressure." In that scenario, objects are automatically purged from the recycle bin in a first-in-first-out manner. The dependent objects (such as indexes) are removed before a table is removed. Similarly, space pressure can occur with user quotas as defined for a particular tablespace. The tablespace may have enough free space, but the user may be running out of his or her allotted portion of it. In such situations, Oracle automatically purges objects belonging to that user in that tablespace. In addition, there are several ways you can manually control the recycle bin. If you want to purge the specific table named TEST from the recycle bin after its drop, you could issue PURGE 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 an index 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 all the 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. This approach could come handy in data warehouse-type environments where users create and drop many transient tables. You could modify the command above to limit the purge to a specific user only: PURGE TABLESPACE USERS USER SCOTT; A user such as SCOTT would clear his own recycle bin with PURGE RECYCLEBIN; You as a DBA can purge all the objects in any tablespace using PURGE DBA_RECYCLEBIN; As you can see, the recycle bin can be managed in a variety of different ways to meet your specific 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

DBAFAQ 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

You might also like