在用rman备份的时候建议开启自动备份控制文件,可以在丢失catalog库的情况下直接从自动备份集恢复数据库
CONFIGURE CONTROLFILE AUTOBACKUP ON;
恢复时只要RMAN> restore controlfile from autobackup;
以下测试主要是关于自动备份文件的命名问题
默认的命名是
win:database\%F
unix:dbs/%F
%F :一个基于DBID唯一的名称,这个格式形式为C-X-YYYYMMDD-QQ
X为DBID,QQ是1-256的序列
测试一:修改备份路径d:\%F_%U,在备份的时候报错,可能是因为文件名过长
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'd:\%F_%U';
old RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'd:\%F_%T_%s';
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'd:\%F_%U';
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete
RMAN> RUN
2> {ALLOCATE CHANNEL D1 TYPE DISK;
3> BACKUP tablespace system
4> FORMAT 'D:\RMANBK\system_%d_%s_%u';
5> RELEASE CHANNEL D1;
6> }
allocated channel: D1
channel D1: sid=10 devtype=DISK
Starting backup at 02-JUL-10
channel D1: starting full datafile backupset
channel D1: specifying datafile(s) in backupset
input datafile fno=00001 name=D:\ORACLE\ORADATA\FOX\SYSTEM01.DBF
channel D1: starting piece 1 at 02-JUL-10
channel D1: finished piece 1 at 02-JUL-10
piece handle=D:\RMANBK\SYSTEM_FOX_23_0NLHPN1L comment=NONE
channel D1: backup set complete, elapsed time: 00:00:15
Finished backup at 02-JUL-10
Starting Control File and SPFILE Autobackup at 02-JUL-10
released channel: D1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of Control File and SPFILE Autobackup command on D1 channel at 07/02/2010 15:54:45
ORA-19715: invalid format for piece name
测试二:修改备份路径d:\%F_1_1_1,备份正常通过
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'd:\%F_1_1_1';
old RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'd:\%F_%U';
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'd:\%F_1_1_1';
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete
RMAN> RUN
2> {ALLOCATE CHANNEL D1 TYPE DISK;
3> BACKUP tablespace system
4> FORMAT 'D:\RMANBK\system_%d_%s_%u';
5> RELEASE CHANNEL D1;
6> }
allocated channel: D1
channel D1: sid=10 devtype=DISK
Starting backup at 02-JUL-10
channel D1: starting full datafile backupset
channel D1: specifying datafile(s) in backupset
input datafile fno=00001 name=D:\ORACLE\ORADATA\FOX\SYSTEM01.DBF
channel D1: starting piece 1 at 02-JUL-10
channel D1: finished piece 1 at 02-JUL-10
piece handle=D:\RMANBK\SYSTEM_FOX_25_0PLHPNGQ comment=NONE
channel D1: backup set complete, elapsed time: 00:00:15
Finished backup at 02-JUL-10
Starting Control File and SPFILE Autobackup at 02-JUL-10
piece handle=D:\C-904273405-20100702-08_1_1_1 comment=NONE
Finished Control File and SPFILE Autobackup at 02-JUL-10
released channel: D1
接着关闭数据库,将控制文件和其它数据文件移除原有目录,启动到nomount状态
直接登陆rman(不需要连数据库或者catalog)
C:\Documents and Settings\linjing>rman
Recovery Manager: Release 9.2.0.1.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
RMAN> set dbid=904273405
executing command: SET DBID
RMAN> connect target /
connected to target database: (not mounted)
RMAN> restore controlfile from autobackup
2> ;
Starting restore at 02-JUL-10
using target database controlfile instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=10 devtype=DISK
channel ORA_DISK_1: looking for autobackup on day: 20100702
channel ORA_DISK_1: looking for autobackup on day: 20100701
channel ORA_DISK_1: looking for autobackup on day: 20100630
channel ORA_DISK_1: looking for autobackup on day: 20100629
channel ORA_DISK_1: looking for autobackup on day: 20100628
channel ORA_DISK_1: looking for autobackup on day: 20100627
channel ORA_DISK_1: looking for autobackup on day: 20100626
channel ORA_DISK_1: no autobackup in 7 days found
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 07/02/2010 16:16:20
RMAN-06172: no autobackup found or specified handle is not a valid copy or piece
修改了默认自动备份的路径后,由于没有登陆到catalog库,oracle无法找到相应的备份集
将文件拷贝到默认路径,文件名暂时不修改,重新执行restore,发现oracle还是无法识别
RMAN> restore controlfile from autobackup;
Starting restore at 02-JUL-10
using channel ORA_DISK_1
channel ORA_DISK_1: looking for autobackup on day: 20100702
channel ORA_DISK_1: looking for autobackup on day: 20100701
channel ORA_DISK_1: looking for autobackup on day: 20100630
channel ORA_DISK_1: looking for autobackup on day: 20100629
channel ORA_DISK_1: looking for autobackup on day: 20100628
channel ORA_DISK_1: looking for autobackup on day: 20100627
channel ORA_DISK_1: looking for autobackup on day: 20100626
channel ORA_DISK_1: no autobackup in 7 days found
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 07/02/2010 16:17:47
RMAN-06172: no autobackup found or specified handle is not a valid copy or piece
将文件命名后缀的_1_1_1去掉,保留%F的格式,再次restore,oracle成功找到了备份文件,并且执行了控制文件的恢复
RMAN> restore controlfile from autobackup;
Starting restore at 02-JUL-10
using channel ORA_DISK_1
channel ORA_DISK_1: looking for autobackup on day: 20100702
channel ORA_DISK_1: autobackup found: c-904273405-20100702-08
channel ORA_DISK_1: controlfile restore from autobackup complete
replicating controlfile
input filename=D:\ORACLE\ORADATA\FOX\CONTROL01.CTL
output filename=D:\ORACLE\ORADATA\FOX\CONTROL02.CTL
output filename=D:\ORACLE\ORADATA\FOX\CONTROL03.CTL
Finished restore at 02-JUL-10
另:自动控制文件备份在执行全库的磁带备份的时候不会生效
阅读(3679) | 评论(0) | 转发(0) |