Вы находитесь на странице: 1из 12

9/15/2016

MyOracle:RMANRecoveryScenarios

MyOracle
Thursday,May21,2009

AboutMe

Govind

RMANRecoveryScenarios
Oldendays,weusetraditionalbackup(puttingtablespaceinhotbackupmode)tobackupthe
database.Whenwerecoverthedatabase,weusetraditionalbackupasabaseandapplyarchive
logfilestorecoverthedatabase.Wehavesomeissueswhenwedealtwithtraditionalbackup.
ThenoracleintroducedRMANbackuptoresolvesomeoftheissueswhichwefacedintraditional
backup.Nowyoumayask,Whataretheissuesintraditionalbackupandwhatarethe
convenienceinRMANbackup?Idiscussedthisinanotherthread..Pleaseseethinklinktoget
theanswer.

Viewmycompleteprofile

Oracle10gRAC
Administrator

Inthisthread,iamgoingtodiscussaboutpossiblerecoveryscenarioinRMAN.Beforethat,we
needtosetuptheRMANinoracleinstance..HowdowesetupRMANinoracleinstance?Here
isthelinktoseehowtosetupRMANinoracle.
NowwewilldiscussaboutdifferenttypeofDBrecoveryscenarios....Thedatabasenameis
ORCL.ThecatalogdatabasenameCATDB....RMANhassetupandbackupisrunningevery
day.Thedatabaseisrunninginwindowsenvironment.

Oracle12cCertified
DBA

Scenario1
KevinisDBA,heisworkinginMissioncriticalworkshop.OnFridaynight,whiletakingRMAN
backup,themachineiscrashedanddatabaseisdown.Kevinrestartedthedatabaseand
databaseismountedsuccessfully.Butitisnotopened.Herealizedthat,someofthetablespaces
arecorrupted.Fortunately,redologfilesandcontrolfilesareintact.KevinwantedtobringtheDB
asfastaspossible.
SQL>startup
ORACLEinstancestarted.
TotalSystemGlobalArea612368384bytes
FixedSize1250428bytes
VariableSize188746628bytes
DatabaseBuffers415236096bytes
RedoBuffers7135232bytes
Databasemounted.
ORA01157:cannotidentify/lockdatafile1seeDBWRtracefile
ORA01110:datafile1:'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF'
SQL>
Hereisthesolution....Sincemostofthetablespacedatafilesarecorrupted,hedecidedtodo
completedatabaserecovery.Firsthemountedthedatabase.Hecannotopenthedatabaseuntil
hecompletelyrecoverthedatabase.
KevinconnectedtheRMANandrecoverdthewholedatabaseasbelow.

C:\>rmancatalog=rman/rman@catdbtarget=sys/password@orcl
RecoveryManager:Release10.2.0.1.0ProductiononThuMay2121:32:282009
Copyright(c)1982,2005,Oracle.Allrightsreserved.
connectedtotargetdatabase:ORCL(DBID=1215124933,notopen)
connectedtorecoverycatalogdatabase
RMAN>run{
2>restoredatabase
3>recoverdatabase
4>alterdatabaseopen
5>}

WelcometomyBlog

Startingrestoreat21MAY09

Thisblogistohelp
onlinecommunity

http://myorastuff.blogspot.com/2009/05/rmanrecoveryscenarios.html

1/12

9/15/2016

MyOracle:RMANRecoveryScenarios
startingfullresyncofrecoverycatalog
fullresynccomplete
allocatedchannel:ORA_DISK_1
channelORA_DISK_1:sid=156devtype=DISK
creatingdatafilefno=5name=C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS02.DBF
channelORA_DISK_1:startingdatafilebackupsetrestore
channelORA_DISK_1:specifyingdatafile(s)torestorefrombackupset
restoringdatafile00001toC:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF
restoringdatafile00002toC:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01.DBF
restoringdatafile00003toC:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX01.DBF
restoringdatafile00004toC:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF
channelORA_DISK_1:readingfrombackuppiece
C:\RMANBACKUP\BACKUPORCL_DB_0CKFJAS2_1_1_%S_%P
channelORA_DISK_1:restoredbackuppiece1
piecehandle=C:\RMANBACKUP\BACKUPORCL_DB_0CKFJAS2_1_1_%S_%P
tag=TAG20090521T143649
channelORA_DISK_1:restorecomplete,elapsedtime:00:00:55
Finishedrestoreat21MAY09
Startingrecoverat21MAY09
usingchannelORA_DISK_1
startingmediarecovery
mediarecoverycomplete,elapsedtime:00:00:14

