引言:
数据库突然报: ORA-01654: unable to extend index BO.INDEX_indexname by 311072 in tablespace 错误,上网查原因,发现解决之道只有一个,就是增加tablespace的大小.因我的database的tablespace已经足够大了,最后发现不是tablespace不足,而是参数错误.现归纳解决此问题的方法如下.
方法1:
当出现类似错误时,首先检查tablespace的空间是否足够大,如果不够大,说明tablespace的空间不够扩展了,这时候需要将tablespace的datafile的size变大,方法很简单我就不讲了,或增加新的datafile到此tablespace中,使用alter tablespace mytablespace add datafile 'XXX' size xxxx就OK啦.
方法2:
这就是我这此遇到的问题.我的datafile的size为2000m,而我的index的next extent为2G,pct increase为50,这样一来下一个要扩展的extent为3G,而我的datafile的Size为2G,故无发找到连续3G的空间,当然会出错.
问题找到了,解决当然很简单,修改next extent 为128k,pct increase为0,问题解决.
不知道是谁设定的,真是个低级错误.
---------------------------------------------分割线---------------------------------------------
问题现象:
测试库使用如下方式创建索引:
create index IDX_ANA_OFFICE on ANA (OFFICE_CITY, OFFICE_NO)
tablespace IDX
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 128K
next 128K
minextents 1
maxextents unlimited
pctincrease 0
);
tablespace IDX;
Error: ORA-01654
Text: unable to extend index %s.%s by %s in tablespace %s
-------------------------------------------------------------------------------
Cause: Failed to allocate extent for index segment in tablespace.
Action: Use the ALTER TABLESPACE ADD DATAFILE statement to add one or more
files to the specified tablespace
(1)、针对表空间不足的情况,建议使用DBA_FREE_SPACE视图进行查询(Note: 121259.1提供了若干脚本)。Possible solutions:
------------------
- Manually coalesce adjacent free extents:
ALTER TABLESPACE <tablespace name> COALESCE;
The extents must be adjacent to each other for this to work.
- Add a datafile:
ALTER TABLESPACE <tablespace name> ADD DATAFILE '<full path and file
name>' SIZE <integer> <k|m>;
- Resize the datafile:
ALTER DATABASE DATAFILE '<full path and file name>' RESIZE <integer> <k|m>;
- Enable autoextend:
ALTER DATABASE DATAFILE '<full path and file name>' AUTOEXTEND ON
MAXSIZE UNLIMITED;
- Defragment the Tablespace
- Lower "next_extent" and/or "pct_increase" size:
ALTER <segment_type> <segment_name> STORAGE ( next <integer> <k|m>
pctincrease <integer>);
FROM DBA_SEGMENTS
WHERE SEGMENT_NAME = <segment name>
AND SEGMENT_TYPE = <segment type>
AND OWNER = <owner>
AND TABLESPACE_NAME = <tablespace name>;
INDEX
INDEX PARTITION
LOB PARTITION
LOBINDEX
LOBSEGMENT
NESTED TABLE
ROLLBACK
TABLE
TABLE PARTITION
TYPE2 UNDO
TYPE2 UNDO (ORA-1651)
使用如下公式计算需要分配的区大小:
例如:
pct_increase = 50
Cause: Failed to allocate an extent of the required number of blocks for a rollback segment in the tablespace.
Action: Use ALTER TABLESPACE ADD DATAFILE statement to add one or more files to the tablespace indicated.
ORA-1651: unable to extend save undo segment by %s in tablespace %s
Cause: Failed to allocate an extent of the required number of blocks for saving undo entries for the indicated offline tablespace.
Action: Check the storage parameters for the SYSTEM tablespace. The tablespace needs to be brought back online so the undo can be applied.
ORA-1652: unable to extend temp segment by %s in tablespace %s
Cause: Failed to allocate an extent of the required number of blocks for a temporary segment in the tablespace indicated.
Action: Use ALTER TABLESPACE ADD DATAFILE statement to add one or more files to the tablespace indicated.
ORA-1653: unable to extend table %s.%s by %s in tablespace %s
Cause: Failed to allocate an extent of the required number of blocks for a table segment in the tablespace indicated.
Action: Use ALTER TABLESPACE ADD DATAFILE statement to add one or more files to the tablespace indicated.
ORA-1654: unable to extend index %s.%s by %s in tablespace %s
Cause: Failed to allocate an extent of the required number of blocks for an index segment in the tablespace indicated.
Action: Use ALTER TABLESPACE ADD DATAFILE statement to add one or more files to the tablespace indicated.
ORA-1655: unable to extend cluster %s.%s by %s for tablespace %s
Cause: Failed to allocate an extent of the required number of blocks for a cluster segment in tablespace indicated.
Action: Use ALTER TABLESPACE ADD DATAFILE statement to add one or more files to the tablespace indicated.
ORA-1658: unable to create INITIAL extent for segment in tablespace %s
Cause: Failed to find sufficient contiguous space to allocate INITIAL extent for segment being created.
Action: Use ALTER TABLESPACE ADD DATAFILE to add additional space to the tablespace or retry with a smaller value for INITIAL
ORA-1659 unable to allocate MINEXTENTS beyond %s in tablespace %s
Cause: Failed to find sufficient contiguous space to allocate MINEXTENTS for the segment being created.
Action: Use ALTER TABLESPACE ADD DATAFILE to add additional space to the tablespace or retry with smaller value for MINEXTENTS, NEXT or PCTINCREASE
ORA-1683: unable to extend index %s.%s partition %s by %s in tablespace %s
Cause: Failed to allocate an extent of the required number of blocks for index segment in the tablespace indicated.
Action: Use ALTER TABLESPACE ADD DATAFILE statement to add one or more files to the tablespace indicated.
ORA-1688: unable to extend table %s.%s partition %s by %s in tablespace %s
Cause: Failed to allocate an extent of the required number of blocks for table segment in the tablespace indicated.
Action: Use ALTER TABLESPACE ADD DATAFILE statement to add one or more files to the tablespace indicated.
ORA-1691: unable to extend lob segment %s.%s by %s in tablespace %s
Cause: Failed to allocate an extent of the required number of blocks for LOB segment in the tablespace indicated.
Action: Use ALTER TABLESPACE ADD DATAFILE statement to add one or more files to the tablespace indicated.
ORA-1692: unable to extend lob segment %s.%s partition %s by %s in tablespace %s
Cause: Failed to allocate an extent of the required number of blocks for LOB segment in the tablespace indicated.
Action: Use ALTER TABLESPACE ADD DATAFILE statement to add one or more files to the tablespace indicated.
ORA-3233: unable to extend table %s.%s subpartition %s by %s in tablespace %s
Cause: Failed to allocate an extent for table subpartition segment in tablespace.
Action: Use ALTER TABLESPACE ADD DATAFILE statement to add one or more files to the tablespace indicated.
ORA-3234: unable to extend index %s.%s subpartition %s by %s in tablespace %s
Cause: Failed to allocate an extent for index subpartition segment in tablespace.
Action: Use ALTER TABLESPACE ADD DATAFILE statement to add one or more files to the tablespace indicated.
ORA-3238: unable to extend LOB segment %s.%s subpartition %s by %s in tablespace %s
Cause: An attempt was made to allocate an extent for LOB subpartition segment in tablespace, but the extent could not be allocated because there is not enough space in the tablespace indicated.
Action: Use the ALTER TABLESPACE ADD DATAFILE statement to add one or more files to the tablespace indicated.
相关阅读:
ORA-01172、ORA-01151错误处理 http://www.linuxidc.com/Linux/2013-06/86529.htm
ORA-00600 [2662]错误解决 http://www.linuxidc.com/Linux/2013-06/86528.htm
ORA-01078 和 LRM-00109 报错解决方法 http://www.linuxidc.com/Linux/2012-07/66044.htm
ORA-00471 处理方法笔记 http://www.linuxidc.com/Linux/2013-09/90017.htm
ORA-00314,redolog 损坏,或丢失处理方法 http://www.linuxidc.com/Linux/2013-09/90646.htm
ORA-00257 归档日志过大导致无法存储的解决办法 http://www.linuxidc.com/Linux/2013-09/90594.htm
更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12
