COLUMN agent_database FORMAT a30
SELECT agent_user,
agent_database,
agent_name
FROM mgw_gateway;
SELECT link_name,
link_type,
agent_name
FROM mgw_links;
SET LINESIZE 200 PAGESIZE 50
COLUMN queue_manager FORMAT a30
COLUMN channel FORMAT a40
SELECT link_name,
queue_manager,
channel,
hostname,
port,
interface_type
FROM mgw_mqseries_links;
SET LINESIZE 200
SET PAGESIZE 50
COLUMN provider_queue FORMAT a50
SELECT name,
link_name,
provider_queue
FROM MGW_FOREIGN_QUEUES;
SET LINESIZE 300
SET PAGESIZE 50
COLUMN destination FORMAT a40
SELECT job_name,
propagation_type,
source,
destination,
enabled,
agent_name,
link_name,
status
FROM mgw_jobs;
Who is Granted MGW_AGENT_ROLE/MGW_ADMINISTRATOR_ROLE?
SELECT grantee,
granted_role
FROM dba_role_privs
WHERE granted_role LIKE 'MGW%';
CONNECT admin_user
EXEC DBMS_MGWADM.STARTUP
CONNECT admin_user
EXEC DBMS_MGWADM.SHUTDOWN
When the Messaging Gateway agent fails to convert a message from the source format to the destination format, the agent moves the message from the source queue to an exception queue.
If the Messaging Gateway agent runs into failures when processing a propagation job, it retries up to sixteen times in an exponential backoff scheme (from two seconds up to thirty minutes) before it stops retrying.
The default location for the log file is (it can be overridden via a setting in MGW.ORA):
$ORACLE_HOME/mgw/log
The default logging level is set in the MGW.ORA file (in normal circumstances this should always be 0 in the MGW.ORA file). The logging level can be dynamically changed by calling DBMS_MGWADM.SET_LOG_LEVEL while the Messaging Gateway agent is running.
0 for basic logging; equivalent to DBMS_MGWADM.BASIC_LOGGING
1 for light tracing; equivalent to DBMS_MGWADM.TRACE_LITE_LOGGING
2 for high tracing; equivalent to DBMS_MGWADM.TRACE_HIGH_LOGGING
3 for debug tracing; equivalent to DBMS_MGWADM.TRACE_DEBUG_LOGGING
4 for high debug tracing; equivalent to DBMS_MGWADM.TRACE_DEBUG_HIGH_LOGGING
SELECT owner,
object_name,
object_type
FROM dba_objects
WHERE status = 'INVALID'
AND object_name like '%MGW%';
Are you sure the listener was started using the correct config files? Check TNS_ADMIN. Set correctly and restart Listener and MGW if necessary.
Possibly due to the setting of SQLNET.INBOUND_CONNECT_TIMEOUT.
See: 2773657.1, 1356971.1Update SQLNET.ORA.
Recommended settings are: 0, 60, or remove the paramter altogether (default is 60).
Reload listener (lsnrctl reload)
Are you sure the listener was started using the correct config files? Check TNS_ADMIN. Set correctly and restart Listener and MGW if necessary.
CONNECT admin_user/admin_password
EXEC DBMS_MGWADM.SHUTDOWN;
EXEC DBMS_MGWADM.CLEANUP_GATEWAY(DBMS_MGWADM.CLEAN_STARTUP_STATE);
Terminate any Messaging Gateway agent process that may still be running after a CLEAN_STARTUP_STATE action has been successfully performed. This should be done before calling DBMS_MGWADM.STARTUP to start Messaging Gateway. The process is usually named extprocmgwextproc.exec dbms_mgwadm.startup;
CONNECT admin_user/admin_password
EXEC DBMS_MGWADM.SHUTDOWN(DBMS_MGWADM.FORCE);
EXEC DBMS_MGWADM.CLEANUP_GATEWAY(DBMS_MGWADM.CLEAN_STARTUP_STATE);
Terminate any Messaging Gateway agent process that may still be running after a CLEAN_STARTUP_STATE action has been successfully performed. This should be done before calling DBMS_MGWADM.STARTUP to start Messaging Gateway. The process is usually named extprocmgwextproc.EXEC DBMS_MGWADM.STARTUP;
SHOW PARAMETER job_queue_processes
MGW needs a non zero value for JOB_QUEUE_PROCESSES
Refrer to the Websphere MQ Troubleshooting section here.
oracle.mgw.admin.MgwAdminException: [610] Agent has been identified as a rogue and will be shut down.
See 1244874.1. This suggests a timeout issue.
If the Messaging Gateway starts successfully but crashes soon after, and you see this in the log file...
java.lang.IllegalArgumentException: Comparison method violates its general contract!
.. it is likely you are running into Sun Java Bug 7075600 .
You can workaround this bug by adding this to your mgw.ora file...
setJavaProp java.util.Arrays.useLegacyMergeSort=true
MOS Note 1507950.1 implies that this only affects Java 7, but this workaround has worked for the IBM build of 1.8.0_231 on AIXCheck status of the host specified in the error message. If the host (or the MQ process on that host) is unreachable then it is likely to cause MGQ to fail.
The value of the JOB_QUEUE_PROCESEES paramter defines the maximum number of Scheduler jobs and job queue jobs that can run concurrently. To use the Messaging Gateway it must be non-zero.
ALTER SYSTEM SET JOB_QUEUE_PROCESSES=20 SCOPE=BOTH;
cd $ORACLE_HOME/mgw/admin
sqlplus / as sysdba
@catmgw.sql
See the example stanzas.
CREATE USER &admin_user IDENTIFIED BY &admin_password;
GRANT CREATE SESSION to &&admin_user;
GRANT MGW_ADMINISTRATOR_ROLE to &&admin_user;
CREATE USER &agent_user IDENTIFIED BY &agent_password;
GRANT CREATE SESSION to &&agent_user;
GRANT MGW_AGENT_ROLE to &&agent_user;
The MGW_ADMINISTRATOR_ROLE gives the user:
This Role:
AQ_ADMINISTRATOR_ROLE
The ability to Execute:
DBMS_MGWADM
MGW_MQSERIES_PROPERTIES
MGW_TIBRV_PROPERTIES
MGW_MSMQ_PROPERTIES
MGW_PROPERTIES
MGW_PROPERTY
The ability to Select from:
MGW_AGENT_OPTIONS
MGW_FOREIGN_QUEUES
MGW_GATEWAY
MGW_JOBS
MGW_LINKS
MGW_MQSERIES_LINKS
MGW_MSMQ_LINKS
MGW_SCHEDULES
MGW_SUBSCRIBERS
MGW_TIBRV_LINKS
The MGW_AGENT_ROLE gives the user:
These Roles:
AQ_ADMINISTRATOR_ROLE
MGW_ADMINISTRATOR_ROLE
The ability to Execute:
DBMS_PIPE
MGWI_ADMIN
MGWI_CRYPTO
MGWI_FOREIGNQUEUE
MGWI_MSGLINK
MGWI_SCHEDULE
MGWI_SUBSCRIBER
MGW_AQDRIVER
MGW_AQ_DEQUEUE_OPTIONS_T
MGW_AQ_ENQUEUE_OPTIONS_T
MGW_AQ_MESSAGE_PROPS_T
MGW_NOTIFY
MGW_NOTIF_ELEMENT
MGW_NOTIF_ELEMENT_LIST
MGW_NOTIF_MSG
The ability to Select and Update ANY TABLE
The ability to Select and Update these objects:
MGW$_AGENT_OPTIONS
MGW$_CONFIG
MGW$_FOREIGN_QUEUES
MGW$_GATEWAY
MGW$_LINKS
MGW$_MQSERIES_LINKS
MGW$_MSMQ_LINKS
MGW$_SCHEDULES
MGW$_TIBRV_LINKS
The ability to Select, Update and Delete from:
MGW$_SUBSCRIBERS
The ability to DEQUEUE, ENQUEUE, SELECT and UPDATE:
MGW_JMS_RECV_LOG
MGW_JMS_SEND_LOG
The ability to ENQUEUE and DEQUEUE:
MGW_RECV_LOG
MGW_SEND_LOG
The ability to Select on these objects:
DBA_TRANSFORMATIONS
set echo off
set verify off
connect admin_user
ACCEPT password CHAR PROMPT 'Enter the password for AGENT_NAME: ' HIDE
ACCEPT password CHAR PROMPT 'Enter the password for AGENT_USER: ' HIDE
ACCEPT password CHAR PROMPT 'Enter the password for AGENT_PASS: ' HIDE
ACCEPT password CHAR PROMPT 'Enter the password for AGENT_DB : ' HIDE
EXEC DBMS_MGWADM.ALTER_AGENT(
agent_name => '&default_agent',
username => '&agent_user',
password => '&password',
database => '&agent_database');
Recommended Settings
agent_name => 'DEFAULT_AGENT'
This is the default agent nameusername => 'AGENT_USER'
Created abovepassword => 'password'
Any complex passworddatabase => 'MGW_AGENT'
As defined in TNSNAMES.ORADECLARE
v_options sys.mgw_properties;
v_prop sys.mgw_mqseries_properties;
BEGIN
v_prop := sys.mgw_mqseries_properties.construct();
v_prop.interface_type := dbms_mgwadm.MQSERIES_BASE_JAVA_INTERFACE;
v_prop.max_connections := 1;
v_prop.username := 'mqm';
v_prop.password := 'mqm';
v_prop.hostname := 'myhost.mydomain';
v_prop.port := 1414;
v_prop.channel := 'mychannel';
v_prop.queue_manager := 'my.queue.manager';
v_prop.outbound_log_queue := 'mylogq';
dbms_mgwadm.create_msgsystem_link(linkname => 'mqlink',
agent_name =>'default_agent',
properties => v_prop,
options => v_options );
END;
BEGIN
dbms_mgwadm.remove_msgsystem_link(linkname =>'mqlink');
END;
BEGIN
DBMS_MGWADM.REGISTER_FOREIGN_QUEUE(
name => 'destq',
linkname => 'mqlink',
provider_queue => 'my_mq_queue',
domain => dbms_mgwadm.DOMAIN_QUEUE);
END;
The domain must be DBMS_MGWADM.DOMAIN_QUEUE or NULL, because only point-to-point queues are supported for WebSphere MQ.BEGIN
DBMS_MGWADM.UNREGISTER_FOREIGN_QUEUE(name =>'destq', linkname=>'mqlink');
END;
BEGIN
DBMS_MGWADM.CREATE_JOB(
job_name => 'job_aq2mq',
propagation_type => DBMS_MGWADM.OUTBOUND_PROPAGATION,
source => 'mquser.srcq',
destination => 'deqq@mqlink');
END;
By default a job is Enabled when created. If it has been Disabled you can re-enable using...
BEGIN
DBMS_MGWADM.ENABLE_JOB(job_name => 'job_aq2mq');
END;
BEGIN
DBMS_MGWADM.DISABLE_JOB(job_name => 'job_aq2mq');
END;
When a problem occurs with a propagation job, the Messaging Gateway agent retries the failed operation up to 16 times in an exponential backoff scheme before the propagation job stops. You can use DBMS_MGWADM.RESET_JOB to reset the failure count to zero to allow the agent to retry the failed operation immediately.
https://docs.oracle.com/database/121/ADQUE/mg_work.htm#ADQUE3333BEGIN
DBMS_MGWADM.RESET_JOB (job_name => 'job_aq2mq');
END;
BEGIN
DBMS_MGWADM.REMOVE_JOB (job_name => 'job_aq2mq');
END;
For a full description of the what removing a job does, please see: https://docs.oracle.com/database/121/ADQUE/mg_work.htm#ADQUE3336If you want to remove MGW from your database...
CONNECT admin_user
EXEC DBMS_MGWADM.SHUTDOWN
Remove any user-created queues whose payload is a Messaging Gateway canonical type (for example, SYS.MGW_BASIC_MSG_T).
sqlplus / as sysdba
@ORACLE_HOME/mgw/admin/catnomgw.sql
This drops the database objects used by Messaging Gateway, including roles, tables, views, packages, object types, and synonyms.Remove entries for Messaging Gateway created in listener.ora and tnsnames.ora.
IDAP = Internet Data Access Presentation which is the SOAP specification for Oracle Database AQ. IDAP defines the XML message structure for the body of the SOAP request. An IDAP-structured message is transmitted over the Internet using HTTP(S).
SOAP = Simple Object Access Protocol. A minimal set of conventions for invoking code using XML over HTTP defined by World Wide Web Consortium.
message = The smallest unit of information inserted into and retrieved from a queue. A message consists of control information (metadata) and payload (data).
queue = The abstract storage unit used by a messaging system to store messages.
Queue monitor coordinator. It dynamically spawns slaves qXXX depending on the system load. The slaves do various background tasks.
Queue monitor process.
Oracle Java Message Service (Oracle JMS) provides a Java API for Oracle Database Advanced Queuing based on the Java Message Service (JMS) standard. Oracle JMS supports the standard JMS interfaces and has extensions to support the Oracle Database Advanced Queuing administrative operations and other Oracle Database Advanced Queuing features that are not a part of the standard.
JMS is a messaging standard defined by Sun Microsystems, Oracle, IBM, and other vendors. JMS is a set of interfaces and associated semantics that define how a JMS client accesses the facilities of an enterprise messaging product.
Oracle Documentation
My Oracle Supporthttps://support.oracle.comMessaging Gateway Will Not Shutdown (Doc ID 335523.1)SRDC - How to Collect Information for Troubleshooting Messaging Gateway Issues (Doc ID 1933998.1) On what Platforms and Versions of Oracle is the Oracle Messaging Gateway available? (Doc ID 219410.1)Sun Defect 7075600 - "Comparison method violates its general contract!" errors - and Problems with the Work-around (Doc ID 1507950.1)Configuring Our Websphere Mq Link To Use Ssl (Doc ID 1293302.1)Extproc User Session Disconnects at SQLNET.INBOUND_CONNECT_TIMEOUT Value (Doc ID 1356971.1)Bug 12932097 : EXTPROC: USER SESSION IS DISCONNECTED IF SQLNET.INBOUND_CONNECT_TIMEOUT IS SEThttps://support.oracle.com/rs?type=doc&id=219410.1 (On what Platforms and Versions of Oracle is the Oracle Messaging Gateway available?)MGW Crashes With Message -- Agent Has Been Identified as a Rogue (Doc ID 1244874.1)