usingOracle
database.Ishare
myOracle
knowledgethrough
thisblog.Allmy
postsinthisblog
arebasedonmy
experience,reading
oraclewebsites,
books,forumsand
otherblogs.Iinvite
peopletoreadand
suggestwayto
improvethisblog.

BlogArchive

2016(10)
2015(23)
2010(4)
2009(38)
November(3)
October(7)
September
(3)
August(2)

Finishedrecoverat21MAY09
databaseopened
RMAN>
Scenario2
AditaisDBAinbankingfirm.OnMondayafternoon,duetomediafailure,oneofthedatafileis
corrupted.Butallotherdatafilesareworkingfine.Anitarestartedthedatabaseandonedatafile
iscomplainingandDBisnotrestarted.Anitamadethecorrupteddatafileoffineandopenedthe
database.SouserscanusetheDBwhilerecovingtheonedatafile.
SQL>startup
ORACLEinstancestarted.
TotalSystemGlobalArea612368384bytes
FixedSize1250428bytes
VariableSize188746628bytes
DatabaseBuffers415236096bytes
RedoBuffers7135232bytes
Databasemounted.
ORA01157:cannotidentify/lockdatafile5seeDBWRtracefile
ORA01110:datafile5:'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS02.DBF'
SQL>alterdatabasedatafile'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS02.DBF'
offline
Databasealtered.
SQL>alterdatabaseopen
Databasealtered.
SQL>selectfile_idfromdba_data_fileswherefile_name
2='C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS02.DBF'
FILE_ID

5
SQL>exit
DisconnectedfromOracleDatabase10gEnterpriseEditionRelease10.2.0.1.0Production
WiththePartitioning,OLAPandDataMiningoptions

June(4)
May(15)
Cloning
Database
through
RMAN
Newfeatures
inRMAN
since
Oracle9i
Instance
Recovery
RMAN
Recovery
Scenarios
StepstoSetup
RMAN
Benefitsof
RMAN
Backupvs.
Scripted
Backups
Enable
Archivelog
in
Oracle10g
Dropping
databasein
oracle10g
Global
Temporary
tables
Constraint
stats
Deferred
Constraints
Reversekey
Index
Resumable
space
allocation
FlashBack
Query
Recyclebin

Hereisthesolutiontorecoverthedatabase..........
C:\>rmancatalog=rman/rman@catdbtarget=sys/password@orcl

April(2)
March(1)
February(1)

RecoveryManager:Release10.2.0.1.0ProductiononThuMay2122:30:062009

2008(33)

Copyright(c)1982,2005,Oracle.Allrightsreserved.

http://myorastuff.blogspot.com/2009/05/rmanrecoveryscenarios.html

2/12

9/15/2016

MyOracle:RMANRecoveryScenarios
connectedtotargetdatabase:ORCL(DBID=1215124933)
connectedtorecoverycatalogdatabase
RMAN>run
2>{
3>restoredatafile5
4>recoverdatafile5
5>}
Startingrestoreat21MAY09
startingfullresyncofrecoverycatalog
fullresynccomplete
allocatedchannel:ORA_DISK_1
channelORA_DISK_1:sid=135devtype=DISK
creatingdatafilefno=5name=C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS02.DBF
restorenotdoneallfilesreadonly,offline,oralreadyrestored
Finishedrestoreat21MAY09
Startingrecoverat21MAY09
usingchannelORA_DISK_1
startingmediarecovery
mediarecoverycomplete,elapsedtime:00:00:01
Finishedrecoverat21MAY09
RMAN>exit
RecoveryManagercomplete.
C:\>sqlplussys/passwordassysdba
SQL*Plus:Release10.2.0.1.0ProductiononThuMay2122:31:102009
Copyright(c)1982,2005,Oracle.Allrightsreserved.
Connectedto:
OracleDatabase10gEnterpriseEditionRelease10.2.0.1.0Production
WiththePartitioning,OLAPandDataMiningoptions
SQL>alterdatabasedatafile'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS02.DBF'
ONLINE

FEEDJITLiveTraffic
Feed

