Oracle:dba_data_file的bytes列为空
今天遇到了如题所示的问题,具体如下:
可以看到,File_id:161,数据文件的bytes为空。
如果你尝试对出问题的数据文件离线后再上线,则你会遇到这样的报错:
1 2 3 4 5 6 7 8 9 |
SQL> alter database datafile 161 online; alter database datafile 161 online * ERROR at line 1: ORA-01113: file 161 needs media recovery if it was restored from backup, or END BACKUP if it was not ORA-01110: data file 161: '/data2/data_spc/wsscm/data_spc23.dbf' SQL> |
而数据文件本身是没有坏块的:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
oracle@wsscm02: /home/oracle> dbv file=/data2/data_spc/wsscm/data_spc23.dbf DBVERIFY: Release 10.2.0.5.0 - Production on Fri Jul 3 14:51:06 2015 Copyright (c) 1982, 2007, Oracle. All rights reserved. DBVERIFY - Verification starting : FILE = /data2/data_spc/wsscm/data_spc23.dbf DBVERIFY - Verification complete Total Pages Examined : 1048576 Total Pages Processed (Data) : 1024 Total Pages Failing (Data) : 0 Total Pages Processed (Index): 54546 Total Pages Failing (Index): 0 Total Pages Processed (Other): 8 Total Pages Processed (Seg) : 0 Total Pages Failing (Seg) : 0 Total Pages Empty : 992998 Total Pages Marked Corrupt : 0 Total Pages Influx : 0 Highest block SCN : 2636396612 (1298.2636396612) oracle@wsscm02: /home/oracle> |
对于该问题,Oracle MOS的文档给出了说明:
Common Causes and Solutions on ORA-376 Error Found in Backup & Recovery (文档 ID 183327.1)
解决方法:
1.将数据文件或者表空间离线
1 2 3 |
alter tablespace xxxx offline or alter database datafile 'xxxx' offline |
2.关闭数据库到mount阶段:
1 2 |
shutdown immediate; startup mount |
3.恢复数据文件:
1 |
recover datafile 'xxx' |
1 |
alter database datafile 'xxx' online; |
5.打开数据库:
1 |
alter database open; |
最后,问题得到解决后,再次查看数据文件的状态:
1 2 3 4 5 6 7 |
SQL> select file_name,file_id,tablespace_name,bytes/1024/1024,status from dba_data_files where file_id=161; FILE_NAME FILE_ID TABLESPACE_NAME BYTES/1024/1024 STATUS -------------------------------------------------------------------- ---------- ------------------------------ --------------- --------- /data2/data_spc/wsscm/data_spc23.dbf 161 DATA_SPC 8192 AVAILABLE SQL> |
也许你的数据库也有一样的问题,检查一下吧:
SQL:select file_name,file_id,tablespace_name,bytes/1024/1024,status from dba_data_files where bytes is null;
——————————————————————————————————————
Done。
最后,有几个数据文件无法通过MOS提供的方式解决,Alert中也没有关于异常的说明,…
问题无法继续深挖了吗?
MOS提供的方法也不是万全的,也是有局限性的。
要用这种方式解决该问题需要数据库归档模式,并且归档日志完整。否则,recover将失败。