下面是我在队列中排队数据的过程,在运行程序时遇到编译错误,我无法找到出错的地方。请帮我解决。
CREATE OR REPLACE PROCEDURE p_enqueue(msg IN VARCHAR2)
AS
PRAGMA AUTONOMOUS_TRANSACTION;
enqueue_options dbms_aq.enqueue_options_t;
message_properties dbms_aq.message_properties_t;
message_handle RAW(16);
BEGIN
dbms_aq.enqueue( queue_name => 'example_queue',
enqueue_options => enqueue_options,
message_properties => message_properties,
payload => message_type(msg),
msgid => message_handle);
COMMIT;
END;
错误:
PLS-00201:必须声明标识符“DBMS_AQ”
PLS-00320:此表达式类型的声明不完整或格式错误
当我尝试使用grant privilage时,我收到了以下错误
ERROR ORA-01031:权限不足
如果这是问题,我运行下面的pl / sql块来排队消息,程序成功创建。如果不存在特权,怎么可能?
DECLARE
enqueue_options dbms_aq.enqueue_options_t;
message_properties dbms_aq.message_properties_t;
message_handle RAW(16);
message message_typ;
BEGIN
message := message_typ('NORMAL MESSAGE',
'enqueued to msg_queue first.');
dbms_aq.enqueue(queue_name => 'msg_queue',
enqueue_options => enqueue_options,
message_properties => message_properties,
payload => message,
msgid => message_handle);
COMMIT;
end;
答案 0 :(得分:0)
错误消息显示DBMS_AQ不知道。由于这是SYS拥有的Oracle软件包,因此它确实存在。所以你错过了查看和执行它的权利。
你跑吗
grant EXECUTE ON DBMS_AQ to appuser;
在我的answer中明确显示了您之前的一个问题?
答案 1 :(得分:0)
检查DBMS_AQ pkg并找出您使用过程的必需参数。
以下查询将对队列有用。
SELECT name, enqueue_enabled, dequeue_enabled
FROM user_queues;
SELECT owner, queue_name, queue_table, consumer_name
FROM dba_queue_subscribers;
SELECT queue_name, consumer_name, address, protocol, delivery_mode, queue_to_queue
FROM user_queue_subscribers;
SELECT qname, destination, start_date, start_time, propagation_window, next_time, latency
FROM user_queue_schedules;
SELECT qname, process_name, session_id, instance, last_run_date, last_run_time, current_start_date
FROM user_queue_schedules;
SELECT qname, current_start_time, next_run_date, next_run_time, total_time, total_number
FROM user_queue_schedules;
SELECT qname, total_bytes, max_number, max_bytes, avg_number, avg_size, avg_time
FROM user_queue_schedules;