oracle 10g 搭建备库以及一次DG GAP的处理情况

1.主庫全庫備份
rman target/
rman> backup database format '/backup/fullbak/fullbak_%U';
2.用scp傳到備庫,最好是rman目錄下
3.關閉備庫
4.主庫創建控制文件
sql> alter database create controlfile as '/backup/fullbak/control01.ctl;
用scp傳到備庫對應目錄下 參照pfile參數文件里的路徑
5.啟動備庫到mount狀態
sql> create spfile from pfile;
sql> startup mount;
6.克隆一個對話框,用rman連接
rman target/
rman> catalog start with '從主庫傳過來的全庫備份路徑'
rman> restore database;
7.完成之後登陸備庫,打開應用 檢查主庫歸檔是否傳到備庫,是否應用。


rman搭建DG

1.主庫rman全備份
RMAN>>run{
allocate channel ch1 device type disk;
allocate channel ch2 device type disk;
backup as compressed backupset database format '/exp/full_%U';
backup current controlfile for standby format '/exp/stadnby.ctl';
release channel ch1;
release channel ch2;
}

run{
allocate channel ch1 device type disk;
allocate channel ch2 device type disk;
backup as compressed backupset database format '/ocfs_data/rman/bak_%U';
backup current controlfile for standby format '/ocfs_data/rman/standby.ctl';
release channel ch1;
release channel ch2;
}

2.傳備份文件、密碼文件、參數文件到備庫 建立相應目錄

3.備庫登陸rman

修復控制文件 restore standby controlfiles from '/exp/standby.ctl';
註冊備份片 catalog start with '/exp/';
修復數據庫 restore database;
恢復歸檔 recover database;
recover standby database using backup controlfile;

打開數據庫 打開應用


二、DG gap處理 10g --2018.6.13
問題:備庫異常關閉,導致歸檔沒有應用,但主庫歸檔能傳到備庫
解壓備庫的歸檔文件,進行介質恢復(recover standby database until cancel )
報錯
ORA-00332: archived log is too small - may be incompletely archived
ORA-00334: archived log: '/u03/archivelog/$ORACLE_SID/1_21761_665836676.dbf'

查看歸檔文件大小發現該日誌與其他歸檔日誌大小有明顯差異(有可能)

從主庫傳相同序號的歸檔文件到備庫,再進行介質恢復,

報錯:

ORA-00600: internal error code, arguments: [kcrrssetalrcv.3], [], [], [], [], [], [], []
(該錯誤為內部錯誤,導致該錯誤的原因很多,此處可能是控制文件和在線日誌時間不一致導致(猜測))

從主庫創建standby controlfile
alter database ctreate standby controlfile as '/backup/control.ctl';

把該控制文件傳到備庫對應目錄下,并替代所有目錄下的原控制文件(替代前最好先bak)

用該控制文件啟動數據庫到mount狀態

recover standby database using backup controlfile;

提示需要歸檔文件后 輸入 auto

待恢復完成后 打開應用

alter database recover managed standby database disconnect from session;

查詢應用是否同步,有可能輸入select max(sequence#) from v$archived_log where applied='YES';
后沒有任何顯示,這時從主庫切幾個歸檔,再重新查看,應用已經同步

10G的庫不能打開到open狀態,如果是11g以後的庫,可以用alter database open resetlogs; 打開數據庫

原文地址:https://www.cnblogs.com/sg1005/p/9907800.html