确认表空间高水位线,是否有可回收空间。
select a.tablespace_name,a.high_water_mark,b.user_bytes,b.total_bytes from
(SELECT tablespace_name, max(header_block+blocks) * 8192 AS high_water_mark FROM dba_segments WHERE tablespace_name = 'USERS' GROUP BY tablespace_name)
a,dba_tablespaces b
where a.tablespace_name=b.tablespace_name ;
如果total_bytes大于high_water_mark,代表有可回收的空间为total_bytes-high_water_mark,单位byte。
确认回收前,表空间磁盘大小
! ls -l $YASDB_DATA/dbfiles
回收空间
ALTER TABLESPACE USERS SHRINK SPACE KEEP 200M;
这里的200M需大于高水位线,不然无法回收。
确认回收后的表空间大小
select a.tablespace_name,a.high_water_mark,b.user_bytes,b.total_bytes from
(SELECT tablespace_name, max(header_block+blocks) * 8192 AS high_water_mark FROM dba_segments WHERE tablespace_name = 'USERS' GROUP BY tablespace_name) a,dba_tablespaces b
where a.tablespace_name=b.tablespace_name ;
! ls -l $YASDB_DATA/dbfiles
标签:water,YashanDB,name,数据库,bytes,回收,mark,high,tablespace
From: https://www.cnblogs.com/YashanDB/p/18357063