How to clear a queue in Oracle AQ

a 夏天 提交于 2019-12-03 04:48:36
erbsock

You can use the DBMS_aqadm.purge_queue_table procedure.


SOLUTION

The SQL looks something like this :

-- purge queue
DECLARE
 po_t dbms_aqadm.aq$_purge_options_t;
BEGIN
  dbms_aqadm.purge_queue_table('MY_QUEUE_TABLE', NULL, po_t);
END;
JOTN

Just do a delete on the queue table.

Never mind, just did a check and that's not right:

Oracle Streams AQ does not support data manipulation language (DML) operations on queue tables or associated index-organized tables (IOTs), if any. The only supported means of modifying queue tables is through the supplied APIs. Queue tables and IOTs can become inconsistent and therefore effectively ruined, if DML operations are performed on them.


So, you'll have to create a little PL/SQL routine to pull the items off.

Use the dbms_aq package. Check the example from the documentation: Dequeuing Messages. Scroll down a little bit and there's a complete example.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!