oracle 11g 通過主機的RMAN備份,測試庫異機恢復(fù)數(shù)據(jù)庫,rman報錯
忘記保存截圖了,口述事情大概
主機SID:orcl
測試庫SID:test
主庫RMAN備份在本地
通過scp把參數(shù)文件,控制文件,數(shù)據(jù)文件,歸檔文件傳到測試庫相同目錄
測試庫啟動到nomunt狀態(tài)
rman target /
先恢復(fù)控制文件:
rman>restore controlfile from 'scp傳過來的控制文件路徑';
測試庫啟動到mount狀態(tài):
rman>alter database mount;
結(jié)果報錯識別不到控制文件中orcl實例
反應(yīng)過來測試庫的SID時test,主庫的SID是orcl,不同步,沒法恢復(fù)
進入sql,create pfile=‘/home/oracle/initorcl.ora' from spfile; 創(chuàng)建一個pfile
修改initorcl.ora這個pfile文件,創(chuàng)建需要的目錄
再次使用這個pfile文件打開數(shù)據(jù)庫,
startup nomount from pfile=’/home/oracle/initorcl.ora';
再次恢復(fù)控制文件:
rman>restore controlfile from 'scp傳過來的控制文件路徑';
啟動到mount狀態(tài):
rman>alter database mount;
成功
最后通過rman恢復(fù)數(shù)據(jù)庫,指定到/u01/oradata/emr/:
rman>
run{
allocate channel c1 device type disk;
allocate channel c2 device type disk;
allocate channel c3 device type disk;
allocate channel c4 device type disk;
set newname for database to '/u01/oradata/emr/%b';
restore database;
switch datafile all;
switch tempfile all;
recover database;
}
