1.備份資料庫

 

RMAN>backupdatabaseformat'/u01/app/RMANBK/bk_dir/%u';

 

2.關閉資料庫

 

SQL>shutdownimmediate

 

Databaseclosed.

 

Databasedismounted.

 

ORACLEinstanceshutdown.

 

3.類比資料丟失

 

刪除控制檔、資料檔案、日誌檔、參數檔、密碼檔

 

[oracle@localhostmyorcl]$pwd

 

/u01/app/oradata/myorcl

 

[oracle@localhostmyorcl]$rm-rf*

 

[oracle@localhostdbs]$ls

 

hc_myorcl.datinit.oraorapwmyorclspfilemyorcl.ora

 

initdw.oralkMYORCLsnapcf_myorcl.f

 

[oracle@localhostdbs]$pwd

 

/u01/app/oracle/dbs

 

[oracle@localhostdbs]$rm-rfspfilemyorcl.ora

 

[oracle@localhostdbs]$rm-rforapwmyorcl

 

4.啟動資料庫到nomount狀態

 

此時需要用到參數檔:

 

[oracle@localhostpfile]$ls

 

init.ora.226201419515

 

[oracle@localhostpfile]$pwd

 

/u01/app/admin/myorcl/pfile

 

[oracle@localhostpfile]$mvinit.ora.226201419515init.ora

 

[oracle@localhostpfile]$ls

 

init.ora




啟動資料庫到nomount狀態:

 

[oracle@localhost~]$sqlplus/assysdba

 

SQL*Plus:Release10.2.0.1.0-ProductiononThuMar2722:11:172014

 

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

 

Connectedtoanidleinstance.

 

SQL>startupnomountpfile='/u01/app/admin/myorcl/pfile/init.ora';

 

ORACLEinstancestarted.

 

TotalSystemGlobalArea281018368bytes

 

FixedSize2020160bytes

 

VariableSize88083648bytes

 

DatabaseBuffers184549376bytes

 

RedoBuffers6365184bytes

 

SQL>

 

4.使用RMAN恢復資料庫參數檔

 

[oracle@localhost~]$rmantarget/

 

RecoveryManager:Release10.2.0.1.0-ProductiononThuMar2722:13:592014

 

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

 

connectedtotargetdatabase:myorcl(notmounted)

 

RMAN>restorespfilefromautobackup;

 

然後關閉資料庫啟動到nomount狀態呢:

 

SQL>shutdownimmediate;

 

ORACLEinstanceshutdown.

 

SQL>startupnomount;

 

ORACLEinstancestarted.

 

TotalSystemGlobalArea281018368bytes

 

FixedSize2020160bytes

 

VariableSize113249472bytes

 

DatabaseBuffers159383552bytes

 

RedoBuffers6365184bytes

 

5.使用RMAN恢復資料庫控制檔

 

RMAN>restorecontrolfilefromautobackup;

 

Startingrestoreat27-MAR-14

 

usingtargetdatabasecontrolfileinsteadofrecoverycatalog

 

allocatedchannel:ORA_DISK_1

 

channelORA_DISK_1:sid=155devtype=DISK

 

recoveryareadestination:/u01/app/flash_recovery_area

 

databasename(ordatabaseuniquename)usedforsearch:MYORCL

 

channelORA_DISK_1:autobackupfoundintherecoveryarea

 

channelORA_DISK_1:autobackupfound:/u01/app/flash_recovery_area/MYORCL/autobackup/2014_03_27/o1_mf_s_843343359_9m8cw0g0_.bkp

 

channelORA_DISK_1:controlfilerestorefromautobackupcomplete

 

outputfilename=/u01/app/oradata/myorcl/control01.ctl

 

outputfilename=/u01/app/oradata/myorcl/control02.ctl

 

outputfilename=/u01/app/oradata/myorcl/control03.ctl

 

Finishedrestoreat27-MAR-14

 

6.啟動資料庫至mount狀態

 

SQL>alterdatabasemount;

 

Databasealtered.

 

7.恢復資料庫

 

RMAN>restoredatabase;

 

接下來執行recoverdatabase,出現錯誤,連結如下:




HTTP://dayong2015.blog.51cto.com/7185873/1397289

 

8.創建密碼檔

 

[oracle@localhost~]$orapwdfile=$ORACLE_HOME/dbs/orapwmyorclpassword=oracle;
創作者介紹
創作者 shadow 的頭像
shadow

資訊園

shadow 發表在 痞客邦 留言(0) 人氣()