Managing the Recovery Catalog.docx
《Managing the Recovery Catalog.docx》由会员分享,可在线阅读,更多相关《Managing the Recovery Catalog.docx(30页珍藏版)》请在冰豆网上搜索。
ManagingtheRecoveryCatalog
ManagingtheRecoveryCatalog
ThischapterdescribeshowtomanageanRMANrecoverycatalog,whichholdsRMANrepositorydataforoneormoredatabasesinaseparatedatabaseschema,inadditiontousingthecontrolfilesofthedatabases.
Thischaptercontainsthesetopics:
∙CreatingaRecoveryCatalog
∙ManagingTargetDatabaseRecordsintheRecoveryCatalog
∙ResynchronizingtheRecoveryCatalog
∙WorkingwithRMANStoredScriptsintheRecoveryCatalog
∙ManagingtheControlFileWhenYouUseaRecoveryCatalog
∙BackingUpandRecoveringtheRecoveryCatalog
∙ExportingandImportingtheRecoveryCatalog
∙IncreasingAvailabilityoftheRecoveryCatalog
∙QueryingtheRecoveryCatalogViews
∙DeterminingtheSchemaVersionoftheRecoveryCatalog
∙UpgradingtheRecoveryCatalog
∙DroppingtheRecoveryCatalog
SeeAlso:
OracleDatabaseBackupandRecoveryBasicstolearnhowtomanagetheRMANcontrolfilerepositorywithoutarecoverycatalog
CreatingaRecoveryCatalog
Creatingarecoverycatalogisathree-stepprocess:
youmustconfigurethedatabasethatwillcontaintherecoverycatalog,createtherecoverycatalogowner,andthencreatetherecoverycatalogitself.
ConfiguringtheRecoveryCatalogDatabase
Whenyouusearecoverycatalog,RMANrequiresthatyoumaintainarecoverycatalogschema.Therecoverycatalogisstoredinthedefaulttablespaceoftheschema.NotethatSYScannotbetheowneroftherecoverycatalog.
Decidewhichdatabaseyouwillusetoinstalltherecoverycatalogschema,andalsohowyouwillbackupthisdatabase.Youshouldnotinstallthecataloginthetargetdatabase:
thistacticdefeatsthepurposeofthecatalog.Also,decidewhethertooperatethecatalogdatabaseinARCHIVELOGmode,whichisrecommended.
PlanningtheSizeoftheRecoveryCatalogSchema
Youmustallocatespacetobeusedbythecatalogschema.Thesizeoftherecoverycatalogschemadependsuponthenumberofdatabasesmonitoredbythecatalog,andthenumberandsizeofRMANscriptsstoredinthecatalog.Theschemaalsogrowsasthenumberofarchivedredologfilesandbackupsforeachdatabasegrows.
Foranexample,assumethatthetrgtdatabasehas100files,andyoubackupthedatabaseonceaday,producing50backupsetscontaining1backuppieceeach.Ifyouassumethateachrowinthebackuppiecetableusesthemaximumamountofspace,thenonedailybackupwillconsumelessthan170KBintherecoverycatalog.So,ifyoubackuponceadayforayear,thenthetotalstorageinthisperiodisabout62MB.Assumeapproximatelythesameamountforarchivedlogs.Hence,theworstcaseisabout120MBforayearformetadatastorage.
Foramoretypicalcaseinwhichonlyaportionofthebackuppiecerowspaceisused,15MBforeachyearisarealisticestimate.
Ifyouplantoregistermultipledatabasesinyourrecoverycatalog,remembertoaddupthespacerequiredforeachonebasedonthepreviouscalculationtoarriveatatotalsizeforthedefaulttablespaceoftherecoverycatalogschema.
AllocatingDiskSpacefortheRecoveryCatalogDatabase
Ifyouarecreatingyourrecoverycataloginanalready-existingdatabase,addenoughroomtoholdthedefaulttablespacetotherecoverycatalogschema.Ifyouarecreatinganewdatabasetoholdyourrecoverycatalog,then,inadditiontothespacefortherecoverycatalogschemaitself,youmustallowspaceforotherfilesintherecoverycatalogdatabase:
∙SYSTEMtablespace
∙Temporarytablespaces
∙Rollbacksegmenttablespaces
∙Onlineredologfiles
Mostofthespaceusedintherecoverycatalogdatabaseisdevotedtosupportingtablespaces,forexample,theSYSTEM,temporary,androllbackorundotablespaces.Table 13-1describestypicalspacerequirements.
Table13-1TypicalRecoveryCatalogSpaceRequirementsfor1Year
TypeofSpace
SpaceRequirement
SYSTEMtablespace
90MB
Temptablespace
5MB
Rollbackorundotablespace
5MB
Recoverycatalogtablespace
15MBforeachdatabaseregisteredintherecoverycatalog
Onlineredologs
1MBeach(3groups,eachwith2members)
Caution:
Ensurethattherecoverycatalogandtargetdatabasesdonotresideonthesamedisk.Ifadiskcontainingbothyourrecoverycatalogandyourtargetdatabasesfailed,yourrecoveryprocesswouldbemuchmorecomplicated.Ifpossible,takeothermeasuresaswelltoeliminatecommonpointsoffailurebetweenyourrecoverycatalogdatabaseandthedatabasesyouarebackingup.
CreatingtheRecoveryCatalogOwner
Afterchoosingtherecoverycatalogdatabaseandcreatingnecessaryspace,youarereadytocreatetheowneroftherecoverycatalogandgrantthisusernecessaryprivileges.
Assumethefollowingbackgroundinformationfortheinstructionsinthefollowingsections:
∙UserSYSwithpasswordoraclehasSYSDBAprivilegesontherecoverycatalogdatabasecatdb.
∙Atablespacecalledtoolsintherecoverycatalogdatabasecatdbstorestherecoverycatalog.NotethattouseanRMANreservedwordasatablespacename,youmustencloseitinquotesandputitinuppercase.(RefertoOracleDatabaseRecoveryManagerReferenceforalistofRMANreservedwords.)
∙Atablespacecalledtempexistsintherecoverycatalogdatabase.
∙Thedatabaseisconfiguredinthesamewayasallnormaldatabases,forexample,catalog.sqlandcatproc.sqlhavesuccessfullyrun.
Tocreatetherecoverycatalogschemaintherecoverycatalogdatabase:
1.StartSQL*Plusandthenconnectwithadministratorprivilegestothedatabasecontainingtherecoverycatalog.Forexample,enter:
2.CONNECTSYS/oracle@catdbASSYSDBA
3.
4.Createauserandschemafortherecoverycatalog.Forexample,enter:
5.CREATEUSERrmanIDENTIFIEDBYcat
6.TEMPORARYTABLESPACEtemp
7.DEFAULTTABLESPACEtools
8.QUOTAUNLIMITEDONtools;
9.
10.GranttheRECOVERY_CATALOG_OWNERroletotheschemaowner.Thisroleprovidestheuserwithallprivilegesrequiredtomaintainandquerytherecoverycatalog.
11.SQL>GRANTRECOVERY_CATALOG_OWNERTOrman;
CreatingtheRecoveryCatalog
Aftercreatingthecatalogowner,createthecatalogtableswiththeRMANCREATECATALOGcommand.Thecommandcreatesthecataloginthedefaulttablespaceofthecatalogowner.
Tocreatetherecoverycatalog:
1.Connecttothedatabasethatwillcontainthecatalogasthecatalogowner.Forexample,enterthefollowingfromtheoperatingsystemcommandline:
2.%rmanCATALOGrman/cat@catdb
3.
YoucanalsoconnectfromtheRMANprompt:
%rman
RMAN>CONNECTCATALOGrman/cat@catdb
4.RuntheCREATECATALOGcommandtocreatethecatalog.Thecreationofthecatalogcantakeseveralminutes.Ifthecatalogtablespaceisthisuser'sdefaulttablespace,thenyoucanrunthiscommand:
5.CREATECATALOG;
6.
IfyouspecifythetablespacenameintheCREATECATALOGcommand,andifthetablespacenameisanRMANreservedword,thenitmustbeuppercaseandenclosedinquotes.Forexample:
CREATECATALOGTABLESPACE'CATALOG';
7.Optionally,startSQL*Plusandquerytherecoverycatalogtoseewhichtableswerecreated:
8.SQL>SELECTTABLE_NAMEFROMUSER_TABLES;
SeeAlso:
OracleDatabaseSQLReferencefortheSQLsyntaxfortheGRANTandCREATEUSERstatements,andOracleDatabaseRecoveryManagerReferenceforCREATECATALOGcommandsyntax
ManagingTargetDatabaseRecordsintheRecoveryCatalog
Thissectiondescribeshowtoregister,unregister,andresettargetdatabaserecordsintherecoverycatalog.
RegisteringaDatabaseintheRecoveryCatalog
Thefirststepinusingarecoverycatalogwithatargetdatabaseisregisteringthedatabaseintherecoverycatalog.Usethefollowingprocedure:
1.Aftermakingsuretherecoverycatalogdatabaseisopen,connectRMANtothetargetdatabaseandrecoverycatalogdatabase.Forexample,issuethefollowingtoconnecttothecatalogdatabasecatdbasuserrman(whoownsthecatalogschema):
2.%rmanTARGET/CATALOGrman/cat@catdb
3.
4.Ifthetargetdatabaseisnotmounted,thenmountoropenit:
5.RMAN>STARTUPMOUNT;
6.
7.Registerthetargetdatabaseintheconnectedrecoverycatalog:
8.RMAN>REGISTERDATABASE;
9.
RMANcreatesrowsinthecatalogtablestocontaininformationaboutthetargetdatabase,thencopiesallpertinentdataaboutthetargetdatabasefromthecontrolfileintothecatalog,synchronizingthecatalogwiththecontrolfile.
VerifythattheregistrationwassuccessfulbyrunningREPORTSCHEMA:
RMAN>REPORTSCHEMA;
Reportofdatabaseschema
FileK-bytesTablespaceRBsegsDatafileName
--------------------------------------------------------
1307200SYSTEMNO/oracle/oradata/trgt/system01.dbf
220480UNDOTBSYES/oracle/oradata/trgt/undotbs01.dbf
310240CWMLITENO/oracle/oradata/trgt/cwmlite01.dbf
410240DRSYSNO/oracle/oradata/trgt/drsys01.dbf
510240EXAMPLENO/oracle/oradata/trgt/example01.dbf
610240INDXNO/oracle/oradata/trgt/indx01.dbf
710240TOOLSNO/oracle/oradata/trgt/tools01.dbf
810240USERSNO/oracle/oradata/trgt/users01.dbf
CatalogingOlderFilesintheRecoveryCatalog
Ifyouhavedatafilecopies,backuppiecesorarchivelogsondisk,youcancatalogthemintherecoverycatalogusingtheCATALOGcommand.Whenusingarecoverycatalog,catalogingolderbackupsthathaveagedoutofthecontrolfileletsRMANusetheolderbackupsduringrestoreoperations.Forexample:
RMAN>CATALOGDATAFILECOPY'/disk1/old_datafiles/01_01_2003/users01.dbf';
RMAN>CATALOGARCHIVELOG'/disk1/arch_logs/archive1_731.dbf',
'/disk1/arch_logs/archive1_732.dbf';
RMAN>CATALOGBACKUPPIECE'/disk1/backups/backup_820.bkp';
Youcanalsocatalogmultiplebackupfilesinadirectoryatonce,usingtheCATALOGSTARTWITHcommand,asshowninthisexample:
RMA