Oracle查询用户占用空间及清理空间语句


SET NEWPAGE NONE HEADING OFF SPACE 0 PAGESIZE 0 TRIMOUT ON TRIMSPOOL ON LINESIZE 2500 colsep | feedback off termout off pages 0
set colsep |
alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';
spool deltab.sql
select 'truncate table ' || tname || ' drop storage' ||';' from tab
where TNAME not like '%TB%'
and TNAME like '%LZW%';
spool off;
exit;

SET NEWPAGE NONE HEADING OFF SPACE 0 PAGESIZE 0 TRIMOUT ON TRIMSPOOL ON LINESIZE 2500 colsep | feedback off termout off pages 0
set colsep |
alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';
spool lzw_tablespace.txt
 select a.segment_name||'|'||sum(BYTES)/1024/1024||'|' from user_segments a 
 group by a.segment_name
 order by sum(BYTES)/1024/1024 desc ;
spool off;

nohup sqlplus  ZJLZ/xx@szj @deltab.sql>deltab.log &

相关内容