ITPub博客

首页 > 数据库 > Oracle > Oracle 11g RMAN 异机恢复报错 RMAN-06172、ORA-07202

Oracle 11g RMAN 异机恢复报错 RMAN-06172、ORA-07202

原创 Oracle 作者:feelpurple 时间:2016-02-24 18:03:21 0 删除 编辑
Oracle 11g RMAN 异机恢复,恢复参数文件的时候报错。

RMAN> startup nomount

Oracle instance started

Total System Global Area   17103163392 bytes

Fixed Size                     2245480 bytes
Variable Size               2181041304 bytes
Database Buffers           14898167808 bytes
Redo Buffers                  21708800 bytes

RMAN> RUN
{
  ALLOCATE CHANNEL c1 DEVICE TYPE disk;
  SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/oradata/bk/rman/%F';
  RESTORE SPFILE 
    TO PFILE '/u01/app/oracle/product/11.2.0/db_1/dbs/initaftdb.ora' 
    FROM AUTOBACKUP;
  SHUTDOWN ABORT;
2> 3> 4> 5> 6> 7> 8> 9> }

allocated channel: c1
channel c1: SID=1072 device type=DISK

executing command: SET CONTROLFILE AUTOBACKUP FORMAT

Starting restore at 24-FEB-16

channel c1: looking for AUTOBACKUP on day: 20160224
channel c1: looking for AUTOBACKUP on day: 20160223
channel c1: looking for AUTOBACKUP on day: 20160222
channel c1: looking for AUTOBACKUP on day: 20160221
channel c1: looking for AUTOBACKUP on day: 20160220
channel c1: looking for AUTOBACKUP on day: 20160219
channel c1: looking for AUTOBACKUP on day: 20160218
channel c1: no AUTOBACKUP in 7 days found
released channel: c1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 02/24/2016 15:52:07
RMAN-06172: no AUTOBACKUP found or specified handle is not a valid copy or piece

报错原因:
使用 FROM AUTOBACKUP 语句时,默认会搜索7天内的备份数据,如果我们进行恢复的控制文件超过了这个时间范围,就会报错。

解决办法:
可以在语句上面指定 MAXDAYS 参数,将扩大搜寻的时间范围,最大可以指定366天。

RMAN> RUN
{
  ALLOCATE CHANNEL c1 DEVICE TYPE disk;
  SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/oradata/bk/rman/%F';
  RESTORE SPFILE 
    TO PFILE '/u01/app/oracle/product/11.2.0/db_1/dbs/initaftdb.ora' 
    FROM AUTOBACKUP  MAXDAYS 30;
  SHUT2> 3> 4> 5> 6> 7> 8> DOWN ABORT;
}9> 

allocated channel: c1
channel c1: SID=1072 device type=DISK

executing command: SET CONTROLFILE AUTOBACKUP FORMAT

Starting restore at 24-FEB-16

channel c1: looking for AUTOBACKUP on day: 20160224
channel c1: looking for AUTOBACKUP on day: 20160223
channel c1: looking for AUTOBACKUP on day: 20160222
channel c1: looking for AUTOBACKUP on day: 20160221
channel c1: looking for AUTOBACKUP on day: 20160220
channel c1: looking for AUTOBACKUP on day: 20160219
channel c1: looking for AUTOBACKUP on day: 20160218
channel c1: looking for AUTOBACKUP on day: 20160217
channel c1: AUTOBACKUP found: /oradata/bk/rman/c-1864798816-20160217-00
channel c1: restoring spfile from AUTOBACKUP /oradata/bk/rman/c-1864798816-20160217-00
channel c1: SPFILE restore from AUTOBACKUP complete
Finished restore at 24-FEB-16

Oracle instance shut down

--恢复控制文件的时候报错 ORA-07202

RMAN> RUN 
{
  ALLOCATE CHANNEL c1 DEVICE TYPE disk;
SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/oradata/bk/rman/%F';
  RESTORE CONTROLFILE FROM AUTOBACKUP MAXDAYS 30;
  ALTER DATABASE MOUNT;
}2> 3> 4> 5> 6> 7> 

