控制文件的默认备份格式是:
c-IIIIIIIIII-YYYYMMDD-QQ
其中:
c:表示控制文件
IIIIIIIIII:表示DBID
YYYYMMDD:备份的时间戳
QQ:16进制的序列号,从00开始,最大值为FF
使用了fast recovery area或recovery catalog
1.从自动备份中还原控制文件
RMAN> restore controlfile from autobackup;
2.从指定备份片中还原控制文件
RMAN> restore controlfile from ‘/tmp/piece_name‘;
3.从最近可用的控制文件备份中还原控制文件
RMAN> restore controlfile;
如果没有使用fast recovery area或recovery catalog,在还原控制文件前,要先设置dbid
4.使用$ORACLE_HOME/dbs中默认的备份
RMAN> set dbid=xxxxxxxx;
RMAN> restore controlfile from autobackup;
5.默认是从最近7天的默认备份中恢复,也可以指定天数
RMAN> set dbid=xxxxxxxx;
RMAN> restore controlfile from autobackup maxdays 20;
6.根据自动备份的序列进行还原
RMAN> set dbid=xxxxxxxx;
RMAN> restore controlfile from autobackup maxseq 20;
7.从非默认备份路径环境
RMAN> set dbid=xxxxxxxx;
RMAN> set controlfile autobackup format for device type disk to ‘/tmp/%F‘;
RMAN> restore controlfile from autobackup;
8.从指定别分进行还原
RMAN> set dbid=xxxxxxxxx;
RMAN> restore controlfile from ‘/tmp/c-1140771490-20080502-03‘;
9.将控制文件先还原到一个临时目录,再用duplicate命令根据参数control_files还原到指定位置和名称
RMAN> set dbid=xxxxxxxxx;
RMAN> restore controlfile from ‘/tmp/c-1140771490-2008050203‘ to ‘/tmp/control.tmp‘;
RMAN> replicate controlfile from ‘/tmp/control.tmp‘;
10.根据时间点进行还原
RMAN> restore controlfile from autobackup until time "to_date(‘Jan 23 2009 14:00:00‘, ‘MON DD YYYY HH24:MI:SS‘ )";