本人使用的是19c版本,使用使用过程中发现预分配空间冗余率太高,通过下述步骤成功进行文件收缩。
-----1 查询各表空间文件使用情况
SELECT
*
FROM
(
SELECT
a.tablespace_name,
to_char( a.bytes / 1024 / 1024, '999,999' )||'M' total_bytes,
to_char( b.bytes / 1024 / 1024, '999,999' )||'M' free_bytes,
to_char( a.bytes / 1024 / 1024 - b.bytes / 1024 / 1024, '999,999' )||'M' use_bytes,
to_char( ( 1 - b.bytes / a.bytes ) * 100, '990.99' ) || '%' 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,
to_char( c.bytes / 1024 / 1024, '999,999' )||'M' total_bytes,
to_char( ( c.bytes - d.bytes_used ) / 1024 / 1024, &#