1. 程式人生 > >在異機實現 Oracle 不完全恢復

在異機實現 Oracle 不完全恢復

otg art set med resetlogs 和數 to_date 數據庫 over

1、將數據庫完全備份集和歸檔日誌備份集傳到執行恢復的 Oracle 服務器
# 傳到中轉服務器

scp -P 2222 database.20181030.5* 218.17.56.50:/tmp/backup
scp -P 2222 archivelog.20181029.5ltgrqir_1_1.rman 218.17.56.50:/tmp/backup
scp -P 2222 archivelog.20181030.* 218.17.56.50:/tmp/backup

# 傳到 Oracle 服務器

scp -r backup/ [email protected]:~/

2、註冊備份集到控制文件

catalog backuppiece ‘/home/oracle/backup/archivelog.20181029.5ltgrqir_1_1.rman‘;
catalog backuppiece ‘/home/oracle/backup/archivelog.20181030.5stguer0_1_1.rman‘;
catalog backuppiece ‘/home/oracle/backup/archivelog.20181030.5ttguer0_1_1.rman‘;
catalog backuppiece ‘/home/oracle/backup/archivelog.20181030.5utguesp_1_1.rman‘;
catalog backuppiece ‘/home/oracle/backup/archivelog.20181030.5vtguesr_1_1.rman‘;
catalog backuppiece ‘/home/oracle/backup/archivelog.20181030.60tgueuk_1_1.rman‘;
catalog backuppiece ‘/home/oracle/backup/database.20181030.5otgue2k_1_1.rman‘;
catalog backuppiece ‘/home/oracle/backup/database.20181030.5ptgue2k_1_1.rman‘;
catalog backuppiece ‘/home/oracle/backup/database.20181030.5qtgueid_1_1.rman‘;

3、處理 incarnation (有需要則執行)

shutdown immediate;
startup mount;
list incarnation;
reset database to incarnation 1;

4、執行不完全恢復
# rman 腳本

cat restore.rman 
run {
    shutdown immediate;
    startup mount;
    set until time = "to_date(‘30-10-18 12:00:00‘,‘dd-mm-yy hh24:mi:ss‘)";
    restore database;
    recover database;
    alter database open resetlogs;
}
# 恢復
rman target / @restore.rman

註意:如果恢復報錯,檢查備份集 Status 是否為 AVAILABLE。如果備份集有效,仍然無法創建數據文件,則從裝系統和數據庫可解決此問題。

在異機實現 Oracle 不完全恢復