Databases Reference
In-Depth Information
that want to use concurrent processes for dequeuing. To be precise, this applies only when
applications ask for any message that is ready for dequeuing, which is the predominant
approach. When concurrent processes ask for specific messages, the probability for contention
is lower.
The following example shows how to obtain a SQL trace file that illustrates the use of the
clause
SKIP
LOCKED
by AQ. Before running the code below, make sure you have sufficient privi-
leges to execute the package
DBMS_AQADM
that is needed to create queue tables and queues.
SQL> EXEC dbms_aqadm.create_queue_table('post_office_queue_table', 'raw');
SQL> EXEC dbms_aqadm.create_queue('caught_in_slow_q_again', -
'post_office_queue_table');
SQL> EXEC dbms_aqadm.start_queue('caught_in_slow_q_again');
SQL> ALTER SESSION SET SQL_TRACE=TRUE;
Session altered.
SQL> DECLARE
dequeue_options dbms_aq.dequeue_options_t;
message_properties dbms_aq.message_properties_t;
payload blob;
msgid raw(16);
BEGIN
dequeue_options.wait:=dbms_aq.no_wait; -- default is to patiently wait forever
DBMS_AQ.DEQUEUE (
queue_name => 'caught_in_slow_q_again',
dequeue_options => dequeue_options,
message_properties => message_properties,
payload => payload,
msgid => msgid);
END;
/
DECLARE
*
ERROR at line 1:
ORA-25228: timeout or end-of-fetch during message dequeue from
NDEBES.CAUGHT_IN_SLOW_Q_AGAIN
ORA-06512: at "SYS.DBMS_AQ", line 358
ORA-06512: at "SYS.DBMS_AQ", line 556
ORA-06512: at line 8
In the SQL trace file, you will see an example of a
SELECT
with the
FOR
UPDATE
SKIP
LOCKED
clause.
PARSING IN CURSOR #27 len=367 dep=0 uid=30 oct=47 lid=30 tim=69919173952 hv=38306557
86 ad='6771d48c'
DECLARE
dequeue_options dbms_aq.dequeue_options_t;
message_properties dbms_aq.message_properties_t;
payload blob;
msgid raw(16);
![](Secrets-of-the-Oracle-Database_images/img-gen11617.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11618.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11619.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11620.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11621.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11622.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11623.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11624.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11625.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11626.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11627.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11628.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11629.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11630.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11631.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11632.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11633.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11634.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11635.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11636.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11637.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11638.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11639.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11640.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11641.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11642.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11643.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11644.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11645.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11646.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11647.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11648.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11649.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11650.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11651.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11652.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11653.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11654.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11655.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11656.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11657.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11658.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11659.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11660.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11661.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11662.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11663.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11664.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11665.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11666.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11667.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11668.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11669.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11670.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11671.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11672.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11673.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11674.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11675.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11676.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11677.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11678.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11679.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11680.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11681.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11682.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11683.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11684.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11685.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11686.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11687.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11688.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11689.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11690.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11691.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11692.png)
![](Secrets-of-the-Oracle-Database_images/img-gen11693.png)