基於非歸檔的冷備份恢復

nathanzhn發表於2014-02-19

基於非歸檔的冷備份恢復—為離線恢復,不完全恢復,在冷備份之後發生的資料庫變化將無法恢復,而且冷備份恢復必須是全庫恢復,包括資料檔案、聯機日誌、控制檔案的restore,不能做資料庫的區域性恢復,比如只恢復某個表空間或某個資料檔案。

冷備能恢復成功的先決條件是,當你在做冷備的時候,資料庫是shutdown已關閉的狀態,這樣才能保證一致性。

下面是執行步驟,因該步驟比較簡單,就只列出指令碼沒有實際操作的結果:

1.        shutdown immediate –這一步是必須放在第一步的

2.        select name from v$datafile;

3.        select member from v$logfile;

4.        select name from v$controlfile;

5.        show parameter spfile;

6.        根據以上四步操作,取得要備份的檔案清單,然後做冷拷貝

cp /u01/app/oracle/oradata/PROD/disk1/system001.dbf /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk1/undotbs01.dbf /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk1/example1.dbf /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk1/indx1.dbf /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk1/tools1.dbf /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk1/users1.dbf /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk1/oltp1.dbf /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk1/tbs_tommie01.dbf /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk1/redo101.log /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk2/redo102.log /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk3/redo103.log /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk1/redo201.log /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk2/redo202.log /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk3/redo203.log /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk1/redo301.log /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk2/redo302.log /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk3/redo303.log /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk4/redo104.log /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk4/redo204.log /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk1/control01.ctl /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk2/control02.ctl /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/product/10.2.0/db_1/dbs/spfilePROD.ora /home/oracle/coldbackup/20140125-1

7.        當資料庫冷備份恢復時,先將資料庫shutdown(可能是正常關閉immediate,也可能是異常關閉abort),然後執行資料庫檔案刪除,再將冷備份拷貝到對應的資料庫目錄

rm -f /u01/app/oracle/oradata/PROD/disk1/system001.dbf

rm -f /u01/app/oracle/oradata/PROD/disk1/undotbs01.dbf

rm -f /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf

rm -f /u01/app/oracle/oradata/PROD/disk1/example1.dbf

rm -f /u01/app/oracle/oradata/PROD/disk1/indx1.dbf

rm -f /u01/app/oracle/oradata/PROD/disk1/tools1.dbf

rm -f /u01/app/oracle/oradata/PROD/disk1/users1.dbf

rm -f /u01/app/oracle/oradata/PROD/disk1/oltp1.dbf

rm -f /u01/app/oracle/oradata/PROD/disk1/tbs_tommie01.dbf

rm -f /u01/app/oracle/oradata/PROD/disk1/redo101.log

rm -f /u01/app/oracle/oradata/PROD/disk2/redo102.log

rm -f /u01/app/oracle/oradata/PROD/disk3/redo103.log

rm -f /u01/app/oracle/oradata/PROD/disk1/redo201.log

rm -f /u01/app/oracle/oradata/PROD/disk2/redo202.log

rm -f /u01/app/oracle/oradata/PROD/disk3/redo203.log

rm -f /u01/app/oracle/oradata/PROD/disk1/redo301.log

rm -f /u01/app/oracle/oradata/PROD/disk2/redo302.log

rm -f /u01/app/oracle/oradata/PROD/disk3/redo303.log

rm -f /u01/app/oracle/oradata/PROD/disk4/redo104.log

rm -f /u01/app/oracle/oradata/PROD/disk4/redo204.log

rm -f /u01/app/oracle/oradata/PROD/disk1/control01.ctl

rm -f /u01/app/oracle/oradata/PROD/disk2/control02.ctl

rm -f /u01/app/oracle/product/10.2.0/db_1/dbs/spfilePROD.ora

 

cp /home/oracle/coldbackup/20140125-1/system001.dbf    /u01/app/oracle/oradata/PROD/disk1/system001.dbf

cp /home/oracle/coldbackup/20140125-1/undotbs01.dbf    /u01/app/oracle/oradata/PROD/disk1/undotbs01.dbf

cp /home/oracle/coldbackup/20140125-1/sysaux01.dbf     /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf

cp /home/oracle/coldbackup/20140125-1/example1.dbf     /u01/app/oracle/oradata/PROD/disk1/example1.dbf

cp /home/oracle/coldbackup/20140125-1/indx1.dbf        /u01/app/oracle/oradata/PROD/disk1/indx1.dbf

cp /home/oracle/coldbackup/20140125-1/tools1.dbf       /u01/app/oracle/oradata/PROD/disk1/tools1.dbf

cp /home/oracle/coldbackup/20140125-1/users1.dbf       /u01/app/oracle/oradata/PROD/disk1/users1.dbf

cp /home/oracle/coldbackup/20140125-1/oltp1.dbf        /u01/app/oracle/oradata/PROD/disk1/oltp1.dbf

cp /home/oracle/coldbackup/20140125-1/tbs_tommie01.dbf /u01/app/oracle/oradata/PROD/disk1/tbs_tommie01.dbf

cp /home/oracle/coldbackup/20140125-1/redo101.log      /u01/app/oracle/oradata/PROD/disk1/redo101.log

cp /home/oracle/coldbackup/20140125-1/redo102.log      /u01/app/oracle/oradata/PROD/disk2/redo102.log

cp /home/oracle/coldbackup/20140125-1/redo103.log      /u01/app/oracle/oradata/PROD/disk3/redo103.log

cp /home/oracle/coldbackup/20140125-1/redo201.log      /u01/app/oracle/oradata/PROD/disk1/redo201.log

cp /home/oracle/coldbackup/20140125-1/redo202.log      /u01/app/oracle/oradata/PROD/disk2/redo202.log

cp /home/oracle/coldbackup/20140125-1/redo203.log      /u01/app/oracle/oradata/PROD/disk3/redo203.log

cp /home/oracle/coldbackup/20140125-1/redo301.log      /u01/app/oracle/oradata/PROD/disk1/redo301.log

cp /home/oracle/coldbackup/20140125-1/redo302.log      /u01/app/oracle/oradata/PROD/disk2/redo302.log

cp /home/oracle/coldbackup/20140125-1/redo303.log      /u01/app/oracle/oradata/PROD/disk3/redo303.log

cp /home/oracle/coldbackup/20140125-1/redo104.log      /u01/app/oracle/oradata/PROD/disk4/redo104.log

cp /home/oracle/coldbackup/20140125-1/redo204.log      /u01/app/oracle/oradata/PROD/disk4/redo204.log

cp /home/oracle/coldbackup/20140125-1/control01.ctl    /u01/app/oracle/oradata/PROD/disk1/control01.ctl

cp /home/oracle/coldbackup/20140125-1/control02.ctl    /u01/app/oracle/oradata/PROD/disk2/control02.ctl

cp /home/oracle/coldbackup/20140125-1/spfilePROD.ora /u01/app/oracle/product/10.2.0/db_1/dbs/spfilePROD.ora

8.        拷貝完成後,啟動資料庫 startup up

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26521853/viewspace-1083928/,如需轉載,請註明出處,否則將追究法律責任。

相關文章