DROP USER jmsuser CASCADE ;

GRANT connect, resource,AQ_ADMINISTRATOR_ROLE TO jmsuser IDENTIFIED BY jmsuser ;
GRANT execute ON sys.dbms_aqadm  TO  jmsuser;
GRANT execute ON sys.dbms_aq     TO  jmsuser;
GRANT execute ON sys.dbms_aqin   TO  jmsuser;
GRANT execute ON sys.dbms_aqjms  TO  jmsuser;

connect jmsuser/jmsuser;
-- Create table to hold the queue.
-- For topics multiple_consumers must be true
BEGIN
   DBMS_AQADM.CREATE_QUEUE_TABLE(
        Queue_table            => 'demoQTab',
        Queue_payload_type     => 'SYS.AQ$_JMS_MESSAGE',
        sort_list => 'PRIORITY,ENQ_TIME',
        multiple_consumers  => false,
        compatible             => '8.1.5');

   DBMS_AQADM.CREATE_QUEUE(
      Queue_name          => 'demoQueue',
      Queue_table         => 'demoQTab');

   DBMS_AQADM.START_QUEUE(
      queue_name         => 'demoQueue');
END;
/
quit;

