This chapter describes the basic concepts for the Oracle Recovery Manager utility, and includes the following topics: Introduction to Recovery Manager Backing Up to e!uential Media Recovery Manager Backup Types "orruption #etection $aralleli%ation Report &eneration User Tags for Recovery Manager Backups Backup "onstraints Restore "onstraints Integrity "hecking 'ractured Block #etection #uring Open #atabase Backups in Recovery Manager "ataloging I(age "opies and )rchive *ogs
2hen running in batch (ode, Recovery Manager reads input fro( a co((and file and writes output (essages to a log file ,if specified-+ The co((and file is parsed in its entirety before any co((ands are co(piled and e.ecuted+ Batch (ode is (ost suitable for perfor(ing regularly scheduled backups via an operating syste( 3ob control facility+ Recovery Manager provides the following categories of co((ands: backup, restore, copy and recover Recovery catalog (aintenance co((ands tored script (aintenance co((ands report and list co((ands
)t a (ini(u(, you should resynchroni%e your recovery catalog at intervals less than the "O=TRO*7'I*17R1"OR#7>11$7TIM1 setting, because after this nu(ber of days, the infor(ation in the control file will be overwritten with the (ost recently created infor(ation? if you have not resynchroni%ed, and infor(ation has been overwritten, this infor(ation can not be propagated to the recovery catalog+ Note: The (a.i(u( si%e of the control file is port specific+ ee your see your operating syste(/ specific Oracle docu(entation+
See Also: 'or (ore infor(ation about the "O=TRO*7'I*17R1"OR#7>11$7TIM1 para(eter, see the Oracle@ Reference+
Operating without a Recovery Catalog Note: You are not required to maintain a recovery catalog with Recovery Manager; however, Oracle recommends that you use one.
Because (ost infor(ation in the recovery catalog is also available in the target database8s control file, Recovery Manager supports an operational (ode where it uses the target database control file instead of a recovery catalog+ This operational (ode is appropriate for s(all databases where installation and ad(inistration of another database for the sole purpose of (aintaining the recovery catalog would be burdenso(e+ =ote that the following features are not supported in this operational (ode: tablespace point/in/ti(e recovery stored scripts restore and recovery when the control file is lost or da(aged To restore and recover your database without using a recovery catalog, Oracle reco((ends that you: Use (ultiple.ed control files ,(ini(u( of two-, and have each control file on separate disks to protect against (edia failure+ >eep e.cellent record of what files were backed up, the date they were backed up, and also the na(es of the backup pieces each file was written to+ >eep all Recovery Manager backup logs+ warning: It is difficult to restore and recover if you lose your control files and do not use a recovery catalog. The only way to restore and recover when you have lost all control files and need to restore and recover datafiles, is to call Oracle WorldWide Support WWS!. WWS will need to know the following: current sche"a of the database
which files were backed up what ti"e the files were backed up na"es of the backup pieces containing the files
See Also: 'or (ore infor(ation about the "O=TRO*7'I*17R1"OR#7>11$7TIM1 para(eter, see the Oracle@ Reference+
Stored Scripts
#atabase ad(inistrators can store a se!uence of Recovery Manager co((ands, called a stored script, in the recovery catalog for e.ecution at a later ti(e+ This allows the ad(inistrator to plan, develop and test a set of co((ands for backing up, restoring, and recovering the database+ tored scripts also (ini(i%e the potential for operator errors+ 1ach stored script relates to only one database+
Backup Sets
) backup set contains one or (ore datafiles or archivelogs? however, it cannot contain both datafiles and archivelogs+ #atafile backup sets can also contain a control file backup+ Backup sets are in an Oracle proprietary for(at ,si(ilar to 1.port files-+ 0ou (ust perfor( a restore operation to e.tract a file fro( a backup set+ ) backup set is also co(plete set of backup pieces that constitute a full or incre(ental backup of the ob3ects specified in the backup co((and+ The pieces of a backup set are written serially+ , triping a backup set across (ultiple output devices is not supported+- If (ultiple output devices are available, you can partition your backups so that (ultiple backup sets are created in parallel+ Recovery Manager perfor(s this backup partitioning auto(atically, if desired+ ) backup set can: be written to disk or tertiary storage be full or incre(ental span (ultiple OD files ,each file is a piece of the set//typically, one set is co(prised of only one piece0ou can write backup sets to either nor(al operating syste( disk files or to se!uential output (edia ,for e.a(ple, (agnetic tape- using a se!uential output device or (edia (anage(ent syste( that is available and supported by Oracle on your operating syste(+ To deter(ine which device types are supported by your operating syste( or Media Manager, !uery the EFB)">U$7#1EI"1 view+
) backup set containing archived logs is called an archivelog backup set+ 0ou cannot archive directly to tape+ <owever, Recovery Manager allows you to back up archived logs fro( disk to tape+ )lso, during recovery Recovery Manager auto(atically stages the re!uired archived logs fro( tape to disk+ See Also: 'or details about EFB)">U$7#1EI"1, see the Oracle@ Reference+
Backup Pieces
) backup set is co(posed of one or (ore backup pieces, each piece being a single output file+ 0ou should restrict the si%e of a backup piece to whatever is the (a.i(u( file si%e supported by your Media Manager or OD ,if writing to disk-+ If you do not restrict this si%e, a backup set will be co(prised of only one file+ 1ach backup piece contains control and checksu( infor(ation that allows the Oracle server process to validate the correctness of the backup piece during a restore+
File Multiplexing
#atafile blocks included in the sa(e backup set are (ultiple.ed together+ This (eans that the blocks fro( all of the files in the set are interspersed with all the other blocks+ 0ou can control the nu(ber of datafiles that are backed up concurrently to a backup set using the filesperset para(eter+ "ontrolling concurrency is helpful if you want to keep a tape device strea(ing without saturating a single datafile with too (any read re!uests ,which can subse!uently degrade online perfor(ance-+ 0ou can li(it the read rate by using the set li"it readrate channel co((and+ See Also: 'or a detailed description, see AMultiple.ed Backup etsAch4+ht( / B54;:5+
Oracle allows you to create and restore full backups of the following: datafile datafile copy tablespace control file ,current or backup database )rchivelog backup sets are always full backups+
) cu(ulative incre(ental level 5 backup occurs+ This backs up all blocks that have changed since the (ost recent incre(ental backup at level n/G or less? in this case the (ost recent incre(ental backup at level 5/G or less is the level : unday backup, so all the blocks changed since unday will be backed up+ ,This includes those which were copied on Monday, as this backup is Acu(ulativeA and includes the blocks copied at backups taken at the sa(e incre(ental level as the current backup-+ 2ednesday ) cu(ulative incre(ental level 5 backup occurs+ This backs up all blocks that have changed since the (ost recent incre(ental backup at level n/G or less? in this case the (ost recent incre(ental backup at level 5/G or less is the level : unday backup, so all the blocks changed since unday will be backed up+ ,This includes those which were copied on Monday H Tuesday, as this backup is cu(ulative and includes the blocks copied at backups taken at the sa(e incre(ental level as the current backup-+ Thursday ) cu(ulative incre(ental level G backup occurs+ This backs up all blocks that have changed since the (ost recent incre(ental backup at level n/G or less? in this case the (ost recent incre(ental backup at level G/G or less is the level : unday backup, so all the blocks changed since unday will be backed up+ 'riday ) cu(ulative incre(ental level 5 backup occurs+ This backs up all blocks that have changed since the (ost recent incre(ental backup at level n/G or less? in this case the (ost recent incre(ental backup at level 5/G or less is the level G Thursday backup, so all the blocks changed since Thursday will be backed up+ aturday ) cu(ulative incre(ental level 5 backup occurs+ This backs up all blocks that have changed since the (ost recent incre(ental backup at level n/G or less? in this case the (ost recent incre(ental backup at level 5/G or less is the level G Thursday backup, so all the blocks changed since unday will be backed up+ The cycle is repeated+
Image Copies
)n image copy contains a single file ,datafile, archivelog, or control file- that you can use as/is to perfor( recovery+ )n i(age copy backup is si(ilar to an OD copy of a single file, e.cept it is produced by an Oracle server process, which perfor(s additional actions like validating the blocks in the file, and registering the copy in the control file+ )n i(age copy differs fro( a backup set because it is not (ultiple.ed, nor is there any additional header or footer control infor(ation stored in the copy+ Image copy backups (ay be written only to disk+ If the i(age copy is of a datafile, then no restore operation is re!uired? a switch co((and is provided to point the control file at the copy and update the recovery catalog to indicate that the copy has been Aconsu(ed?A this is e!uivalent to the 9* state(ent )*T1R #)T)B) 1 R1=)M1 #)T)'I*1+ 0ou can then perfor( (edia recovery to (ake the copy current+ )n i(age copy can be restored to another location to prevent the Aconsu(ptionA of the copy, but a restore is not strictly necessary because the datafile can be rena(ed to the i(age copy+
(ust notify Recovery Manager when the copy is no longer available for restore ,using the change ... uncatalog co((and-+ In this e.a(ple, if the (irror is resilvered ,not including other copies of the broken (irror-, you (ust use a change ... uncatalog to update the recovery catalog and indicate that this copy is no longer available+
Corruption Detection
)s it is an Oracle server process which is perfor(ing a backup or copy, the server process is able to detect (any types of corrupt blocks+ 1ach new corrupt block not previously encountered in a backup or copy operation is recorded in the control file and in the alert log+ Recovery Manager !ueries this infor(ation at the co(pletion of a backup and stores it in the recovery catalog+ 0ou can !uery this infor(ation fro( the control file using the views EFB)">U$7"ORRU$TIO= and EF"O$07"ORRU$TIO=+ If you encounter a datafile block during a backup that has already been identified as corrupt by the database, then the corrupt block is copied into the backup and the corruption is reported to the control file as either a logical or (edia corruption+ If a datafile block is encountered with a corrupt header that has not already been identified as corrupt by the database, then the block is written to the backup with a refor(atted header indicating the block is (edia corrupt+ Note: #ot all types of corruptions can be detected at this ti"e.
Channel Control
) channel (ust be allocated before issuing a backup, copy, restore, or recover co((and+ 1ach allocate channel co((and establishes a connection fro( Recovery Manager to a target database instance by starting a server process on the target instance+ The allocate channel co((and also specifies the type of IDO device that the server process will use to perfor( the backup or restore operation+ 1ach channel usually corresponds to one output device, unless your MM* ,Media Manage(ent *ibrary- is capable of hardware (ultiple.ing+ Oracle does not reco((end hardware (ultiple.ing of Oracle backups+ =ote that there is only one Recovery Manager process co((unicating with one or (any server processes attached to the target database+ 0ou can allocate (ultiple channels, thus allowing (ultiple backup sets or file copies to be read or written in parallel by a single Recovery Manager co((and+ Thus, the degree of parallelis( within a co((and is affected by the nu(ber of channels ,connections- that are allocated+ 1ach allocate channel co((and uses a separate connection to the target database+ 0ou can specify a different connect string for each channel, to connect to different instances of the target database+ This is useful in an Oracle $arallel erver configuration for distributing the workload across different nodes+ "hannel control co((ands can be used to: control the OD resources Recovery Manager uses when perfor(ing backup, copy, restore, and recover co((ands affect the degree of parallelis( ,in con3unction with filesperset specify li(its on IDO bandwidth consu(ption ,set li"it read rate specify li(its on the si%e of backup pieces ,set li"it kbytes-
specify li(its on the nu(ber of concurrently open files ,set li"it "a$openfiles-
On so(e platfor(s, these co((ands specify the na(e or type of IDO device to use+ On other platfor(s, these co((ands specify which OD access (ethod or IDO driver to use+ =ot all platfor(s support the selection of IDO device through this interface? on so(e platfor(s, IDO device selection is controlled through platfor(/specific (echanis(s+ 2hether or not the allocate channel co((and actually causes OD resources to be allocated is OD dependent+ o(e operating syste(s allocate resources at the ti(e the co((and is issued? others do not allocate resources until a file is opened for reading or writing+ 'urther(ore, when type disk is specified, no OD resources are allocated, other than for the creation of the server process+ ) channel (ust be allocated before issuing a change ... delete co((and, which calls the OD to delete a file+ ) channel which is allocated in this way is useful only for deleting files+ It cannot be used as an input or output channel for a 3ob+ Only one such channel can be allocated at a ti(e+
Parallelization
Recovery Manager (ay paralleli%e its operations, establishing (ultiple logon sessions and conducting (ultiple backup sets or file copies in parallel+ "oncurrent backup sets or i(age copies (ust operate on dis3oint sets of database files+
run { allocate channel allocate channel allocate channel allocate channel allocate channel allocate channel allocate channel allocate channel allocate channel allocate channel copy dataf"le && copy dataf"le &( copy dataf"le &) copy dataf"le &* copy dataf"le &+ copy dataf"le &, copy dataf"le © dataf"le &. copy dataf"le (# copy dataf"le (1 %
c1 type d" k; c& type d" k; c( type d" k; c) type d" k; c* type d" k; c+ type d" k; c, type d" k; c- type d" k; c. type d" k; c1# type d" k; to '/de0/prod/backup1/prod_tab*_1'dbf'; to '/de0/prod/backup1/prod_tab*_&'dbf'; to '/de0/prod/backup1/prod_tab*_('dbf'; to '/de0/prod/backup1/prod_tab*_)'dbf'; to '/de0/prod/backup1/prod_tab+_1'dbf'; to '/de0/prod/backup1/prod_tab,_1'dbf'; to '/de0/prod/backup1/prod_tab*_&'dbf'; to '/de0/prod/backup1/prod_nd1*_1'dbf'; to '/de0/prod/backup1/prod_nd1*_&'dbf'; to '/de0/prod/backup1/prod_nd1*_('dbf';
The following state(ent paralleli%es the sa(e e.a(ple? there is one Recovery Manager co((and copying G: files, and G: channels available+ )ll G: channels are concurrently active-/each channel copies one file+ run { allocate channel c1 type d" k; allocate channel c& type d" k; allocate channel c( type d" k; allocate channel c) type d" k; allocate channel c* type d" k; allocate channel c+ type d" k; allocate channel c, type d" k; allocate channel c- type d" k; allocate channel c. type d" k; allocate channel c1# type d" k; copy dataf"le && to '/de0/prod/backup1/prod_tab*_1'dbf'2 dataf"le &( to '/de0/prod/backup1/prod_tab*_&'dbf'2 dataf"le &) to '/de0/prod/backup1/prod_tab*_('dbf'2 dataf"le &* to '/de0/prod/backup1/prod_tab*_)'dbf'2 dataf"le &+ to '/de0/prod/backup1/prod_tab+_1'dbf'2 dataf"le &, to '/de0/prod/backup1/prod_tab,_1'dbf'2 dataf"le &- to '/de0/prod/backup1/prod_tab*_&'dbf'2 dataf"le &. to '/de0/prod/backup1/prod_nd1*_1'dbf'2 dataf"le (# to '/de0/prod/backup1/prod_nd1*_&'dbf'2 dataf"le (1 to '/de0/prod/backup1/prod_nd1*_('dbf'; %
2hen e.ecuting a (ultiple.ed backup ,(ultiple datafiles written to the sa(e backup set-, you can either partition the datafiles into backup sets e.plicitly, or let Recovery Manager auto(atically select a partitioning+ ) high perfor(ance se!uential output device can be kept strea(ing by including a sufficient nu(ber of datafiles in the backup+ This is i(portant for open database backups where the backup operation (ust co(pete with the online syste( for IDO bandwidth+ The control file (ay also be included in a datafile backup set+ The Oracle logical blocksi%e of the ob3ects in a (ultiple.ed backup (ust be the sa(e+ <ence, datafiles and archive logs cannot be written to the sa(e set+
Report Generation
The report and list co((ands provide infor(ation about backups and i(age copies+ 2hile the list co((and si(ply lists the contents of the recovery catalog, the report co((and perfor(s a (ore detailed analysis of the recovery catalog+ The output fro( these co((ands is written to the (essage log file+ The report co((and produces reports that can answer !uestions such as: what files need a backupI what files haven8t been backed up recentlyI what backup files can be deletedI what files are not recoverable because of unrecoverable operationsI what was the physical sche(a of the database at so(e previous point in ti(eI The report need backup and report unrecoverable co((ands should be used on a regular basis to ensure that the necessary backups are available to perfor( recovery, and to ensure that the recovery can be perfor(ed within a reasonable length of ti(e+ The report co((and lists backup sets and datafile copies that can be deleted either because they are redundant or because they could never be used by a recover co((and+ ) datafile is considered unrecoverable if an unrecoverable operation has been perfor(ed against an ob3ect residing in the datafile subse!uent to the last backup+ Note: ) datafile that does not have a backup is not considered unrecoverable+ uch datafiles can be recovered through the use of the create datafile co((and, provided that logs starting fro( when the file was created still e.ist+
The list co((and !ueries the recovery catalog and produces a listing of its contents+ 0ou can use it to find out what backups or copies are available: backup sets containing a backup of a specified list of datafiles copies of a specified list of datafiles backup sets containing a backup of any datafile which is a (e(ber of a specified list of tablespaces copies of any datafile that is a (e(ber of a specified list of tablespaces backup sets containing a backup of any archivelogs with a specified na(e andDor within a specified range copies of any archivelog with a specified na(e andDor within a specified range incarnations of a specified database+
See Also: 'or (ore details on the Recovery Manager report co((and, see )ppendi. ), ARecovery Manager "o((and ynta.A+
warning: %ou can use a tag to specify the input files to a restore or switch co""and. If a tag is specified, &ecovery 'anager will consider only backup sets with a "atching tag when choosing which particular backup set or i"age copy to use.
See Also: 'or infor(ation about the switch and restore co((ands, see )ppendi. ), ARecovery Manager "o((and ynta.+A
Backup Constraints
Backup operations (ay be perfor(ed only by an instance that has the database (ounted or open+ In an Oracle parallel server environ(ent, if the instance where the backup operation is being perfor(ed does not have the database open, then the database (ust not be open by any instance+
Backups are supported at both the tablespace and datafile level+ Backups of the control file (ay also be created+ Backups of online logs are not supported+ ,If backups of the online logs are desired, you (ust run the database in )R"<IE1*O& (ode+ If the database is in =O)R"<IE1*O& (ode, you can (ake whole database backups only if the database is shutdown cleanly+ 0ou can (ake tablespace or datafile backups if the datafiles to be backed up are in an offline nor(al tablespace, or tablespaces are in read/only (ode+ If the database is in )R"<IE1*O& (ode, then backups (ay be taken when the database is open and in use+ Only current datafiles (ay be backed up+ #atafiles which have been restored fro( backups (ay not be backed up until they have been (ade current by perfor(ing (edia recovery+ Backups of a database that was not shutdown cleanly are allowed, but not reco((ended+ Recovery Manager does not back up: $ara(eter files associated with the database $assword files associated with the database Operating syste( files Online redo logs See Also: ABacking Up Online Redo *ogsAchJ+ht( / B5B5G;+
Restore Constraints
Restore operations (ust be perfor(ed on a started instance, however, the instance need not have the database (ounted+ This allows restore operations to be perfor(ed when the control file has been lost+ ) tablespaceDdatafile that is to be restored (ust be offline, or the database (ust be closed+ ) restore (ay either overwrite the e.isting datafiles or its output (ay be directed to a new file via the set newna"e co((and+
Integrity Checking
Oracle prohibits any atte(pts to perfor( operations which would result in unusable backup files or corrupt restored datafiles+ )(ong the integrity checks that the Oracle erver perfor(s are: ensures that restore operations do not corrupt the database by applying backups fro( a previous incarnation of the database ensures that incre(ental backups are applied in the correct order prohibits accessing datafiles that are in the process of being restored or recovered allows only one restore operation per datafile at a ti(e prohibits backups of unrecovered backup files control infor(ation stored in backups ensure that corrupt backup files are detected
detected, the Oracle server process rereads the block+ This is why, when using Recovery Manager to back up or copy database files, tablespaces do not need to be in hot backup (ode+ See Also: 'or infor(ation about hot backup (ode, see "hapter GG, A$erfor(ing Operating yste( BackupsA+