标签:tab nts 对象 drop block 占用 loop tempfile rop
释放临时表空间
alter tablespace temp shrink space;
--确定TEMP表空间的ts#
SELECT TS#, NAME FROM SYS.TS$;
--执行清理操作 temp表空间的TS# 为 3*, So TS#+ 1= 4
BEGIN FOR CUR IN 1 .. 10 LOOP EXECUTE IMMEDIATE ‘alter session set events ‘‘immediate trace name DROP_SEGMENTS level 4‘‘‘; END LOOP; END; /
查看占用temp表空间对象;
set lines 200 col username for a20 col b.BYTES_USED/1024/1024/1024||‘G‘ for a30 SELECT a.username,a.sql_id,a.SEGTYPE,b.BYTES_USED/1024/1024/1024||‘G‘,b.BYTES_FREE/1024/1024/1024 FROM V$TEMPSEG_USAGE a JOIN V$TEMP_SPACE_HEADER b ON a.TABLESPACE=b.tablespace_name; set line 232 set pagesize 49999 set wrap off col USERNAME for a8 col tablespace for a10 col sql_text for a60 Select se.username,se.sid,se.serial#,su.extents,su.blocks*to_number(rtrim(p.value))as Space,tablespace,segtype,sql_text from v$sort_usage su,v$parameter p,v$session se,v$sql s where p.name=‘db_block_size‘ and su.session_addr=se.saddr and s.hash_value=su.sqlhash and s.address=su.sqladdr order by se.username,se.sid;
TEMP临时表空间的数据文件使用情况
SELECT file_id,TABLESPACE_NAME AS TABLESPACE_NAME,BYTES_USED/1024/1024/1024 AS TABLESAPCE_USED_GB, BYTES_FREE/1024/1024/1024 AS TABLESAPCE_FREE_GB FROM V$TEMP_SPACE_HEADER ORDER BY 1 DESC;
删除临时表空间文件
ALTER TABLESPACE TEMP DROP TEMPFILE ‘/u01/app/oracle/oradata/GSP/temp02.dbf‘;
标签:tab nts 对象 drop block 占用 loop tempfile rop
原文地址:https://www.cnblogs.com/runingli/p/12174133.html