欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

记一次坑爹的ORA-01152&ORA-01110错误

程序员文章站 2022-10-18 20:31:03
最近做RMAN还原时遇到了一次非常坑爹的ORA-01152&ORA-01110错误。遇到的具体错误信息如下所示: RMAN> alter database open resetlogs; RMAN-00571: ============================================... ......

最近做RMAN还原时遇到了一次非常坑爹的ORA-01152&ORA-01110错误。遇到的具体错误信息如下所示:

 

RMAN> alter database open resetlogs;

 

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

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

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

RMAN-03002: failure of alter db command at 11/08/2017 18:56:25

ORA-01152: file 1 was not restored from a sufficiently old backup

ORA-01110: data file 1: '/u01/oradata/SCM2/system01.dbf          '

 

 

 

刚开始不清楚为什么出现这个错误,各种折腾都没有彻底解决。后面仔细检查自己的脚本时,然来是自己的粗心把自己坑了,泪流满面啊!!

 

run {

sql'alter session set nls_date_format="yyyy-mm-dd hh24:mi:ss"';

set until time '2017-11-08 03:30:00';

set newname for datafile   1 to "/u01/oradata/SCM2/system01.dbf          "; 

set newname for datafile   2 to "/u01/oradata/SCM2/undotbs01.dbf         ";

set newname for datafile   3 to "/u04/oradata/SCM2/undotbs02.dbf         ";

set newname for datafile   4 to "/u01/oradata/SCM2/sysaux01.dbf          ";

set newname for datafile   5 to "/u01/oradata/SCM2/users01.dbf           ";

…………………………………………………………………………………………………

…………………………………………………………………………………………………………

restore database;

switch datafile all;

restore database;

}

 

注意上面红色部分,本来应该是recover database命令,结果由于粗心弄成了restore database,而且由于上面命令一大串,一直没有关注命令细节。老是在纠结出错信息。真是坑爹,粗心害死人!