LiveTrafficFeed
AvisitorfromKuwait
viewed"MyOracle:RMAN
RecoveryScenarios"3days
15hoursago
AvisitorfromNellore,
AndhraPradeshviewed"My
Oracle:LocalIndexVersus
GlobalIndexonPartition
AvisitorfromBangalore,
Table"3days16hoursago
Karnatakaviewed"My
Oracle:Oracle12cOCP
ExamWentthrough.."3days
AvisitorfromIndore,
17hoursago
MadhyaPradeshviewed"My
Oracle:OracleSQL
QuestionsforNewbies"3
AvisitorfromNoida,Uttar
days17hoursago
Pradeshviewed"MyOracle:
ConvertNonPartitionedto
PartitionedTable"3days17
AvisitorfromIsraelviewed
hoursago
"MyOracle:OracleSQL
QuestionsforNewbies"3
days18hoursago
AvisitorfromAlgeria
viewed"MyOracle:ORA
01578:ORACLEdatablock
corruptedinActiveStandby
Database"3days18hours
AvisitorfromMumbai,
ago
Maharashtraviewed"My
Oracle:OracleSQL
QuestionsforNewbies"3
AvisitorfromAbidjan,
days19hoursago
Lagunesviewed"MyOracle:
AnalyzeVersus
DBMS_STATS"3days19
AvisitorfromGlenAllen,
hoursago
Virginiaviewed"MyOracle:
StarschemavsSnowflake
Schema"3days20hoursago
RealtimeviewGetFeedjit

Databasealtered.
SQL>selectdistinctstatusfromdba_data_files

OnlineUsers

STATUS

AVAILABLE
SQL>
Scenario3
ScottisaDBAintradingfirm.Duringtheharddiskreplacementinunixbox,oneoftheapplication
tablespacedatafilesarecorrupted.WhenScottrestartthedatabase,itcomplainedthat,datafile
iscorruptedandtablespaceisnotusable.Butfortunately,othertablespacesdatafilesareintact.
Scottdecidedtomakethistablespaceofflineandopenthedatabase.Sothatotherscanusethe
databasewhilerecoveringthetablespace.
SQL>startup
ORACLEinstancestarted.
TotalSystemGlobalArea612368384bytes
FixedSize1250428bytes
VariableSize188746628bytes
DatabaseBuffers415236096bytes
RedoBuffers7135232bytes
Databasemounted.
ORA01157:cannotidentify/lockdatafile4seeDBWRtracefile
ORA01110:datafile4:'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF'
SQL>alterdatabasedatafile'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF'
OFFLINE

http://myorastuff.blogspot.com/2009/05/rmanrecoveryscenarios.html

3/12

9/15/2016

MyOracle:RMANRecoveryScenarios
Databasealtered.
SQL>alterdatabaseopen
alterdatabaseopen
*
ERRORatline1:
ORA01157:cannotidentify/lockdatafile5seeDBWRtracefile
ORA01110:datafile5:'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS02.DBF'
SQL>alterdatabasedatafile'C:\ORACLE\PRODUCT\10.2.\ORADATA\ORCL\USERS02.DBF'
OFFLINE
Databasealtered.
SQL>alterdatabaseopen
Databasealtered.
SQL>exit
DisconnectedfromOracleDatabase10gEnterpriseEditionRelease10.2.0.1.0Pr
oduction
WiththePartitioning,OLAPandDataMiningoptions
Scottmadedatafilesofflineandopenedthedatabase.Whileothersareusingthedatabase,he
connectedinRMANandrecoveredonlycorruptedtablespace
C:\>rmancatalog=rman/rman@catdbtarget=sys/password@orcl
RecoveryManager:Release10.2.0.1.0ProductiononFriMay2209:36:522009
Copyright(c)1982,2005,Oracle.Allrightsreserved.
connectedtotargetdatabase:ORCL(DBID=1215124933)
connectedtorecoverycatalogdatabase
RMAN>run{
2>restoretablespaceusers
3>recovertablespaceusers
4>}
Startingrestoreat22MAY09
allocatedchannel:ORA_DISK_1
channelORA_DISK_1:sid=128devtype=DISK
creatingdatafilefno=5name=C:\ORACLE\PRODUCT\10.2.\ORADATA\ORCL\USERS02.DBF
channelORA_DISK_1:startingdatafilebackupsetrestore
channelORA_DISK_1:specifyingdatafile(s)torestorefrombackupset
restoringdatafile00004toC:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF
channelORA_DISK_1:readingfrombackuppiece
C:\RMANBACKUP\BACKUPORCL_DB_0CKFJAS2_1_1_%S_%P
channelORA_DISK_1:restoredbackuppiece1
piecehandle=C:\RMANBACKUP\BACKUPORCL_DB_0CKFJAS2_1_1_%S_%P
tag=TAG20090521T143649
channelORA_DISK_1:restorecomplete,elapsedtime:00:00:16
Finishedrestoreat22MAY09
Startingrecoverat22MAY09
usingchannelORA_DISK_1
startingmediarecovery
archivelogthread1sequence12isalreadyondiskasfileC:\ORACLE\PRODUCT\10
.2.0\DB_1\DATABASE\ARCHIVE\LOG_12_1_687344200.ARC
archivelogthread1sequence17isalreadyondiskasfileC:\ORACLE\PRODUCT\10
.2.0\DB_1\DATABASE\ARCHIVE\LOG_17_1_687344200.ARC
archivelogthread1sequence18isalreadyondiskasfileC:\ORACLE\PRODUCT\10
.2.0\DB_1\DATABASE\ARCHIVE\LOG_18_1_687344200.ARC
archivelogthread1sequence19isalreadyondiskasfileC:\ORACLE\PRODUCT\10
.2.0\DB_1\DATABASE\ARCHIVE\LOG_19_1_687344200.ARC
mediarecoverycomplete,elapsedtime:00:01:23
Finishedrecoverat22MAY09
SQL>connectsys/passwordassysdba
Connected.
SQL>alterdatabasedatafile'c:\oracle\product\10.2.0\oradata\orcl\users01.dbf'
2online

