1、在非归档中,联机重做日志文件没丢失,
SQL> startup;
ORACLE instance started.SQL>
2、在归档模式下
1)首先备份控制文件
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 8
Next log sequence to archive 10
Current log sequence 10
SQL> show parameter control_f
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time integer 7
control_files string /u1/oracle/oradata/orcl/contro
l01.ctl
SQL> alter database backup controlfile to '/u1/oracle/oradata/ctl2011.ctl';
Database altered.
先备份在做以下操作:
SQL> startup;
ORACLE instance started.
Total System Global Area 243269632 bytes
Fixed Size 1218748 bytes
Variable Size 75499332 bytes
Database Buffers 163577856 bytes
Redo Buffers 2973696 bytes
ORA-00205: error in identifying control file, check alert log for more info
SQL> show parameter control_f
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time integer 7
control_files string /u1/oracle/oradata/orcl/contro
l01.ctl
SQL> ho cp /u1/oracle/database/ctl2001.ctl /u1/oracle/oradata/orcl/control01.ctl
cp: 无法 stat “/u1/oracle/database/ctl2001.ctl”: 没有那个文件或目录
SQL> ho cp /u1/oracle/database/ctl2011.ctl /u1/oracle/oradata/orcl/control01.ctl
cp: 无法 stat “/u1/oracle/database/ctl2011.ctl”: 没有那个文件或目录
SQL> ho cp /u1/oracle/oradata/ctl2011.ctl /u1/oracle/oradata/orcl/control01.ctl
SQL> alter database mount;
Database altered.
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> alter database recover database using backup controlfile;
alter database recover database using backup controlfile
*
ERROR at line 1:
ORA-00279: change 715251 generated at 12/15/2011 17:06:13 needed for thread 1
ORA-00289: suggestion :
/u1/oracle/flash_recovery_area/ORCL/archivelog/2011_12_16/o1_mf_1_10_%u_.arc
ORA-00280: change 715251 for thread 1 is in sequence #10
SQL> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.
Total System Global Area 243269632 bytes
Fixed Size 1218748 bytes
Variable Size 75499332 bytes
Database Buffers 163577856 bytes
Redo Buffers 2973696 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> alter database recover database using backup controlfile until change 715251;
alter database recover database using backup controlfile until change 715251
*
ERROR at line 1:
ORA-00279: change 715251 generated at 12/15/2011 17:06:13 needed for thread 1
ORA-00289: suggestion :
/u1/oracle/flash_recovery_area/ORCL/archivelog/2011_12_16/o1_mf_1_10_%u_.arc
ORA-00280: change 715251 for thread 1 is in sequence #10
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01156: recovery in progress may need access to files
SQL> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.
Total System Global Area 243269632 bytes
Fixed Size 1218748 bytes
Variable Size 75499332 bytes
Database Buffers 163577856 bytes
Redo Buffers 2973696 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: '/u1/oracle/oradata/orcl/system01.dbf'
SQL> alter system set "_allow_resetlogs_corruption"=true scope=spfile; --在极端情况下操作
System altered.
SQL> startup force;
ORACLE instance started.
Total System Global Area 243269632 bytes
Fixed Size 1218748 bytes
Variable Size 75499332 bytes
Database Buffers 163577856 bytes
Redo Buffers 2973696 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> alter database open resetlogs;
SQL>alter system reset "_allow_resetlogs_corruption" scope=spfile sid='*';
2)第二种方法:
SQL> startup;
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 92276304 bytes
Database Buffers 188743680 bytes
Redo Buffers 2973696 bytes
ORA-00205: error in identifying control file, check alert log for more info
SQL> show parameter control
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time integer 7
control_files string /u1/oradata/orcl/control01.ctl
SQL> ho cp /u1/oradata/ctl2011.ctl /u1/oradata/orcl/control01.ctl
SQL> alter database mount;
Database altered.
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: '/u1/oradata/orcl/system01.dbf'
SQL> alter database recover database backup controlfile;
alter database recover database backup controlfile
*
ERROR at line 1:
ORA-00905: missing keyword
SQL> alter database recover database using backup controlfile;
alter database recover database using backup controlfile
*
ERROR at line 1:
ORA-00279: change 499981 generated at 12/21/2011 21:26:15 needed for thread 1
ORA-00289: suggestion :
/u1/flash_recovery_area/ORCL/archivelog/2011_12_21/o1_mf_1_3_%u_.arc
ORA-00280: change 499981 for thread 1 is in sequence #3
SQL> shutdown ;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 92276304 bytes
Database Buffers 188743680 bytes
Redo Buffers 2973696 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '/u1/oradata/orcl/system01.dbf'
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 499981 generated at 12/21/2011 21:26:15 needed for thread 1
ORA-00289: suggestion :
/u1/flash_recovery_area/ORCL/archivelog/2011_12_21/o1_mf_1_3_%u_.arc
ORA-00280: change 499981 for thread 1 is in sequence #3
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/u1/oracle/oradata/orcl/redo01.log
ORA-00308: cannot open archived log '/u1/oracle/oradata/orcl/redo01.log'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/u1/oradata/orcl/redo01.log
ORA-00328: archived log ends at change 499852, need later change 499981
ORA-00334: archived log: '/u1/oradata/orcl/redo01.log'
SQL> recover database using backup controlfile;
ORA-00279: change 499981 generated at 12/21/2011 21:26:15 needed for thread 1
ORA-00289: suggestion :
/u1/flash_recovery_area/ORCL/archivelog/2011_12_21/o1_mf_1_3_%u_.arc
ORA-00280: change 499981 for thread 1 is in sequence #3
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/u1/oradata/orcl/redo02.log
Log applied.
Media recovery complete.
SQL> alter database open resetlogs;
Database altered.
SQL>