真实案例:Oracle数据库恢复ORA-01861问题


Oracle 数据库WEBDB 在新的服务器环境进行备份的异地恢复测试,在执行到还原数据文件时出现“ORA-01861: literal does not match format string ”的错误。

该错误不是NLS_DATE_FORMAT 参数设置不正确导致的,而是一个Oracle bug 导致的。在该错误的解决过程中,我们没有采用官方推荐的重建控制文件的解决方法,而是使用自己的解决方法,将老备份集完全删除再注册进新备份集。

生产数据库是10.2.0.3  ,RAC 集群,ASM 存储,测试数据库为单实例,文件系统存储。

这个bug 不会影响到生产库的正常的备份和恢复操作。

1.  问题

在还原数据文件时,出现ORA-01861 错误,文件无法还原,导致备份恢复工作停止。

整个还原过程操作如下:

1 、在sqlplus 中启动实例到nomount 状态;

2 、在rman 中还原控制文件;

restore controlfile from ‘/backup/ctl.xxx’;

3 、启动实例到mounted 状态

sql ‘alter database mount’;

4 、注册备份集

catalog start with ‘/backup/’;

因为生产库的备份集所在目录和测试库的备份集所在目录不一样,所以使用catalog 将新位置注册进控制文件中。

5 、还原所有数据文件,并重命名。

这里测试还原第一个数据文件,文件位置从ASM 修改文件系统目录。

run
{
allocate channel ch01 type disk;
set until time "to_date('2012-06-25 23:00:00','yyyy-mm-dd hh24:mi:ss')";

set newname for datafile 1 to '/stor2T/app/oracle/oradata/WEBDB/system01.dbf';
restore datafile 1;
switch datafile all;
release channel ch01;
}


在这一步操作时,出现如下错误:


RMAN-03002: failure of restore command at 06/27/2012 16:09:51

ORA-01861: literal does not match format string

 


备份恢复测试工作因此而中止。

从错误信息看,这个应该是NLS_DATE_FORMAT 的格式设置的不对,set until time 的格式有问题。

于是,我们换成set until scn 进行数据文件的还原,还原操作的脚步如下是这样。

run
{
allocate channel ch01 type disk;
set until scn 3054150330;

set newname for datafile 1 to '/stor2T/app/oracle/oradata/WEBDB/system01.dbf';
restore datafile 1;
switch datafile all;
release channel ch01;
}

 


但是,还是报ORA-01861 错误。

甚至执行列出所有备份集时都出现这个错误。


RMAN> list backupset summary;

 

using target database control file instead of recovery catalog

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of list command at 06/27/2012 16:29:18

ORA-01861: literal does not match format string

从这个现象看,这个问题已经不是一个参数设置不正确那么简单了。

  • 1
  • 2
  • 3
  • 4
  • 5
  • 下一页

相关内容