http://myorastuff.blogspot.com/2009/05/rmanrecoveryscenarios.html

4/12

9/15/2016

MyOracle:RMANRecoveryScenarios
Databasealtered.
SQL>alterdatabasedatafile'c:\oracle\product\10.2.0\oradata\orcl\users02.dbf'
2online
Databasealtered.
SQL>connectscott/tiger@orcl
Connected.
SQL>selectcount(*)fromemp
COUNT(*)

14
SQL>
Scenario4
JaneisaDBAintelecommunicationcompany.Unixadminhaddonesomemaintenanceworkon
theserver.Oncetheycompletedtheirwork,Janerestartedthedatabase.WhenJanerestartthe
DB,Janerealizedthat,SYSTEMtablespaceiscorrupted..Butothersareintact.Hedecidedto
mountthedatabaseandrecoverthistablespace.Thisleadsdowntimeforthedatabase,since
janecannotopenthedatabasewithoutrecoveringthesystemtablespace.
SQL>startup
ORACLEinstancestarted.
TotalSystemGlobalArea612368384bytes
FixedSize1250428bytes
VariableSize188746628bytes
DatabaseBuffers415236096bytes
RedoBuffers7135232bytes
Databasemounted.
ORA01157:cannotidentify/lockdatafile1seeDBWRtracefile
ORA01110:datafile1:'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF'
SQL>alterdatabasedatafile'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF
'OFFLINE
Databasealtered.
SQL>ALTERDATABASEOPEN
ALTERDATABASEOPEN
*
ERRORatline1:
ORA01147:SYSTEMtablespacefile1isoffline
ORA01110:datafile1:'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF'
SQL>exit
DisconnectedfromOracleDatabase10gEnterpriseEditionRelease10.2.0.1.0Pr
oduction
WiththePartitioning,OLAPandDataMiningoptions
C:\>rmancatalog=rman/rman@catdbtarget=sys/password@orcl
RecoveryManager:Release10.2.0.1.0ProductiononFriMay2210:21:042009
Copyright(c)1982,2005,Oracle.Allrightsreserved.
connectedtotargetdatabase:ORCL(DBID=1215124933,notopen)
connectedtorecoverycatalogdatabase
RMAN>run
2>{
3>restoretablespacesystem
4>recovertablespacesystem
5>}
Startingrestoreat22MAY09
allocatedchannel:ORA_DISK_1
channelORA_DISK_1:sid=156devtype=DISK
channelORA_DISK_1:startingdatafilebackupsetrestore
channelORA_DISK_1:specifyingdatafile(s)torestorefrombackupset
restoringdatafile00001toC:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF
channelORA_DISK_1:readingfrombackuppiece
C:\RMANBACKUP\BACKUPORCL_DB_0JKFLE
9Q_1_1_%S_%P

http://myorastuff.blogspot.com/2009/05/rmanrecoveryscenarios.html

5/12

9/15/2016

