欢迎光临
我们一直在努力

RMAN-06172: no autobackup found or specified handle is not a valid copy or piece - 关系型数据库

有个朋友问我,他想恢复(利用rman备份迁移)数据库(10.2,从aix 到 linux)但控制文件restore失败,报错如下:
询问了下貌似那个人连原数据库结构都不知到,只时拿到了备份文件,就想恢复,哎!

c-IIIIIIIIII-YYYYMMDD-QQ,  包含了DBID、日、月、年、季度
 %I  表示DBID
 %T 表示 YYYYMMDD 
参考:Database Backup and Recovery Reference – formatSpec

在开启autobackup的备份时,控制文件自动备份的格式应保证为默认的 %F,
oracle文档上说:参考: (How RMAN Performs Control File Autobackups)
If you do not use the default format, then during disaster recovery you must specify the format that was used to generate the autobackups. Otherwise, RMAN cannot restore the autobackup.
如果不使用默认格式,那么在恢复过程中有个灾难,必须指定用于生成autobackup的格式。
否则,RMAN无法恢复autobackup。

实际测试:
用下面语句,即使指定了格式为 %T
set controlfile autobackup format for device type disk to ’/home/orabak/control_bak_%T’;   
这个命令是不成功的, 提示不可指定为 %T
估计必须要包含DBID吧

用以下方式还原rman设置中的控制文件备份格式:
CONFIGURE CONTROLFILE AUTOBACKUP FORMATFOR DEVICE TYPE DISK clear;
CONFIGURE CONTROLFILE AUTOBACKUP ON;    #开启自动备份 默认格式 ‘%F’

CONFIGURE CONTROLFILEAUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO ’%F’; # default

附2:

偶到oracle官方文档查找各个版本的restore controlfile条件对比(都是使用autobackup)

10gR2:   no catalog 状态下:
    restore controlfile; 提示必须使用指定from autobackup ,而且restore controlfile from autobackup 必须先set dbid;
    restore controlfile from ’xxx’ ;  也是必须先set dbid
    restore controlfile tag ’xxx’ ;  如果no catalog 模式,会失败找不到tag。

之后的版本11gR2 / 12.1/12.2版本 , no catalog 状态下
  如果跟 restore controlfile from autobackup 需要set dbid 
  但如果 restore controlfile from ’media_handle’; 还是必须指定  set dbid

参考:https://docs.oracle.com/database/121/RCMRF/rcmsynta2008.htm#RCMRF149

恢复的步骤:

  1. RMAN> SET DBID 12345;
  2. RMAN> STARTUP NOMOUNT;
  3. RMAN> RESTORE CONTROLFILE FROM ”/backup/rman/ctl_c-12345-20141003-03”;
  4. RMAN> RESTORE DATABASE;
  5. RMAN> RECOVER DATABASE;
  6. RMAN> ALTER DATABASE OPEN RESETLOGS;

参考:
https://www.thegeekstuff.com/2014/11/oracle-rman-restore

赞(0)
【声明】:本博客不参与任何交易,也非中介,仅记录个人感兴趣的主机测评结果和优惠活动,内容均不作直接、间接、法定、约定的保证。访问本博客请务必遵守有关互联网的相关法律、规定与规则。一旦您访问本博客,即表示您已经知晓并接受了此声明通告。