rac到單例項的rman恢復

n-lauren發表於2012-11-26
1.建立單例項pfile檔案,對應db_name引數,dbs下對應sid
*.audit_file_dest='/u01/app/oracle/admin/cn100db/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oracle/oradata/cn100db/control01.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='cn100db'
*.db_recovery_file_dest='/u01/app/oracle/recovery_area'
*.db_recovery_file_dest_size=4070572032
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=cn100dbXDB)'
*.log_archive_dest_1='location=/u01/app/oracle/archlog'
*.memory_target=8206107648
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'
 
2.啟動到nomout
SQL> startup nomout
 
3.將rac的rman備份資料庫與每個節點的歸檔日子,拷貝到單例項
scp xxxx xxxxxx
 
4.恢復controlfile檔案從備份中
RMAN> restore controfile from '/backjup/xxxx';
 
5.啟動到mount,檢視控制檔案中備份
SQL> alter datbase mount;
RMAN> list backupset;
 
6.還原資料檔案,並rename到新目錄
RMAN>
run{
set newname for datafile 1  to '/u01/app/oracle/oradata/system01.dbf';
set newname for datafile 2  to '/u01/app/oracle/oradata/sysaux01.dbf';
set newname for datafile 3  to '/u01/app/oracle/oradata/undotbs01.dbf';
set newname for datafile 4  to '/u01/app/oracle/oradata/users01.dbf';
set newname for datafile 5  to '/u01/app/oracle/oradata/undotbs02.dbf';
set newname for datafile 6  to '/u01/app/oracle/oradata/lunar.274.796133339';
set newname for datafile 7  to '/u01/app/oracle/oradata/space_data_order_01_01.dbf';
set newname for datafile 8  to '/u01/app/oracle/oradata/space_data_order_02_01.dbf';
set newname for datafile 9  to '/u01/app/oracle/oradata/space_data_order_03_01.dbf';
set newname for datafile 10 to '/u01/app/oracle/oradata/system02.dbf';
set newname for datafile 11 to '/u01/app/oracle/oradata/sysaux02.dbf';
restore database;
switch datafile all;
}
 
7.還原歸檔,對應list backupset的sequence及thread
RMAN>
run
{allocate channel c1 type disk;
set archivelog destination to '/u01/app/oracle';
restore archivelog sequence between 225 and 226 thread 1;
allocate channel c2 type disk;
set archivelog destination to '/u01/app/oracle';
restore archivelog sequence between 164 and 165 thread=2;
release channel c1;
release channel c2;
}
 
8.恢復到最新歸檔
SQL> recover database until cancel;
 
9.由於rac環境的redolog在asm中,需要重建controlfile重定向redolog檔案路徑.
SQL> alter database backup controlfile to trace;
SQL> shutdown immediate
 
10.查詢controlfile trace 修改redolog對應位置
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "CN100DB" RESETLOGS  ARCHIVELOG
    MAXLOGFILES 192
    MAXLOGMEMBERS 3
    MAXDATAFILES 1024
    MAXINSTANCES 32
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 '/u01/app/oracle/oradata/redo01.log'  SIZE 100M BLOCKSIZE 512,
  GROUP 2 '/u01/app/oracle/oradata/redo02.log'  SIZE 100M BLOCKSIZE 512,
  GROUP 5 '/u01/app/oracle/oradata/redo03.log'  SIZE 300M BLOCKSIZE 512,
  GROUP 6 '/u01/app/oracle/oradata/redo04.log'  SIZE 100M BLOCKSIZE 512
DATAFILE
  '/u01/app/oracle/oradata/system01.dbf',
  '/u01/app/oracle/oradata/sysaux01.dbf',
  '/u01/app/oracle/oradata/undotbs01.dbf',
  '/u01/app/oracle/oradata/users01.dbf',
  '/u01/app/oracle/oradata/undotbs02.dbf',
  '/u01/app/oracle/oradata/lunar.274.796133339',
  '/u01/app/oracle/oradata/space_data_order_01_01.dbf',
  '/u01/app/oracle/oradata/space_data_order_02_01.dbf',
  '/u01/app/oracle/oradata/space_data_order_03_01.dbf',
  '/u01/app/oracle/oradata/space_data_order_04_01.dbf',
  '/u01/app/oracle/oradata/system02.dbf',
  '/u01/app/oracle/oradata/sysaux02.dbf'
CHARACTER SET ZHS16GBK
;
-- Database can now be opened zeroing the online logs.
ALTER DATABASE OPEN RESETLOGS;

11.建立臨時表空間
create temporary tablespace temp tempfile 'xxxxxx' size 512m;

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

相關文章