CREATE OR REPLACE FUNCTION calc_shared_pool(max_users IN NUMBER) RETURN NUMBER IS -------------------------------------------------- -- 覦 as sysdba 蟠 螳讌 襦 . -------------------------------------------------- session_id NUMBER; --sample session id session_uga_max NUMBER; -- session uga_memory max sql_area NUMBER; plsql_area NUMBER; temp NUMBER; BEGIN -- 語 螳讌 覃覈襴 語 螳語. SELECT id INTO session_id FROM (SELECT sid AS id FROM v$process p, v$session s WHERE p.addr = s.paddr ORDER BY dbms_random.VALUE) WHERE ROWNUM = 1; --dbms_output.put_line(' 語 ID : ' || session_id); --企 語 螳讌 豕 覃覈襴 SELECT VALUE INTO session_uga_max FROM v$sesstat s, v$statname n WHERE s.statistic# = n.statistic# AND n.NAME = 'session uga memory max' AND sid = session_id; --dbms_output.put_line('企 語 螳讌 豕 覃覈襴 : ' || session_uga_max); --Total Shared SQL Area SELECT SUM(sharable_mem) INTO sql_area FROM v$sqlarea; --PL/SQL Sharable Memory Area SELECT SUM(sharable_mem) INTO plsql_area FROM v$db_object_cache; --豕 Shared Pool Size 螻 temp := (session_uga_max * max_users) + sql_area + plsql_area; RETURN CEIL((temp + temp*0.3)/1024/1024); END; / --Shared Pool 蠍磯 伎覿磯. --Shared Pool 蠍 螻一 企 燕 譯手鍵朱 螳 --Insert ~ Select 覓語 伎伎 曙 襷讌襷朱 螳 螳 谿場碁. CREATE TABLE temp_shared_pool_size(nSIZE NUMBER); INSERT INTO temp_shared_pool_size SELECT calc_shared_pool(400) "豕 Shared Pool Size(MB)" FROM dual; -- 蟆郁骸 Shared Pool 豕 蠍一 覈伎 . 襦企 蟆 ′譴. SELECT MAX(nSIZE) FROM temp_shared_pool_size;