分类: 服务器与存储
2011-01-04 10:00:56
环境 oracle10104, windows 2000
测试的数据库是由9207升级到10104得来的。
在贴子 http://www.itpub.net/showthread.php?s=&postid=6035979#post6035979
里有网友询问,在该贴子里我为什么不使用
restore controlfile from autobackup;
命令来恢复控制文件?当时我主要是考虑到控制文件的快照在那,能恢复即可。
未考虑到要要用该命令来恢复控制文件。既然他问了,我要尝试一下以该命令来
恢复。我来到另外一台机器上,使用该机器上的RMAN(9205)来做测试,
1、先rman 登录,查看一下当时我本机的rman 配置
RMAN> show all;
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'H:rmanbackspctl2894056775_%F
TL';
CONFIGURE DEVICE TYPE DISK PARALLELISM 1; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'F:ORACLEDATABASESNCFPSI2.ORA'; # default
2、退出rman, 关闭,startup nomount 数据库。
3、
d:oraclebin>rman target nocatalog -- 连接到我机器上。
Recovery Manager: Release 9.2.0.5.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
connected to target database: MARKET2 (not mounted) -- 没有mount上机器
using target database controlfile instead of recovery catalog
RMAN> set dbid=2894056775;
executing command: SET DBID
RMAN> restore controlfile from autobackup;
Starting restore at 2006-11-23 18:31:48
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=161 devtype=DISK
channel ORA_DISK_1: looking for autobackup on day: 20061123
channel ORA_DISK_1: looking for autobackup on day: 20061122
channel ORA_DISK_1: looking for autobackup on day: 20061121
channel ORA_DISK_1: looking for autobackup on day: 20061120
channel ORA_DISK_1: looking for autobackup on day: 20061119
channel ORA_DISK_1: looking for autobackup on day: 20061118
channel ORA_DISK_1: looking for autobackup on day: 20061117
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 11/23/2006 18:31:54
RMAN-06172: no autobackup found or specified handle is not a valid copy or piece
到此,发现该命令无论如何也找不到控制文件的备份:H:rmanbackspctl2894056775_C-2894056775-20061123-01.CTL。
很纳闷,于是用rman 的 debug 选项去跟踪,发现跟踪文件里,有许多类似的信息
DBGMISC: Input: argc=3 (krmzgaut)
DBGMISC: Parameters, aut_seq: 250, aut_date: 20061123 (krmzgaut)
DBGMISC: EXITED krmzgaut with status 1 on [11/23/2006 23:28:18]
DBGRPC: krmxrpc: xc=18754888 kpurpc2 rc=0 db=target proc=DBMS_BACKUP_RESTORE.GENPIECENAME
DBGRPC: krmxrpc: xc=18754888 RPC #16 completed immediately
DBGPLSQL: channel ORA_DISK_1: Channel ORA_DISK_1 looking for day: 20061123 sequence 250handle: c-2894056775-20061123-fa (raut_search)
DBGRPC: krmxrpc: xc=18754888 kpurpc2 rc=0 db=target proc=DBMS_BACKUP_RESTORE.VALIDATEBACKUPPIECE
DBGRPC: krmxrpc: xc=18754888 RPC #17 completed immediately
DBGMISC: ENTERED krmzgaut on [11/23/2006 23:28:18]
从上面的信息上看,似乎RMAN正在寻找 c-2894056775-20061123-fa,猛然间醒悟,数据库还未mount, rman 自然无法知道我把控制文件的备份保存在此,它只能按照默认的设置去寻找,此时,当然是在 $ORACLE_HOME/DATABASE 下, 当然,它也不知道我把控制文件的备份名改成了该格式。至此,我把H:rmanbackspctl2894056775_C-2894056775-20061123-01.CTL 改名为c-2894056775-20061123-fa, 并把它保存在 D:oracledatabase 下,再去恢复,此时,
RMAN> restore controlfile from autobackup;
Starting restore at 2006-11-23 23:48:39
using channel ORA_DISK_1
channel ORA_DISK_1: looking for autobackup on day: 20061123
channel ORA_DISK_1: autobackup found: c-2894056775-20061123-e6
channel ORA_DISK_1: controlfile restore from autobackup complete
replicating controlfile
input filename=D:ORACLEORADATAMARKET2CONTROL01.CTL
output filename=D:ORACLEORADATAMARKET2CONTROL02.CTL
output filename=D:ORACLEORADATAMARKET2CONTROL03.CTL
Finished restore at 2006-11-23 23:48:50
说明,要使用restore controlfile from autobackup; 必须
1、CONFIGURE CONTROLFILE AUTOBACKUP ON;
2、CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F';即,保留rman的原始设置,因为在 mount 数据库之前,rman 根本不知道dba 对设置作的任何修改