1.問題現象
業務反饋系統報 ORA-01652:無法通過128(在表空間TEMP中)拓展temp字段;
2.問題原因
這個很明顯是臨時表空TEMP空間滿了,導致不能拓展字段;
3.解決方法
3.1 查看表空間使用情況
SELECT
*
FROM
(
SELECT
a.tablespace_name,
round( a.bytes / 1024 / 1024, 2 ) total_bytes,
round( b.bytes / 1024 / 1024, 2 ) free_bytes,
round( a.bytes / 1024 / 1024 - b.bytes / 1024 / 1024, 2 ) use_bytes,
round(( 1 - b.bytes / a.bytes ) * 100, 2 ) || '%' USE
FROM
( SELECT tablespace_name, sum( bytes ) bytes FROM dba_data_files GROUP BY tablespace_name ) a,
( SELECT tablespace_name, sum( bytes ) bytes FROM dba_free_space GROUP BY tablespace_name ) b
WHERE
a.tablespace_name = b.tablespace_name UNION ALL
SELECT
c.tablespace_name,
round( c.bytes / 1024 / 1024, 2 ) total_bytes,
round( ( c.bytes - d.bytes_used ) / 1024 / 1024, 2 ) free_bytes,
round( d.bytes_used / 1024 / 1024, 2 ) use_bytes,
round( d.bytes_used * 100 / c.bytes, 2 ) || '%' USE
FROM
( SELECT tablespace_name, sum( bytes ) bytes FROM dba_temp_files GROUP BY tablespace_name ) c,
( SELECT tablespace_name, sum( bytes_cached ) bytes_used FROM v$temp_extent_pool GROUP BY tablespace_name ) d
WHERE
c.tablespace_name = d.tablespace_name
)
ORDER BY
tablespace_name;
3.2 查看表空間大小、位置、空間使用情況、空間拓展性
select *
from (
select tablespace_name, file_id, file_name, round(bytes/(1024*1024),0) total_space, round(maxbytes/(1024*1024),0) maxbytes_space, autoextensible from dba_data_files
union all
select tablespace_name, file_id, file_name, round(bytes/(1024*1024),0) total_space, round(maxbytes/(1024*1024),0) maxbytes_space, autoextensible from dba_temp_files
) a
order by tablespace_name,file_id;
3.3 為表空間增加文件
alter tablespace temp add tempfile 'E:/ORADATA/NCENVIRO/temp05.dbf' size 2048M reuse autoextend on next 100M;
