今天在客户那边巡检一个数据库时,在警告日志文件发现了一个报错,大概每隔20秒就有一次记录;
“ORA-1654: unable to extend index ODS.EI_P1_ATTRSTORE by 256 in tablespace P1TS_IND_STORE”
后来发现是oracle对单个数据文件大小有限制导致的(Oracle数据文件的大小存在一个内部限制:db_block_size为2k时,单个数据文件最大为8G;db_block_size为4k时,单个数据文件最大为16G;(这里说的是小文件表空间)))
客户这边的数据库版本是9.2.0.4,linux操作系统,参数db_block_size为4096
查看db_block_size:
SQL> show parameter db_block_size
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_block_size integer 4096
表空间P1TS_IND_STORE只有一个数据文件icatsp1_ora9i.dbf,
用命令du -sh icatsp1_ora9i.dbf查看该数据文件大小,17G(奇怪,不是最大16G吗?)!
查看表空间有哪些数据文件:
SQL> SELECT d.name FROM v$datafile d JOIN v$tablespace t USING(ts#) WHERE t.name='P1TS_IND_STORE';
NAME
-----------------------------------
/***/ora_data/icatsp1_ora9i.dbf
解决方法:
添加一个新的数据文件,并设置成自动扩展
ALTER TABLESPACE P1TS_IND_STORE
ADD DATAFILE '/**/ora_data/icatsp2_ora9i.dbf' SIZE 2048M autoextend on next 512M MAXSIZE UNLIMITED;
观察警告日志文件一段时间,没有发现继续报错,问题解决。
参考文档:http://www.eygle.com/archives/2007/07/oracle_datafile_limit.html
ALERT: RESIZE or AUTOEXTEND can "Over-size" Datafiles and Corrupt the Dictionary [ID 112011.1]
Workaround
~~~~~~~~~~
The workaround for all of the above problems is not to use the commands
described in this alert with sizes above the maximum for your database
DB_BLOCK_SIZE.
As sizes are often specified in "K" or "M" never try to use file sizes
greater than the values given by the following select:
SELECT to_char(4194303*value,'999,999,999,999') MAX_BYTES,
to_char(trunc(4194303*value/1024),'999,999,999')||' Kb' MAX_KB,
to_char(trunc(4194303*value/1024/1024),'999,999')||' Mb' MAX_MB
FROM v$parameter WHERE name='db_block_size';
For convenience the table below shows the maximum sizes for common
DB_BLOCK_SIZES:
DB_BLOCK_SIZE Max Mb value to use in any command
~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2048 8191 M
4096 16383 M
8192 32767 M
16384 65535 M
Note: For a 2K (2048 byte) DB_BLOCK_SIZE an 8Gb datafile is TOO LARGE.
An 8Gb file would be 8192Mb which is more than 4194303 DB blocks.