ORA-1688: unable to extend table ACT.INFO_HIS partition P_201807 by 64 in tablespace TA

问题描述:

表空间TA的已扩展空间还有剩余255GB,而数据文件最大可扩展空间已到最大值。current_tatal=max_total,数据文件已经无法扩展。

ORA-1688: unable to extend table ACT.INFO_HIS partition P_201807 by 64 in tablespace TA

库报ORA-1688错误的问题分析如下:

 

Mon Aug 13 09:35:47 2018
ORA-1688: unable to extend table ACT.INFO_HIS partition P_201807 by 64 in                 tablespace TA 
ORA-1688: unable to extend table ACT.INFO_HIS partition P_201807 by 4096 in                 tablespace TA
Mon Aug 13 09:56:17 2018

 

       根据MOS文档官方解释,以下文档解释合理清晰:

       Troubleshooting Guide - 'Unable to Extend / Create' Errors (Doc ID 1025288.6)

 

       如下是对ORA-1688错误的解释:

ORA-1688: unable to extend table ACT.INFO_HIS partition P_201807 by 64 in tablespace TA

        根据这个文档进行问题分析:

        1.Determine the largest contiguous space available for the tablespace with the error

         

         以下是查询结果,最大可连续的块空间:

 

ORA-1688: unable to extend table ACT.INFO_HIS partition P_201807 by 64 in tablespace TA

 

         计算数据块:3145728/1024/16=192.

         也就是说当前已扩展的数据文件中未用的空间,也就是常说的当前已扩展剩余空间,最大连续的extent是192数据块。

 

         2.Determine NEXT_EXTENT size  

下面这个图获取脚本是:

Script to Monitor Tablespace Usage and Information (Doc ID 1902106.1)

ORA-1688: unable to extend table ACT.INFO_HIS partition P_201807 by 64 in tablespace TA

 

        B) For Locally Managed Tablespaces (LMT) with SYSTEM | AUTOALLOCATE extent management 


            At present there is no query that can determine the next extent size for this kind of tablespace 

            The error message must be examined and the number of blocks indicated in the message is multiplied by the block size for the tablespace to determine the size of the extent to be created 

 

           对于表空间是本地管理的表空间,无法确定下一次扩展一个extent的大小,也就是NEXT_EXTENT这个是一个不固定的值。必须检查错误消息,并将消息中指示的块数目乘以表空间的块大小,以确定要创建的范围的大小。

 

           从报错中看一个是要扩64,4096这两种extent。4096*1024*16=67239936。需要67239936字节的空间,而当前已扩展从dba_free_space中查到最大的可用extent的空间为3145728。所以不够用,就需要从未扩展的数据文件中扩展空间来存储数据。

 

           下图中可以看到三个数据文件的文件号分别为198,199,200。在加数据文件是设置100M初始大小,当加完这三个数据文件后,未报ORA-1688错误,从数据文件扩展需要的空间:67239936字节,因而扩展需要的extent就可以写入数据。

          ORA-1688: unable to extend table ACT.INFO_HIS partition P_201807 by 64 in tablespace TA

 

           从报错的表INFO_HIS ,数据文件198,199,200对应的extent的blocks都是4096个块。正是报错中需要4096个数据块的大小。

            

ORA-1688: unable to extend table ACT.INFO_HIS partition P_201807 by 64 in tablespace TA

         

          根据MOS文档中内容解释,有如下几种解决该问题的方法:

          1.手工合并连续剩余的extents。前提要求是:extent必须是相邻的。

             ALTER TABLESPACE <tablespace name> COALESCE;

          2.开启表空间的数据文件自动扩展。

             ALTER DATABASE DATAFILE|TEMPFILE '<full path and name>' AUTOEXTEND ON MAXSIZE <integer> <k | m | g | t | p | e>;

          3.增加数据文件

             ALTER TABLESPACE <tablespace name> ADD DATAFILE|TEMPFILE '<full path and file name>' SIZE <integer> <k | m | g | t | p | e>;

          4.resize数据文件

            ALTER DATABASE DATAFILE|TEMPFILE '<full path and file name>' RESIZE <integer> <k | m | g | t | p | e>;

 

          总结:

          处理该问题,可以先将表空间已扩展的表空间进行COALESCE,手动聚合连续的extent。如果还是依然报错那么添加数据文件,预留出充足的可扩展空间。