- 最后登录
- 2023-8-16
- 在线时间
- 1686 小时
- 威望
- 2135
- 金钱
- 50532
- 注册时间
- 2011-10-12
- 阅读权限
- 200
- 帖子
- 5207
- 精华
- 39
- 积分
- 2135
- UID
- 2
|
2#
发表于 2012-5-4 22:47:55
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP on;
using target database control file instead of recovery catalog
old RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored
RMAN> backup spfile;
Starting backup at 04-MAY-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=142 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 04-MAY-12
channel ORA_DISK_1: finished piece 1 at 04-MAY-12
piece handle=/s01/orabase/fast_recovery_area/G11R23/backupset/2012_05_04/o1_mf_nnsnf_TAG20120504T152207_7t8c321b_.bkp tag=TAG20120504T152207 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 04-MAY-12
Starting Control File and SPFILE Autobackup at 04-MAY-12
piece handle=/s01/orabase/fast_recovery_area/G11R23/autobackup/2012_05_04/o1_mf_s_782407330_7t8c32ng_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 04-MAY-12
SQL> select dbid from v$database;
DBID
----------
2935193447
SQL> show parameter control
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time integer 7
control_files string /s01/orabase/oradata/G11R23/co
ntrol01.ctl, /s01/orabase/fast
_recovery_area/G11R23/control0
2.ctl
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
delete controlfiles
[oracle@nas ~]$ rman target /
Recovery Manager: Release 11.2.0.3.0 - Production on Fri May 4 15:25:06 2012
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database (not started)
RMAN> startup nomount;
Oracle instance started
Total System Global Area 939495424 bytes
Fixed Size 2233960 bytes
Variable Size 708839832 bytes
Database Buffers 222298112 bytes
Redo Buffers 6123520 bytes
RMAN> alter database mount;
using target database control file instead of recovery catalog
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 05/04/2012 15:25:32
ORA-00205: error in identifying control file, check alert log for more info
RMAN> restore controlfile from autobackup;
Starting restore at 04-MAY-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=135 device type=DISK
recovery area destination: /s01/orabase/fast_recovery_area
database name (or database unique name) used for search: G11R23
channel ORA_DISK_1: AUTOBACKUP /s01/orabase/fast_recovery_area/G11R23/autobackup/2012_05_04/o1_mf_s_782407330_7t8c32ng_.bkp found in the recovery area
AUTOBACKUP search with format "%F" not attempted because DBID was not set
channel ORA_DISK_1: restoring control file from AUTOBACKUP /s01/orabase/fast_recovery_area/G11R23/autobackup/2012_05_04/o1_mf_s_782407330_7t8c32ng_.bkp
channel ORA_DISK_1: control file restore from AUTOBACKUP complete
output file name=/s01/orabase/oradata/G11R23/control01.ctl
output file name=/s01/orabase/fast_recovery_area/G11R23/control02.ctl
Finished restore at 04-MAY-12
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/s01/%F';
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/s01/%F';
new RMAN configuration parameters are successfully stored
RMAN> backup spfile;
Starting backup at 04-MAY-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=19 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 04-MAY-12
channel ORA_DISK_1: finished piece 1 at 04-MAY-12
piece handle=/s01/orabase/fast_recovery_area/G11R23/backupset/2012_05_04/o1_mf_nnsnf_TAG20120504T153659_7t8cyw45_.bkp tag=TAG20120504T153659 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 04-MAY-12
Starting Control File and SPFILE Autobackup at 04-MAY-12
piece handle=/s01/c-2935193447-20120504-02 comment=NONE
Finished Control File and SPFILE Autobackup at 04-MAY-12
SQL> shutdown immediate;
delete controlfiles
RMAN> alter database mount;
using target database control file instead of recovery catalog
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 05/04/2012 15:39:08
ORA-00205: error in identifying control file, check alert log for more info
RMAN> RUN
2> {
3> SET CONTROLFILE AUTOBACKUP FORMAT
4> FOR DEVICE TYPE DISK TO '/s01/%F';
5> RESTORE CONTROLFILE FROM AUTOBACKUP;
6> }
executing command: SET CONTROLFILE AUTOBACKUP FORMAT
Starting restore at 04-MAY-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=135 device type=DISK
recovery area destination: /s01/orabase/fast_recovery_area
database name (or database unique name) used for search: G11R23
channel ORA_DISK_1: AUTOBACKUP /s01/orabase/fast_recovery_area/G11R23/autobackup/2012_05_04/o1_mf_s_782407330_7t8c32ng_.bkp found in the recovery area
AUTOBACKUP search with format "/s01/%F" not attempted because DBID was not set
channel ORA_DISK_1: restoring control file from AUTOBACKUP /s01/orabase/fast_recovery_area/G11R23/autobackup/2012_05_04/o1_mf_s_782407330_7t8c32ng_.bkp
channel ORA_DISK_1: control file restore from AUTOBACKUP complete
output file name=/s01/orabase/oradata/G11R23/control01.ctl
output file name=/s01/orabase/fast_recovery_area/G11R23/control02.ctl
Finished restore at 04-MAY-12
[oracle@nas ~]$ rm /s01/orabase/oradata/G11R23/control01.ctl
[oracle@nas ~]$ rm /s01/orabase/fast_recovery_area/G11R23/control02.ctl
[oracle@nas ~]$ rm -rf /s01/orabase/fast_recovery_area/G11R23/autobackup/
RMAN> RUN
2> {
3> SET CONTROLFILE AUTOBACKUP FORMAT
4> FOR DEVICE TYPE DISK TO '/s01/%F';
5> RESTORE CONTROLFILE FROM AUTOBACKUP;
6> }
executing command: SET CONTROLFILE AUTOBACKUP FORMAT
Starting restore at 04-MAY-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=125 device type=DISK
recovery area destination: /s01/orabase/fast_recovery_area
database name (or database unique name) used for search: G11R23
channel ORA_DISK_1: no AUTOBACKUPS found in the recovery area
AUTOBACKUP search with format "/s01/%F" not attempted because DBID was not set
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 05/04/2012 15:42:04
RMAN-06172: no AUTOBACKUP found or specified handle is not a valid copy or piece
[oracle@nas ~]$ ls -l /s01/c-2935193447-20120504-02
-rw-r----- 1 oracle oinstall 9863168 May 4 15:37 /s01/c-2935193447-20120504-02
RMAN> set dbid 2935193447
executing command: SET DBID
RMAN> RUN
2> {
3> SET CONTROLFILE AUTOBACKUP FORMAT
4> FOR DEVICE TYPE DISK TO '/s01/%F';
5> RESTORE CONTROLFILE FROM AUTOBACKUP;
6> }
executing command: SET CONTROLFILE AUTOBACKUP FORMAT
Starting restore at 04-MAY-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=135 device type=DISK
recovery area destination: /s01/orabase/fast_recovery_area
database name (or database unique name) used for search: G11R23
channel ORA_DISK_1: no AUTOBACKUPS found in the recovery area
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20120504
channel ORA_DISK_1: AUTOBACKUP found: /s01/c-2935193447-20120504-02
channel ORA_DISK_1: restoring control file from AUTOBACKUP /s01/c-2935193447-20120504-02
channel ORA_DISK_1: control file restore from AUTOBACKUP complete
output file name=/s01/orabase/oradata/G11R23/control01.ctl
output file name=/s01/orabase/fast_recovery_area/G11R23/control02.ctl
Finished restore at 04-MAY-12
结论 : rman restore controlfile from autobackup 会优先采用fast_recovery_area中的autobackup 自动备份 ,
当dbid未被设置时 会提示 "AUTOBACKUP search with format "/s01/%F" not attempted because DBID was not set" , 通过 相对 唯一的DB_UNIQUE_NAME 来定位controlfile autoback (database name (or database unique name) used for search: G11R23),若找到则直接使用:
channel ORA_DISK_1: AUTOBACKUP /s01/orabase/fast_recovery_area/G11R23/autobackup/2012_05_04/o1_mf_s_782407330_7t8c32ng_.bkp found in the recovery area
当fast_recovery_area 中没有可用的备份时, rman才考虑CONTROLFILE AUTOBACKUP FORMAT 指定的位置, 若此时没有设置DBID 则会报错 ,
若此时指定 DBID 则会按照DBID去搜索:
recovery area destination: /s01/orabase/fast_recovery_area
database name (or database unique name) used for search: G11R23
channel ORA_DISK_1: no AUTOBACKUPS found in the recovery area
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20120504
channel ORA_DISK_1: AUTOBACKUP found: /s01/c-2935193447-20120504-02
channel ORA_DISK_1: restoring control file from AUTOBACKUP /s01/c-2935193447-20120504-02
channel ORA_DISK_1: control file restore from AUTOBACKUP complete |
|