Mobile Application Services

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Thursday, 29 November 2012

Scripts related to TEMP Tablespace

Posted on 23:24 by Unknown

To see Temp Space:
-------------------

SELECT a.tablespace_name,ROUND((c.total_blocks*b.block_size)/1024/1024/1024,2)
"Total Size [GB]",ROUND((a.used_blocks*b.block_size)/1024/1024/1024,2) "Used_size[GB]",
ROUND(((c.total_blocks-a.used_blocks)*b.block_size)/1024/1024/1024,2) "Free_size[GB]",
ROUND((a.max_blocks*b.block_size)/1024/1024/1024,2) "Max_Size_Ever_Used[GB]",            
ROUND((a.max_used_blocks*b.block_size)/1024/1024/1024,2) "MaxSize_ever_Used_by_Sorts[GB]" ,
ROUND((a.used_blocks/c.total_blocks)*100,2) "Used Percentage"
FROM V$sort_segment a,dba_tablespaces b,(SELECT tablespace_name,SUM(blocks)
total_blocks FROM dba_temp_files GROUP by tablespace_name) c
WHERE a.tablespace_name=b.tablespace_name AND a.tablespace_name=c.tablespace_name;


==============================================================================================
To see top 10 consuming process :
---------------------------------

select * from
(SELECT d.tablespace_name,a.sid,a.serial#,a.program,a.module,a.action,a.username "DB Username",a.osuser,ROUND((b.blocks*d.block_size)/1024/1024,2) "Used MB",c.sql_text
FROM v$session a, v$tempseg_usage b, v$sqlarea c,dba_tablespaces d
WHERE a.saddr = b.session_addr AND c.address= a.sql_address AND c.hash_value = a.sql_hash_value AND d.tablespace_name=b.tablespace ORDER BY b.tablespace, b.blocks DESC)
where rownum <=10


==============================================================================================

Query to check TEMP USAGE :
----------------------------

col name for a20
SELECT d.status "Status", d.tablespace_name "Name", d.contents "Type", d.extent_management
"ExtManag",
TO_CHAR(NVL(a.bytes / 1024 / 1024, 0),'99,999,990.900') "Size (M)", TO_CHAR(NVL(t.bytes,
0)/1024/1024,'99999,999.999') ||'/'||TO_CHAR(NVL(a.bytes/1024/1024, 0),'99999,999.999') "Used (M)",
TO_CHAR(NVL(t.bytes / a.bytes * 100, 0), '990.00') "Used %"
FROM sys.dba_tablespaces d, (select tablespace_name, sum(bytes) bytes from dba_temp_files group by
tablespace_name) a,
(select tablespace_name, sum(bytes_cached) bytes from
v$temp_extent_pool group by tablespace_name) t
WHERE d.tablespace_name = a.tablespace_name(+) AND d.tablespace_name = t.tablespace_name(+)
AND d.extent_management like 'LOCAL' AND d.contents like 'TEMPORARY';



=================================================================================================

To Check Percentage Usage of Temp Tablespace:
---------------------------------------------

select (s.tot_used_blocks/f.total_blocks)*100 as "percent used"
from (select sum(used_blocks) tot_used_blocks
from v$sort_segment where tablespace_name='TEMP') s,
(select sum(blocks) total_blocks
from dba_temp_files where tablespace_name='TEMP') f;

=================================================================================================
To find Sort Segment Usage by a particular User:
------------------------------------------------

SELECT s.username,s.sid,s.serial#,u.tablespace, u.contents, u.extents, u.blocks
FROM v$session s, v$sort_usage u
WHERE s.saddr=u.session_addr
order by u.blocks desc;

===================================================================================================
To find Total Free space in Temp Tablespace :
---------------------------------------------

select tablespace_name , (free_blocks*8)/1024/1024  FreeSpaceInGB,
(used_blocks*8)/1024/1024  UsedSpaceInGB,
(total_blocks*8)/1024/1024  TotalSpaceInGB
from v$sort_segment where tablespace_name like '%TEMP%'

=====================================================================================================
Get 10 sessions with largest temp usage :
-----------------------------------------

cursor bigtemp_sids is
select * from (
select s.sid,
s.status,
s.sql_hash_value sesshash,
u.SQLHASH sorthash,
s.username,
u.tablespace,
sum(u.blocks*p.value/1024/1024) mbused ,
sum(u.extents) noexts,
nvl(s.module,s.program) proginfo,
floor(last_call_et/3600)||':'||
floor(mod(last_call_et,3600)/60)||':'||
mod(mod(last_call_et,3600),60) lastcallet
from v$sort_usage u,
v$session s,
v$parameter p
where u.session_addr = s.saddr
and p.name = 'db_block_size'
group by s.sid,s.status,s.sql_hash_value,u.sqlhash,s.username,u.tablespace,
nvl(s.module,s.program),
floor(last_call_et/3600)||':'||
floor(mod(last_call_et,3600)/60)||':'||
mod(mod(last_call_et,3600),60)
order by 7 desc,3)
where rownum < 11;

