- 论坛徽章:
- 0
|
确定 contolfile 是否自动备份
SQL> select * from v$rman_configuration;
CONF# NAME VALUE
---------- ------------------------- ----------
1 CONTROLFILE AUTOBACKUP ON
恢复的3个步骤
1. nomount状态。恢复spfile,然后shutdown,用spfile启动到nomount状态.
2. noumount状态。恢复controlfile.然后alter database mount.
3. mount状态,恢复数据库文件。然后alter database open resetlogs;
分三步:
1. 取得NBU for controlfile的备份记录
2. 使用sqlplus通过执行procedure恢复controlfile,并将此controlfile拷贝到pfile中指定的位置
3. controlfile恢复完成后,进行database的恢复
另,你所说的restore controlfile和restore spfile只有在“CONFIGURE CONTROLFILE AUTOBACKUP ON(默认OFF)”时才起作用
devtype:=dbms_backup_restore.deviceallocate('sbt_tape',params=>'ENV=(NB_ORA_CLIENT=xxxxxx)');
# bplist -C <clientname> -S <servername> -t 4 -R /
/cntrl_55_1_577644786 #取得备份controlfile的记录
/al_54_1_577644729
/bk_53_1_577644310
/bk_52_1_577643697
sql$ sqlplus /nolog
SQL*Plus: Release 8.1.6.0.0 - Production on Wed Dec 21 17:53:52 2005
(c) Copyright 1999 Oracle Corporation. All rights reserved.
SQL> conn /as sysdba
Connected to an idle instance.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 109879012 bytes
Fixed Size 69348 bytes
Variable Size 76083200 bytes
Database Buffers 33554432 bytes
Redo Buffers 172032 bytes
SQL> declare
2 devtyp varchar2(256);
3 done boolean;
4 begin
5 devtyp:=dbms_backup_restore.deviceallocate('sbt_tape',params=>'ENV=(NB_ORA_CLIENT=obms1-ocn-shanghai-cn)');
6 dbms_backup_restore.restoresetdatafile;
7 dbms_backup_restore.restorecontrolfileto('/tmp/bmsrptcon/abc.cf');
8 dbms_backup_restore.restorebackuppiece('cntrl_470_1_645517212',done=>done);
9 end;
10 /
PL/SQL procedure successfully completed.
SQL> host
$ ls -l /tmp/abc.cf
-rw-r----- 1 oracle dba 4218880 Dec 21 17:56 /tmp/abc.cf
$ cp /tmp/bmsrptcon/abc.cf /oradata/BMSRPT/control01.ctl #之所以copy到/oracle/oradata/orapp/control0x.ctl是由于这是在pfile中定义的
$ cp /tmp/bmsrptcon/abc.cf /oradata2/BMSRPT/control02.ctl
$ exit
SQL> alter database mount;
Database altered.
$ rman nocatalog target /
Recovery Manager: Release 8.1.6.0.0 - Production |
|