RAC資料庫恢復到單例項資料庫

panpong發表於2014-08-15

RAC資料庫恢復到單例項資料庫

       RAC資料庫恢復到單例項資料庫的基本步驟如下:

a.準備單例項伺服器,pfile檔案,啟動到nomount

b.備份rac資料庫

c.將備份檔案複製到單例項伺服器

d.在單例項伺服器上還原、恢復

e.resetlogs開啟資料庫

f.rename redo檔名

g.disable thread 2並刪除其redo

h.增加temp臨時表空間資料檔案

i.刪除不必要的undo表空間

業務需要(比如,測試備份)將RAC資料庫透過備份恢復到單例項伺服器;下面是實際操作步驟;測試環境:RHEL4u7、oracle 10gR2、ASM2節點,單例項伺服器:RHEL4u7oracle 10gR2、檔案系統;在測試環境下,RAC 資料庫檔案都在asm時,在rename file操作時會遇到了BUG問題,最後的恢復時則需要重建控制檔案;上面介紹的步驟是指沒有BUG的情況的操作;

另外,備份、複製的環節就請參考其他文件,就不介紹了,下面從第4步在單例項伺服器上還原、恢復與開啟開始介紹;

RMAN> startup nomount

RMAN> restore controlfile to '/app/oracle/oradata/ctl01.dbf' from '/app/oracle/backup/ctl_23_1_855331400';

RMAN> run{startup mount;

set until sequence 870 thread 1;

set newname for datafile 1  to '/app/oracle/oradata/system.257.779207027';

set newname for datafile 3  to '/app/oracle/oradata/sysaux.262.779207043';

set newname for datafile 4  to '/app/oracle/oradata/users.260.779207053';

set newname for datafile 2  to '/app/oracle/oradata/undotbs1.264.779207043';

set newname for datafile 15  to '/app/oracle/oradata/pptest_tbs.282.793979093';

set newname for datafile 5  to'/app/oracle/oradata/undotbs2.268.779207507';

set newname for datafile 8  to'/app/oracle/oradata/tbs_p3w.271.780396123';

set newname for datafile 9  to'/app/oracle/oradata/tbs_p4w.274.780396125';

set newname for datafile 6  to'/app/oracle/oradata/tbs_p1w.270.780396121';

set newname for datafile 7  to'/app/oracle/oradata/tbs_p2w.273.780396123';

set newname for datafile 14 to'/app/oracle/oradata/pptest_tbs.279.781454807';

restore database;

switch datafile all;

recover database;

}

sys@racdb3> alter database rename file '+DG/racdb/onlinelog/group_1.263.779207025' to '/app/oracle/oradata/redo1.log';

rename 完所有redo檔案後,即可resetlogs開啟資料庫;但是,實際操作中遇到bug7207932Rman Restore From RAC ASM To Single Instance Non ASM Fails With ORA-00600 [kgeade_is_0] (文件 ID 1146703.1)

Bug 7207932  ORA-600 [KGEADE_IS_0] WHEN RENAMING A FILE FROM ASM TO FS

要想繞開的方法則是重建控制檔案後,再開啟資料庫

 

sys@racdb3> alter database backup controlfile to trace as '/tmp/ctl.trc' reuse resetlogs;

開啟trace檔案,修改裡面的logfile部分資訊;然後重啟資料庫到nomount狀態;

sys@racdb3> shutdown immediate

SQL> STARTUP NOMOUNT

CREATE CONTROLFILE REUSE DATABASE "RACDB" RESETLOGS  ARCHIVELOG

    MAXLOGFILES 50

    MAXLOGMEMBERS 2

    MAXDATAFILES 2000

    MAXINSTANCES 8

    MAXLOGHISTORY 292

LOGFILE

  GROUP 1 '/app/oracle/oradata/group_1.263.779207025'  SIZE 10M,

  GROUP 2 '/app/oracle/oradata/group_2.259.779207027'  SIZE 10M,

  GROUP 3 '/app/oracle/oradata/group_3.258.779207027'  SIZE 10M

DATAFILE

  '/app/oracle/oradata/system.257.779207027',

  '/app/oracle/oradata/undotbs1.264.779207043',

  '/app/oracle/oradata/sysaux.262.779207043',

  '/app/oracle/oradata/users.260.779207053',

  '/app/oracle/oradata/undotbs2.268.779207507',

  '/app/oracle/oradata/tbs_p1w.270.780396121',

  '/app/oracle/oradata/tbs_p2w.273.780396123',

  '/app/oracle/oradata/tbs_p3w.271.780396123',

  '/app/oracle/oradata/tbs_p4w.274.780396125',

  '/app/oracle/oradata/pptest_tbs.279.781454807',

  '/app/oracle/oradata/pptest_tbs.282.793979093'

CHARACTER SET ZHS16GBK

;

建立完成後,用backup controlfile進行恢復;

sys@racdb3> RECOVER DATABASE USING BACKUP CONTROLFILE until cancel;

sys@racdb3>ALTER DATABASE ADD LOGFILE THREAD 2

  GROUP 4 '/app/oracle/oradata/group_4.265.779207453' SIZE 10M REUSE,

  GROUP 5 '/app/oracle/oradata/group_5.266.779207459' SIZE 10M REUSE,

  GROUP 6 '/app/oracle/oradata/group_6.267.779207467' SIZE 10M REUSE;

sys@racdb3> alter database open resetlogs;

成功resetlogs開啟後,還需要做一些去thread 2的操作;

sys@racdb3> alter database disable thread 2;

sys@racdb3> alter database drop logfile group 4;

alter database drop logfile group 4

*

ERROR at line 1:

ORA-00350: log 4 of instance UNNAMED_INSTANCE_2 (thread 2) needs to be archived

ORA-00312: online log 4 thread 2: '/app/oracle/oradata/RACDB/onlinelog/o1_mf_4_9ym2kvgf_.log'

 

sys@racdb3> alter database clear unarchived logfile group 4;

 

sys@racdb3> alter tablespace temp add tempfile '/app/oracle/oradata/temp01.dbf' size 10M reuse;

Tablespace altered.

sys@racdb3> drop tablespace undotbs2 including contents and datafiles;

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

相關文章