MyOracle:RMANRecoveryScenarios
channelORA_DISK_1:restoredbackuppiece1
piecehandle=C:\RMANBACKUP\BACKUPORCL_DB_0JKFLE9Q_1_1_%S_%P
tag=TAG20090522T094738
channelORA_DISK_1:restorecomplete,elapsedtime:00:00:35
Finishedrestoreat22MAY09
Startingrecoverat22MAY09
usingchannelORA_DISK_1
startingmediarecovery
mediarecoverycomplete,elapsedtime:00:00:04
Finishedrecoverat22MAY09
RMAN>exit
RecoveryManagercomplete.
C:\>sqlplussys/passwordassysdba
SQL*Plus:Release10.2.0.1.0ProductiononFriMay2210:22:202009
Copyright(c)1982,2005,Oracle.Allrightsreserved.
Connectedto:
OracleDatabase10gEnterpriseEditionRelease10.2.0.1.0Production
WiththePartitioning,OLAPandDataMiningoptions
SQL>alterdatabaseopen
alterdatabaseopen
*
ERRORatline1:
ORA01147:SYSTEMtablespacefile1isoffline
ORA01110:datafile1:'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF'
SQL>alterdatabasedatafile
'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF'online
Databasealtered.
SQL>ALTERDATABASEOPEN
Databasealtered.
SQL>selectdistinctstatusfromdba_tablespaces
STATUS

ONLINE
SQL>selectdistinctstatusfromdba_data_files
STATUS

AVAILABLE
SQL>
Scenario5
DavidisDBAforEnergycompany.Davidendeduprestartingthedatabaseduetohardware
maintenance.WhenDavidrestartsthedatabase,realizedthatalltheredologfilesarecorrupted...
RMANbackuprunseverydayat11.30PM.Davidfoundthisissueon12.20PM.NowDavid
needstodoincompleterecovery.HereisthestepsDavidtaken...Mountthedatabaseandrun
theRMANbackup.Justtomakesureallthearchivedredologfilesarebackedupbeforestartthe
recovery.OnceRMANbackupiscompleted,Davidruntheincompleterecoveryandrecovered
untilthelastarchivedredolog.
SQL>startup
ORACLEinstancestarted.
TotalSystemGlobalArea612368384bytes
FixedSize1250428bytes
VariableSize188746628bytes
DatabaseBuffers415236096bytes
RedoBuffers7135232bytes
Databasemounted.
ORA00313:openfailedformembersofloggroup1ofthread1
ORA00312:onlinelog1thread1:
'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO01.LOG'
SQL>exit
C:\>rmancatalog=rman/rman@catdbtarget=sys/password@orcl

http://myorastuff.blogspot.com/2009/05/rmanrecoveryscenarios.html

6/12

9/15/2016

MyOracle:RMANRecoveryScenarios
RecoveryManager:Release10.2.0.1.0ProductiononSatMay2320:36:242009
Copyright(c)1982,2005,Oracle.Allrightsreserved.
connectedtotargetdatabase:ORCL(DBID=1215124933,notopen)
connectedtorecoverycatalogdatabase
RMAN>backuparchivelogall
Startingbackupat23MAY09
allocatedchannel:ORA_DISK_1
channelORA_DISK_1:sid=152devtype=DISK
channelORA_DISK_1:startingarchivelogbackupset
channelORA_DISK_1:specifyingarchivelog(s)inbackupset
inputarchivelogthread=1sequence=2recid=31stamp=687541158
inputarchivelogthread=1sequence=3recid=32stamp=687542042
inputarchivelogthread=1sequence=4recid=33stamp=687542062
40comment=NONE
StartingControlFileandSPFILEAutobackupat23MAY09
piecehandle=C:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\C1215124933200905230A
comment=NONE
FinishedControlFileandSPFILEAutobackupat23MAY09
RMAN>listbackupofarchivelogfromtime='sysdate7'
ListofBackupSets
===================
BSKeySizeDeviceTypeElapsedTimeCompletionTime

106098.10MDISK00:00:0223MAY09
BPKey:10611Status:AVAILABLECompressed:NOTag:TAG20090523T2235
40
PieceName:C:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\01KFPFLS_1_1
ListofArchivedLogsinbackupset10609
ThrdSeqLowSCNLowTimeNextSCNNextTime

1254452223MAY0955086923MAY09
1355086923MAY0955089823MAY09
BSKeySizeDeviceTypeElapsedTimeCompletionTime

10625103.00KDISK00:00:0223MAY09
BPKey:10630Status:AVAILABLECompressed:NOTag:TAG20090523T2236
29
PieceName:C:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\03KFPFND_1_1
ListofArchivedLogsinbackupset10625
ThrdSeqLowSCNLowTimeNextSCNNextTime

1455089823MAY0955098823MAY09
BSKeySizeDeviceTypeElapsedTimeCompletionTime

106728.29MDISK00:00:0223MAY09
BPKey:10676Status:AVAILABLECompressed:NOTag:TAG20090523T2239
52
PieceName:C:\RMANBACKUP\BACKUPORCL_DB_05KFPFTO_5_1
ListofArchivedLogsinbackupset10672
ThrdSeqLowSCNLowTimeNextSCNNextTime

