SQL> alter database datafile 7 online;
alter database datafile 7 online
*
ERROR at line 1:
ORA-01113: file 7 needs media recovery
ORA-01110: data file 7: '/disk2/oradata/sydb/tbs03.dbf'
SQL> recover datafile 7;
ORA-00283: recovery session canceled due to errors
ORA-01122: database file 7 failed verification check
ORA-01110: data file 7: '/disk2/oradata/sydb/tbs03.dbf'
ORA-01207: file is more recent than control file - old control file
通过重建控制文件恢复数据文件7:
SQL> alter database backup controlfile to trace;
SQL> shutdown immediate
SQL>STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "SYDB" NORESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oradata/sydb/redo01.log' SIZE 50M BLOCKSIZE 512,
GROUP 2 '/u01/app/oradata/sydb/redo02.log' SIZE 50M BLOCKSIZE 512,
GROUP 3 '/u01/app/oradata/sydb/redo03.log' SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'/u01/app/oradata/sydb/system01.dbf',
'/u01/app/oradata/sydb/sysaux01.dbf',
'/u01/app/oradata/sydb/undotbs01.dbf',
'/u01/app/oradata/sydb/users01.dbf',
'/disk2/oradata/sydb/tbs01.dbf',
'/disk2/oradata/sydb/tbs02.dbf',
'/disk2/oradata/sydb/tbs03.dbf',
'/tmp/tbs_tmp.dbf'
CHARACTER SET UTF8
;
Control file created.
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01113: file 7 needs media recovery
ORA-01110: data file 7: '/disk2/oradata/sydb/tbs03.dbf''
SQL> recover database;
Media recovery complete.
SQL> alter database open;
Database altered.
SQL> column name format a35
SQL> select file#,name, CHECKPOINT_CHANGE#,to_char(CHECKPOINT_TIME,'yyyy-mm-dd hh24:mi:ss')checkpoint_time,status,BLOCK_SIZE from v$datafile;
FILE# NAME CHECKPOINT_CHANGE# CHECKPOINT_TIME STATUS BLOCK_SIZE
---------- ----------------------------------- ------------------ ------------------- ------- ----------
1 /u01/app/oradata/sydb/system01.dbf 3183058 2015-04-13 22:11:12 SYSTEM 8192
2 /u01/app/oradata/sydb/sysaux01.dbf 3183058 2015-04-13 22:11:12 ONLINE 8192
3 /u01/app/oradata/sydb/undotbs01.dbf 3183058 2015-04-13 22:11:12 ONLINE 8192
4 /u01/app/oradata/sydb/users01.dbf 3183058 2015-04-13 22:11:12 ONLINE 8192
5 /disk2/oradata/sydb/tbs01.dbf 3183058 2015-04-13 22:11:12 ONLINE 8192
6 /disk2/oradata/sydb/tbs02.dbf 3183058 2015-04-13 22:11:12 ONLINE 8192
7 /disk2/oradata/sydb/tbs03.dbf 3183058 2015-04-13 22:11:12 ONLINE 8192
8 /tmp/tbs_tmp.dbf 3183058 2015-04-13 22:11:12 ONLINE 8192
注:不同情况,有可能还是无法打开数据库,比如报(ORA-01113: file 1 needs media recovery),尝试使用NORESETLOGS方式重建控制文件,然后在执行Media Recovery 。