Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: HOW TO, AQ between 2 dbs
got it working,
just a case of being saturday, clear brain and starting with a clean slate.
below is the solutions for anyone interested.
George
PS: got to give credit where it is due, as usual http://asktome.oracle.com
connect aqfinexc/aqfinexc_at_lab1
CREATE type aqfinexc.fin_msg_typ as object(
seq_num number,
name varchar2(64),
amt number
);
/
connect aqfinexc/aqfinexc_at_lab
CREATE type aqfinexc.fin_msg_typ as object(
seq_num number,
name varchar2(64),
amt number
);
/
begin
DBMS_AQADM.CREATE_QUEUE_TABLE(queue_table => 'aqfinexc.aqfinexc_queue_qtab',
queue_payload_type => 'aqfinexc.fin_msg_typ', multiple_consumers => TRUE); DBMS_AQADM.CREATE_QUEUE(queue_name => 'aqfinexc_queue', queue_table => 'aqfinexc.aqfinexc_queue_qtab');DBMS_AQADM.START_QUEUE(queue_name => 'aqfinexc_queue'); end;
create or replace procedure enqueue_msg(p_seq_num in number,
p_name in varchar2, p_amt in number, p_add in varchar2 default null)as
enqueue_options dbms_aq.enqueue_options_t; message_properties dbms_aq.message_properties_t; message_handle RAW(16); message aqfinexc.fin_msg_typ; recipients DBMS_AQ.aq$_recipient_list_t;BEGIN
From: oracle-l-bounce_at_freelists.org on behalf of Leonard, George
Sent: Fri 2005/02/18 07:18 PM
To: Oracle-L_at_freelists.org
Subject: FW: HOW TO, AQ between 2 dbs
below is the code as i got it at the moment,
i am pretty sure it is correct, but then it is friday night this side,
as far as i can see it has a roblem with the destination, guessing something to do with the Schedule_Propagation and the dblink ...
thanks.
George
begin
dbms_aqadm.grant_system_privilege('ENQUEUE_ANY', 'aqfinexc', FALSE);
dbms_aqadm.grant_system_privilege('DEQUEUE_ANY', 'aqfinexc', FALSE);
end;
/
-- dspif1
connect system/manager_at_lab1
drop user aqpdes cascade;
create user aqpdes identified by aqpdes;
GRANT CONNECT, RESOURCE, aq_administrator_role TO aqpdes;
GRANT EXECUTE ON dbms_aq TO aqpdes;
GRANT EXECUTE ON dbms_aqadm TO aqpdes;
alter user aqpdes quota unlimited on users;
begin
dbms_aqadm.grant_system_privilege('ENQUEUE_ANY', 'aqpdes', FALSE);
dbms_aqadm.grant_system_privilege('DEQUEUE_ANY', 'aqpdes', FALSE);
end;
/
connect aqfinexc/aqfinexc_at_lab
-- message that will be send to fin system
CREATE type aqfinexc.fin_msg_typ as object(
seq_num number,
name VARCHAR2(30),
amt number
);
/
-- look at maybe trying to rename the queue table to something else, more relevant to the system
begin
DBMS_AQADM.CREATE_QUEUE_TABLE(queue_table => 'aqfinexc.objmsgs80_qtab',
queue_payload_type => 'aqfinexc.fin_msg_typ', multiple_consumers => TRUE); DBMS_AQADM.CREATE_QUEUE(queue_name => 'FIN_MSG_QUEUE', queue_table => 'aqfinexc.objmsgs80_qtab');DBMS_AQADM.START_QUEUE(queue_name => 'FIN_MSG_QUEUE'); end;
connect aqpdes/aqpdes_at_lab1
-- message that will be send to fin system
CREATE type aqpdes.fin_msg_typ as object(
seq_num number,
name VARCHAR2(30),
amt number
);
/
-- look at maybe trying to rename the queue table to something else, more relevant to the system
begin
DBMS_AQADM.CREATE_QUEUE_TABLE(queue_table => 'aqpdes.objmsgs80_qtab',
queue_payload_type => 'aqpdes.fin_msg_typ', multiple_consumers => TRUE); DBMS_AQADM.CREATE_QUEUE(queue_name => 'FIN_MSG_QUEUE', queue_table => 'aqpdes.objmsgs80_qtab');DBMS_AQADM.START_QUEUE(queue_name => 'FIN_MSG_QUEUE'); end;
connect aqfinexc/aqfinexc_at_lab
-- ADDED: Create loopback database link
create database link aqpdes connect to aqpdes identified by aqpdes
USING 'LAB1.WESBANK.CO.ZA';
/* when we need to do some cleaning
begin
DBMS_AQADM.UNSCHEDULE_PROPAGATION (
Queue_Name => 'fin_msg_queue',
Destination => 'aqfinexc.aqpdes');
end;
/
*/
From: oracle-l-bounce_at_freelists.org on behalf of Leonard, George
Sent: Fri 2005/02/18 05:56 PM
To: oracle-l_at_freelists.org
Subject: HOW TO, AQ between 2 dbs
Hi all
hope someone can save me some time, (busy trying examples and jsut running into walls, sorry late on Friday guess brain is weekend mode already)
busy trying a POC atm regarding AQ.
DB=>A, user aqfinexc need to send msg to DB=>B, user aqpdes
as message is added to A's Queue i want to have it pushed over to B and will be colelcted that side by a dequeue process listening, got a example to do this.
does anyone have a script to set soemthing like this up already.
i got AQ working locally but now got to get it working from A=>B (from Asktom.oracle.com)
thanks.
George
The views expressed in this email are, unless otherwise stated, those of the author and not those of the FirstRand Banking Group an Authorised Financial Service Provider or its management. The information in this e-mail is confidential and is intended solely for the addressee. Access to this e-mail by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted in reliance on this, is prohibited and may be unlawful. Whilst all reasonable steps are taken to ensure the accuracy and integrity of information and data transmitted electronically and to preserve the confidentiality thereof, no liability or responsibility whatsoever is accepted if information or data is, for whatever reason, corrupted or does not reach its intended destination.
-- http://www.freelists.org/webpage/oracle-l ___________________________________________________________________________________________________ The views expressed in this email are, unless otherwise stated, those of the author and not those of the FirstRand Banking Group an Authorised Financial Service Provider or its management. The information in this e-mail is confidential and is intended solely for the addressee. Access to this e-mail by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted in reliance on this, is prohibited and may be unlawful. Whilst all reasonable steps are taken to ensure the accuracy and integrity of information and data transmitted electronically and to preserve the confidentiality thereof, no liability or responsibility whatsoever is accepted if information or data is, for whatever reason, corrupted or does not reach its intended destination. ________________________________ -- http://www.freelists.org/webpage/oracle-l ___________________________________________________________________________________________________ The views expressed in this email are, unless otherwise stated, those of the author and not those of the FirstRand Banking Group an Authorised Financial Service Provider or its management. The information in this e-mail is confidential and is intended solely for the addressee. Access to this e-mail by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted in reliance on this, is prohibited and may be unlawful. Whilst all reasonable steps are taken to ensure the accuracy and integrity of information and data transmitted electronically and to preserve the confidentiality thereof, no liability or responsibility whatsoever is accepted if information or data is, for whatever reason, corrupted or does not reach its intended destination. ________________________________ -- http://www.freelists.org/webpage/oracle-lReceived on Sat Feb 19 2005 - 06:35:34 CST