allocated channel: c1
channel c1: SID=1174 device type=DISK

executing command: SET CONTROLFILE AUTOBACKUP FORMAT

Starting restore at 24-FEB-16

recovery area destination: /oradata/aftdb
database name (or database unique name) used for search: AFTDB
channel c1: no AUTOBACKUPS found in the recovery area
channel c1: looking for AUTOBACKUP on day: 20160224
channel c1: looking for AUTOBACKUP on day: 20160223
channel c1: looking for AUTOBACKUP on day: 20160222
channel c1: looking for AUTOBACKUP on day: 20160221
channel c1: looking for AUTOBACKUP on day: 20160220
channel c1: looking for AUTOBACKUP on day: 20160219
channel c1: looking for AUTOBACKUP on day: 20160218
channel c1: looking for AUTOBACKUP on day: 20160217
channel c1: AUTOBACKUP found: /oradata/bk/rman/c-1864798816-20160217-00
channel c1: restoring control file from AUTOBACKUP /oradata/bk/rman/c-1864798816-20160217-00
released channel: c1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 02/24/2016 17:28:38
ORA-07202: sltln: invalid parameter to sltln.

仔细查看参数文件,发现 db_recovery_file_dest 配置成数据文件的上级目录

*.control_files='/oradata/aftdb/controlfile/control01.ctl','/oradata/aftdb/controlfile/control02.ctl'
*.db_create_file_dest='/oradata/aftdb/data'
*.db_create_online_log_dest_1='/oradata/aftdb/log'
*.db_create_online_log_dest_2='/oradata/aftdb/log'
*.db_recovery_file_dest='/oradata/aftdb/'
*.LOG_ARCHIVE_DEST_1='LOCATION=/oradata/aftdb/arc'

更改如下

*.control_files='/oradata/aftdb/controlfile/control01.ctl','/oradata/aftdb/controlfile/control02.ctl'
*.db_create_file_dest='/oradata/aftdb/data'
*.db_create_online_log_dest_1='/oradata/aftdb/log'
*.db_create_online_log_dest_2='/oradata/aftdb/log'
*.db_recovery_file_dest='/oradata/aftdb/recovery'
*.LOG_ARCHIVE_DEST_1='LOCATION=/oradata/aftdb/arc'

使用新改正后的参数文件重新启动数据库,报错消失,正常恢复控制文件。

RMAN>  RUN 
{
  ALLOCATE CHANNEL c1 DEVICE TYPE disk;
SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/oradata/bk/rman/%F';
  RESTORE CONTROLFILE FROM AUTOBACKUP MAXDAYS 30;
  ALTER DATABASE MOUNT;
}2> 3> 4> 5> 6> 7> 

using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=1174 device type=DISK

executing command: SET CONTROLFILE AUTOBACKUP FORMAT

Starting restore at 25-FEB-16

recovery area destination: /oradata/aftdb/recovery
database name (or database unique name) used for search: AFTDB
channel c1: no AUTOBACKUPS found in the recovery area
channel c1: looking for AUTOBACKUP on day: 20160225
channel c1: looking for AUTOBACKUP on day: 20160224
channel c1: looking for AUTOBACKUP on day: 20160223
channel c1: looking for AUTOBACKUP on day: 20160222
channel c1: looking for AUTOBACKUP on day: 20160221
channel c1: looking for AUTOBACKUP on day: 20160220
channel c1: looking for AUTOBACKUP on day: 20160219
channel c1: looking for AUTOBACKUP on day: 20160218
channel c1: looking for AUTOBACKUP on day: 20160217
channel c1: AUTOBACKUP found: /oradata/bk/rman/c-1864798816-20160217-00
channel c1: restoring control file from AUTOBACKUP /oradata/bk/rman/c-1864798816-20160217-00
channel c1: control file restore from AUTOBACKUP complete
output file name=/oradata/aftdb/controlfile/control01.ctl
output file name=/oradata/aftdb/controlfile/control02.ctl
Finished restore at 25-FEB-16

database mounted
released channel: c1

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26506993/viewspace-1993939/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2014-08-01

  • 博文量
    404
  • 访问量
    1673977