1254452223MAY0955086923MAY09
1355086923MAY0955089823MAY09
1455089823MAY0955098823MAY09
1555098823MAY0955120623MAY09
BSKeySizeDeviceTypeElapsedTimeCompletionTime

1069237.00KDISK00:00:0123MAY09
BPKey:10697Status:AVAILABLECompressed:NOTag:TAG20090523T2240
42
PieceName:C:\RMANBACKUP\BACKUPORCL_DB_07KFPFVA_7_1
ListofArchivedLogsinbackupset10692
ThrdSeqLowSCNLowTimeNextSCNNextTime

http://myorastuff.blogspot.com/2009/05/rmanrecoveryscenarios.html

7/12

9/15/2016

MyOracle:RMANRecoveryScenarios
1655120623MAY0955126323MAY09
RMAN>restoredatabaseuntilsequence=6thread=1force
Startingrestoreat23MAY09
allocatedchannel:ORA_DISK_1
channelORA_DISK_1:sid=156devtype=DISK
channelORA_DISK_1:startingdatafilebackupsetrestore
channelORA_DISK_1:specifyingdatafile(s)torestorefrombackupset
restoringdatafile00001toC:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF
restoringdatafile00002toC:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01.DBF
restoringdatafile00003toC:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX01.DBF
restoringdatafile00004toC:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF
channelORA_DISK_1:readingfrombackuppieceC:\ORACLE\PRODUCT\10.2.0\DB_1\DATA
BASE\02KFPFLV_1_1
channelORA_DISK_1:restoredbackuppiece1
piecehandle=C:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\02KFPFLV_1_1
tag=TAG20090523
T223542
channelORA_DISK_1:restorecomplete,elapsedtime:00:00:45
Finishedrestoreat23MAY09
RMAN>recoverdatabaseuntilsequence=6thread=1
Startingrecoverat23MAY09
usingchannelORA_DISK_1
startingmediarecovery
archivelogthread1sequence4isalreadyondiskasfileC:\ORACLE\PRODUCT\10.
2.0\DB_1\DATABASE\ARCHIVE\LOG_4_1_687649381.ARC
archivelogthread1sequence5isalreadyondiskasfileC:\ORACLE\PRODUCT\10.
2.0\DB_1\DATABASE\ARCHIVE\LOG_5_1_687649381.ARC
archivelog
filename=C:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\ARCHIVE\LOG_4_1_6876
49381.ARCthread=1sequence=4
archivelog
filename=C:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\ARCHIVE\LOG_5_1_6876
49381.ARCthread=1sequence=5
mediarecoverycomplete,elapsedtime:00:00:03
Finishedrecoverat23MAY09
RMAN>alterdatabaseopenresetlogs
databaseopened
newincarnationofdatabaseregisteredinrecoverycatalog
RMAN>
Thedatabaseisrecoveredsuccessfully.Butthisisincompleterecovery.Priortooracle10g,
oraclestronglyrecommendtotakethefulldatabasebackupwheneverthereisincomplete
recovery.Butinoracle10g,itisoptional.Butstillitisgoodtotakethefulldatabasebackupfor
saferside.Pleasereadthislinktoknowmoreaboutthis...
Scenario6
KathyisDBAforoneofthefinancecompany.OnMonday,duetohardwareissue,theserverwas
crashed.Unfortunately,Kathylostalldatafiles,controlfiles,redologfiles.Butluckilythecurrent
archivedredologfileswereintact.HereisthestepsKathyhastakentohandlethiscrash
recovery.
Kathywasnotabletomountthedatabasesinceshelosthercontrolfile.Soshefirstrecovered
thecontrolfilefromRMANbackup.Oncecontrolfileisrecovered,shemountedthedatabase.
Afterthedatabaseismounted,sherantheRMANbackuptomakesure,allthecurrentarchive
logfilesarebackedup.sherecoveredthedatabaseuntillastarchivedlogfile.Finallysheopened
thetheDBRESETLOGSoption.
SQL>startup
ORACLEinstancestarted.
TotalSystemGlobalArea612368384bytes
FixedSize1250428bytes
VariableSize188746628bytes
DatabaseBuffers415236096bytes
RedoBuffers7135232bytes
ORA00205:errorinidentifyingcontrolfile,checkalertlogformoreinfo

http://myorastuff.blogspot.com/2009/05/rmanrecoveryscenarios.html

8/12

9/15/2016

