Oracle locking related checkings: Part I

1. Who is placing a lock on a table and what is the person doing:

define thesid=”
COLUMN thesid NOPRINT NEW_VALUE thesid
select o.object_name, session_id thesid, oracle_username, locked_mode
from v$locked_object lo, dba_objects o
where o.object_id=lo.object_id and o.object_name=‘table_name’;
select a.sid, a.serial#, b.sql_text from v$session a, v$sqlarea b where a.sql_address=b.address
  and a.sid=’&&thesid’;

2. List the blocking sessions

select blocking_session, sid, serial#, wait_class, seconds_in_wait
from v$session
where blocking_session is not NULL
order by blocking_session;
Advertisements
This entry was posted in Blogroll. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s