The PL/SQL lock timer wait event represents the amount of time a user or application has "slept" through the USER_LOCK.SLEEP or DBMS_LOCK.SLEEP procedures. The PL/SQL lock timer event is worth watching because it can indicate issues with application response, throughput and possibly coding.
2. About Oracle PL/SQL Lock Timer
Wait Events
• Represents the amount of time a user or
application has "slept" through the
USER_LOCK.SLEEP or DBMS_LOCK.SLEEP
procedures
• Is a sleep mandated by the application code
– Indicates that the application is idle and doing nothing
– For example, if the application sleeps for a combined
interval of five minutes, the response to the user or
complete run of the application will take at least five
minutes longer
12/4/2013
2
3. Why It’s Worth Watching the
PL/SQL Lock Timer Waits
• Can indicate issues with application response,
throughput and possibly coding
• Oracle sleeps are put into an application for
serialization of transactional events or spinning
on queues until something happens
• When the event occurs or a queue is populated,
then the application continues its work
• You will gain quicker responses if you trigger an
action instead of the action waiting for an event
12/4/2013
3
4. How to look at the PL/SQL Lock
Timer wait event
•
To initiate a sleep for the current session for five seconds:
SQL> execute sys.dbms_lock.sleep(5);
•
To look at current sessions that are using the SLEEP command:
SQL> select osuser,event,p1 from v$session where event = 'PL/SQL lock timer'
OSUSER EVENT P1
Johnny Smith PL/SQL lock timer 500
– Note that the column P1 in V$SESSION does not represent the amount of time the session has
slept but the duration this session will sleep
– Also note that this column is in centiseconds (the five seconds issued for a sleep has been
translated in to 500 centiseconds)
•
To see the total amount of time accumulated for this wait event, look at the
V$SYSTEM_EVENT view.
SQL> select time_waited from v$system_event where event = 'PL/SQL lock timer';
– Note that the time waited is also in centiseconds, but the time actually waited may be more
that expected. On our test system this equated to about 1.024 seconds to 1 second requested.
12/4/2013
4
5. Recommendations for the PL/SQL
Lock Timer wait event
• If an application is waiting for the PL/SQL lock timer wait,
the end user is also waiting
• As DBAs, our job is to increase the throughput of the Oracle
engine by limiting the amount of time an application runs
• We recommend asking why an application is sleeping for
any amount of time and providing alternatives if necessary
to reduce this idle event
• We must use response time analysis and a tool such as
Confio Ignite to:
– Identify the wait
– Determine its impact
– Provide an environment that allows database workload to
complete within respected times
12/4/2013
5
6. With Confio Ignite, You Find Root
Cause of Waits Quickly
• Improve database performance by 65% with
Confio Ignite
– Installs in minutes
– Puts no load on monitored servers
– Identify bottlenecks and root causes of blocks like
these in minutes
Download Ignite trial for free
www.confio.com/freetrial
12/4/2013
6