1.1 现象描述
收集数据库统计信息失败,系统显示如下错误信息:
SQL> execute dbms_stats.GATHER_SCHEMA_STATS(ownname=>'imuse01',estimate_percent=>DBMS_STATS.AUTO_SAMPLE_SIZE);
BEGIN dbms_stats.GATHER_SCHEMA_STATS(ownname=>'imuse01',estimate_percent=>DBMS_STATS.AUTO_SAMPLE_SI
ZE); END;
*
ERROR at line 1:
ORA-01115: IO error reading block from file 8 (block # 10612)
ORA-01110: data file 8: '/dev/md/oracledg/rdsk/d714'
ORA-27091: skgfqio: unable to queue I/O
ORA-27072: skgfdisp: I/O error
SVR4 Error: 12: Not enough space
Additional information: 10611
ORA-06512: at "SYS.DBMS_STATS", line 10301
ORA-06512: at "SYS.DBMS_STATS", line 10795
ORA-06512: at "SYS.DBMS_STATS", line 10982
ORA-06512: at "SYS.DBMS_STATS", line 11036
ORA-06512: at "SYS.DBMS_STATS", line 11013
ORA-06512: at line 1
1.2 可能原因
表空间所在磁盘的可用空间不足,导致收集数据库统计信息失败。
1.3 处理步骤
以oracle用户登录数据库所在机器。
以sysdba用户连接数据库。
% sqlplus / as sysdba
检查表空间所在路径。
SQL> select file_name,tablespace_name from dba_temp_files;
系统显示如下信息:
FILE_NAME
--------------------------------------------------------------------------------
TABLESPACE_NAME
------------------------------
/dev/md/oracledg/rdsk/d714
TEMP
由以上执行结果可知,“/dev/md/oracledg/rdsk/d714”为表空间所在路径。
检查表空间的利用率。
SQL> select total.tablespace_name, round(total.MB, 2) as Total_MB, round(total.MB - free.MB, 2) as Used_MB, round((1 - free.MB / total.MB) * 100, 2) || '%' as Used_Pct from (select tablespace_name, sum(bytes) / 1024 / 1024 as MB from dba_free_space group by tablespace_name) free, (select tablespace_name, sum(bytes) / 1024 / 1024 as MB from dba_data_files group by tablespace_name) total 11 where free.tablespace_name = total.tablespace_name;
系统显示如下信息:
TABLESPACE_NAME TOTAL_MB USED_MB USED_PCT
------------------------------ ---------- ---------- -----------------------------------------
SYSAUX 870 798.88 91.82%
USERS 250 1.06 .43%
SYSTEM 1000 736.81 73.68%
UNDOTBS2 50 14.25 28.5%
PERFSTAT 200 152.75 76.38%
是否增加表空间的“USED_PCT”需要结合业务、数据增长速率具体情况具体分析。比如对于只是read-only的表空间,它的数据根本就不会长,永远都不用增加(只要表空间还是read-only下)。
增加表空间。
o 增长现有的数据文件
SQL> alter database datafile 'xxxxx' resize xxxxM;
o 增加数据文件。
SQL> alter tablespace xxx add datafile 'xxx\xxx\xxx.dbf ' size xxxM;