MyOracle:RMANRecoveryScenarios
SQL>
C:\>setoracle_sid=orcl
C:\>rmancatalog=rman/rman@catdbtarget=sys/password
RecoveryManager:Release10.2.0.1.0ProductiononSunMay2415:26:512009
Copyright(c)1982,2005,Oracle.Allrightsreserved.
connectedtotargetdatabase:orcl(notmounted)
connectedtorecoverycatalogdatabase
RMAN>restorecontrolfile
Startingrestoreat24MAY09
allocatedchannel:ORA_DISK_1
channelORA_DISK_1:sid=157devtype=DISK
channelORA_DISK_1:startingdatafilebackupsetrestore
channelORA_DISK_1:restoringcontrolfile
channelORA_DISK_1:readingfrombackuppieceC:\ORACLE\PRODUCT\10.2.0\DB_1\DATA
BASE\C12154929282009052400
channelORA_DISK_1:restoredbackuppiece1
piecehandle=C:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\C12154929282009052400tag
=TAG20090524T152409
channelORA_DISK_1:restorecomplete,elapsedtime:00:00:04
outputfilename=C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\CONTROL01.CTL
outputfilename=C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\CONTROL02.CTL
outputfilename=C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\CONTROL03.CTL
Finishedrestoreat24MAY09
RMAN>
Oncethecontrolfileisrecovered,thedatabaseismounted.....
SQL>alterdatabasemount
Databasealtered.
SQL>selectarchivelog_change#1fromv$database
ARCHIVELOG_CHANGE#1

547010
SQL>exit
DisconnectedfromOracleDatabase10gEnterpriseEditionRelease10.2.0.1.0Pr
oduction
WiththePartitioning,OLAPandDataMiningoptions
C:\>rmancatalog=rman/rman@catdbtarget=sys/password@orcl
RecoveryManager:Release10.2.0.1.0ProductiononSunMay2415:29:332009
Copyright(c)1982,2005,Oracle.Allrightsreserved.
connectedtotargetdatabase:ORCL(DBID=1215492928,notopen)
connectedtorecoverycatalogdatabase
RMAN>run{
2>setuntilscn547010
3>restoredatabase
4>recoverdatabase
5>alterdatabaseopenresetlogs
6>}
executingcommand:SETuntilclause
Startingrestoreat24MAY09
allocatedchannel:ORA_DISK_1
channelORA_DISK_1:sid=156devtype=DISK
channelORA_DISK_1:startingdatafilebackupsetrestore
channelORA_DISK_1:specifyingdatafile(s)torestorefrombackupset

http://myorastuff.blogspot.com/2009/05/rmanrecoveryscenarios.html

9/12

9/15/2016

MyOracle:RMANRecoveryScenarios
restoringdatafile00001toC:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF
restoringdatafile00002toC:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01.DBF
restoringdatafile00003toC:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX01.DBF
restoringdatafile00004toC:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF
channelORA_DISK_1:readingfrombackuppiece
C:\RMANBACKUP\BACKUPORCL_DB_02KFRA
N7_1_1_%S_%P
channelORA_DISK_1:restoredbackuppiece1
piecehandle=C:\RMANBACKUP\BACKUPORCL_DB_02KFRAN7_1_1_%S_%P
tag=TAG20090524T1523
19
channelORA_DISK_1:restorecomplete,elapsedtime:00:00:45
Finishedrestoreat24MAY09
Startingrecoverat24MAY09
usingchannelORA_DISK_1
startingmediarecovery
archivelogthread1sequence3isalreadyondiskasfileC:\ORACLE\PRODUCT\10.
2.0\DB_1\DATABASE\ARCHIVE\LOG_3_1_687712197.ARC
archivelog
filename=C:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\ARCHIVE\LOG_3_1_6877
12197.ARCthread=1sequence=3
mediarecoverycomplete,elapsedtime:00:00:04
Finishedrecoverat24MAY09
databaseopened
newincarnationofdatabaseregisteredinrecoverycatalog
startingfullresyncofrecoverycatalog
fullresynccomplete
RMAN>
Scenario7
ScottistheDBAfordatabase.OneoftheDBprogammertruncatedthecriticaltablearound
3.45PMandhecalledScottandexplainedthesituation.Scotthastorecoverthetruncatedtable.
HereisthestepsScottfollowed....
SQL>selectcount(*)fromemployee
COUNT(*)

