
1、查询临时表空间占用情况(最大使用,不是真实)select * from (select
c.tablespace_name,sum(decode(c.maxbytes, 0, c.bytes,
maxbytes))/1024/1024 max_mb,sum(c.bytes) /1024 /1024 temp_mb from
dba_temp_files c group by tablespace_name) b;
2、查看临时表空间文件 select tablespace_name,file_name,bytes/1024/1024
file_size,autoextensible from dba_temp_files;
3、查询用户默认临时表空间 select username,temporary_tablespace from
dba_users;
4、查看数据库默认的临时表空间 select * from database_properties where
property_name='DEFAULT_TEMP_TABLESPACE';
5
、查看哪些用户在使用临时段
select
se.username,se.sid,se.serial#,se.sql_address,se.machine,se.progra
m,su.tablespace,su.segtype,su.contents from v$session se,
v$sort_usage su where se.saddr = su.session_addr;
SELECT
s.sid,s.serial#,s.username,p.spid,s.module,p.program,SUM(su.block
s)*tbsp.block_size/1024/1024 mb_used ,su.tablespace FROM
v$sort_usage su,v$session s,dba_tablespaces tbsp,v$process p WHERE
su.session_addr=s.saddr AND su.tablespace=tbsp.tablespace_name AND
s.paddr=p.addr GROUP BY
s.sid,s.serial#,s.username,s.osuser,p.spid,s.module,
p.program,tbsp.block_size,su.tablespace ORDER BY s.sid;
6、临时表空间数据文件使用率(真实占用)select round((f.BYTES_FREE +
f.BYTES_USED) / 1024 / 1024, 2) "total MB",round(((f.BYTES_FREE +
f.BYTES_USED) - nvl(p.BYTES_USED, 0)) / 1024 / 1024,2) "Free
MB",round(nvl(p.BYTES_USED, 0) / 1024 / 1024, 2) "Used
MB",round(nvl(p.BYTES_USED, 0) / 1024 / 1024, 2) /round((f.BYTES_FREE
评论