用的是最新的Oracle10.2.0.3的版本,
在recover database using backup controlfile时会稍有些不同(
自动恢复时不能使用前面的INCARNATION的archive log)
sys@EXAM> select * from v$version;
BANNER
-----------------------------------------------------------
-----------------------------------------------------------
----------
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 -
Prod
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for Linux: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production
sys@EXAM> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 2
Next log sequence to archive 4
Current log sequence 4
sys@EXAM> select group#,status from v$log;
GROUP# STATUS
---------- --------------------------------
1 CURRENT
2 INACTIVE
3 ACTIVE
sys@EXAM>select name from v$datafile;
NAME
------------------------------
/home/new/exam/system01.dbf
/home/new/exam/undotbs01.dbf
/home/new/exam/sysaux01.dbf
/home/new/exam/users01.dbf
/home/new/exam/example01.dbf
sys@EXAM>select * from v$controlfile;
STATUS NAME IS_REC
BLOCK_SIZE FILE_SIZE_BLKS
-------------- ------------------------------ ------
---------- --------------
/home/new/exam/control01.ctl NO
16384 430
/home/new/exam/control02.ctl NO
16384 430
/home/new/exam/control03.ctl NO
16384 430
sys@EXAM>select group#,member from v$logfile;
GROUP#
----------
MEMBER
-----------------------------------------------------------
-----------------------------------------------------------
-------------
3
/home/new/exam/redo03.log
2
/home/new/exam/redo02.log
1
/home/new/exam/redo01.log
1,--start hot backup(开始热备份)
[oracle@localhost ~/labs Mon Sep 19]$ rman target /
Recovery Manager: Release 10.2.0.3.0 - Production on Mon
Sep 19 19:46:25 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: EXAM (DBID=2013372950)
RMAN> show all;
using target database control file instead of recovery
catalog
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 OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE
DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO
BACKUPSET; # 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 ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO
'/home/ora10g/product/10.2.0/dbs/snapcf_exam.f'; # default
RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE
TO compressed BACKUPSET;
new RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO
COMPRESSED BACKUPSET;
new RMAN configuration parameters are successfully stored
RMAN> backup database;
Starting backup at 19-SEP-11
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=190 devtype=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: sid=189 devtype=DISK
channel ORA_DISK_1: starting compressed full datafile
backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/home/new/exam/system01.dbf
input datafile fno=00004 name=/home/new/exam/users01.dbf
channel ORA_DISK_1: starting piece 1 at 19-SEP-11
channel ORA_DISK_2: starting compressed full datafile
backupset
channel ORA_DISK_2: specifying datafile(s) in backupset
input datafile fno=00003 name=/home/new/exam/sysaux01.dbf
input datafile fno=00005 name=/home/new/exam/example01.dbf
input datafile fno=00002 name=/home/new/exam/undotbs01.dbf
channel ORA_DISK_2: starting piece 1 at 19-SEP-11
input datafile fno=00003 name=/home/new/exam/sysaux01.dbf
input datafile fno=00005 name=/home/new/exam/example01.dbf
input datafile fno=00002 name=/home/new/exam/undotbs01.dbf
channel ORA_DISK_2: starting piece 1 at 19-SEP-11
channel ORA_DISK_2: finished piece 1 at 19-SEP-11
piece
handle=/home/new/EXAM/backupset/2011_09_19/o1_mf_nnndf_TAG2
0110919T194704_77gbxtn6_.bkp tag=TAG20110919T194704
comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time:
00:01:57
channel ORA_DISK_2: starting compressed full datafile
backupset
channel ORA_DISK_2: specifying datafile(s) in backupset
including current control file in backupset
channel ORA_DISK_2: starting piece 1 at 19-SEP-11
channel ORA_DISK_2: finished piece 1 at 19-SEP-11
piece
handle=/home/new/EXAM/backupset/2011_09_19/o1_mf_ncnnf_TAG2
0110919T194704_77gc1kpo_.bkp tag=TAG20110919T194704
comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time:
00:00:07
channel ORA_DISK_2: starting compressed full datafile
backupset
channel ORA_DISK_2: specifying datafile(s) in backupset
including current SPFILE in backupset
channel ORA_DISK_2: starting piece 1 at 19-SEP-11
channel ORA_DISK_2: finished piece 1 at 19-SEP-11
piece
handle=/home/new/EXAM/backupset/2011_09_19/o1_mf_nnsnf_TAG2
0110919T194704_77gc1ow7_.bkp tag=TAG20110919T194704
comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time:
00:00:02
channel ORA_DISK_1: finished piece 1 at 19-SEP-11
piece
handle=/home/new/EXAM/backupset/2011_09_19/o1_mf_nnndf_TAG2
0110919T194704_77gbxrr9_.bkp tag=TAG20110919T194704
comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time:
00:02:07
Finished backup at 19-SEP-11
--end of hot backup, THIS IS POINT A(热备份结束,时间点A)
2,add some data to database(添加测试数据)
sys@EXAM>create user t identified by t default tablespace
users temporary tablespace temp;
User created.
sys@EXAM> grant resource,connect to t;
Grant succeeded.
sys@EXAM> conn t/t
Connected.
sys@EXAM> create table t (c1 number);
Table created.
t@EXAM> insert into t values(1);
1 row created.
t@EXAM> commit;
Commit complete.
t@EXAM> select * from t;
C1
----------
1
t@EXAM> conn / as sysdba
Connected.
sys@EXAM> alter system archive log current;
System altered.
sys@EXAM> alter system archive log current;
System altered.
sys@EXAM> /
System altered.
sys@EXAM> /
System altered.
sys@EXAM>select group#,status from v$log;
GROUP# STATUS
---------- --------------------------------
1 CURRENT
2 ACTIVE
3 ACTIVE
--END OF ADD DATA, THIS IS POINT A1(添加数据结束,时间点A1
)
3,--SIMULATE DATABASE CRASH(模拟数据库崩溃)
--RESTORE AND RECOVER DATABASE
--including control file and datafile, no redo files
(actually, backup redo is not userful)(包括控制文件和数据文
件,无redo文件)
[oracle@localhost ~/labs Mon Sep 19]$ sqlplus / as sysdba
idle> startup nomount;
ORACLE instance started.
Total System Global Area 104857600 bytes
Fixed Size 1260336 bytes
Variable Size 83887312 bytes
Database Buffers 16777216 bytes
Redo Buffers 2932736 bytes
[oracle@localhost ~ Mon Sep 19]$ rman target /
Recovery Manager: Release 10.2.0.3.0 - Production on Mon
Sep 19 20:36:23 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: exam (not mounted)
RMAN> restore controlfile from autobackup;
Starting restore at 19-SEP-11
using channel ORA_DISK_1
recovery area destination: /home/new
database name (or database unique name) used for search:
EXAM
channel ORA_DISK_1: autobackup found in the recovery area
channel ORA_DISK_1: autobackup found:
/home/new/EXAM/autobackup/2011_09_19/o1_mf_s_762292496_77gf
mxly_.bkp
channel ORA_DISK_1: control file restore from autobackup
complete
output filename=/home/new/exam/control01.ctl
output filename=/home/new/exam/control02.ctl
output filename=/home/new/exam/control03.ctl
Finished restore at 19-SEP-11
idle> alter database mount;
Database altered.
RMAN> restore database;
Starting restore at 19-SEP-11
released channel: ORA_DISK_1
Starting implicit crosscheck backup at 19-SEP-11
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=210 devtype=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: sid=209 devtype=DISK
Crosschecked 4 objects
Finished implicit crosscheck backup at 19-SEP-11
Starting implicit crosscheck copy at 19-SEP-11
using channel ORA_DISK_1
using channel ORA_DISK_2
Finished implicit crosscheck copy at 19-SEP-11
searching for all files in the recovery area
cataloging files...
cataloging done
List of Cataloged Files
=======================
File Name:
/home/new/EXAM/autobackup/2011_09_19/o1_mf_s_762292496_77gf
mxly_.bkp
using channel ORA_DISK_1
using channel ORA_DISK_2
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from
backup set
restoring datafile 00002 to /home/new/exam/undotbs01.dbf
restoring datafile 00003 to /home/new/exam/sysaux01.dbf
restoring datafile 00005 to /home/new/exam/example01.dbf
channel ORA_DISK_1: reading from backup piece
/home/new/EXAM/backupset/2011_09_19/o1_mf_nnndf_TAG20110919
T203107_77gfjdpz_.bkp
channel ORA_DISK_2: starting datafile backupset restore
channel ORA_DISK_2: specifying datafile(s) to restore from
backup set
restoring datafile 00001 to /home/new/exam/system01.dbf
restoring datafile 00004 to /home/new/exam/users01.dbf
channel ORA_DISK_2: reading from backup piece
/home/new/EXAM/backupset/2011_09_19/o1_mf_nnndf_TAG20110919
T203107_77gfjd8m_.bkp
channel ORA_DISK_1: restored backup piece 1
piece
handle=/home/new/EXAM/backupset/2011_09_19/o1_mf_nnndf_TAG2
0110919T203107_77gfjdpz_.bkp tag=TAG20110919T203107
channel ORA_DISK_1: restore complete, elapsed time:
00:01:08
channel ORA_DISK_2: restored backup piece 1
piece
handle=/home/new/EXAM/backupset/2011_09_19/o1_mf_nnndf_TAG2
0110919T203107_77gfjd8m_.bkp tag=TAG20110919T203107
channel ORA_DISK_2: restore complete, elapsed time:
00:01:44
Finished restore at 19-SEP-11
idle> recover database using backup controlfile;
ORA-00279: change 569463 generated at 09/19/2011 19:53:59
needed for thread 1
ORA-00289: suggestion :
/home/new/EXAM/archivelog/2011_09_19/o1_mf_1_6_%u_.arc
ORA-00280: change 569463 for thread 1 is in sequence #6
Specify log: {
=suggested | filename | AUTO | CANCEL}
auto
ORA-00279: change 569495 generated at 09/19/2011 19:54:50
needed for thread 1
ORA-00289: suggestion :
/home/new/EXAM/archivelog/2011_09_19/o1_mf_1_7_%u_.arc
ORA-00280: change 569495 for thread 1 is in sequence #7
ORA-00278: log file
'/home/new/EXAM/archivelog/2011_09_19/o1_mf_1_6_77gcdb7x_.a
rc' no longer needed for this recovery
ORA-00279: change 569500 generated at 09/19/2011 19:54:56
needed for thread 1
ORA-00289: suggestion :
/home/new/EXAM/archivelog/2011_09_19/o1_mf_1_8_%u_.arc
ORA-00280: change 569500 for thread 1 is in sequence #8
ORA-00278: log file
'/home/new/EXAM/archivelog/2011_09_19/o1_mf_1_7_77gcdj9z_.a
rc' no longer needed for this recovery
ORA-00308: cannot open archived log
'/home/new/EXAM/archivelog/2011_09_19/o1_mf_1_8_%u_.arc'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
idle> recover database using backup controlfile until
cancel;
ORA-00279: change 569500 generated at 09/19/2011 19:54:56
needed for thread 1
ORA-00289: suggestion :
/home/new/EXAM/archivelog/2011_09_19/o1_mf_1_8_%u_.arc
ORA-00280: change 569500 for thread 1 is in sequence #8
Specify log: {=suggested | filename | AUTO | CANCEL}
cancel
Media recovery cancelled.
idle> alter database open noresetlogs;
alter database open noresetlogs
*
ERROR at line 1:
ORA-01588: must use RESETLOGS option for database open
--试图用noresetlogs打开数据库,失败! 因为当前的redo log丢失
,所以要用resetlogs打开数据库。
idle> alter database open resetlogs;
Database altered.
--THIS IS POINT B. 应用了所有的archive log之后,用resetlogs
打开数据库(时间点B)
idle> conn t/t
Connected.
t@EXAM> select * from t;
C1
----------
1
--检查一下B点的数据, 没有丢失。
应该在resetlogs之后,马上做数据库的全备份,这样才是安全的备
份方式。
4,--这里我们只备份控制文件
t@EXAM> conn /as sysdba
Connected.
sys@EXAM> alter database backup controlfile to
'/home/oracle/control.ctl';
Database altered.
sys@EXAM> alter database backup controlfile to trace as
'/home/oracle/b1_ctl.trc';
Database altered.
sys@EXAM> conn t/t
Connected.
t@EXAM> insert into t values(2);
1 row created.
t@EXAM> commit;
Commit complete.
t@EXAM> select * from t;
C1
----------
1
2
sys@EXAM> alter system archive log current;
System altered.
sys@EXAM> /
System altered.
sys@EXAM> /
System altered.
sys@EXAM>select group#,status from v$log;
GROUP# STATUS
---------- --------------------------------
1 CURRENT
2 INACTIVE
3 INACTIVE
--THIS IS POINT B1 WHICH AFTER B. (时间点B之后的时间点B1)
5--SIMULATE DATABASE CRASH(模拟数据库崩溃)
sys@EXAM> shutdown abort;
ORACLE instance shut down.
sys@EXAM> exit
Disconnected from Oracle Database 10g Enterprise Edition
Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
[oracle@localhost ~/labs Mon Sep 19]$ rm -rf
/home/new/exam/*
--THIS IS POINT C(时间点C)
--WE HAVE A FULL BACKUP OF POINT 'A' AND CONTROL FILE OF
'B' AND ALL ARCHIVED LOG FILES(有时间点A的全备份、时间点B的
控制文件和所有ARCHIVED LOG FILES)
6,--LET'S RECOVE DB FROM A -> C(从时间点A到时间点C恢复数据库
)
--restore data file and control file(复原数据文件和控制文件
)
--recover database to B(恢复数据库到时间点B)
[oracle@localhost ~/labs Mon Sep 19]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.3.0 - Production on Mon Sep 19
20:55:38 2011
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Connected to an idle instance.
idle> startup nomount;
ORACLE instance started.
Total System Global Area 104857600 bytes
Fixed Size 1260336 bytes
Variable Size 79693008 bytes
Database Buffers 20971520 bytes
Redo Buffers 2932736 bytes
[oracle@localhost ~ Mon Sep 19]$ rman target /
Recovery Manager: Release 10.2.0.3.0 - Production on Mon
Sep 19 20:56:04 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: exam (not mounted)
RMAN> restore controlfile from autobackup;
Starting restore at 19-SEP-11
using target database control file instead of recovery
catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=210 devtype=DISK
recovery area destination: /home/new
database name (or database unique name) used for search:
EXAM
channel ORA_DISK_1: autobackup found in the recovery area
channel ORA_DISK_1: autobackup found:
/home/new/EXAM/autobackup/2011_09_19/o1_mf_s_762295576_77gg
dxn7_.bkp
channel ORA_DISK_1: control file restore from autobackup
complete
output filename=/home/new/exam/control01.ctl
output filename=/home/new/exam/control02.ctl
output filename=/home/new/exam/control03.ctl
Finished restore at 19-SEP-11
idle> alter database mount;
Database altered.
RMAN> restore database;
Starting restore at 19-SEP-11
released channel: ORA_DISK_1
Starting implicit crosscheck backup at 19-SEP-11
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=210 devtype=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: sid=209 devtype=DISK
Crosschecked 5 objects
Finished implicit crosscheck backup at 19-SEP-11
Starting implicit crosscheck copy at 19-SEP-11
using channel ORA_DISK_1
using channel ORA_DISK_2
Finished implicit crosscheck copy at 19-SEP-11
searching for all files in the recovery area
cataloging files...
cataloging done
List of Cataloged Files
=======================
File Name:
/home/new/EXAM/autobackup/2011_09_19/o1_mf_s_762295576_77gg
dxn7_.bkp
File Name:
/home/new/EXAM/archivelog/2011_09_19/o1_mf_1_1_77ggpw8o_.ar
c
File Name:
/home/new/EXAM/archivelog/2011_09_19/o1_mf_1_2_77ggpzgq_.ar
c
File Name:
/home/new/EXAM/archivelog/2011_09_19/o1_mf_1_3_77ggq2nt_.ar
c
using channel ORA_DISK_1
using channel ORA_DISK_2
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from
backup set
restoring datafile 00002 to /home/new/exam/undotbs01.dbf
restoring datafile 00003 to /home/new/exam/sysaux01.dbf
restoring datafile 00005 to /home/new/exam/example01.dbf
channel ORA_DISK_1: reading from backup piece
/home/new/EXAM/backupset/2011_09_19/o1_mf_nnndf_TAG20110919
T203107_77gfjdpz_.bkp
channel ORA_DISK_2: starting datafile backupset restore
channel ORA_DISK_2: specifying datafile(s) to restore from
backup set
restoring datafile 00001 to /home/new/exam/system01.dbf
restoring datafile 00004 to /home/new/exam/users01.dbf
channel ORA_DISK_2: reading from backup piece
/home/new/EXAM/backupset/2011_09_19/o1_mf_nnndf_TAG20110919
T203107_77gfjd8m_.bkp
channel ORA_DISK_1: restored backup piece 1
piece
handle=/home/new/EXAM/backupset/2011_09_19/o1_mf_nnndf_TAG2
0110919T203107_77gfjdpz_.bkp tag=TAG20110919T203107
channel ORA_DISK_1: restore complete, elapsed time:
00:01:16
channel ORA_DISK_2: restored backup piece 1
piece
handle=/home/new/EXAM/backupset/2011_09_19/o1_mf_nnndf_TAG2
0110919T203107_77gfjd8m_.bkp tag=TAG20110919T203107
channel ORA_DISK_2: restore complete, elapsed time:
00:02:01
Finished restore at 19-SEP-11
idle> recover database using backup controlfile;
ORA-00279: change 569463 generated at 09/19/2011 19:53:59
needed for thread 1
ORA-00289: suggestion :
/home/new/EXAM/archivelog/2011_09_19/o1_mf_1_6_%u_.arc
ORA-00280: change 569463 for thread 1 is in sequence #6
Specify log: {=suggested | filename | AUTO | CANCEL}
auto
ORA-00279: change 569495 generated at 09/19/2011 19:54:50
needed for thread 1
ORA-00289: suggestion :
/home/new/EXAM/archivelog/2011_09_19/o1_mf_1_7_%u_.arc
ORA-00280: change 569495 for thread 1 is in sequence #7
ORA-00278: log file
'/home/new/EXAM/archivelog/2011_09_19/o1_mf_1_6_77gcdb7x_.a
rc' no longer needed for this recovery
ORA-00279: change 569501 generated at 09/19/2011 20:45:36
needed for thread 1
ORA-00289: suggestion :
/home/new/EXAM/archivelog/2011_09_19/o1_mf_1_1_%u_.arc
ORA-00280: change 569501 for thread 1 is in sequence #1
ORA-00279: change 571006 generated at 09/19/2011 20:51:40
needed for thread 1
ORA-00289: suggestion :
/home/new/EXAM/archivelog/2011_09_19/o1_mf_1_2_%u_.arc
ORA-00280: change 571006 for thread 1 is in sequence #2
ORA-00278: log file
'/home/new/EXAM/archivelog/2011_09_19/o1_mf_1_1_77ggpw8o_.a
rc' no longer needed for this recovery
ORA-00279: change 571009 generated at 09/19/2011 20:51:43
needed for thread 1
ORA-00289: suggestion :
/home/new/EXAM/archivelog/2011_09_19/o1_mf_1_3_%u_.arc
ORA-00280: change 571009 for thread 1 is in sequence #3
ORA-00278: log file
'/home/new/EXAM/archivelog/2011_09_19/o1_mf_1_2_77ggpzgq_.a
rc' no longer needed for this recovery
ORA-00279: change 571012 generated at 09/19/2011 20:51:46
needed for thread 1
ORA-00289: suggestion :
/home/new/EXAM/archivelog/2011_09_19/o1_mf_1_4_%u_.arc
ORA-00280: change 571012 for thread 1 is in sequence #4
ORA-00278: log file
'/home/new/EXAM/archivelog/2011_09_19/o1_mf_1_3_77ggq2nt_.a
rc' no longer needed for this recovery
ORA-00308: cannot open archived log
'/home/new/EXAM/archivelog/2011_09_19/o1_mf_1_4_%u_.arc'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
idle> recover database using backup controlfile ;
ORA-00279: change 571012 generated at 09/19/2011 20:51:46
needed for thread 1
ORA-00289: suggestion :
/home/new/EXAM/archivelog/2011_09_19/o1_mf_1_4_%u_.arc
ORA-00280: change 571012 for thread 1 is in sequence #4
Specify log: {=suggested | filename | AUTO | CANCEL}
cancel
Media recovery cancelled.
--Now is the POINT BEFORE B (BEFORE RESETLOGS)(现在是时间点
B之前的时间点---在RESETLOGS选项打开数据库之前)
--这里我们不能再resetlog了, 要偷梁换柱, 替换controlfile为B
点之后B1点的controlfile
idle> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '/home/new/exam/system01.dbf'
idle>show parameter control_files
NAME TYPE
VALUE
------------------------------------ ----------------------
------------------------------
control_files string
/home/new/exam/control01.ctl,
/home/new/exam/control02.ctl,
/home/new/exam/control03.ctl
idle> alter system set
control_files='/home/oracle/control.ctl' scope=spfile;
System altered.
idle> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
idle> startup mount
ORACLE instance started.
Total System Global Area 104857600 bytes
Fixed Size 1260336 bytes
Variable Size 83887312 bytes
Database Buffers 16777216 bytes
Redo Buffers 2932736 bytes
Database mounted.
idle> recover database using backup controlfile ;
ORA-00279: change 569757 generated at 09/19/2011 20:45:36
needed for thread 1
ORA-00289: suggestion :
/home/new/EXAM/archivelog/2011_09_19/o1_mf_1_1_%u_.arc
ORA-00280: change 569757 for thread 1 is in sequence #1
Specify log: {=suggested | filename | AUTO | CANCEL}
auto
ORA-00279: change 571006 generated at 09/19/2011 20:51:40
needed for thread 1
ORA-00289: suggestion :
/home/new/EXAM/archivelog/2011_09_19/o1_mf_1_2_%u_.arc
ORA-00280: change 571006 for thread 1 is in sequence #2
ORA-00278: log file
'/home/new/EXAM/archivelog/2011_09_19/o1_mf_1_1_77ggpw8o_.a
rc' no longer needed for this recovery
ORA-00279: change 571009 generated at 09/19/2011 20:51:43
needed for thread 1
ORA-00289: suggestion :
/home/new/EXAM/archivelog/2011_09_19/o1_mf_1_3_%u_.arc
ORA-00280: change 571009 for thread 1 is in sequence #3
ORA-00278: log file
'/home/new/EXAM/archivelog/2011_09_19/o1_mf_1_2_77ggpzgq_.a
rc' no longer needed for this recovery
ORA-00279: change 571012 generated at 09/19/2011 20:51:46
needed for thread 1
ORA-00289: suggestion :
/home/new/EXAM/archivelog/2011_09_19/o1_mf_1_4_%u_.arc
ORA-00280: change 571012 for thread 1 is in sequence #4
ORA-00278: log file
'/home/new/EXAM/archivelog/2011_09_19/o1_mf_1_3_77ggq2nt_.a
rc' no longer needed for this recovery
ORA-00308: cannot open archived log
'/home/new/EXAM/archivelog/2011_09_19/o1_mf_1_4_%u_.arc'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
idle> recover database using backup controlfile;
ORA-00279: change 571012 generated at 09/19/2011 20:51:46
needed for thread 1
ORA-00289: suggestion :
/home/new/EXAM/archivelog/2011_09_19/o1_mf_1_4_%u_.arc
ORA-00280: change 571012 for thread 1 is in sequence #4
--注意这里要用until cancel, 否则下面 alter database open
resetlogs时oracle会以为还需要恢复。
Specify log: {=suggested | filename | AUTO | CANCEL}
cancel
Media recovery cancelled.
idle> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '/home/new/exam/system01.dbf'
idle> recover database using backup controlfile until
cancel;
ORA-00279: change 571012 generated at 09/19/2011 20:51:46
needed for thread 1
ORA-00289: suggestion :
/home/new/EXAM/archivelog/2011_09_19/o1_mf_1_4_%u_.arc
ORA-00280: change 571012 for thread 1 is in sequence #4
--再试一遍, 用until cancel就好了
Specify log: {=suggested | filename | AUTO | CANCEL}
cancel
Media recovery cancelled.
idle> alter database open resetlogs;
Database altered.
idle> conn t/t
Connected.
t@EXAM> select * from t;
C1
----------
1
2
t@EXAM>
--数据完成了从A到C的恢复,成功跨越resetlogs点。
总结:关键在于需要resetlogs之后的控制文件, 如果resetlogs后
没有备份控制文件,
crash了就over了,:)
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/14359/viewspace-709275/
,如需转载,请注明出处,否则将追究法律责任。