Listing Objects
All queues - including exception queues
-
select *
-
from user_queues;
-
SELECT *
-
FROM user_queue_tables;
Subscribers
-
select *
-
from "SYS"."DBA_QUEUE_SUBSCRIBERS"
-
;
Subscriber Registrations
-
select *
-
from "SYS".DBA_SUBSCR_REGISTRATIONS;
Queues and stats (Msgs waiting)
-
select q.name, stats.*
-
from "SYS"."V_$AQ" stats
-
left join (
-
select *
-
from "SYS"."DBA_QUEUES"
-
) q on q.qid=stats.qid
-
where ready>0
Deleting Objects
-
begin
-
dbms_aqadm.stop_queue('AQ$_RJMTESTQ_001_QTAB_E');
-
dbms_aqadm.drop_queue('AQ$_RJMTESTQ_001_QTAB_E');
-
dbms_aqadm.drop_queue_table('RJMTESTQ_001_QTAB');
-
commit;
-
end;
Altering Queue Props
-
DBMS_AQADM.ALTER_QUEUE (
-
queue_name =>'GMSELEMENTSYNCEBIZ',
-
max_retries =>4,
-
retry_delay =>60,
-
retention_time =>5184000);
-
end;
Force drop queue
-
begin
-
DBMS_AQADM.DROP_QUEUE_TABLE (queue_table => upper('SOA_JMS.JMS_QTAB'),FORCE=>true);
-
end;
Oracle support note: https://blogs.oracle.com/db/entry/oracle_support_master_note_for_aq_que…
-
select *
-
from GV$QMON_COORDINATOR_STATS;
-
-
select *
-
from GV$QMON_SERVER_STATS;
Queue Granting
-
select *
-
from QUEUE_PRIVILEGES
-
;
Start/Stop queue (for either enqueue or dequeue)
Param meening. If enqueue or dequeue is false keep current state. True to change start
Use START_QUEUE or STOP_QUEUE
The following code will do nothing unless false is changed to true
-
BEGIN
-
DBMS_AQADM.START_QUEUE(
-
queue_name => 'test.obj_queue',
-
enqueue => false
-
dequeue => false
-
);
-
DBMS_AQADM.STOP_QUEUE(
-
queue_name => 'test.obj_queue',
-
enqueue => false
-
dequeue => false
-
);
-
END;
Select properties from queue items
-
select
-
q.queue,
-
TREAT (q.user_data as sys.aq$_jms_text_message).get_string_property('IC_REL_ORIG_QUEUE') as orig_queue,
-
TREAT (q.user_data as sys.aq$_jms_text_message).get_string_property('IC_REL_PHASE_ID') as phase_id,
-
TREAT (q.user_data as sys.aq$_jms_text_message).get_string_property('IC_REL_RESUBIMT_ID') as resubmit_id
-
from soa_jms.aq$systemerror_qtab q
-
order by
-
q.enq_timestamp desc
-
Debug
Support master note:
https://blogs.oracle.com/db/entry/oracle_support_master_note_for_aq_que…
QMON - Queue Monitor Process
http://www.dba-oracle.com/t_v$_qmon_task_stats.htm
-
select *
-
from v$qmon_coordinator_stats
-
;
-
select *
-
from GV$QMON_SERVER_STATS
-
;
-
select *
-
from v$qmon_tasks
-
;
Is there a task QMON_PERSISTENT_TM?
When did is start?
Healthcheck script oracle Doc ID 1193854.1
Drop subscriber
-
DECLARE
-
subscriber sys.aq$_agent;
-
BEGIN
-
subscriber := sys.aq$_agent('subscriber1','aq2.msg_queue2', NULL);
-
DBMS_AQADM.REMOVE_SUBSCRIBER(
-
queue_name => 'aq.multi_queue',
-
subscriber => subscriber);
-
END;
JMS Text Message
Output
-
set serveroutput on
-
-
declare
-
l_message sys.aq$_jms_text_message;
-
l_messagePropArray sys.aq$_jms_userproparray;
-
l_messageProp sys.aq$_jms_userproperty;
-
l_message_data clob;
-
l_xml xmltype;
-
l_tmp varchar2(4096);
-
l_offset number := 1;
-
l_c number;
-
begin
-
dbms_output.put_line('Start');
-
-
select q.user_data
-
into l_message
-
from
-
soa_jms.aq$jms_qtab q
-
where msg_id='11BB7419A9850C6FE053AF39C69B8F3E'
-
;
-
-
l_message.get_text(l_message_data);
-
l_xml := XMLTYPE(l_message_data);
-
-
loop
-
exit when l_offset > dbms_lob.getlength(l_message_data);
-
dbms_output.put_line( dbms_lob.substr( l_message_data, 255, l_offset ) );
-
l_offset := l_offset + 255;
-
end loop;
-
-
l_messagePropArray := l_message.header.properties;
-
-
dbms_output.put_line('');
-
dbms_output.put_line('Props');
-
dbms_output.put_line('=====');
-
for l_c in 1..l_messagePropArray.count LOOP
-
l_messageProp := l_messagePropArray(l_c);
-
dbms_output.put_line('Name=' || l_messageProp.name);
-
dbms_output.put_line('Type=' || l_messageProp.type);
-
dbms_output.put_line('str_value=' || l_messageProp.str_value);
-
dbms_output.put_line('num_value=' || l_messageProp.num_value);
-
dbms_output.put_line('java_type=' || l_messageProp.java_type);
-
dbms_output.put_line('-----');
-
END LOOP;
-
-
/*
-
select XMLSERIALIZE(Document l_xml as CLOB INDENT SIZE = 2)
-
into l_tmp
-
from dual;
-
dbms_output.put_line(l_tmp);
-
*/
-
-
-
dbms_output.put_line('End');
-
end;
Remove Subscriber
Delete Subscriber
-
DECLARE
-
subscriber sys.aq$_agent;
-
queueSchema varchar2(1024) := 'soa_jms';
-
queueN varchar2(1024) := 'RJMTEST001';
-
subN varchar2(1024) := 'RJMTEST001';
-
BEGIN
-
subscriber := sys.aq$_agent(subN,queueN, NULL);
-
DBMS_AQADM.REMOVE_SUBSCRIBER(
-
queue_name => queueSchema || '.' || queueN,
-
subscriber => subscriber);
-
END;
Purging Queue Messages
-
DECLARE
-
l_purge_opt dbms_aqadm.aq$_purge_options_t;
-
BEGIN
-
l_purge_opt.block := TRUE;
-
dbms_aqadm.purge_queue_table(
-
queue_table => 'APPS.WF_BPEL_QTAB'
-
,purge_condition => 'queue = ''WF_BPEL_Q'' AND MSG_ID=''1CCCCCC23'' AND qtview.msg_state=''PROCESSED'''
-
,purge_options => l_purge_opt
-
);
-
END;
See https://code2.metcarob.com/node/256
Release 12 AQ Changes
3 Teir background architecture
https://docs.oracle.com/database/121/ADQUE/componet.htm#ADQUE3663
-
select *
-
from GV$AQ_BACKGROUND_COORDINATOR
-
;
-
-
select *
-
from GV$AQ_JOB_COORDINATOR
-
;
-
-
select *
-
from GV$AQ_SERVER_POOL
-
;