欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

数据文件 failed check 的处理

程序员文章站 2022-06-01 22:34:18
...

数据文件 failed check 的处理 - ldquo;ORA-01122database file 201 failedrdquo;

今天data从mounted 到open 的时候,,报:
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01092: Oracle instance terminated. Disconnection forced

检查alert日志:

Errors in file /u01/pp/oracle/admin/ezhou/bdump/ezhou_dbw0_6672.trc:
ORA-01186: file 201 failed verification tests
ORA-01122: database file 201 failed verification check
ORA-01110: data file 201: '/u02/ezhou/temp01.dbf'
ORA-01203: wrong incarnation of this file - wrong creation SCN
Fri Dec 9 11:14:17 2011
File 201 not verified due to error ORA-01122

报我的test01.dbf 有问题。
我看一下:
SQL> select * from v$tempfile;

FILE# CREATION_CHANGE# CREATION_TIME TS# RFILE# STATUS
---------- ---------------- ------------------- ---------- ---------- -------
ENABLED BYTES BLOCKS CREATE_BYTES BLOCK_SIZE
---------- ---------- ---------- ------------ ----------
NAME
--------------------------------------------------------------------------------
1 446161 2011-08-27 21:25:00 3 1 ONLINE
READ WRITE 52428800 6400 20971520 8192
/u02/ezhou/temp01.dbf

是online 的。

思路:先offline 再online:
发现: offline 容易,online 难:

SQL> alter database tempfile '/u02/ezhou/temp01.dbf' offline;

Database altered.

SQL> alter database tempfile '/u02/ezhou/temp01.dbf' online;
alter database tempfile '/u02/ezhou/temp01.dbf' online
*
ERROR at line 1:
ORA-01122: database file 201 failed verification check
ORA-01110: data file 201: '/u02/ezhou/temp01.dbf'
ORA-01203: wrong incarnation of this file - wrong creation SCN


好,下面试试删除重建:

SQL> alter database tempfile '/u02/ezhou/temp01.dbf' drop;

Database altered.

SQL> alter tablespace temp add tempfile '/u02/ezhou/temp01.dbf' size 100m;
alter tablespace temp add tempfile '/u02/ezhou/temp01.dbf' size 100m
*
ERROR at line 1:
ORA-01109: database not open

没有办法。
在看一下log:
ORA-01122: database file 201 failed verification check

还是做一下datafile 的check 吧:

SQL> alter system check datafiles;

System altered.

SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01139: RESETLOGS option only valid after an incomplete database recovery


SQL> alter database open;

Database altered.

SQL> select * from v$tempfile;

no rows selected

把原来的存在的文件:temp01.dbf 删除,重建:

SQL> alter tablespace temp add tempfile '/u02/ezhou/temp01.dbf' size 100m;

Tablespace altered.

好,现在database open, temp文件也有了。

数据文件 failed check 的处理