Ora01031 in dbms_aq.enqueue
Hi..I have a procedure that calls dbms_aq.enqueue but I always get the exception _"ORA-01031: insufficient privileges"_.
It is called from Oracle Apps Workflow, my procedure is in APPS schema. I have given all the required grants. I get the same error if I execute DBMS_AQ.ENQUEUE from SQL PLUS.
Request some help/suggestions here.
GRANT EXECUTE ON DBMS_AQ TO APPLSYS;
GRANT EXECUTE, DEBUG ON DBMS_AQ TO APPS WITH GRANT OPTION;
GRANT EXECUTE, DEBUG ON DBMS_AQ TO AQADMIN;
GRANT EXECUTE ON DBMS_AQ TO AQ_ADMINISTRATOR_ROLE;
GRANT EXECUTE ON DBMS_AQ TO AQ_USER_ROLE;
GRANT EXECUTE ON DBMS_AQ TO EXECUTE_CATALOG_ROLE;
GRANT EXECUTE ON DBMS_AQ TO MGWUSER;
GRANT EXECUTE ON DBMS_AQ TO NATCRM;
GRANT EXECUTE ON DBMS_AQ TO OEM_MONITOR;
GRANT EXECUTE ON DBMS_AQ TO STRMADMIN;
GRANT EXECUTE ON DBMS_AQ TO SYSTEM WITH GRANT OPTION;
Similar Messages
-
Doubt: Problem in enqueing using DBMS_AQ.enqueue procedure
Hello All,
I have one issue with Oracle AQ. One of our implementation requires us to extract data from the tables and enqueue the extracted data into an Oracle AQ.
I will try to explain my problem as briefly as possible:
1. We have created a queue of type CLOB using the following procedure
begin
dbms_aqadm.create_queue_table('BOD36_3PLB2B_TABLE', 'IKN_CLOB'); -- IKN_CLOB—This is CLOB custom type that we have created to have CLOB data.
dbms_aqadm.create_queue('BOD36_3PLB2B_Q', 'BOD36_3PLB2B_TABLE');
dbms_aqadm.start_queue('BOD36_3PLB2B_Q');
end;
The queue creation was successful.
2. Then we have developed a package to extract data from the database into a VARRAY and then using the varray as the payload.
3. In the package we are calling the following code to enqueue data into the database with the VARRAY as the payload
dbms_aq.enqueue(queue_name => ikn_qname,
enqueue_options => lt_enqueue_options,
message_properties => lt_message_properties,
payload => p_SHOWPL_ARR_OUT, ---> p_SHOWPL_ARR_OUT it is the varray to which we are putting the data to enqueue
msgid => messageid);
4. When I compile the package, I get the error: PLS-00306: wrong number or types of arguments in call to 'ENQUEUE'.
If you have faced similar issues and have any pointers to the above, then please help!! I am not sure where i have gone wrong.
Please help !!!!!
Thanks in advance and thanks for your patience.
Regards,
DibyaThe package has another function enqueue_array. Maybe that will help you. Check it out from the Oracle docs.
Ben -
Advanced queue DBMS_AQ.ENQUEUE procedure
Hi all.
I want to use the oracle DBMS_AQ.ENQUEUE procedure to enqueue a message to a specified queue. However I want to only do it in an after statement trigger (for insert update or delete).
My concern is if the DML operation is rolled back for whatever reason, the message might remain (ie: I only want the message to remain if the record is commited).
Can anyone tell me if the DBMS_AQ.ENQUEUE would be rolled back and reversed if the DML operation is rolled back? Or if Oracle decides to re-do the operation for write concurrency, etc.. ?
Any ideas on how to make it work if not?
Regards,
Greg.Well it appears that I was mistaken. Wouldn't be the first time. But hey - it got you to read the docs. And that's a good thing!
You should be okay in an AFTER STATEMENT trigger since that trigger will only fire once and there will no side effects.
But as Tom Kyte has said
>
Now, before we discuss this - you must be made aware that not only do we NOT promise to fire the trigger once - we actually promise to fire it more than once in certain cases:
You are doing something non-transactional in a trigger - we are doing a statement level rollback silently on you (we do those, we have always done those, we will always do those). When we rollback - your code doesn't "rollback".
in general before, before for each row, after for each row triggers can fire twice in a multi-row update"
{quote}
See this in his Followup April 28, 2010 - 7am Central time zone: at
http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:2599480800346313755#2600827300346401245 -
Standard datatype in dbms_aq.enqueue procedure
Payload argument is defined as standard datatype in dbms_aq.enqueue procedure definition. Any object type can then be passed to the enqueue procedure. Can we define an argument's type as STANDARD in a user defined PL/SQL procedure ?
What is standard datatype ? I haven't seen documentation for it.
PROCEDURE ENQUEUE
Argument Name Type
QUEUE_NAME VARCHAR2 IN
PAYLOAD STANDARD IN
other arguments..The payload has to be a user created object type. In Oracle9i you can use SYS.Anydata or SYS.XMLType.
-
How many recipients can be added to one enqueue procedure?
Hi all,
Does anybody know how many recipients can be added to one DBMS_AQ.ENQUEUE procedure?
According to a user's guide of Advanced Quing, it seems that we can have 1000 "local queue" subscribers and/or 32 "remote database" subscribers.
But I'm not sure this restriction is also true to the recipient list which I just declare when I enqueue messages. (I didn't do ADD_SUBSCRIBER.)
Also, I wander what does the remote "database" mean. At first, I thought it meaned totally different database instance (we need to use DB link or something to connect it), however, it seems that we can't add more than 32 remote queue subscribers.
I'm using 10g R2.
Any information on this matter will be highly appreciated.
Thanks,Hi,
I think there is some confusion between users and subscriber for a queue. Subscriber which dedicatedly point to queue and users who have privilege to dequeue the message. If you are not using ADD_subscriber that means you are connecting to queues as a user with dequeue privilieges. -
Message Selector and Setting JMS Header Properties PL/SQL Enqueue
Currently I am attempting to use the Message selector functionality. I just know know exactly how we need to set the property in PL/SQL when enqueuing. I also want to verify the syntax that I should use in the event that I am doing this incorrectly...
The code I am using to test the enqueue is
declare
enqueue_options dbms_aq.enqueue_options_t;
message_properties dbms_aq.message_properties_t;
message_handle RAW(16);
agent sys.aq$_agent := sys.aq$_agent('', null, null);
message sys.aq$_jms_text_message;
recipients DBMS_AQ.aq$_recipient_list_t;
BEGIN
message := sys.aq$_jms_text_message.construct;
message.set_text('<ORDER><HEADER_ID>16992531</HEADER_ID></ORDER>');
message.header.set_string_property('bamfilter','ORDER_ENTRY');
dbms_aq.enqueue(queue_name => 'XX_OM_MONITOR_Q',
enqueue_options => enqueue_options,
message_properties => message_properties,
payload => message,
msgid => message_handle);
COMMIT;
END;
we have tried a few other methods, but still to no avail...
the syntax I believe for the selector in the ems should be bamfilter='ORDER_ENTRY'
Any help would be great.
The DB the Queue is locate is on 10g if that makes any difference...Yes
I am able to specify JMS Header and JMS Properties when producing a message. However I am not able to user "Message Selector" to filter messages based on JMS Properties information when consuming messages.
In the link you provide, there is an example on how to use Message Selector:
# (a copy from the link)
Message Selector
...for example, you can enter logic, such as:
* JMSType = 'car' AND color = 'blue' AND weight > 2500
* Country in ('UK', 'US', 'France')
I believe the example with "Country" is exactly what I need, but I can´t get it work.
I create the same example above, setting a property named "Country" in the JMSHeader, sending the message to a JMS Queue (BPEL Process #1) and try to comsume it on the Message Selector (BPEL Process#2), but JMSAdapter never consumes the message.
Thanks for your help. -
I need to enqueue xml files.How can I do this?(I need to use the JMS interfaces)
I am able to create a topic connection and session.I am unable to figure out how to create a ObjectPayload with the xml mesage in it.
I have created the necessary queue by running the following scripts:
CREATE TYPE queue_message_type AS XMLType ;
EXEC DBMS_AQADM.CREATE_QUEUE_TABLE (queue_table => 'multi_message_xml_table', queue_payload_type => 'SYS.XMLTYPE', multiple_consumers => TRUE);
EXEC DBMS_AQADM.CREATE_QUEUE (queue_name => 'multi_xml_queue', queue_table => 'multi_message_xml_table');
EXEC DBMS_AQADM.START_QUEUE (queue_name => 'multi_xml_queue');
Thanks,
MahimaJust to follow up with some other information.
I created an AQ queue with AQ$_JMS_MESSAGE as payload type. Only, JDeveloper doen't recognize this queue when trying to create an AQ adapter in an ESB or BPEL project. It says it only supports RAW or OBJECT payload types. This seems like a bug; also see: ESB 10.1.3.1 Not Connecting to AQ QUEUE with error
So I changed the payload type to SYS.XMLType and it works fine.
The PL/SQL trigger I use to enqueue messages is:
CREATE OR REPLACE TRIGGER JMSUSER.AIT_TEST AFTER INSERT ON JMSUSER.TEST_AQ_TABEL FOR each row
declare
msg SYS.XMLType;
queue_options DBMS_AQ.ENQUEUE_OPTIONS_T;
msg_props DBMS_AQ.MESSAGE_PROPERTIES_T;
msg_id RAW(16);
Begin
msg := SYS.XMLType.createXML('<?xml version="1.0"?>' || '<id xmlns="http://www.approach-alliance.com">' || :new.ID || '</id>');
DBMS_AQ.ENQUEUE(
queue_name => 'TESTXML_QUEUE',
enqueue_options => queue_options,
message_properties => msg_props,
payload => msg,
msgid => msg_id);
end ;
I can then create an AQ adapter in the ESB and transform and/or route the XML content as desired.
Regards,
Ronald -
Enqueue works fine Dequeue works when run manually but not via Notification
Hi,
My Enqueue works fine. My Dequeue procedure works fine when run manually. But when I register a notification the procedure is not called.
The log file shows:
ORACLE_HOME = /u01/app/oracle/product/10.2.0
System name: Linux
Node name: gooch.com
Release: 2.4.21-50.ELsmp
Version: #1 SMP Tue May 8 17:18:29 EDT 2007
Machine: i686
Instance name: xml
Redo thread mounted by this instance: 1
Oracle process number: 25
Unix process pid: 7761, image: [email protected] (J000)
*** 2010-03-06 14:09:22.167
*** ACTION NAME:() 2010-03-06 14:09:22.167
*** MODULE NAME:() 2010-03-06 14:09:22.167
*** SERVICE NAME:(SYS$USERS) 2010-03-06 14:09:22.167
*** SESSION ID:(145.99) 2010-03-06 14:09:22.167
Error in PLSQL notification of msgid:8128C090A10BE480E0407E0A660F1B97
Queue :"XML4"."TEST14_Q"
Consumer Name :TEST14
PLSQL function :xml4.test14_proc
: Exception Occured, Error msg:
ORA-00604: error occurred at recursive SQL level 2
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'TEST14_PROC'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
my code is
BEGIN
DBMS_AQADM.CREATE_QUEUE_TABLE(
queue_table => 'test14_t',
comment => 'Queue Table to process incoming ORDER XML messages from Management Dynamics',
multiple_consumers => TRUE,
queue_payload_type => 'SYS.XMLTYPE',
compatible => '8.1');
END;
BEGIN
DBMS_AQADM.CREATE_QUEUE(
queue_name => 'test14_q',
queue_table => 'test14_t');
END;
BEGIN
dbms_aqadm.start_queue('test14_q');
END;
BEGIN
DBMS_AQADM.ADD_SUBSCRIBER (
queue_name => 'test14_q',
subscriber => SYS.AQ$_AGENT('test14', NULL, NULL)
END;
CREATE or replace PROCEDURE test14_proc AS
deq_opts dbms_aq.dequeue_options_t;
mess_prop dbms_aq.message_properties_t;
mess_handle RAW(16);
message XMLTYPE;
buffer varchar2(100);
msglen number;
begin
deq_opts.wait := dbms_aq.FOREVER;
deq_opts.consumer_name := 'test14';
dbms_aq.dequeue(queue_name=> 'test14_q',
dequeue_options => deq_opts,
message_properties => mess_prop,
payload => message,
msgid => mess_handle);
commit;
insert into testxml values(message);
commit;
insert into hello select extractvalue(xml1, '/Hello') from testxml;
commit;
end test14_proc;
DECLARE
queue_options DBMS_AQ.ENQUEUE_OPTIONS_T;
message_properties DBMS_AQ.MESSAGE_PROPERTIES_T;
message_id RAW(16);
message SYS.XMLType;
BEGIN
message := sys.XMLType.createXML('<?xml version="1.0"?><Hello>Test</Hello>');
DBMS_AQ.ENQUEUE( queue_name => 'test14_q',
enqueue_options => queue_options,
message_properties => message_properties,
payload => message,
msgid => message_id);
COMMIT;
END;
BEGIN
DBMS_AQ.REGISTER (
SYS.AQ$_REG_INFO_LIST(
SYS.AQ$_REG_INFO(
'xml4.test14_q:test14',
DBMS_AQ.NAMESPACE_AQ,
'plsql://xml4.test14_proc?PR=0',
HEXTORAW('FF'))),1);
END;Any ideas?
Thanks in advance!I actually changed it to process RAW as well i.e.
BEGIN
DBMS_AQ.REGISTER (
SYS.AQ$_REG_INFO_LIST(
SYS.AQ$_REG_INFO(
'xml4.test14_q:test14',
DBMS_AQ.NAMESPACE_AQ,
'plsql://xml4.test14_proc?PR=0',
HEXTORAW('FF'))),1);
END;and it still is failing with the same error -
Problems with dbms_aq.listen
I am having problem trying to listen to a set of queues.
I have tried it with Single Consumer queues and it works fine.
But with Multi Consumer queues dbms_aq.listen does not detect a new message enqueued and just waits until the time out then returns with the normal "No message" exception.
Can any one tell me what I am doing wrong?
Thanks
Rick Laird
code
CREATE OR REPLACE TYPE message_type AS OBJECT (xml_message CLOB);
exec dbms_aqadm.create_queue_table('testqueue_qtable','message_type',Null,Null,true);
exec dbms_aqadm.create_queue('testqueue', 'testqueue_qtable');
exec dbms_aqadm.start_queue('testqueue');
exec dbms_aqadm.add_subscriber('testqueue',sys.aq$_agent('testqueue_subscriber',NULL,NULL));
exec DBMS_AQADM.SCHEDULE_PROPAGATION('testqueue');
CREATE OR REPLACE PROCEDURE MONITOR_STATUS_QUEUE(time IN NUMBER)
IS
pragma autonomous_transaction;
agent_w_message sys.aq$_agent;
agent_list dbms_aq.aq$_agent_list_t;
wait_time INTEGER := 10;
no_message EXCEPTION;
pragma EXCEPTION_INIT(no_message, -25254);
new_status VARCHAR2(30);
monitor BOOLEAN := TRUE;
begin_time number;
end_time number;
v_dequeue_options dbms_aq.dequeue_options_t;
v_message_properties dbms_aq.message_properties_t;
v_message_type message_type;
v_dequeue_msg_id RAW(40);
v_xml_message CLOB;
v_message_text varchar2(2000);
v_amount number;
BEGIN
begin_time := dbms_utility.get_time;
WHILE (monitor)
LOOP
BEGIN
-- agent_list(1) := sys.aq$_agent('testqueue_agent', 'testqueue', NULL);
agent_list(1) := sys.aq$_agent('agent1', 'testqueue', NULL);
/* wait for order status messages */
dbms_aq.listen(agent_list, 0, agent_w_message);
dbms_output.put_line('Agent' || agent_w_message.name || ' Address '|| agent_w_message.address);
/* dequeue the message from the queue */
v_dequeue_options.consumer_name := 'testqueue_subscriber';
v_dequeue_options.wait := 0.5;
-- v_dequeue_options.wait := dbms_aq.NO_WAIT;
dbms_aq.dequeue('testqueue',v_dequeue_options, v_message_properties,
v_message_type,v_dequeue_msg_id);
v_amount := dbms_lob.getlength(v_message_type.xml_message);
dbms_lob.read(v_message_type.xml_message,v_amount,1,v_message_text);
dbms_output.put_line('New Message :'||v_message_text);
/* exit if we have been working long enough */
end_time := dbms_utility.get_time;
IF (end_time - begin_time > time) THEN
EXIT;
END IF;
EXCEPTION
WHEN no_message THEN
dbms_output.put_line('No messages so far');
end_time := dbms_utility.get_time;
--exit if we have done enough work
IF (end_time - begin_time > time) THEN
EXIT;
END IF;
END;
END LOOP;
commit;
END;
create or replace procedure enqueue is
v_enqueue_options dbms_aq.enqueue_options_t;
v_messages_properties dbms_aq.message_properties_t;
v_message_type message_type;
v_message_locator CLOB;
v_enqueue_msg_id RAW(40);
v_select_sql varchar2(2000);
v_xml_message varchar2(2000);
v_temp_clob CLOB;
begin
v_xml_message := '<TESTING><TEST>'||to_char(sysdate,'HH:MI:SS')||'</TEST></TESTING>';
dbms_lob.createtemporary(v_temp_clob,true);
dbms_lob.write(v_temp_clob,length(v_xml_message),1,v_xml_message);
v_message_type := message_type(empty_clob());
dbms_aq.enqueue(
queue_name => 'testqueue',
enqueue_options => v_enqueue_options,
message_properties => v_messages_properties,
payload => v_message_type,
msgid => v_enqueue_msg_id);
v_select_sql := ' select t.user_data.xml_message from testqueue_qtable t where t.msgid = :MSG_ID';
execute immediate v_select_sql INTO v_message_locator using v_enqueue_msg_id;
dbms_lob.copy( dest_lob => v_message_locator,
src_lob => v_temp_clob,
amount => dbms_lob.getlength(v_temp_clob));
COMMIT;
end enqueue;Hi,
Your subscriber is called testqueue_subscriber. You must use the same consumer name in the agent list for dbms_aq.listen
Change
agent_list(1) := sys.aq$_agent('agent1', 'testqueue', NULL);
to
agent_list(1) := sys.aq$_agent('testqueue_subscriber', 'testqueue', NULL); -
DBMS_AQ.dequeue_array always returns 0 messages
Hi all,
first of all, thanks for your time reading this...
I have to dequeue messages from a Oracle queue and for performance reasons, I must dequeue batches of messages and not one by one.
I have a logmessage object that it is what is queued:
CREATE OR REPLACE
type logmessage as object (
wpTRID number(9),
wpRuleID number(9),
wpCompType Number(4),
wpComponent varchar2(40),
wpEvent varchar2(80),
wpStartTimestamp timestamp,
wpEndTimestamp timestamp,
wpSuccess varchar2(20)
The queue is created with the following statement:
DBMS_AQADM.CREATE_QUEUE (
queue_name => 'Log_Queue',
queue_table => 'Log_Table',
queue_type => DBMS_AQADM.NORMAL_QUEUE,
max_retries => 3,
comment => 'Log Queue',
auto_commit => FALSE);
The messages are enqueued with this function:
PROCEDURE LOGENQUEUE(wpTRID in number, wpRuleID in number, wpCompType in number, wpComponent in varchar2, wpEvent in varchar2, wpSuccess in varchar2, wpStartTimestamp in timestamp, wpEndTimestamp in timestamp)
IS
queue_options DBMS_AQ.ENQUEUE_OPTIONS_T;
message_prop DBMS_AQ.MESSAGE_PROPERTIES_T;
message_id RAW(16);
my_msg LogMessage;
seq Number(9);
BEGIN
IF(wpTRID=-1)
THEN
select wp_queue_seq.nextval into seq from dual;
my_msg:=LogMessage(seq,wpRuleID,wpCompType,wpComponent,wpEvent, wpStartTimestamp, wpEndTimestamp, wpSuccess);
message_prop.correlation:=seq;
ELSE
my_msg:=LogMessage(wpTRID,wpRuleID,wpCompType,wpComponent,wpEvent, wpStartTimestamp, wpEndTimestamp, wpSuccess);
message_prop.correlation:=wpTRID;
END IF;
message_prop.exception_queue:='Log_ExcepQueue';
DBMS_AQ.ENQUEUE( queue_name => 'Log_Queue', enqueue_options => queue_options, message_properties => message_prop, payload => my_msg, msgid => message_id);
END LOGENQUEUE;
Now, this dequeue procedure works (but it gets one message at a time, so no good):
PROCEDURE DEQUEUE_LOG_TABLE_2
IS
options DBMS_AQ.dequeue_options_t;
properties DBMS_AQ.message_properties_t;
v_message_handle RAW(16);
log_message_a logmessage;
TYPE log_dump_a_t IS TABLE OF log_dump%ROWTYPE
INDEX BY BINARY_INTEGER;
log_dump_a log_dump_a_t;
total NUMBER := 0;
n NUMBER;
BEGIN
options.navigation := DBMS_AQ.first_message;
options.WAIT := DBMS_AQ.no_wait;
FOR rec IN (SELECT wpi_id
FROM jm_wp_info_history jm, log_table l
WHERE jm.wpi_state = 'DONE'
AND jm.wpi_id = l.user_data.wptrid
AND ROWNUM < 2
GROUP BY jm.wpi_id) LOOP
total := total + 1;
options.correlation := rec.wpi_id;
SELECT COUNT(1)
INTO n
FROM log_table
WHERE corrid = rec.wpi_id;
FOR i IN 1 .. n LOOP
DBMS_AQ.dequeue(queue_name => 'Log_Queue',
dequeue_options => options,
message_properties => properties,
payload => log_message_a,
msgid => v_message_handle
log_dump_a(NVL(log_dump_a.LAST + 1, 1)).wptrid := log_message_a.wptrid;
log_dump_a(log_dump_a.LAST).wpruleid := log_message_a.wpruleid;
log_dump_a(log_dump_a.LAST).wpcomptype := log_message_a.wpcomptype;
log_dump_a(log_dump_a.LAST).wpcomponent := log_message_a.wpcomponent;
log_dump_a(log_dump_a.LAST).wpevent := log_message_a.wpevent;
log_dump_a(log_dump_a.LAST).wpstarttimestamp := log_message_a.wpstarttimestamp;
log_dump_a(log_dump_a.LAST).wpendtimestamp := log_message_a.wpendtimestamp;
log_dump_a(log_dump_a.LAST).wpsuccess := log_message_a.wpsuccess;
END LOOP;
IF ( log_dump_a IS NOT NULL
AND log_dump_a.COUNT > 0) THEN
FORALL i IN log_dump_a.FIRST .. log_dump_a.LAST
INSERT INTO log_dump
VALUES log_dump_a(i);
log_dump_a.DELETE;
END IF;
COMMIT;
END LOOP;
END dequeue_log_table_2;
And this one doesn't (it does, doesn't return any exception, just doesn't dequeue any message):
PROCEDURE DEQUEUE_LOG_TABLE
IS
TYPE log_message_a_t IS TABLE OF logmessage;
payloadarr log_message_a_t := log_message_a_t();
deqopt DBMS_AQ.dequeue_options_t;
msgproparr DBMS_AQ.message_properties_array_t := DBMS_AQ.message_properties_array_t();
msgidarr DBMS_AQ.msgid_array_t := DBMS_AQ.msgid_array_t();
retval PLS_INTEGER;
TYPE log_dump_a_t IS TABLE OF log_dump%ROWTYPE
INDEX BY BINARY_INTEGER;
log_dump_a log_dump_a_t;
total NUMBER := 0;
BEGIN
payloadarr.EXTEND(100);
msgproparr.EXTEND(100);
deqopt.WAIT := DBMS_AQ.no_wait;
deqopt.navigation := DBMS_AQ.first_message_multi_group;
FOR rec IN (SELECT wpi_id
FROM jm_wp_info_history jm, log_table l
WHERE jm.wpi_state = 'DONE'
AND jm.wpi_id = l.user_data.wptrid
AND ROWNUM < 2
GROUP BY jm.wpi_id) LOOP
total := total + 1;
deqopt.correlation := TO_CHAR(rec.wpi_id);
payloadarr.DELETE;
msgidarr.DELETE;
msgproparr.DELETE;
retval :=
DBMS_AQ.dequeue_array(queue_name => 'Log_Queue',
dequeue_options => deqopt,
array_size => payloadarr.COUNT,
message_properties_array => msgproparr,
payload_array => payloadarr,
msgid_array => msgidarr
FOR i IN 1 .. retval LOOP
log_dump_a(NVL(log_dump_a.LAST + 1, 1)).wptrid := payloadarr(i).wptrid;
log_dump_a(log_dump_a.LAST).wpruleid := payloadarr(i).wpruleid;
log_dump_a(log_dump_a.LAST).wpcomptype := payloadarr(i).wpcomptype;
log_dump_a(log_dump_a.LAST).wpcomponent := payloadarr(i).wpcomponent;
log_dump_a(log_dump_a.LAST).wpevent := payloadarr(i).wpevent;
log_dump_a(log_dump_a.LAST).wpstarttimestamp := payloadarr(i).wpstarttimestamp;
log_dump_a(log_dump_a.LAST).wpendtimestamp := payloadarr(i).wpendtimestamp;
log_dump_a(log_dump_a.LAST).wpsuccess := payloadarr(i).wpsuccess;
END LOOP;
IF ( log_dump_a IS NOT NULL
AND log_dump_a.COUNT > 0) THEN
FORALL i IN log_dump_a.FIRST .. log_dump_a.LAST
INSERT INTO log_dump
VALUES log_dump_a(i);
log_dump_a.DELETE;
END IF;
COMMIT;
END LOOP;
END dequeue_log_table;
And I assure the queue has plenty of messages at the moment!
SELECT state, COUNT(1)
FROM log_table
GROUP BY state;
State count(1)
0 1218578
I already tried everything I could think off... From different (ALL) options.navigation settings available to removing the correlation use, etc, etc... I simply don't know what else to try.
Can anyone share some insight on this?!
Sorry for the long post. Better have all the information to start with, I guess.
Thanks a lot!
Best regards,
Vítor Pinto
Added the queue create statement.
Message was edited by:
user449493
Message was edited by:
user449493don't define log_message_a_t in proc. Create an explicit type on SQL prompt and see it will work..
CREATE OR REPLACE TYPE log_message_a_t AS TABLE OF <schema_name>.logmessage; -
Enqueuing JMS_TEXT_MESSAGE with Java creates strange message payload
Hello everybody,
I'm trying to enqueue a JMS_TEXT_MESSAGE. There is no problem doing this with PL/SQL, but with Java the payload of the enqueued message seems to contain garbage. I tried a lot but actually I have no idea why this happens.
Here are the different user_data values of the enqueued messages:
Java: (((; ; 0); ; ; ; ; ; ((; 100; ; ; 27); (; 200; ; 1257325532555; 24); ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; )); 14; ; )
PL/SQL: ((; ; ; ; ; 0; ); 14; This is a test; )
As you can see there are a lot of differences. The length of the string (14) is correct with Java, too, but where do the other values come from ? And what happened to the message text ?
Environment:
- Oracle Database 10g Enterprise Edition 10.2.0.3.0
- JDK 1.5.0_06
- Used libraries
-- $ORACLE_HOME/rdbms/jlib/jmscommon.jar
-- $ORACLE_HOME/rdbms/jlib/aqapi13.jar
-- $ORACLE_HOME/jdbc/lib/ojdb14.jar
-- $ORACLE_HOME/jlib/jta.jar
This is how created the user:
CREATE USER strm_admin IDENTIFIED BY strm_admin;
GRANT connect, resource, aq_administrator_role TO strm_admin;
GRANT execute on dbms_aq TO strm_admin;
Here is the test class that creates the strange payload:
package test;
import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
import javax.jms.TextMessage;
import oracle.AQ.AQQueueTable;
import oracle.AQ.AQQueueTableProperty;
import oracle.jms.AQjmsDestination;
import oracle.jms.AQjmsDestinationProperty;
import oracle.jms.AQjmsFactory;
import oracle.jms.AQjmsSession;
public class AQTest
public static void main(String[] args) throws Exception
String url = "jdbc:oracle:thin:@server:port:sid";
QueueConnectionFactory qcf = AQjmsFactory.getQueueConnectionFactory(url, null);
QueueConnection connection = qcf.createQueueConnection("strm_admin", "strm_admin");
AQjmsSession session = (AQjmsSession)connection.createQueueSession(true, 0);
// create queuetable
AQQueueTableProperty tableProperty = new AQQueueTableProperty("SYS.AQ$_JMS_TEXT_MESSAGE");
session.createQueueTable("strm_admin", "testqueuetablejms", tableProperty);
// create queue
AQQueueTable queueTable = session.getQueueTable("strm_admin", "testqueuetablejms");
Queue queue = session.createQueue(queueTable, "testqueuejms", new AQjmsDestinationProperty());
((AQjmsDestination)queue).start(session, true, true);
// enqueue message
TextMessage message = session.createTextMessage();
message.setText("This is a test");
MessageProducer producer = session.createProducer(queue);
producer.send(message);
producer.close();
// close
session.commit();
session.close();
connection.close();
With this PL/SQL the message payload is correct:
DECLARE
v_enqueue_options DBMS_AQ.ENQUEUE_OPTIONS_T;
v_message_properties DBMS_AQ.MESSAGE_PROPERTIES_T;
v_message SYS.AQ$_JMS_TEXT_MESSAGE;
v_message_id RAW(16);
BEGIN
v_message := SYS.AQ$_JMS_TEXT_MESSAGE.CONSTRUCT;
v_message.set_text('This is a test');
DBMS_AQ.ENQUEUE (
queue_name => 'strm_admin.testqueuejms'
,enqueue_options => v_enqueue_options
,message_properties => v_message_properties
,payload => v_message
,msgid => v_message_id
COMMIT;
END;
Can anyone help me, please ? Has anyone experienced the same problem ? Or can anyone reproduce it ?
Any help is appreciated.
RolandFinally I got it fixed !
The library "orai18n.jar" hat to be included in class path. Very strange, that there was no exception or any hint to what was missing. -
Problem enqueuing with SYS.AQ$_JMS_TEXT_MESSAGE payload
We are trying to enqueue a message into a SYS.AQ$_JMS_TEXT_MESSAGE AQ from java using the standard AQjmsQueueSender. The message arrives onto the queue but the USER_DATA is always 'oracle.sql.STRUCT@5a41ec' instead of the actual message. When we enqueue from PL/SQL the USER_DATA contains the actual message. Any help would be greatly appreciated. Thanks.
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
"CORE 10.2.0.4.0 Production"
TNS for Linux: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
QUEUE DETAILS
OWNER: EIMGR
QUEUE_TABLE: AQ_VENDORS_IN_TABLE
TYPE: OBJECT
OBJECT_TYPE: SYS.AQ$_JMS_TEXT_MESSAGE
SORT_ORDER: ENQUEUE_TIME
RECIPIENTS: SINGLE
MESSAGE_GROUPING: NONE
COMPATIBLE: 8.1.3
PRIMARY_INSTANCE: 0
SECONDARY_INSTANCE: 0
OWNER_INSTANCE: 1
USER_COMMENT: EI_QUEUE
SECURE: NO
CREATED: 09-09-03
LAST_DDL_TIME: 09-09-03
-------------------------------------------------------------------------------------We've discovered with PL/SQL that setting any headers on messages causes the same problem that we're seeing from JAVA. There is no option in JAVA to send messages without headers (it's part of the JMS spec). This can be seen with the following PL/SQL script (use null instead of HEADER in the message constructor to see it work):
DECLARE
Enqueue_options DBMS_AQ.enqueue_options_t;
Message_properties DBMS_AQ.message_properties_t;
Message_handle RAW(16);
User_prop_array SYS.AQ$_JMS_USERPROPARRAY;
Agent SYS.AQ$_AGENT;
Header SYS.AQ$_JMS_HEADER;
Message SYS.AQ$_JMS_TEXT_MESSAGE;
Message_text VARCHAR2(500);
BEGIN
Agent := SYS.AQ$_AGENT('',NULL,0);
User_prop_array := SYS.AQ$_JMS_USERPROPARRAY();
Header := SYS.AQ$_JMS_HEADER( Agent, '', 'dave', '', '', '', User_prop_array);
Message_text := 'Message from PL/SQL created at '|| TO_CHAR(SYSDATE, 'mm/dd/yyyy hh24:mi:ss');
Message := SYS.AQ$_JMS_TEXT_MESSAGE(Header, LENGTH(Message_text), Message_text, NULL);
DBMS_AQ.ENQUEUE(queue_name => 'AQ_VENDORS_IN',
Enqueue_options => enqueue_options,
Message_properties => message_properties,
Payload => message,
Msgid => message_handle);
COMMIT;
END; -
How to enqueue an AQ$_JMS_OBJECT_MESSAGE message to AQ
I need to enqueue a message with type AQ$_JMS_OBJECT_MESSAGE to AQ.
My AQ definition is like this:
DBMS_AQADM.CREATE_QUEUE_TABLE (queue_table => l_queue_table,
queue_payload_type => 'SYS.AQ$_JMS_OBJECT_MESSAGE',
multiple_consumers => FALSE);
DBMS_AQADM.CREATE_QUEUE (queue_name => l_queue,
queue_table => l_queue_table);
I have a type defined as
create or replace type DataObject as object (
dataString VARCHAR2(128)
I tried to enqueue the message by doing the following:
l_data := DataObject('Hello World from PL/SQL ');
l_bytes_raw := utl_raw.cast_to_raw(l_data);
l_bytes_len := length(l_bytes_raw);
l_payload := sys.aq$_jms_object_message(l_header,l_bytes_len,l_bytes_raw,null);
l_queue_options.visibility := DBMS_AQ.ON_COMMIT;
l_queue_options.sequence_deviation := NULL;
DBMS_AQ.ENQUEUE( queue_name => l_queue_name
, enqueue_options => l_queue_options
, message_properties => l_msg_props
, payload => l_msg
, msgid => l_msg_id);
I tried to cast DataObject to Raw but I got error msg. I guess I can't do that. Can someone tell me how to fix it? Or is there any doc or code samples I can refer to?
Thank you in advance.
- YangYou defined your own object type so you need to cast your message to your data type ... not to raw. You would only cast to RAW if that was how you defined your message.
Look at the demo here:
http://www.morganslibrary.org/reference/aq_demo1.html
Not how the message type "message_t" is defined and loaded. -
Dbms_scheduler - dbms_aq - dbms_aqadm - event driven job runs only once/sec
hi, i tried here to process events with 2 jobs... surprisingly i had to call dbms_lock.sleep(1) to be able to enqueue events
at inserts in a row ... even more surprisingly the enqueuing doesn't function if the processing (prc_evsched) lasts some seconds...
how must the code be changed to be able to enqueue all events after the inserts without any sleep()?
and how must the code be changed to be able to enqueue all events with a proc (prc_evsched) running longer?
thanx in advance for your help!
--evsched
h4.
--to remove all test-objects
h4.
--test table
h4.
--define the object type to act as the payload for the queue
h4.
--creating the event queue
h4.
--creating the proc for the prog/job
h4.
--creating the proc for the prog/job
h4.
--creating the program
h4.
--creating the first job (for parallel execution)
h4.
--creating the second job (for parallel execution)
h4.
--test block
h4.
--test scenarios/results
h4.
--to remove all test-objects
DECLARE
exc_ora_27475 EXCEPTION; --ora-27475: <job_name> muss job sein
PRAGMA EXCEPTION_INIT (exc_ora_27475, -27475);
exc_ora_27476 EXCEPTION; --ora-27476: <program_name> ist nicht vorhanden
PRAGMA EXCEPTION_INIT (exc_ora_27476, -27476);
exc_ora_24010 EXCEPTION; --ORA-24010: QUEUE SYSGIS.EVENT_QUEUE ist nicht vorhanden
PRAGMA EXCEPTION_INIT (exc_ora_24010, -24010);
exc_ora_24002 EXCEPTION; --ORA-24002: QUEUE_TABLE SYSGIS.EVENT_QUEUE_TAB ist nicht vorhanden
PRAGMA EXCEPTION_INIT (exc_ora_24002, -24002);
exc_ora_4043 EXCEPTION; --ORA-04043: Objekt T_EVENT_QUEUE_PAYLOAD ist nicht vorhanden
PRAGMA EXCEPTION_INIT (exc_ora_4043, -4043);
exc_ora_942 EXCEPTION; --ORA-00942: Tabelle oder View nicht vorhanden
PRAGMA EXCEPTION_INIT (exc_ora_942, -942);
exc_ora_2289 EXCEPTION; --ORA-02289: Sequence ist nicht vorhanden.
PRAGMA EXCEPTION_INIT (exc_ora_2289, -2289);
v_fpos PLS_INTEGER := 1;
BEGIN
v_fpos := 10;
BEGIN
--remove job
SYS.DBMS_SCHEDULER.DROP_JOB(job_name=> 'job_evsched', FORCE=>TRUE);
EXCEPTION WHEN exc_ora_27475 THEN NULL;
END;
v_fpos := 12;
BEGIN
--remove job
SYS.DBMS_SCHEDULER.DROP_JOB(job_name=> 'job_evsched_2', FORCE=>TRUE);
EXCEPTION WHEN exc_ora_27475 THEN NULL;
END;
v_fpos := 20;
BEGIN
--remove program
SYS.DBMS_SCHEDULER.DROP_PROGRAM(program_name=>'prg_evsched',FORCE=>TRUE);
EXCEPTION WHEN exc_ora_27476 THEN NULL;
END;
v_fpos := 30;
BEGIN
-- stop the event queue.
DBMS_AQADM.stop_queue (queue_name => 'evsched_event_queue');
EXCEPTION WHEN exc_ora_24010 THEN NULL;
END;
v_fpos := 40;
BEGIN
-- drop the event queue.
DBMS_AQADM.drop_queue (queue_name => 'evsched_event_queue');
EXCEPTION WHEN exc_ora_24010 THEN NULL;
END;
v_fpos := 50;
BEGIN
-- Remove the queue table.
DBMS_AQADM.drop_queue_table(queue_table => 'tab_evsched_event_queue');
EXCEPTION WHEN exc_ora_24002 THEN NULL;
END;
v_fpos := 60;
BEGIN
-- remove type
EXECUTE IMMEDIATE 'DROP TYPE typ_evsched_payload';
EXCEPTION WHEN exc_ora_4043 THEN NULL;
END;
v_fpos := 70;
BEGIN
-- remove table
EXECUTE IMMEDIATE 'DROP TABLE tab_evsched';
EXCEPTION WHEN exc_ora_942 THEN NULL;
END;
v_fpos := 80;
BEGIN
-- remove sequence
EXECUTE IMMEDIATE 'DROP SEQUENCE seq_evsched';
EXCEPTION WHEN exc_ora_2289 THEN NULL;
END;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('v_fpos='||v_fpos);
END;
h4.
--test table
CREATE TABLE tab_evsched
( id NUMBER
, sys_date DATE
, status VARCHAR2(1)
, processed VARCHAR2(1) DEFAULT 'N'
, processed_by varchar2(128)
GRANT DELETE, INSERT, SELECT, UPDATE ON tab_evsched TO PUBLIC
CREATE SEQUENCE seq_evsched
h4.
--define the object type to act as the payload for the queue
CREATE OR REPLACE TYPE typ_evsched_payload AS OBJECT
( event_name VARCHAR2(30)
, tab_evsched_id NUMBER
, daterf DATE
h4.
--creating the event queue
BEGIN
-- Create a queue table to hold the event queue.
DBMS_AQADM.create_queue_table
( queue_table => 'tab_evsched_event_queue'
, queue_payload_type => 'typ_evsched_payload'
, multiple_consumers => TRUE
, COMMENT => 'Queue Table For Event Messages'
-- Create the event queue.
DBMS_AQADM.create_queue
( queue_name => 'evsched_event_queue'
, queue_table => 'tab_evsched_event_queue'
, queue_type => DBMS_AQADM.NORMAL_QUEUE
, max_retries => 0
, retry_delay => 0
, dependency_tracking => FALSE
, comment => 'Test Object Type Queue'
, auto_commit => FALSE
-- Start the event queue.
DBMS_AQADM.start_queue
( queue_name => 'evsched_event_queue'
END;
h4.
--creating the proc for the prog/job
CREATE OR REPLACE PROCEDURE prc_evsched
( p_message IN typ_evsched_payload
, p_job_name IN VARCHAR2
IS
BEGIN
UPDATE tab_evsched
SET processed = 'J'
, processed_by = p_job_name
, sys_date = p_message.daterf
WHERE 1=1
AND id = p_message.tab_evsched_id
dbms_lock.sleep(5); --#sleep-1#
COMMIT;
END prc_evsched;
h4.
--creating the program
DECLARE
exc_ora_27476 EXCEPTION; --ora-27476: <program_name> ist nicht vorhanden
PRAGMA EXCEPTION_INIT (exc_ora_27476, -27476);
BEGIN
BEGIN
SYS.DBMS_SCHEDULER.DROP_PROGRAM(program_name=>'prg_evsched',FORCE=>TRUE);
EXCEPTION
WHEN exc_ora_27476 THEN
NULL;
END;
SYS.DBMS_SCHEDULER.CREATE_PROGRAM
( program_name => 'prg_evsched'
, program_type => 'STORED_PROCEDURE'
, program_action => '"SYSGIS"."PRC_EVSCHED"'
, number_of_arguments => 2
, enabled => FALSE
, comments => 'Program-Komponent für den Test von DBMS_SCHEDULER'
--event message as the first param to prc_evsched
DBMS_SCHEDULER.DEFINE_METADATA_ARGUMENT
( program_name => 'prg_evsched'
, argument_position => 1
, metadata_attribute => 'EVENT_MESSAGE'
--name of the job as the second param to prc_evsched
SYS.DBMS_SCHEDULER.define_program_argument
( program_name => 'prg_evsched'
, argument_name => 'p_job_name'
, argument_position => 2
, argument_type => 'VARCHAR2'
, default_value => 'dummy'
--enable program
SYS.DBMS_SCHEDULER.ENABLE(NAME=>'prg_evsched');
END;
h4.
--creating the first job (for parallel execution)
DECLARE
exc_ora_27475 EXCEPTION; --ora-27475: <job_name> muss job sein
PRAGMA EXCEPTION_INIT (exc_ora_27475, -27475);
BEGIN
BEGIN
--remove job
SYS.DBMS_SCHEDULER.DROP_JOB(job_name=> 'job_evsched', FORCE=>TRUE);
EXCEPTION WHEN exc_ora_27475 THEN NULL;
END;
DBMS_SCHEDULER.create_job
( job_name => 'job_evsched'
, program_name => 'prg_evsched'
, start_date => SYSTIMESTAMP
, event_condition => 'tab.user_data.event_name = ''MYEVENT'''
, queue_spec => 'evsched_event_queue'
, auto_drop => FALSE
, enabled => FALSE
SYS.DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE
( job_name => 'job_evsched'
, argument_name => 'p_job_name'
, argument_value => 'job_evsched'
SYS.DBMS_SCHEDULER.ENABLE(NAME=>'job_evsched');
END;
h4.
--creating the second job (for parallel execution)
DECLARE
exc_ora_27475 EXCEPTION; --ora-27475: <job_name> muss job sein
PRAGMA EXCEPTION_INIT (exc_ora_27475, -27475);
BEGIN
BEGIN
--remove job
SYS.DBMS_SCHEDULER.DROP_JOB(job_name=> 'job_evsched_2', FORCE=>TRUE);
EXCEPTION WHEN exc_ora_27475 THEN NULL;
END;
DBMS_SCHEDULER.create_job
( job_name => 'job_evsched_2'
, program_name => 'prg_evsched'
, start_date => SYSTIMESTAMP
, event_condition => 'tab.user_data.event_name = ''MYEVENT'''
, queue_spec => 'evsched_event_queue'
, auto_drop => FALSE
, enabled => FALSE
SYS.DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE
( job_name => 'job_evsched_2'
, argument_name => 'p_job_name'
, argument_value => 'job_evsched_2'
SYS.DBMS_SCHEDULER.ENABLE(NAME=>'job_evsched_2');
END;
h4.
--test block
DECLARE
PROCEDURE pr_ins_tab_evsched
( p_id IN NUMBER
, p_status IN VARCHAR2
IS
BEGIN
INSERT INTO tab_evsched(id,status) VALUES (p_id, p_status);
COMMIT;
--enqueue the MYEVENT-event
IF p_status = 'M' THEN
--enqueue works in 1sekunden-taktung.... !?
dbms_lock.sleep(1); --#sleep-2#
DECLARE
v_enqueue_options DBMS_AQ.enqueue_options_t;
v_message_properties DBMS_AQ.message_properties_t;
v_message_handle RAW(16);
v_queue_msg typ_evsched_payload;
BEGIN
v_queue_msg := typ_evsched_payload
( event_name => 'MYEVENT'
, tab_evsched_id => p_id
, daterf => SYSDATE
v_enqueue_options.VISIBILITY := DBMS_AQ.ON_COMMIT;
v_enqueue_options.delivery_mode := DBMS_AQ.PERSISTENT;
v_message_properties.PRIORITY := 1;
v_message_properties.DELAY := DBMS_AQ.NO_DELAY;
v_message_properties.EXPIRATION := DBMS_AQ.NEVER;
v_message_properties.CORRELATION := 'TEST MESSAGE';
DBMS_AQ.enqueue
( queue_name => 'evsched_event_queue'
, enqueue_options => v_enqueue_options
, message_properties => v_message_properties
, payload => v_queue_msg
, msgid => v_message_handle
END;
END IF;
COMMIT;
END pr_ins_tab_evsched;
BEGIN
DELETE tab_evsched;
pr_ins_tab_evsched (seq_evsched.NEXTVAL,'M');
pr_ins_tab_evsched (seq_evsched.NEXTVAL,'M');
pr_ins_tab_evsched (seq_evsched.NEXTVAL,'M');
pr_ins_tab_evsched (seq_evsched.NEXTVAL,'M');
pr_ins_tab_evsched (seq_evsched.NEXTVAL,'M');
pr_ins_tab_evsched (seq_evsched.NEXTVAL,'M');
pr_ins_tab_evsched (seq_evsched.NEXTVAL,'M');
pr_ins_tab_evsched (seq_evsched.NEXTVAL,'M');
END;
SELECT * FROM tab_evsched ORDER BY id;
SELECT * FROM sysgis.tab_evsched_event_queue;
h4.
--test scenarios/resultsh
h5.
--test results #sleep-1#=5, #sleep-2#=0
--job (job_evsched) runs only once, only the first event is enqued/processed
ID SYS_DATE STATUS PROCESSED PROCESSED_BY
9 22.03.2012 17:00:41 M J job_evsched
10 (Null) M N (Null)
11 (Null) M N (Null)
12 (Null) M N (Null)
13 (Null) M N (Null)
14 (Null) M N (Null)
15 (Null) M N (Null)
16 (Null) M N (Null)
h5.
--test results #sleep-1#=0, #sleep-2#=1
--jobs (job_evsched/job_evsched2) run alternately, every events are enqued/processed
ID SYS_DATE STATUS PROCESSED PROCESSED_BY
25 22.03.2012 17:04:31 M J job_evsched_2
26 22.03.2012 17:04:32 M J job_evsched_2
27 22.03.2012 17:04:33 M J job_evsched
28 22.03.2012 17:04:34 M J job_evsched_2
29 22.03.2012 17:04:35 M J job_evsched_2
30 22.03.2012 17:04:36 M J job_evsched_2
31 22.03.2012 17:04:37 M J job_evsched
32 22.03.2012 17:04:38 M J job_evsched_2
h5.
--test results #sleep-1#=5, #sleep-2#=1
--jobs (job_evsched/job_evsched2) run alternately, only two events are enqued/processed
ID SYS_DATE STATUS PROCESSED PROCESSED_BY
41 22.03.2012 17:07:42 M J job_evsched_2
42 (Null) M N (Null)
43 (Null) M N (Null)
44 (Null) M N (Null)
45 (Null) M N (Null)
46 (Null) M N (Null)
47 22.03.2012 17:07:48 M J job_evsched
48 (Null) M N (Null)
*/hi, thank you for your (fast) answer! that is the solution to my problem!
now i have a follow-up question:
i've got a procedure, that runs between 1 and 2 minutes long. unlimited running lightweight jobs
would freeze the db...
how can the count of the parallel running lightweight-jobs be limited?
according to the documentation it is not possible:
There is no explicit limit to the number of lightweight jobs that can run simultaneously to process multiple instances of the event.
However, limitations may be imposed by available system resources.
could you explain to me, what it (...available system recources...) means?
eventually what i would like to have: max. two parallel running (lightweight) jobs....
thank you in advance, bye, á
ps: can i attach a file to the post anyway?
Edited by: user4786904 on 23.03.2012 07:22 -
Enqueue and Dequeue of BLOB messages
Hi all,
Does anyone have any experience with enqueue and dequeue of BLOB messages? I have PDF files that I would like to send via aq. I can enqueue them, but not dequeue them. When I attempt to deque, I get the following error:
ORA-25236: buffer too small for user data
Here is my enqueue code:
set serveroutput on size 1000000
set timing on
/* Enqueue to msg_queue: */
DECLARE
Enqueue_options DBMS_AQ.enqueue_options_t;
Message_properties DBMS_AQ.message_properties_t;
Message_handle RAW(16);
Message blob;
TmpMsg blob := empty_blob;
cnt number;
BEGIN
DBMS_AQ.ENQUEUE(queue_name => 'JOOSTENBERGVLAKTE',
Enqueue_options => enqueue_options,
Message_properties => message_properties,
Payload => tmpmsg,
Msgid => message_handle);
select t.user_data into message from test_queue t where t.msgid = message_handle;
select blob_content into tmpmsg from tbl;
cnt := length(message) + 1;
dbms_lob.erase(message, cnt);
dbms_lob.trim(message, 0);
dbms_lob.append(message, tmpmsg);
dbms_output.put_line('Erased ' || cnt || ' characters');
dbms_output.put_line('Message length ' || length(message));
COMMIT;
END;
/And here is my deque code:
set serveroutput on 1000000;
declare
l_options dbms_aq.dequeue_options_t;
l_properties dbms_aq.message_properties_t;
l_hnd RAW(16);
l_msg blob := empty_blob;
begin
dbms_aq.dequeue(
queue_name => 'JOOSTENBERGVLAKTE',
dequeue_options => l_options,
message_properties => l_properties,
payload => l_msg,
msgid => l_hnd
commit;
exception
when others then
rollback;
raise;
end;
/Hi,
I think you have the order of enqueueing and filling your blob in the wrong order. I understand why you do it, because inserting a blob in the table you could do that in this way. But I think that you should fill and close your blob before enqueueing it.
Try something like:
l_attachment blob;-- := :p_attachment;
begin
dbms_lob.createtemporary(l_attachment, false);
dbms_lob.write( lob_loc => l_attachment
, amount => length(:p_attachment)
, offset => 1
, buffer => utl_raw.cast_to_raw(:p_attachment));
Another small remark is that I see you doing a commit right after the enqueue-dequeue. In your enqueu example it seems to make sense because you try to fill the blob afterwards. But you could also use the enqueue-dequeue option "visibility" and set that on dbms_aq.immediate. Then you don't have to do a commit. This is handy for enqueueing messages with out affecting your transaction.
Regards,
Martien
Maybe you are looking for
-
Moved to a bundled service that is more than double my old bill
I was originally on a plan where my internet was bundled with basic cable for $39.99. I was then in the last few months moved to a plan that is more that double that with HBO and Starz I did not ask for. If I can't find a plan that significantly redu
-
Forcing iPod to play while using apps
Not sure if this is possible, but is there a way to force the iPod to play even when using apps? I turned off the app audio, but the app keeps stopping music from ipod on the iPad. Want iPod to always have priority. Again not sure if this is possible
-
Error message when try to create a Service Notification - IW51
Hi Everyone! When the customer try to create a new Service Notification (IW51 transaction), they receive an customized error message: "No pricing reference material for material [item code] not able to save". The price appears on the quantity contra
-
I have Labview 2011 and I am using PXI 5600 downconverter with PXI 5620 as the digitizer..First I had the problem that PXI 5620 was not compatible with DAQmx so the device did not have a self test in MAX 5.0.. Also due to PXI 5600 failed the test..
-
Kernel_task is using 300% on my cpu. Any help??
I upgraded to Mavericks and that kernel_task has bombed my CPU recently. I followed suit with everyone else and downloaded EtreCheck and copied the results to my clipboard as I alone cannot identify the problem and may need some assistance. Something