oracle表空单清理常用代码段整理
前端之家收集整理的这篇文章主要介绍了
oracle表空单清理常用代码段整理,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
1.查询表空间使用情况:
sqlplus system/manager@topprod
<div class="codetitle"><a style="CURSOR: pointer" data="20759" class="copybut" id="copybut20759" onclick="doCopy('code20759')"> 代码如下:
<div class="codebody" id="code20759">
sql>@q_tbsFREE
2.
查询temp使用
方法:
sqlplus system/manager@topprod
<div class="codetitle">
<a style="CURSOR: pointer" data="12473" class="copybut" id="copybut12473" onclick="doCopy('code12473')"> 代码如下:
<div class="codebody" id="code12473">
sql>SELECT
d.tablespace_name tablespace_name
,d.status tablespace_status
,NVL(a.bytes,0) tablespace_size
,NVL(t.bytes,0) used
,TRUNC(NVL(t.bytes / a.bytes * 100,0)) used_pct
,NVL(s.current_users,0) current_users
FROM
sys.dba_tablespaces d
,( select tablespace_name,sum(bytes) bytes
from dba_temp_files
group by tablespace_name
) a
,sum(bytes_cached) bytes
from v$temp_extent_pool
group by tablespace_name
) t
,v$sort_segment s
WHERE
d.tablespace_name = a.tablespace_name(+)
AND d.tablespace_name = t.tablespace_name(+)
AND d.tablespace_name = s.tablespace_name(+)
AND d.extent_management like 'LOCAL'
AND d.contents like 'TEMPORARY';