cle/product/10G_single/dbs/c-539593454-20110413-00,稍后就利用这个备份进行恢复。
(2)进行了一堆操作和日志切换:
- SQL> alter system switch logfile;
-
- System altered.
-
- SQL> create table a as select * from tabs;
-
- Table created.
-
- SQL> alter system switch logfile;
-
- System altered.
-
- SQL> create table b as select * from a;
-
- Table created.
-
- SQL> alter system switch logfile;
当前的日志序列:
- SQL> select sequence# from v$log;
-
- SEQUENCE#
- ----------
- 24
- 22
- 23
(3)关闭数据库,模拟故障:
- SQL> shutdown abort;
- ORACLE instance shut down
删除控制文件。
(4)启动数据库,因为没有控制文件,所以只能打开到nomount状态,这也是恢复所必须的状态:
- SQL> startup
- ORACLE instance started.
-
- Total System Global Area 3221225472 bytes
- Fixed Size 2024200 bytes
- Variable Size 637537528 bytes
- Database Buffers 2566914048 bytes
- Redo Buffers 14749696 bytes
- ORA-00205: error in identifying control file,
check alert log for more info
(5)恢复控制文件:
- [oracle@dbs cindytest]$ rman target /
-
- Recovery Manager: Release 10.2.0.1.0 - Production
on Wed Apr 13 11:38:56 2011
-
- Copyright (c) 1982, 2005, Oracle. All rights reserved.
-
- connected to target database: ctest (not mounted)
-
- RMAN> restore controlfile from '/oracle/product/
10G_single/dbs/c-539593454-20110413-00';
-
- Starting restore at 13-APR-11
- using target database control file instead of recovery catalog
- allocated channel: ORA_DISK_1
- channel ORA_DISK_1: sid=2486 devtype=DISK
-
- channel ORA_DISK_1: restoring control file
- channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
- output filename=/zxm/cindytest/control01.ctl
- Finished restore at 13-APR-11
把数据库打开到mount状态:
- SQL> select status from v$instance;
-
- STATUS
- ------------
- STARTED
-
- SQL> alter database mount;
-
- Database altered.
-
- SQL> select sequence# from v$log;
-
- SEQUENCE#
- ----------
- 21
- 20
- 19 David备注:v$log是从control file中提取的,备份时control file中的redo log序号最大还在21,备份后又做了三次log switch,因此上面查到的是22-24,这里查到的是19-21.
(6)恢复数据库,如果不用using子句,rman会提示:
- SQL> recover database;
- ORA-00283: recovery session canceled due to errors
- ORA-01610: recovery using the BACKUP
CONTROLFILE option must be done
-
- SQL> recover database using backup controlfile;
- ORA-00279: change 76850708247 generated at
04/13/2011 09:52:40 needed for
- thread 1
- ORA-00289: suggestion : /zxm/cindytest/arch/1_21_747160176.dbf
- ORA-00280: change 76850708247 for thread 1 is in sequence #21
-
-
- Specify log: {=suggested | filename | AUTO | CANCEL}
-
- ORA-00279: change 76850708257 generated at
04/13/2011 11:35:48 needed for
- thread 1
- ORA-00289: suggestion : /zxm/cindytest/arch/
1_22_747160176.dbf
- ORA-00280: change 76850708257 for thread 1
is in sequence #22
- ORA-00278: log file '/zxm/cindytest/arch/1_2
1_747160176.dbf' no longer needed
- for this recovery
-
-
- Specify log: {=suggested | filename | AUTO | CANCEL}
-
- ORA-00279: change 76850708305 generated at 04/
13/2011 11:36:01 needed for
- thread 1
- ORA-00289: suggestion : /zxm/cindytest/arch/1_23_747160176.dbf
- ORA-00280: change 76850708305 for thread 1 is in sequence #23
- ORA-00278: log file '/zxm/cindytest/arch/1_22_
747160176.dbf' no longer needed
- for this recovery
-
-
- Specify log: {=suggested | filename | AUTO | CANCEL}
-
- ORA-00279: change 76850708336 generated at
04/13/2011 11:36:21 needed for
- thread 1
- ORA-00289: suggestion : /zxm/cindytest/arch/1_24_747160176.dbf
- ORA-00280: change 76850708336 for thread 1 is in sequence #24
- ORA-00278: log file '/zxm/cindytest/arch/1_23_
747160176.dbf