============================================================================================

Identifying WHO is currently using TEMP Segments :
---------------------------------------------------


SELECT sysdate,a.username, a.sid, a.serial#, a.osuser, (b.blocks*d.block_size)/1048576 MB_used, c.sql_text
FROM v$session a, v$tempseg_usage b, v$sqlarea c,
     (select block_size from dba_tablespaces where tablespace_name='TEMP') d
    WHERE b.tablespace = 'TEMP'
    and a.saddr = b.session_addr
    AND c.address= a.sql_address
    AND c.hash_value = a.sql_hash_value
    AND (b.blocks*d.block_size)/1048576 > 1024
    ORDER BY b.tablespace, 6 desc;


=============================================================================================


































Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in TEMP Tablespace | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • Difference Between Oracle apps 11i & R12
    Summary of Changes : Component Release 11i Release 12 Database 9.2 10.2 Developer 6i 10i Application Server 1.0 10.1 Client Plug-in Jinitiat...
  • Obtaining Forms Runtime Diagnostics (FRD) In Oracle Applications
    A. Introduction When starting a Forms-based session in Applications it is possible to pass various useful parameters like formname=xyz, or l...
  • The simplest query for checking what’s happening in a database
    When someone asks you to take a quick look into database performance and for whatever reason you can’t run your usual scripts or performance...
  • Refresh vs Clone
    Refreshing VS Cloning an e-Business Suite Environment What is Refreshing? A refresh is where the data in the target environment has been syn...
  • How To Change Look And Feel and Colors Of Oracle Applications 11i and R12
    There are two system profile options that can be used to change look and feel.  Java Look and Feel . Java Look and Feel can have two values:...
  • Workflow Scripts
    1.Check for workflow components: ================================ set pagesize 400 set linesize 120 set pagesize 50 column COMPONENT_NAME fo...
  • CMAN [ Oracle Connection Manager ]
                                         Oracle Connection Manager helps a client process with directions to a network address. The Oracle Conn...
  • Oracle 11g RAC Interview question and answers
    1. What is the major difference between 10g and 11g RAC? Well, there is not much difference between 10g and 11gR (1) RAC. But there is a sig...
  • Concurrent Manager : troubleshooting
    Concurrent Manager : troubleshooting Summary of Possible Reasons and Solutions for the Problem Where All Concurrent Requests Stuck in Pendin...
  • How to lock/unlock statistics on a table?
                   In certain cases you may want to lock statistics in a table in certain cases, for example if you want a table not be analyzed...

Categories

  • 11.2.0.3 to 12.1.0 (Oracle 12c) upgrade
  • Backup and recovery
  • Basic RAC Commands
  • Blocking Sessions
  • CMAN [ Oracle Connection Manager ]
  • Data Guard Interview Questions
  • Deadlocks
  • Difference Between Oracle apps 11i & R12
  • File Locations -R12
  • Gather stats on table in oracle
  • How To Change Look And Feel and Colors Of Oracle Applications 11i and R12
  • How to compile invalid objects in an APPS Environment
  • How to recover Applications context file if it is corrupted or deleted accidentally?
  • How to Recreate the OraInventory?
  • Important DBA Views
  • JInitiator version too low and quot Errors in EBS Environments
  • Linux interview questions for DBA
  • Log file location in Oracle Apps 11i/R12
  • Long running concurrent requests
  • MWA Services
  • Obtaining Forms Runtime Diagnostics (FRD) In Oracle Applications
  • ORA-00845: MEMORY_TARGET not supported on this system
  • Oracle 11g RAC Interview question and answers
  • Oracle Applications Idle Session Timeout
  • Oracle Apps DBA Interview Questions
  • Oracle DBA Interview Questions
  • Oracle E-Business Suite 12.2 Architecture
  • Oracle Exadata Interview Questions
  • Personalizing The Login Page
  • RAC Cheat Sheet
  • RAC Interview Questions
  • Recovery catalog for RMAN backup
  • Refresh vs Clone
  • REP-3000 Oracle Toolkit Error
  • Replacing Jinitiator with JRE
  • RMAN Backup
  • RMAN Commands List (Oracle 11g)
  • Snapshot
  • TEMP Tablespace
  • Tracing Techniques
  • Undo Tablespace
  • Unix for DBA's
  • Workflow Mailer Troubleshooting
  • Workflow Trouble Shooting

Blog Archive

  • ►  2013 (30)
    • ►  November (3)
    • ►  October (3)
    • ►  August (3)
    • ►  July (1)
    • ►  May (1)
    • ►  March (10)
    • ►  February (8)
    • ►  January (1)
  • ▼  2012 (27)
    • ▼  November (1)
      • Scripts related to TEMP Tablespace
    • ►  October (8)
    • ►  September (5)
    • ►  August (5)
    • ►  July (7)
    • ►  June (1)
Powered by Blogger.

About Me

Unknown
View my complete profile