Oracle收縮表空間
column SQLTEXT format a80
select count(*) from dba_segments where tablespace_name = ‘USERS‘ and segment_type=‘TABLE‘;
select ‘alter table ‘ || owner || ‘.‘ || segment_name || ‘ move tablespace dbs_temp;‘ sqltext from dba_segments where tablespace_name = ‘USERS‘ and segment_type=‘TABLE‘;
select count(*) from dba_segments where tablespace_name = ‘USERS‘ and segment_type=‘INDEX‘;
select ‘alter index ‘ || owner || ‘.‘ || segment_name || ‘ rebuild tablespace dbs_temp;‘ sqltext from dba_segments where tablespace_name = ‘USERS‘ and segment_type=‘INDEX‘;
select count(*) from from dba_lobs where tablespace_name = ‘USERS‘;
select ‘alter table ‘ || owner || ‘.‘ || table_name || ‘ move lob(‘ || column_name || ‘) store as(tablespace dbs_temp);‘ sqltext from dba_lobs where tablespace_name = ‘USERS‘;
Oracle收縮表空間