天天看点

RAC数据库恢复到单实例数据库

  a.准备单实例服务器,pfile文件,启动到nomount

  b.备份rac数据库

  c.将备份文件拷贝到单实例服务器

  d.在单实例服务器上还原、恢复

  e.resetlogs打开数据库

  f.rename redo文件名

  g.disable thread 2并删除其redo组

  h.增加temp临时表空间数据文件

  i.删除不必要的undo表空间

  另外,备份、拷贝的环节就请参考其他文档,就不介绍了,下面从第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打开数据库;但是,实际操作中遇到bug7207932:rman 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;

最新内容请见作者的github页:http://qaseven.github.io/