我试图通过一个程序获得V $ RESOURCE_LIMIT结果的Oracle DBMS_OUTPUT。
但是,我收到有关c1未完成或格式错误的错误。
到目前为止,我有以下代码:
CREATE OR REPLACE PROCEDURE resource_output AS
CURSOR c1 IS SELECT resource_name , current_utilization , max_utilization , initial_allocation , limit_value FROM v$resource_limit;
TYPE rl_typ IS TABLE OF c1%ROWTYPE;
rl rl_typ;
BEGIN
dbms_output.enable(100000);
FOR rl IN (
select * BULK COLLECT INTO rl from v$resource_limit
)
LOOP
DBMS_OUTPUT.PUT_LINE('Resource Name = ' || rl.resource_name ||
', Current Utilization = ' || rl.current_utilization ||
', Max Utilization = ' || rl.max_utilization ||
', Initial Allocation = ' || rl.initial_allocation ||
', Limit Value = ' || rl.limit_value);
END LOOP;
END resource_output;
答案 0 :(得分:1)
对不起,我不在Oracle实例的前面来更全面地帮助您。但是,我认为您对re.split(r'[\W_]+', unicode(phrase.strip('.'), 'utf-8').lower(), flags=re.U)
的声明没有错。
但是,您实际上并未在程序中使用c1
。您的c1
循环应为:
FOR
...没有FOR rl IN (
select * from v$resource_limit
) LOOP
。
答案 1 :(得分:0)
CREATE OR REPLACE PROCEDURE resource_output AS
BEGIN
dbms_output.enable(100000);
FOR rl IN (
select * from v$resource_limit
)
LOOP
DBMS_OUTPUT.PUT_LINE('Resource Name = ' || rl.resource_name ||
', Current Utilization = ' || rl.current_utilization ||
', Max Utilization = ' || rl.max_utilization ||
', Initial Allocation = ' || rl.initial_allocation ||
', Limit Value = ' || rl.limit_value);
END LOOP;
END resource_output;
exec resource_output;
输出:
Resource Name = processes, Current Utilization = 103, Max Utilization = 179, Initial Allocation = 900, Limit Value = 900
Resource Name = sessions, Current Utilization = 117, Max Utilization = 212, Initial Allocation = 1372, Limit Value = 1372
Resource Name = enqueue_locks, Current Utilization = 105, Max Utilization = 223, Initial Allocation = 15820, Limit Value = 15820
Resource Name = enqueue_resources, Current Utilization = 35, Max Utilization = 94, Initial Allocation = 6256, Limit Value = UNLIMITED
Resource Name = ges_procs, Current Utilization = 0, Max Utilization = 0, Initial Allocation = 0, Limit Value = 0
Resource Name = ges_ress, Current Utilization = 0, Max Utilization = 0, Initial Allocation = 0, Limit Value = UNLIMITED
Resource Name = ges_locks, Current Utilization = 0, Max Utilization = 0, Initial Allocation = 0, Limit Value = UNLIMITED
Resource Name = ges_cache_ress, Current Utilization = 0, Max Utilization = 0, Initial Allocation = 0, Limit Value = UNLIMITED
Resource Name = ges_reg_msgs, Current Utilization = 0, Max Utilization = 0, Initial Allocation = 0, Limit Value = UNLIMITED
Resource Name = ges_big_msgs, Current Utilization = 0, Max Utilization = 0, Initial Allocation = 0, Limit Value = UNLIMITED
Resource Name = ges_rsv_msgs, Current Utilization = 0, Max Utilization = 0, Initial Allocation = 0, Limit Value = 0
Resource Name = gcs_resources, Current Utilization = 0, Max Utilization = 0, Initial Allocation = UNLIMITED, Limit Value = UNLIMITED
Resource Name = gcs_shadows, Current Utilization = 0, Max Utilization = 0, Initial Allocation = UNLIMITED, Limit Value = UNLIMITED
Resource Name = smartio_overhead_memory, Current Utilization = 0, Max Utilization = 68632, Initial Allocation = 0, Limit Value = UNLIMITED
Resource Name = smartio_buffer_memory, Current Utilization = 0, Max Utilization = 0, Initial Allocation = 0, Limit Value = UNLIMITED
Resource Name = smartio_metadata_memory, Current Utilization = 0, Max Utilization = 0, Initial Allocation = 0, Limit Value = UNLIMITED
Resource Name = smartio_sessions, Current Utilization = 0, Max Utilization = 1, Initial Allocation = 0, Limit Value = UNLIMITED
Resource Name = dml_locks, Current Utilization = 0, Max Utilization = 0, Initial Allocation = 6036, Limit Value = UNLIMITED
Resource Name = temporary_table_locks, Current Utilization = 0, Max Utilization = 65, Initial Allocation = UNLIMITED, Limit Value = UNLIMITED
Resource Name = transactions, Current Utilization = 5, Max Utilization = 5, Initial Allocation = 1509, Limit Value = UNLIMITED
Resource Name = branches, Current Utilization = 0, Max Utilization = 0, Initial Allocation = 1509, Limit Value = UNLIMITED
Resource Name = cmtcallbk, Current Utilization = 3, Max Utilization = 19, Initial Allocation = 1509, Limit Value = UNLIMITED
Resource Name = max_rollback_segments, Current Utilization = 14, Max Utilization = 21, Initial Allocation = 1509, Limit Value = 65535
Resource Name = sort_segment_locks, Current Utilization = 16, Max Utilization = 40, Initial Allocation = UNLIMITED, Limit Value = UNLIMITED
Resource Name = k2q_locks, Current Utilization = 0, Max Utilization = 0, Initial Allocation = 2744, Limit Value = UNLIMITED
Resource Name = max_shared_servers, Current Utilization = 0, Max Utilization = 0, Initial Allocation = UNLIMITED, Limit Value = UNLIMITED
Resource Name = parallel_max_servers, Current Utilization = 0, Max Utilization = 16, Initial Allocation = 40, Limit Value = 3600
答案 2 :(得分:0)
grant select any dictionary to that particular user
;或者如果你想只给v $ resource_limit提供权限,那么grant select on v$resource_limit to particular user
;
然后尝试