Ways to find blocked and blocked SIDs in Oracle ____oracle

Source: Internet
Author: User

In Oracle, blocking and blocking are frequently encountered.

There are several main ways to find blocking and blocking:
I. By looking for V$lock and V$locked_object
This is the most common and direct method.

Sql> Select Sid,block from V$lock where block=1;

SID Block
---------- ----------
252 1

--as you can see, sid=252 's session blocks the rest of the session.


Sql>
Sql> Select object_id,session_id from V$locked_object where object_id into (select object_id from V$locked_object where s ession_id=252);

OBJECT_ID session_id
---------- ----------
63833 252
63833 269

Sql>

--it can be concluded that sid=252 's session blocked sid=269 's session.


Two. By looking for Dba_waiters and dba_blockers
Sql> select * from Dba_blockers;

Holding_session
---------------
252

As you can see, sid=252 's session blocks other sessions.

Sql> select Waiting_session,holding_session from Dba_waiters;

Waiting_session holding_session
--------------- ---------------
269 252

As you can see, the holding_session is 252 and the waiting waiting_session is 269.

Three. In Oracle 10G, you can find through the Blocking_session field in V$session
Sql> Select Sid,blocking_session from v$session where blocking_session are NOT null;

SID blocking_session
---------- ----------------
269 252

Original address: http://charsi.itpub.net/post/42352/516427

Related Article

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.