Anda di halaman 1dari 9

RecoveryofdatathroughRMAN

CASE(1):
1stJuly09

DatabaseCreatedin
Archivelogmode

10thJuly09

Tablespacetb1
Created

20thJuly09

TakeaBackup

Steps:
Step1:
SQL>createtablespacetb2
2datafile'/home/ora9i/vk/data/tb2.dbf'size50m;
Tablespacecreated.

SQL>createuserkvidentifiedbyk
defaulttablespacetb2;
Usercreated.
SQL>grantconnect,resourcetokv;
Grantsucceeded.
SQL>connkv
Enterpassword:*
Connected.
SQL>createtablet1(nonumber);
Tablecreated.

30thJuly09

Tablespacetb1is
corruptedorlost

SQL>createtablet2(nonumber);
Tablecreated.

SQL>select*fromt1;
NO

1
2
3
4
5
SQL>select*fromt2;
NO

10
20
20
$]corruptthetablespace
SQL>shuimmediate
ORA01122:databasefile4failedverificationcheck
ORA01110:datafile4:'/home/ora9i/vk/data/tb2.dbf'
ORA01251:UnknownFileHeaderVersionreadforfilenumber4

Step2:

RMAN>sql"altertablespacetb2offline";
sqlstatement:altertablespacetb2offline


RMAN>run{
2>restoretablespacetb2;
3>recovertablespacetb2;
4>}
Startingrestoreat02JUL09
usingchannelORA_DISK_1
channelORA_DISK_1:startingdatafilebackupsetrestore
channelORA_DISK_1:specifyingdatafile(s)torestorefrombackupset
restoringdatafile00004to/home/ora9i/vk/data/tb2.dbf
channelORA_DISK_1:restoredbackuppiece1
piecehandle=/home/ora9i/OraHome1/dbs/0akj4ake_1_1tag=C1params=NULL
channelORA_DISK_1:restorecomplete
Finishedrestoreat02JUL09
Startingrecoverat02JUL09
usingchannelORA_DISK_1
startingmediarecovery
mediarecoverycomplete
Finishedrecoverat02JUL09
Step3:

RMAN>sql"altertablespacetb2online";
usingtargetdatabasecontrolfileinsteadofrecoverycatalog
sqlstatement:altertablespacetb2online
CASE(2):

1stjuly09

10thJuly09

30thJuly09

Databasecreatedin
archivelogmode.

Takeafull
DatabaseBackup

Systemtablespace
islostorcorrupted

Steps:
Step1:
Ifdatabaseisalreadystarted..shutdownthedatabaseusingabortoption

sql>shutdownabort;
or
rman>shutdownabort;
Step2:
startupthedatabaseinthemountphase.

sql>startupmount
or
rman>startupmount
Step3:
RMAN>run{
2>restoretablespacesystem;
3>recovertablespacesystem;
4>}

Startingrestoreat02JUL09
usingtargetdatabasecontrolfileinsteadofrecoverycatalog
allocatedchannel:ORA_DISK_1
channelORA_DISK_1:sid=12devtype=DISK

channelORA_DISK_1:startingdatafilebackupsetrestore
channelORA_DISK_1:specifyingdatafile(s)torestorefrombackupset
restoringdatafile00001to/home/ora9i/vk/data/syste.dbf
channelORA_DISK_1:restoredbackuppiece1
piecehandle=/home/ora9i/OraHome1/dbs/0ckj4hb3_1_1tag=C2params=NULL
channelORA_DISK_1:restorecomplete
Finishedrestoreat02JUL09
Startingrecoverat02JUL09
usingchannelORA_DISK_1
startingmediarecovery
mediarecoverycomplete
Finishedrecoverat02JUL09
Step4:
sql>alterdatabaseopen
or
rman>sqlalterdatabaseopen
CASE(3):

1stJul09

DatabaseCreatedin
noarchivelogmode

Steps:
Step1:

20thJuly09

Takenfulldatabase
backup

30thJuly09

Systemtablespaceis
corruptedorlost

RMAN>backupdatabase;
Startingbackupat02JUL09
usingchannelORA_DISK_1
channelORA_DISK_1:startingfulldatafilebackupset
channelORA_DISK_1:specifyingdatafile(s)inbackupset
includingcurrentSPFILEinbackupset
includingcurrentcontrolfileinbackupset
inputdatafilefno=00001name=/home/ora9i/vk/data/syste.dbf
inputdatafilefno=00003name=/home/ora9i/vk/data/undo1.dbf
inputdatafilefno=00002name=/home/ora9i/vk/data/tb1.dbf
inputdatafilefno=00004name=/home/ora9i/vk/data/tb2.dbf
channelORA_DISK_1:startingpiece1at02JUL09
channelORA_DISK_1:finishedpiece1at02JUL09
piecehandle=/home/ora9i/OraHome1/dbs/0ikj4pbt_1_1comment=NONE
channelORA_DISK_1:backupsetcomplete,elapsedtime:00:00:15
Finishedbackupat02JUL09
Step2:
SQL>shuimmediate
Databaseclosed.
Databasedismounted.
ORACLEinstanceshutdown.
SQL>startup
ORACLEinstancestarted.
TotalSystemGlobalArea97588504bytes
FixedSize451864bytes
VariableSize46137344bytes
DatabaseBuffers50331648bytes
RedoBuffers667648bytes
Databasemounted.

ORA01157:cannotidentify/lockdatafile1seeDBWRtracefile
ORA01110:datafile1:'/home/ora9i/vk/data/syste.dbf'
RMAN>run{
restoredatabase;
recoverdatabase;
}
Step3:
RMAN>sqlalterdatabaseopen
or
SQL>alterdatabaseopen;
CASE(4):
1stJuly09

10thJuly09

DatabaseCreatedin
Noarchivelogmode

Createda
tablespacetb1

20thJuly09

30thjuly09

BringtheDatabase
toarchivelogmode

Tablespacetb1is
corruptedorlost

Steps:
Step1:
Startupthedatabaseinthemountphase
SQL>startupmount
or
RMAN>Startupmount
Step2:
RMAN>sqlalterdatabasedatafile''/home/ora9i/kv/data/tb1.dbf''offline;

Aswedon'thaveabackupoftablespace,sothereisnowayorestorethetablespaceand
recoverthedata.butthereisanentryincontrolfile,whichdoesnotallowtoopenthe
database,soremovingtheentryofthetablespacefromthecontrolfile.
Step3:
RMAN>sqlalterdatabaseopen
Step4:
SQL>droptablespacetb1includingcontents
CASE(5):
1stJuly09

10thJuly09

DatabaseCreatedin Bringingthedatabase
Noarchivelogmode toarchivelogmode

20thJuly09

Createatablespace
namedtb1

30thJuly09

Tablepacetb1is
corruptedorlost

Step1:
SQL>STARTUPMOUNT
or
RMAN>STARTUPMOUNT
Step2:
RMAN>Alterdatabasecreatedatafile''/home/ora9i/kv/data/tb1.dbf'';
Inthiscaseevenifwedon'thaveabackup,asdatabaseisinarchivelogmode,wecan
restorethetablespaceandrecoverthedata,byaddinganentryincontrolfilethroughthe
abovecommand.

Step3:
RMAN>Recovertablespacetb1;
Step4:
RMAN>SQLAlterdatabaseOpen;

Anda mungkin juga menyukai