Oracle Temporal tablespace Usage Analysis

Source: Internet
Author: User

To query the usage of temporary tablespace:

SELECT * FROM (select A.tablespace_name,sum (maxbytes/1024/1024/1024) total_g,sum (a.bytes/1024/1024) ALLOCATED_MB
From Dba_temp_files A
where A.tablespace_name=upper (' XXX ') group by a.tablespace_name) x,
(select sum (b.bytes_used/1024/1024) USED_MB,
SUM (b.bytes_free/1024/1024) FREE_MB
From V$temp_space_header b
where B.tablespace_name=upper (' XXX ') group by b.tablespace_name) y;

Query the SQL statement that occupies the temporary tablespace in the existing run:

Select se.sid,se.username,su.blocks*ts.block_size/1024/1024 Mb_used,su.tablespace,
Su.sqladdr Address,sq.hash_value,sq.sql_text
From V$sort_usage su,v$session se,v$sqlarea sq,dba_tablespaces ts
where su.session_addr=se.saddr
and su.sqladdr=sq.address (+)
and Su.tablespace=ts.tablespace_name;

Query session summary, usage of temporary tablespace:

Select Se.sid,se.username,se.osuser,pr.spid,se.module,se.program,
SUM (su.blocks)ts.block_size/1024/1024 Mb_used,su.tablespace,
Count (
) sorts
From V$sort_usage su,v$session se,dba_tablespaces ts,v$process PR
where su.session_addr=se.saddr
and SE.PADDR=PR.ADDR
and Su.tablespace=ts.tablespace_name
Group BY Se.sid,se.username,se.osuser,pr.spid,se.module,se.program,ts.block_size,su.tablespace;

---Note sometimes we see unable to extend temp segment by 1024x768 in Tablespace AppData;
Not carefully thought is the temporary table space is insufficient, actually here should see AppData table space size

Oracle Temporal tablespace Usage Analysis

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.