故障现象:启动时报错
SQL> startup nomount
ORACLE instance started.
Total System Global Area 393375744 bytes
Fixed Size 1300156 bytes
Variable Size 289409348 bytes
Database Buffers 96468992 bytes
Redo Buffers 6197248 bytes
SQL> alter database mount;
alter database mount
*
ERROR at line 1:
ORA-00205:error in identifying control file, check alert log for more info
alter_.log相关信息如下:
Thu Mar 05 14:59:48 2009
alter database mount
Thu Mar 05 14:59:48 2009
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/oracle/oradata/ora11g/control03.ctl'ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/oracle/oradata/ora11g/control02.ctl'ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/oracle/oradata/ora11g/control01.ctl'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
Thu Mar 05 14:59:48 2009
Checker run found 3 new persistent failures
ORA-205 signalled during: alter database mount...
恢复方法
1、生成可获得的脚本
SQL> alter database backup controlfile to trace;
Database altered.
查看生成的trace文件:
[oracle@RHEL5 trace]$ tail -f alert_ora11g.log
ALTER DATABASE MOUNT
Setting recovery target incarnation to 2
Successful mount of redo thread 1, with mount id 4076919815
Database mounted in Exclusive Mode
Lost write protection disabled
Completed: ALTER DATABASE MOUNT
Thu Mar 05 14:41:39 2009
alter database backup controlfile to trace
Backup controlfile written to trace file/oracle/diag/rdbms/ora11g/ora11g/trace/ora11g_ora_4619.trcCompleted: alter database backup controlfile to trace
[oracle@RHEL5 trace]$ cat ora11g_ora_4619.trc
Trace file /oracle/diag/rdbms/ora11g/ora11g/trace/ora11g_ora_4619.trc
Oracle Database Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORACLE_HOME = /oracle/product/11.1/db_1
System name: Linux
Node name: RHEL5
Release: 2.6.18-8.el5xen
Version: #1 SMP Fri Jan 26 14:42:21 EST 2007
Machine: i686
Instance name: ora11g
Redo thread mounted by this instance: 1
Oracle process number: 18
Unix process pid: 4619, image: oracle@RHEL5 (TNS V1-V3)
*** 2009-03-05 14:41:39.487
*** SESSION ID:(170.5) 2009-03-05 14:41:39.487
*** CLIENT ID:() 2009-03-05 14:41:39.487
*** SERVICE NAME:() 2009-03-05 14:41:39.487
*** MODULE NAME:(sqlplus@RHEL5 (TNS V1-V3)) 2009-03-05 14:41:39.487
*** ACTION NAME:() 2009-03-05 14:41:39.487
-- The following are current System-scope REDO Log Archival related
-- parameters and can be included in the database initialization file.
--
-- LOG_ARCHIVE_DEST=''
-- LOG_ARCHIVE_DUPLEX_DEST=''
--
-- LOG_ARCHIVE_FORMAT=%t_%s_%r.dbf
--
-- DB_UNIQUE_NAME="ora11g"
--
-- LOG_ARCHIVE_CONFIG='SEND, RECEIVE, NODG_CONFIG'
-- LOG_ARCHIVE_MAX_PROCESSES=4
-- STANDBY_FILE_MANAGEMENT=MANUAL
-- STANDBY_ARCHIVE_DEST=?/dbs/arch
-- FAL_CLIENT=''
-- FAL_SERVER=''
--
-- LOG_ARCHIVE_DEST_10='LOCATION=USE_DB_RECOVERY_FILE_DEST'
-- LOG_ARCHIVE_DEST_10='OPTIONAL REOPEN=300 NODELAY'
-- LOG_ARCHIVE_DEST_10='ARCH NOAFFIRM NOEXPEDITE NOVERIFY SYNC'
-- LOG_ARCHIVE_DEST_10='REGISTER NOALTERNATE NODEPENDENCY'
-- LOG_ARCHIVE_DEST_10='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED NODB_UNIQUE_NAME'
-- LOG_ARCHIVE_DEST_10='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILES)'
-- LOG_ARCHIVE_DEST_STATE_10=ENABLE
--
-- LOG_ARCHIVE_DEST_1='LOCATION=/oracle/product/11.1/db_1/dbs/arch'
-- LOG_ARCHIVE_DEST_1='MANDATORY NOREOPEN NODELAY'
-- LOG_ARCHIVE_DEST_1='ARCH NOAFFIRM EXPEDITE NOVERIFY SYNC'
-- LOG_ARCHIVE_DEST_1='NOREGISTER NOALTERNATE NODEPENDENCY'
-- LOG_ARCHIVE_DEST_1='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED NODB_UNIQUE_NAME'
-- LOG_ARCHIVE_DEST_1='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILES)'
-- LOG_ARCHIVE_DEST_STATE_1=ENABLE
--
-- Below are two sets of statements, each of which creates a new
-- control file and uses it to open the database. The first set opens
-- the database with the NORESETLOGS option and should be used only if
-- the current versions of all online logs are available. The second
-- set opens the database with the RESETLOGS option and should be used
-- if online logs are unavailable.
-- The appropriate set of statements can be copied from the trace into
-- a script. file, edited as necessary, and executed when there is a
-- need to re-create the control file.
--
-- Set #1. NORESETLOGS case
--
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- Additional logs may be required for media recovery of offline
-- Use this only if the current versions of all online logs are
-- available.
-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
-- ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "ORA11G" NORESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/oracle/oradata/ora11g/redo01.log' SIZE 50M,
GROUP 2 '/oracle/oradata/ora11g/redo02.log' SIZE 50M,
GROUP 3 '/oracle/oradata/ora11g/redo03.log' SIZE 50M
-- STANDBY LOGFILE
DATAFILE
'/oracle/oradata/ora11g/system01.dbf',
'/oracle/oradata/ora11g/sysaux01.dbf',
'/oracle/oradata/ora11g/undotbs01.dbf',
'/oracle/oradata/ora11g/users01.dbf'
CHARACTER SET ZHS16GBK
;
-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE '/oracle/flash_recovery_area/ORA11G/archivelog/2009_03_05/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/oracle/flash_recovery_area/ORA11G/archivelog/2009_03_05/o1_mf_1_1_%u_.arc';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE
-- Database can now be opened normally.
ALTER DATABASE OPEN;
-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '/oracle/oradata/ora11g/temp01.dbf' REUSE;
-- End of tempfile additions.
--
-- Set #2. RESETLOGS case
--
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- The contents of online logs will be lost and all backups will
-- be invalidated. Use this only if online logs are damaged.
-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
-- ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "ORA11G" RESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/oracle/oradata/ora11g/redo01.log' SIZE 50M,
GROUP 2 '/oracle/oradata/ora11g/redo02.log' SIZE 50M,
GROUP 3 '/oracle/oradata/ora11g/redo03.log' SIZE 50M
-- STANDBY LOGFILE
DATAFILE
'/oracle/oradata/ora11g/system01.dbf',
'/oracle/oradata/ora11g/sysaux01.dbf',
'/oracle/oradata/ora11g/undotbs01.dbf',
'/oracle/oradata/ora11g/users01.dbf'
CHARACTER SET ZHS16GBK
;
-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE '/oracle/flash_recovery_area/ORA11G/archivelog/2009_03_05/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/oracle/flash_recovery_area/ORA11G/archivelog/2009_03_05/o1_mf_1_1_%u_.arc';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE USING BACKUP CONTROLFILE
-- Database can now be opened zeroing the online logs.
ALTER DATABASE OPEN RESETLOGS;
-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '/oracle/oradata/ora11g/temp01.dbf' REUSE;
-- End of tempfile additions.
--
通过这个文件可以获得生成控制文件的脚本(分NORESETLOGS/RESETLOGS):
[oracle@RHEL5 scripts]$ cat createctlf.sql
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "ORA11G" NORESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/oracle/oradata/ora11g/redo01.log' SIZE 50M,
GROUP 2 '/oracle/oradata/ora11g/redo02.log' SIZE 50M,
GROUP 3 '/oracle/oradata/ora11g/redo03.log' SIZE 50M
DATAFILE
'/oracle/oradata/ora11g/system01.dbf',
'/oracle/oradata/ora11g/sysaux01.dbf',
'/oracle/oradata/ora11g/undotbs01.dbf',
'/oracle/oradata/ora11g/users01.dbf'
CHARACTER SET ZHS16GBK
;
RECOVER DATABASE
ALTER DATABASE OPEN;
ALTER TABLESPACE TEMP ADD TEMPFILE '/oracle/oradata/ora11g/temp01.dbf' REUSE;
运行这个脚本即可重建控制文件:
SQL> conn / as sysdba
Connected to an idle instance.
SQL> @createctlf
SP2-0310: unable to open file "createctlf.sql"
SQL> set echo on
SQL> @/oracle/admin/ora11g/scripts/createctlf
SQL> STARTUP NOMOUNT
ORACLE instance started.
Total System Global Area 393375744 bytes
Fixed Size 1300156 bytes
Variable Size 289409348 bytes
Database Buffers 96468992 bytes
Redo Buffers 6197248 bytes
SQL> CREATE CONTROLFILE REUSE DATABASE "ORA11G" NORESETLOGS NOARCHIVELOG
2 MAXLOGFILES 16
3 MAXLOGMEMBERS 3
4 MAXDATAFILES 100
5 MAXINSTANCES 8
6 MAXLOGHISTORY 292
7 LOGFILE
8 GROUP 1 '/oracle/oradata/ora11g/redo01.log' SIZE 50M,
9 GROUP 2 '/oracle/oradata/ora11g/redo02.log' SIZE 50M,
10 GROUP 3 '/oracle/oradata/ora11g/redo03.log' SIZE 50M
11 DATAFILE
12 '/oracle/oradata/ora11g/system01.dbf',
13 '/oracle/oradata/ora11g/sysaux01.dbf',
14 '/oracle/oradata/ora11g/undotbs01.dbf',
15 '/oracle/oradata/ora11g/users01.dbf'
16 CHARACTER SET ZHS16GBK
17 ;
Control file created.
SQL> RECOVER DATABASE
ORA-00283: recovery session canceled due to errors
ORA-00264: no recovery required
SQL> ALTER DATABASE OPEN;
Database altered.
SQL> ALTER TABLESPACE TEMP ADD TEMPFILE '/oracle/oradata/ora11g/temp01.dbf' REUSE;
Tablespace altered.
查看实例状态:
SQL> select status from v$instance;
STATUS
------------
OPEN
查看新生成的控制文件:
SQL> select * from V$controlfile;
rows will be truncated
rows will be truncated
rows will be truncated
STATUS NAME
------- ------------------------------------------------------------------------
/oracle/oradata/ora11g/control01.ctl
/oracle/oradata/ora11g/control02.ctl
/oracle/oradata/ora11g/control03.ctl
SQL> host ls -l /oracle/oradata/ora11g/contr*
-rw-r----- 1 oracle oinstall 10076160 Mar 5 15:37 /oracle/oradata/ora11g/control01.ctl
-rw-r----- 1 oracle oinstall 10076160 Mar 5 15:37 /oracle/oradata/ora11g/control02.ctl
-rw-r----- 1 oracle oinstall 10076160 Mar 5 15:37 /oracle/oradata/ora11g/control03.ctl