NBU将RAC数据库恢复到单机
2019-04-17 17:51 abce 阅读(790) 评论(0) 编辑 收藏 举报恢复的过程和(https://www.cnblogs.com/abclife/p/5687993.html)差不多。
但是,具体过程有些不同。
如果按照之前的恢复方式,在run语句中同时运行restore和recover操作,虽然可以执行成功,但是在以resetlogs方式打开时会报错:
SQL> alter database open resetlogs; alter database open resetlogs * ERROR at line 1: ORA-00392: log 3 of thread 1 is being cleared, operation not allowed ORA-00312: online log 3 thread 1: '+abce' SQL> select member from v$logfile; MEMBER -------------------------------------------------------------------------------- +abce +abce +abce +abce +abce +abce +abce +abce 8 rows selected. SQL>
从这里可以看到,在找redo日志的时候,还是从asm磁盘中查找。因此发生了问题。
解决方案:
解决方案就是分开执行。
1.首先restore数据库
run{ allocate channel ch01 type 'sbt_tape'; SEND 'NB_ORA_SERV=nbubak,NB_ORA_CLIENT=abce1'; set newname for datafile '+ABCE/simple/datafile/system.283.914330399' to '/u01/app/oracle/oradata/simple/system.283.914330399'; set newname for datafile '+ABCE/simple/datafile/sysaux.276.914330399' to '/u01/app/oracle/oradata/simple/sysaux.276.914330399'; set newname for datafile '+ABCE/simple/datafile/undotbs1.280.914330399' to '/u01/app/oracle/oradata/simple/undotbs1.280.914330399'; set newname for datafile '+ABCE/simple/datafile/users.284.914330399' to '/u01/app/oracle/oradata/simple/users.284.914330399'; set newname for datafile '+ABCE/simple/datafile/undotbs2.281.914330739' to '/u01/app/oracle/oradata/simple/undotbs2.281.914330739'; set newname for datafile '+ABCE/simple/datafile/simple2.289.914403223' to '/u01/app/oracle/oradata/simple/simple2.289.914403223'; set newname for datafile '+ABCE/simple/datafile/simple.290.914422933' to '/u01/app/oracle/oradata/simple/simple.290.914422933'; set newname for datafile '+ABCE/simple/datafile/zabbix.292.913197723' to '/u01/app/oracle/oradata/simple/zabbix.292.913197723'; set newname for datafile '+ABCE/simple/datafile/simple.301.981364941' to '/u01/app/oracle/oradata/simple/simple.301.981364941'; restore database; switch datafile all; release channel ch01; }
2.如果有需要,要将归档日志备份恢复到指定位置
3.修改redo文件的路径和名称
执行以下命令,找出redo路径和名称
select 'alter database rename file '''||member||''' to ''/u01/app/oracle/oradata/simple'||substr(member,21)||''';' from v$logfile;
然后根据查出的结果,执行修改文件路径和名称
alter database rename file '+ABCE/simple/datafile/group_3.278.997540305' to '/u01/app/oracle/oradata/simple/group_3.278.997540305'; alter database rename file '+ABCE/simple/datafile/group_2.279.997539653' to '/u01/app/oracle/oradata/simple/group_2.279.997539653'; alter database rename file '+ABCE/simple/datafile/group_1.282.997539437' to '/u01/app/oracle/oradata/simple/group_1.282.997539437'; alter database rename file '+ABCE/simple/datafile/group_4.272.997539667' to '/u01/app/oracle/oradata/simple/group_4.272.997539667'; alter database rename file '+ABCE/simple/datafile/group_5.273.557540335' to '/u01/app/oracle/oradata/simple/group_5.273.557540335'; alter database rename file '+ABCE/simple/datafile/group_6.274.557535155' to '/u01/app/oracle/oradata/simple/group_6.274.557535155'; alter database rename file '+ABCE/simple/datafile/group_7.367.557535353' to '/u01/app/oracle/oradata/simple/group_7.367.557535353'; alter database rename file '+ABCE/simple/datafile/group_8.368.557535405' to '/u01/app/oracle/oradata/simple/group_8.368.557535405';
3.执行recover操作
run{ allocate channel ch01 type 'sbt_tape'; SEND 'NB_ORA_SERV=nbubak,NB_ORA_CLIENT=abce1'; recover database until scn 8500716647; release channel ch01; }
最后,记得修改一下临时文件。
SQL> create temporary tablespace temp2 tempfile '/u01/app/oracle/oradata/simple/temp02.dbf' size 200M autoextend off; SQL> alter database default temporary tablespace temp2; SQL> drop tablespace temp; 或者 SQL> drop tablespace temp including contents and datafiles cascade constraints(彻底删除包括操作系统中的临时表空间的数据文件)