14
SQL>selectto_char(sysdate,'DDMMYYYY:HH24:MI:SS')
2fromdual
3/
TO_CHAR(SYSDATE,'DD

24052009:15:45:42
SQL>truncatetableemployee
Tabletruncated.
SQL>selectcount(*)fromemployee
COUNT(*)

0
SQL>shutdownimmediate
Databaseclosed.
Databasedismounted.
ORACLEinstanceshutdown.
SQL>startupmount
ORACLEinstancestarted.
TotalSystemGlobalArea612368384bytes
FixedSize1250428bytes
VariableSize188746628bytes
DatabaseBuffers415236096bytes
RedoBuffers7135232bytes

http://myorastuff.blogspot.com/2009/05/rmanrecoveryscenarios.html

10/12

9/15/2016

MyOracle:RMANRecoveryScenarios
Databasemounted.
SQL>

C:\>rmancatalog=rman/rman@catdbtarget=sys/password@orcl
RecoveryManager:Release10.2.0.1.0ProductiononSunMay2415:58:562009
Copyright(c)1982,2005,Oracle.Allrightsreserved.
connectedtotargetdatabase:ORCL(DBID=1215492928,notopen)
connectedtorecoverycatalogdatabase
RMAN>run
2>{
3>setuntiltime"to_date('24052009:15:45:42','DDMMYYYYHH24:MI:SS')"
4>restoredatabase
5>recoverdatabase
6>}
executingcommand:SETuntilclause
Startingrestoreat24MAY09
allocatedchannel:ORA_DISK_1
channelORA_DISK_1:sid=156devtype=DISK
channelORA_DISK_1:startingdatafilebackupsetrestore
channelORA_DISK_1:specifyingdatafile(s)torestorefrombackupset
restoringdatafile00001toC:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF
restoringdatafile00002toC:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01.DBF
restoringdatafile00003toC:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX01.DBF
restoringdatafile00004toC:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF
channelORA_DISK_1:readingfrombackuppiece
C:\RMANBACKUP\BACKUPORCL_DB_09KFRB
BR_1_1_%S_%P
channelORA_DISK_1:restoredbackuppiece1
piecehandle=C:\RMANBACKUP\BACKUPORCL_DB_09KFRBBR_1_1_%S_%P
tag=TAG20090524T1534
19
channelORA_DISK_1:restorecomplete,elapsedtime:00:00:45
Finishedrestoreat24MAY09
Startingrecoverat24MAY09
usingchannelORA_DISK_1
startingmediarecovery
archivelogthread1sequence2isalreadyondiskasfileC:\ORACLE\PRODUCT\10.
2.0\DB_1\DATABASE\ARCHIVE\LOG_2_1_687713476.ARC
archivelogthread1sequence3isalreadyondiskasfileC:\ORACLE\PRODUCT\10.
2.0\DB_1\DATABASE\ARCHIVE\LOG_3_1_687713476.ARC
archivelog
filename=C:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\ARCHIVE\LOG_2_1_6877
13476.ARCthread=1sequence=2
mediarecoverycomplete,elapsedtime:00:00:05
Finishedrecoverat24MAY09
RMAN>exit
RecoveryManagercomplete.
C:\>sqlplussys/passwordassysdba
SQL*Plus:Release10.2.0.1.0ProductiononSunMay2416:01:312009
Copyright(c)1982,2005,Oracle.Allrightsreserved.

Connectedto:
OracleDatabase10gEnterpriseEditionRelease10.2.0.1.0Production
WiththePartitioning,OLAPandDataMiningoptions
SQL>alterdatabaseopenresetlogs
Databasealtered.

http://myorastuff.blogspot.com/2009/05/rmanrecoveryscenarios.html

11/12

9/15/2016

MyOracle:RMANRecoveryScenarios
SQL>connectscott/tiger@orcl
Connected.
SQL>selectcount(*)fromemployee
COUNT(*)

14
SQL>
Ihavediscussedsomeoftheothertopicswhicharerelatedtothisthread.Pleasegothrough
belowlinksincaseifyouareinterested....
Howdoweenablearchiveloginoracle?Clickhere
WhatarethenewfeaturesinRMANsinceOracle9i?Clickhere
PostedbyGovindat5:24PM
Labels:alterdatabaseopenresetlogs,ORA01110,ORA01157,recoverdatabase,recoverdatafile,recover
tablespace,recoveryscenarios,restoredatabase,restoretablespace,RMAN

Nocomments:
PostaComment

NewerPost

Home

OlderPost

Subscribeto:PostComments(Atom)

Simpletemplate.PoweredbyBlogger.

http://myorastuff.blogspot.com/2009/05/rmanrecoveryscenarios.html

12/12

Вам также может понравиться