We grant the following priviliges on schema A to user B for inserting into a queue in Oracle 12c:
GRANT CREATE SESSION TO &UNAME_ENQUEUE;
GRANT EXECUTE ON SYS.DBMS_AQ TO &UNAME_ENQUEUE;
GRANT EXECUTE ON SYS.DBMS_AQADM TO &UNAME_ENQUEUE;
GRANT EXECUTE ON SYS.DBMS_AQIN TO &UNAME_ENQUEUE;
GRANT EXECUTE ON SYS.DBMS_AQJMS TO &UNAME_ENQUEUE;
...
DBMS_AQADM.GRANT_QUEUE_PRIVILEGE (
privilege => 'ENQUEUE',
queue_name => v_queue_name,
grantee => v_grantee_name,
grant_option => FALSE);
The queue table is defined as:
dbms_aqadm.create_queue_table(queue_table => 'queue_name_t', queue_payload_type => 'sys.aq$_jms_message');
...
GRANT INSERT ON &USERNAME..queue_name_t TO &UNAME_ENQUEUE;
GRANT SELECT ON &USERNAME..queue_name_t TO &UNAME_ENQUEUE;
The queue is accessed through the JMS interface. We noticed that for messages with a size greater than x, Oracle wants to store the message payload as a CLOB. First of all, we do not know x. Guessing from the Specification of the JMS message type, it should be 4000 for text messages and 2000 for byte messages, as smaller messages would fit into text_vc
or bytes_raw
. However, the payload is only about 500 characters long. (We do set a couple of headers, but those go into a separate header 'field', if I understand the type correctly).
The main problem however is that we get the error ORA-01031: insufficient privileges
when user B wants to insert a CLOB sized message into schema A. Authorized as user A the problem does not arise.
- How can we grant the necessary privileges to user B?
- When does Oracle choose to use a (C)LOB?