目的:客户环境11.2.0.4 ,多节点RAC环境,现在使用带库的备份,在单机环境测试备份有效性
RMAN异机恢复流程如下!!!
1.normal参数文件
删除集群相关参数cluster
2.mount 使用备份的控制文件进行还原
3.restore database,recover database 到预想的位置(建议recover时间,低于控制文件中记录归档日志的前30分钟或者前15分钟)
各位老铁门,为了不耽误大家时间,文档前面进行备注说明:
1.本次问题是resetlog open 打开DB报错
ERROR at line 1:
ORA-00392: log 1 of thread 1 is being cleared, operation not allowed
ORA-00312: online log 1 thread 1: '/<PATH>/group_1.log'
2.处理流程
1) 根据现有的控制文件,trace一份到指定文件;
2)编辑新的控制文件脚本,使用resetlogs 方式!!!有小伙伴遇到noresetlogs 不好使。
并且删除原来的+DATA等磁盘组的日志信息,添加为文件系统的日志信息。
3)使用编辑好的控制文件启动到MOUNT状态;
4)创建其它线程的REDO,RAC 2线程,及再创建thread 2 redo即可;
5) resetlog open
6)disable ,drop 不需要的线程2的redo
如下是RMAN恢复脚本
run{ allocate channel c1 device type 'sbt_type' PARMS="ENV=(MASTER_SERVER_IP=XXX,INSTANCE_NAME=oraxxx,BACKUP_CLIENT=TTXXX,RESTORE_CLIENT=RecoveryFxxxx)"; set newname for database to '/u01/xxx/%b‘; sql 'alter session set NLS_DATE_FORMAT="yyyy-mm-dd hh24:mi:ss"'; sql 'alter session set NLS_LANGUAGE=American'; set until time '2019-xx-xx 18:00:00'; restore database; SWITCH DATAFILE ALL; recover database; } --参考http://blog.itpub.net/30126024/viewspace-2142843/ SET NEWNAME FOR DATAFILE 1 to '/oracle/ora11g/oradata/system01.dbf'; SET NEWNAME FOR TEMPFILE 1 to '/oracle/ora11g/oradata/temp01.dbf'; RESTORE DATABASE; SWITCH DATAFILE ALL; SWITCH TEMPFILE ALL;
4.resetlogs open DB,客户再此处遇到问题
ALTER DATABASE OPEN RESETLOGS fails with ORA-00392 (Doc ID 1352133.1)
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-00392: log 1 of thread 1 is being cleared, operation not allowed
ORA-00312: online log 1 thread 1: '/<PATH>/group_1.log'
ORA-00312: online log 1 thread 1: '/<PATH>/group_12.log'
SQL> select GROUP#,THREAD#,SEQUENCE#,MEMBERS,ARCHIVED,STATUS,FIRST_CHANGE# from v$log order by first_change# ;
GROUP# THREAD# SEQUENCE# MEMBERS ARCHIVED STATUS FIRST_CHANGE#
------------- ----------- ----------- -------------- ---------- ---------------- -------------------
2 1 0 2 YES CLEARING 12142264718335
3 1 0 2 YES CLEARING 12142306351551
1 1 0 2 NO CLEARING_CURRENT 12142306351562
3 rows selected.
如下CLEARING_CURRENT解释说明
Failure of CLEAR LOGFILE Operation
The ALTER DATABASE CLEAR LOGFILE statement can fail with an I/O error due to
media failure when it is not possible to:
* Relocate the redo log file onto alternative media by re-creating it under
the currently configured redo log filename
* Reuse the currently configured log filename to re-create the redo log file
because the name itself is invalid or unusable (for example, due to media failure)
In these cases, the ALTER DATABASE CLEAR LOGFILE statement (before receiving the I/O error) would
have successfully informed the control file that the log was being cleared and did not require archiving.
The I/O error occurred at the step in which the CLEAR LOGFILE statement attempts to create the new
redo log file and write zeros to it. This fact is reflected in V$LOG.CLEARING_CURRENT.
操作报错,重置redo报错,由于redo均为+DATA磁盘组,而实际上单实例环境为文件系统,无法重置
alter database clear unarchived logfile group 3 ;
alter database open resetlogs;
SQL> ALTER DATABASE BACKUP CONTROLFILE TO TRACE AS '/tmp/control.sql' resetlogs ;
SQL> STARTUP FORCE NOMOUNT
SQL> @/tmp/control.sql
SQL> ALTER DATABASE OPEN RESETLOGS ;
上述是按照MOS文档的预期值,可以解决问题,如下是博客链接,可以根据如下进行修改控制文件。
http://blog.itpub.net/30126024/viewspace-2144906/
MOS文档写的过于简单,只是说修改控制文件,根据上述博客链接,可分为几个步骤
1.备份控制文件,生成trace,默认控制文件二进制无法读取
2.删除关于控制文件中,对于redo的信息,修改调整为
LOGFILE ······
GROUP 1 (
'/oracle/ora11g/oradata/redo01.log'
) SIZE 50M BLOCKSIZE 512,
GROUP 2 (
'/oracle/ora11g/oradata/redo02.log'
) SIZE 50M BLOCKSIZE 512,
DATAFILE ······
3.shutdown abort DB,使用新编辑的控制文件,启动到mount状态
4.创建其它线程的redo,存在多线程redo,则创建多个thread redo信息
ALTER DATABASE ADD LOGFILE THREAD 2
GROUP 3 '/oracle/ora11g/oradata/redo03.dbf' SIZE 50M,GROUP 4 '/oracle/ora11g/oradata/redo04.dbf' SIZE 50M;
5.启动DB
ALTER DATABASE OPEN RESETLOGS;
6.单机删除多余的thread 2的在线日志
alter database disable thread 2;
alter database drop logfile group 3;
备注:如下是客户并未添加其它线程redo,直接open resetlogs出现如下报错
上述根据博客链接的说明,可以解决问题,另一种方法,则是通过设置隐患参数,强制OPEN,均可以,具体实施看需求。
RMAN Duplicate from RAC backup fails ORA-38856 (Doc ID 334899.1)
RMAN duplicate using a backup taken from a RAC installation fails on opening the clone instance with RMAN-06136: ORACLE error from auxiliary database: ORA-38856: cannot mark instance UNNAMED_INSTANCE_2 (redo thread 2) as enabled The target database is a RAC two node database being duplicated to a single instance database.
_no_recovery_through_resetlogs=TRUE