oracle 異機恢復 從asm到檔案系統成功例項
1.1 確實 源資料庫與目標庫版本一致
語句:select * from v$version;
源庫:
1.2 確認源資料庫名與目標庫資料庫名一致
查詢資料庫名語句:select name fromv$database;
如果不一致通過恢復spfile檔案再把spfile檔案轉為為pfile檔案修改資料庫名;
恢復spfile:
restore spfile from '/home/oracle/backup/spfile_20171103_0hsijpo8_1_1.bak';
根據spfile建立pfile:
createpfile from spfile;
1.3 查詢源庫dbid
語句:select dbid fromv$database;
1.4 登入sqlplus 建立pfile
1.5 關閉資料庫
1.6 進入rman
1.7 由pfile啟動資料庫到nomount狀態
語句:startup pfile ='$ORACLE_HOME/dbs/initauth.ora' nomount;
1.8 恢復控制檔案
命令:restorecontrolfile from '/home/oracle/backup/ctl_20171109_1usj3jvs_1_1.ctl'
1.9 mount資料庫
命令: alterdatabase mount;
1.10 重新註冊備份集
命令:catalogstart with '/home/oracle/backup/';
1.11 恢復資料檔案
指令碼如下:
run{
allocate channel t1 type DISK FORMAT'/home/oracle/backup/%U';
allocate channel t2 type DISK FORMAT'/home/oracle/backup/%U';
allocate channel t3 type DISK FORMAT'/home/oracle/backup/%U';
set newname for datafile 1 to'/u01/app/oracle/oradata/AUTH/system.259.856237927';
set newname for datafile 2 to'/u01/app/oracle/oradata/AUTH/sysaux.260.856237941';
set newname for datafile 3 to'/u01/app/oracle/oradata/AUTH/undotbs1.261.856237955';
set newname for datafile 4 to'/u01/app/oracle/oradata/AUTH/undotbs2.263.856237975';
set newname for datafile 5 to'/u01/app/oracle/oradata/AUTH/users.264.856237981';
set newname for datafile 6 to'/u01/app/oracle/oradata/AUTH/auth.268.856243549';
set newname for datafile 7 to'/u01/app/oracle/oradata/AUTH/auth.269.856243795';
set newname for datafile 8 to'/u01/app/oracle/oradata/AUTH/sysaux02.dbf';
set newname for datafile 9 to'/u01/app/oracle/oradata/AUTH/system02.dbf';
restore database;
switch datafile all;
release channel t1;
release channel t2;
release channel t3;
}
等待。。。。
1.12 recover 資料庫
指令碼如下:
run {
allocate channel t1 type DISK FORMAT'/home/oracle/backup/%U';
allocate channel t2 type DISK FORMAT'/home/oracle/backup/%U';
allocate channel t3 type DISK FORMAT'/home/oracle/backup/%U';
recover database;
release channel t1;
release channel t2;
release channel t3;
}
1.12.1 更改資料庫,歸檔日誌的存檔終點。
刪除選中兩行
alter system setlog_archive_dest='/u01/app/oracle/oradata/arch_log';
1.13 用resetlogs方式開啟資料庫
命令: alterdatabase open resetlogs;
1.14 修改redo 日誌檔案位置:
在sqlplusz中
通過 select memberfrom V$logfile; 查詢
通過 alterdatabase rename file ‘原路徑’ to ‘新路徑’ 全部修改完畢
再次嘗試resetlog方式開啟資料庫
刪除 log 10;
再次嘗試resetlog方式開啟資料庫
由於rman備份的時候並不備temporarytablespaces,所以恢復完畢後,要重新建立它們。如:
$sqlplus /nolog
SQL>conn /as sysdba
SQL> altertablespace temp add tempfile '/u01/app/oracle/oradata/AUTH/temp01.dbf' size1024m;