Solved

Oracle Advanced Queue: Dequeue not working, stuck in WAIT state, DELAY_TIMESTAMP - SYSTIMESTAMP > 0

Posted on 2009-07-01
2
4,522 Views
Last Modified: 2013-12-19
The queue's view DELAY_TIMESTAMP column appears to have the correct time, but when compared to SYSTIMESTAMP, there's an unexpected five hour difference.   After the message should have gone to the READY state, it is still in the WAIT state.

For example, a message is enqueued using DBMS_AQ.ENQUEUE with delay of 60 seconds.  I wait till well after the message should be dequeued.  The message is still in the queue despite attempting to dequeue it with DBMS_AQ.DEQUEUE.  Here is what the query looks like.

select delay_timestamp, systimestamp , delay_timestamp - systimestamp
from AQ$THE_QUEUE;
DELAY_TIMESTAMP =                     7/1/2009 8:23:05.769546 PM
SYSTIMESTAMP =                            7/1/2009 9:06:23.944861 PM +00:00
DELAY_TIMESTAMP-SYSTIMESTAMP   +00 04:16:41.824685

The difference should be negative because the time should have expired.  However, it's positive, exactly 5 hours less the time since it was enqueued.

This code worked fine until it was re-installed as part of dropping and creating the Oracle user.  It works fine on Oracle XE and other databases.  The problem is consistent with some change having been done either in Oracle or the Unix operating system.  I don't have control over those systems and the administrator says nothing changed.  Oracle has been stopped and started since the problem was noticed.  The queue table was then dropped and recreated.

Do you have any idea as to what could cause the difference?  It looks like a difference between GMT and CDT time zones.  It could be related to the session time zone.

It is Oracle 10g 10.2.0.4.0.

Thank you...

w_enqueue_options    dbms_aq.enqueue_options_t;

   w_message_handle     RAW(16);

   w_message_properties dbms_aq.message_properties_t;

BEGIN

   w_obj := NEW obj();

   w_message_properties.delay := 60;
 

   dbms_aq.enqueue(queue_name => 'AQ.THE_QUEUE',

                   enqueue_options => w_enqueue_options,

                   message_properties => w_message_properties,

                   payload => w_obj,

                   msgid => w_message_handle);
 

END;

Open in new window

0
Comment
Question by:EdFred
2 Comments
 
LVL 13

Expert Comment

by:anand_2000v
ID: 24770713
what about the code to dequeue?
0
 

Accepted Solution

by:
EdFred earned 0 total points
ID: 24785927
Thanks for the reply.

Here's the DEQUEUE code.  I do not expect DEQUEUE to retrieve any data because the because the message MSG_STATE is WAIT.

But it is moot.  I just decided to not use Oracle AQ.  It's has a lot of neat features and works with the many tests I've run on it.  But, for me, it has not been as stable as regular tables.

It's not worth investigating anymore.
-Ed
   w_dequeue_options    DBMS_AQ.DEQUEUE_OPTIONS_T;

   w_message_handle     RAW(16);

   w_message_properties DBMS_AQ.MESSAGE_PROPERTIES_T;

BEGIN

   w_dequeue_options.wait := 30;

   --in_filter is an input arg

   w_dequeue_options.deq_condition :='tab.user_data.filter='''||in_filter||'''';
 

   DBMS_AQ.DEQUEUE(queue_name => 'AQ.THE_QUEUE',

                   dequeue_options => w_dequeue_options,

                   message_properties => w_message_properties,

                   payload => w_obj,   --SP instantiates v_message

                   msgid => w_message_handle);

Open in new window

0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Format Number Field 10 40
oracle report printing 2 pages in one page 2 38
EXECUTE IMMEDIATE 5 36
report returning null 21 52
Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now