Query disconnect session Oracle

Published by Edo on

Query disconnect session Oracle

With the Oracle Query disconnect session article, we can disconnect the user session connected to the database, then the end of the session.

LOCK session situations in frequently accessed databases occur frequently.

With the Oracle Query disconnect session article we provide the solution.

In these cases, it is necessary to identify them with the query available on the articles:

Query utili:

  1. Query to identify which session is determining the LOCK
  2. Query to see the sessions holding LOCK or with the query available on the article
  3. Query to identify the session which is blocking other sessions.

Once the SID that determines the LOCK and the blocked SIDs has been identified, we must deepen the analysis by recovering useful information to be provided to the application group and allowing us to authorize the kill of the session that is causing the block.

The analysis takes place through the query available on the Query article to see the details of a session from SID once authorized we can proceed with the disconnect of the session.
If that doesn’t work, we can try the kill command instead of the disconnect statement Pay maximum attention to the origin of the session that we have to disconnect, in a RAC the SID can be the same on all instances. SERIAL with SID accurately identify the session we are interested in.

Query to disconnect a session for SID:

select ‘alter system disconnect session ”’||SID||’,’||SERIAL#||”’ immediate;’ from gv$session where SID=&sid;

Query to run the disconnect sessions for SID on RAC environment:

select ‘alter system disconnect session’ ” || SID || ‘,’ || SERIAL # || ‘@’ || INST_ID || ‘ immediate; ‘ from gv$session where SID = & sid;

 

Keep in touch!

To view my guides on CRS commands click here! At this LINK, however, you will find SQL queries

Stay updated on our activities by joining our community:
Facebook
Youtube
Linkedin

For any doubt, do not hesitate to comment on the article.


0 Comments

Leave a Reply

Avatar placeholder