oracle的RMAN異機恢復

peng163fj發表於2015-04-13

裝載前階段

1.        將備份檔案放到相同位置

2.        設定sidunix export windows set oracle_sid=orcl 注意大寫

3.        進入set dbid=...可以在log中看到

4.        進入nomount狀態,startup force nomount

5.        恢復SPFILE restore spfile from ‘位置

6.        恢復控制檔案 restore controlfile from ‘位置’,如報錯dummy而非orclshutdownstart

裝載mount後階段

7.        注意把控制檔案複製過去,然後chown –R oracle.oinstall /u01/test1/

8.        然後是alter databse mount,不是startup,否則datafile沒法複製

9.        ORA-00205: error in identifyingcontrol file, check alert log for more info

10.    alart log/U01/oradata/test1adump裡,

11.    ORA-01102: cannot mountdatabase in EXCLUSIVE mode 注意兩個資料庫不能一起開

12.    select file_id,file_name from dba_data_files;檢視資料檔案,為14步打基礎

13.    catalog start with 'F:\backup';這個用於定位恢復檔案的位置




select  file_id,file_name from dba_data_files;
select file_id,file_name from dba_temp_files;

跨平臺遷移時,可用catalog start with '/u01/install/soft'; 來制定恢復源的路徑

完成後,rman>recover database,會有報錯,可以不管
最後
SQL> startup pfile='/u01/install/soft/2.ora' upgrade;--如果版本不一致


startup nomount pfile='/home/backup/20150525/spfile.ora'

restore controlfile from '/home/backup/20150525/RMSDB_20150525_308_1_cONTROL';
報錯就用ps -ef|more ora 看看有沒有多餘的程式,kill -9 一個個殺




完整恢復命令
startup nomount pfile='/u02/backup/ism.ora';


restore controlfile from '/u02/backup/ISM_20150807_320_1_CONTROL';


alter database mount;


column c1 format a5
column c2 format a40
select trim(file#) c1,name c2 from v$datafile;
select trim(file#) c1,name c2 from v$tempfile;


catalog start with '/u02/backup';


run
{
set newname for datafile 1 to"/u02/oracle/app/oradata/ism/SYSTEM.DBF";
set newname for datafile 2 to"/u02/oracle/app/oradata/ism/SYSAUX.DBF";
set newname for datafile 3 to"/u02/oracle/app/oradata/ism/UNDOTBS1.DBF";
set newname for datafile 4 to"/u02/oracle/app/oradata/ism/USERS.DBF";
set newname for datafile 5 to"/u02/oracle/app/oradata/ism/NNC_DATA01.DBF";
set newname for datafile 6 to"/u02/oracle/app/oradata/ism/NNC_DATA02.DBF";
set newname for datafile 7 to"/u02/oracle/app/oradata/ism/NNC_DATA03.DBF";
set newname for datafile 8 to"/u02/oracle/app/oradata/ism/NNC_INDEX01.DBF";
set newname for datafile 9 to"/u02/oracle/app/oradata/ism/NNC_INDEX02.DBF";
set newname for datafile 10 to"/u02/oracle/app/oradata/ism/NNC_INDEX03.DBF";
set newname for tempfile 1 to"/u02/oracle/app/oradata/ism/TEMP.DBF";
restore database;
switch datafile all;
}
shutdown immediate

startup pfile='/u02/backup/ism.ora' upgrade ;

upgrade後還沒有完,要做以下幾個步驟
0.修改temp指向
CREATE TEMPORARY TABLESPACE TMP 
TEMPFILE '/u01/app/oradata/TEMP01.DBF'
SIZE 8G
AUTOEXTEND OFF;

alter database default temporary tablespace tmp;
drop tablespace temp including contents and datafiles;
1.建立spfile
create spfile from pfile='/u01/backup/init.ora';
2.rman備份
show all;---改掉所有路徑錯誤的
3.listener配置
alter system set local_listener='';
alter system register;
4.升級收尾
如果不想每次開啟都用startup upgrade,就老實點泡指令碼,預計時間1小時左右
@/u01/oracle/app/product/11.2.0/dbhome_1/rdbms/admin/catupgrd.sql













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

相關文章