我正在使用 oracle 11.2。
数据库用户:
- AQADM:用户拥有队列,并拥有AQ_ADMINISTRATOR_ROLE
- SCOTT:jms 用户,具有以下权限。
我有以下存储过程,它编译好。它是从表上的触发器调用的。
CREATE OR REPLACE PROCEDURE scott.PROC_JMS_ENQUEUE (NAME VARCHAR,
MESSAGE IN VARCHAR)
AS
msg SYS.AQ$_JMS_TEXT_MESSAGE;
queue_options DBMS_AQ.ENQUEUE_OPTIONS_T;
msg_props DBMS_AQ.MESSAGE_PROPERTIES_T;
msg_id RAW (16);
no_consumers_error EXCEPTION;
PRAGMA EXCEPTION_INIT (no_consumers_error, -24033);
BEGIN
-- Ensure what is sent will be a JMS message
msg := SYS.AQ$_JMS_TEXT_MESSAGE.CONSTRUCT ();
msg.set_text (MESSAGE);
--ENQUEUE
DBMS_AQ.ENQUEUE (queue_name => 'aqadm.my_queue',
enqueue_options => queue_options,
message_properties => msg_props,
payload => msg,
msgid => msg_id);
-- Without the following, the procedure will die if none
-- Is listening for cache control
EXCEPTION
WHEN no_consumers_error
THEN
-- Output it in case, but otherwise swallow
DBMS_OUTPUT.PUT_LINE (
'No interested parties are listening to messages');
END;
/
我有以下 GRANT 给用户
GRANT EXECUTE ON AQ_USER_ROLE TO scott;
GRANT EXECUTE ON SYS.DBMS_AQ TO scott;
GRANT EXECUTE ON SYS.DBMS_AQIN TO scott;
--GRANT EXECUTE ON SYS.DBMS_AQJMS_INTERNAL TO scott;
--GRANT EXECUTE ON SYS.DBMS_TRANSFORM TO scott;
GRANT EXECUTE ANY PROCEDURE TO scott;
当我执行上述存储过程或更新触发触发器代码的表时,出现以下错误:
exec PROC_JMS_ENQUEUE('Test Message','Dam');
ORA-01031: insufficient privileges
ORA-06512: at "SYS.DBMS_AQ", line 169
ORA-06512: at "SCOTT.PROC_JMS_ENQUEUE", line 19
ORA-06512: at line 1
编辑:
这是特权视图,所有都被授予 SYS 作为 SYSDBA