One of the session having slow performance which comparing to other sessions

PC & Tech Category

If one of the session is having a slow performance while compared to other sessions, then this is because, this session is waiting for some event. First of all we go to tune the Query using EXPLAIN PLAN / EXECUTION PLAN.

If we face the same problem even after that, then we approach it with the below steps.

Steps:

  • We will check any objects are locked by particular sessions?

Select * from dba_waiters;Select * from dba_blockers;

  • Respective query return value, we know easily particular session holding & waiting for what type of objects?
  • Pass the holding Sid, to find out what are the queries running by this Sid?

SELECT sql_text

FROM v$sqltext_with_newlines

WHERE address = (SELECT prev_sql_addr

FROM v$session

WHERE username = &uname AND SID = &snum)

ORDER BY piece;

Note: Pass the Username & holding Sid value.

  • Now we decide, “Kill the holding session or waiting session”? (Based on our business needs.)

Example: I have run the one EOD application. In this EOD application contains large number of DML operation. At the end of the EOD we have given the COMMIT. So due to COMMIT, while running the EOD application large number of Objects are locked. Once EOD completed objects are released. (Mostly EOD applications are running on non-peak hours).Now I have executed the EOD application at 10 PM. It took 5 hour. At 12 AM another user connected to database try to update the some objects holded by EOD application session. (Now user session is hanging)At that time I have checked any objects are locked. I have found out the Sid & decided which sessions to be killed. (EOD session or another session). I have checked out the EOD application will complete within 1 hour. Already it took 4 hours. So I have decided to kill the user session. (Remember do this, depending upon your business needs).

  • No locked objects belong to our query objects. So we find out how many sessions access my objects?

Example: I have executed one procedure PROC_TEST. How many users to access the PROC_TEST?

Using the below to find out the user.

Select

V$S.LOGON_TIME,

V$S.SID,V$S.SERIAL#,

V$S.USERNAME,

V$S.PROCESS,

V$P.SPID,

V$S.STATUS,

V$S.MACHINE,

V$S.CLIENT_INFO

from v$session V$S,

v$process V$P

where V$S.PADDR = V$P.ADDR

and V$S.SID in

(Select distinct sid from v$access where object like (‘%&obj%’))

order byV$S.PROCESS,V$S.SID;

  • Wecouldn’tidentify the potential cause root of the query so we will go to the SQL TRACE.
  • Generate the Trace file of the query.
  • Using TKPROF to interpret the output for readability.

Discuss Here


Tags:

Edward Ramamoorthy Avatar

Help Us Grow

If you like this post, please share it with your friends.

You are free to copy and redistribute this article in any medium or format, as long as you keep the links in the article or provide a link back to this page.

Subscribe to Newsletter




Privacy Settings

Privacy & Cookie Overview

Our website uses cookies to provide you with the best user experience possible. These cookies are stored in your browser and perform essential functions such as recognizing you when you return to our website, as well as helping us to understand which sections of the website you find most useful and engaging.

To learn more, you can read our Privacy & Cookie Policy or reach out through our Contact form.

Strictly Necessary Cookies

Strictly Necessary Cookies must always be enabled to ensure the proper functioning of this website and to allow us to provide you with excellent service. These cookies are also essential for saving your cookie preferences.

Google Adsense

We use Google AdSense to keep this site free by displaying relevant ads. AdSense requires essential cookies that cannot be disabled, but you can manage other cookies. We respect your privacy and provide options to control non-essential cookies.

For more details on how Google handles your data, visit Google's Data Usage Policy. Please review our Privacy Policy for more information on how we protect your data.

AddToAny

We use AddToAny for social sharing. It doesn’t store cookies, ensuring a privacy-friendly experience. AddToAny complies with GDPR and CCPA by default.

For more, see their Privacy Policy.

OneSignal

We use OneSignal to send notifications to users who opt in. OneSignal complies with GDPR and is certified under the EU-US and Swiss-US Privacy Shield frameworks.

For more, see their Privacy Policy.

3rd Party Cookies

This website utilizes third-party cookies, which can enhance your experience and support our ongoing efforts to improve our services.

Google Analytics

We use Google Analytics to collect anonymous data, such as visitor numbers and popular pages, to improve user experience and site performance. Keeping this cookie enabled helps us refine the site based on visitor activity.

For more information, see Google’s Privacy Policy.

Discover more from Prime Inspiration

Subscribe now to keep reading and get access to the full archive.

Continue reading