我正在使用oracle 11.2。oracle觸發器執行DBMS_AQ獲取的權限不足錯誤
數據庫用戶:
- AQADM:用戶所擁有的隊列,並具有AQ_ADMINISTRATOR_ROLE
- SCOTT:JMS用戶,有以下特權。
我有以下存儲過程,編譯OK。並且它從表上的觸發器被調用。
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;
在i執行上述的存儲過程,或者火災觸發代碼更新表,我得到以下錯誤:
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