Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 
 

Find the exact data block causing a hung session

Oracle Tips by Burleson Consulting

May 18, 2003, Updated 18 May 2015

It is not uncommon for an end-user session to ?hang? when a user is trying to access a shared data resource that is being held by another end-user.  When a session is waiting on a resource, information can be found in the v$session view in the row_wait_file# and row_wait_block# .  These values will help you identify the source of the contention. 

Also see how to find blocking sessions and how to find Oracle RAC blocking sessions

If we know the data file and block number, we can zoom-in and see exactly what resource is causing the contention.  The file number and block number can then be cross-referenced into the dba_extents view to see the name of the table where the session is waiting on a block.

Here is the script that I use to find the source of hung sessions.  Note how the v$session column row_wait_file# is joined into the dba_extents view.

 
column host     format a6
column username format a10
column os_user  format a8
column program  format a30
column tsname   format a12
 
select
   b.machine         host,
   b.username        username,
   b.server,
   b.osuser          os_user,
   b.program         program,
   a.tablespace_name ts_name,
   row_wait_file#    file_nbr,
   row_wait_block#   block_nbr,
   c.owner,
   c.segment_name,
   c.segment_type
from
   dba_data_files a,
   v$session      b,
   dba_extents    c
See code depot for full script
where
   b.row_wait_file# = a.file_id
and
   c.file_id = row_wait_file#
and
  row_wait_block#  between c.block_id and c.block_id + c.blocks - 1
and
  row_wait_file# <> 0
and
  type='USER'
;

Here is the output from this script:

BOX    USERNAME   SERVER    OS_USER  PROGRAM
------ ---------- --------- -------- ------------------------------
TS_NAME        FILE_NBR  BLOCK_NBR OWNER
------------ ---------- ---------- ------------------------------
SEGMENT_NAME
---------------------------------------------------------------------------
SEGMENT_TYPE
-----------------
avmak1 JONES        DEDICATED server      ?  @avmak1 (TNS interface)
TS_ITEM                9      55342 SYSADM
ITEM
TABLE

The result shows that a session owned by user ?JONES? is waiting for a resource in the TS_ITEM tablespace at data block number 70945. The ITEM table is at data block 55432.

Now that the source of the contention has been identified, you can locate other users who may be holding locks on this table.  This is done by changing the WHERE clause of the above query to include the clause

   WHERE row_wait_block# = 5532;

By the way, this type of wait can commonly be issued when a large update task is holding locks on the table, or when an individual task has placed an exclusive lock on specific rows in the table.

If you like DBA internal tricks, check-out my new book Oracle Tuning: The Definitive Reference by Rampant TechPress. 

[http://dba-oracle.com/include_tuning_book3.htm]

 


 

 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster
 
 
 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.