Sie sind auf Seite 1von 2

3/27/2015

OracleRecipes::MonitorlongrunningOracleoperations

oraclerecipes
ProblemWanttoknowhowlongyouhaveto
waituntiltheoperationfinishes?
Sometimeswhenyourunaslowquerywhichproducesafulltablescan,you'llhavetoknowhowlong
it'sgoingtotakeforthequerytofinish.There'sasimplequerywhichshowsyouhowmanyseconds
elapsedandhowmanysecondsyou'llhavetowait.

Recipe#1Getdetailsaboutlongrunning
operations
Runthefollowingqueryandyou'llgetmostinformationyouneed:
SELECTosuser,
sl.sql_id,
sl.sql_hash_value,
opname,
target,
elapsed_seconds,
time_remaining
FROMv$session_longopssl
innerjoinv$sessionsONsl.SID=s.SIDANDsl.SERIAL#=s.SERIAL#
WHEREtime_remaining>0

Recipe#2ShowlongrunningSQLStatements
IfyoualsowanttoseetheSQLquerycausingthelongrunningoperation,justjoinv$sqllikeshow
below:
SELECTs.username,
sl.sid,
sq.executions,
sl.last_update_time,
sl.sql_id,
sl.sql_hash_value,
opname,
target,
elapsed_seconds,
time_remaining,
sq.sql_fulltext
FROMv$session_longopssl
INNERJOINv$sqlsqONsq.sql_id=sl.sql_id
INNERJOINv$sessionsONsl.SID=s.SIDANDsl.serial#=s.serial#
WHEREtime_remaining>0
http://www.oraclerecipes.com/monitoring/monitorlongrunningoracleoperations/

1/2

3/27/2015

OracleRecipes::MonitorlongrunningOracleoperations

Copyright20102015byOracleRecipes.com
OracleistheregisteredtrademarkofOracleCorporation.

http://www.oraclerecipes.com/monitoring/monitorlongrunningoracleoperations/

2/2

Das könnte Ihnen auch gefallen