Skip to content

Commit fc0be3e

Browse files
authored
Merge pull request #630 from afumagalli98/update-memory-pga-sga-advisory
Updated memory_pga_sga_advisory.sql
2 parents bb67818 + a275bcc commit fc0be3e

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

sql/memory_pga_sga_advisory.sql

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ set serveroutput on
2020
DECLARE
2121
has_memory_target_enabled number := 0;
2222
memory_size_lower number := 0;
23-
exists_lower_pga_cache_hit_100 number := 0;
24-
exists_lower_pga_cache_hit_95 number := 0;
23+
exists_low_pga_cachehit_100 number := 0;
24+
exists_low_pga_cachehit_95 number := 0;
2525
pga_target_lower number := 0;
26-
exists_lower_est_db_time_factor_105 number := 0;
26+
exists_low_est_dbtime_105 number := 0;
2727
sga_size_lower number := 0;
2828
begin
2929
--Check if exists a record in v$memory_target_advice -> if yes automatic memory management is enabled
3030
select count(*) into has_memory_target_enabled from v$memory_target_advice;
3131
if (has_memory_target_enabled>0) then
32-
select count(*) into exists_lower_est_db_time_factor_105 from v$memory_target_advice where ESTD_DB_TIME_FACTOR<=1.05 and MEMORY_SIZE_FACTOR<1;
33-
if (exists_lower_est_db_time_factor_105>0) then
32+
select count(*) into exists_low_est_dbtime_105 from v$memory_target_advice where ESTD_DB_TIME_FACTOR<=1.05 and MEMORY_SIZE_FACTOR<1;
33+
if (exists_low_est_dbtime_105>0) then
3434
select MEMORY_SIZE into memory_size_lower from
3535
(select MEMORY_SIZE
3636
from v$memory_target_advice
@@ -40,24 +40,24 @@ if (has_memory_target_enabled>0) then
4040
end if;
4141
DBMS_OUTPUT.PUT_LINE('BEGINOUTPUT');
4242
memory_size_lower := round(memory_size_lower/1024,3);
43-
if (exists_lower_est_db_time_factor_105=0) then
43+
if (exists_low_est_dbtime_105=0) then
4444
DBMS_OUTPUT.PUT_LINE('MEMORY_SIZE_LOWER_GB|||' || 'N/A');
4545
else
4646
DBMS_OUTPUT.PUT_LINE('MEMORY_SIZE_LOWER_GB|||' || memory_size_lower);
4747
end if;
4848
DBMS_OUTPUT.PUT_LINE('ENDOUTPUT');
4949
else
5050
--Check if exist a pga_aggregate_target size lower than the actual that have pga_cache_hit_precentage = 100 or at least >=95
51-
select count(*) into exists_lower_pga_cache_hit_100 from v$pga_target_advice where ESTD_PGA_CACHE_HIT_PERCENTAGE=100 and PGA_TARGET_FACTOR<1;
52-
select count(*) into exists_lower_pga_cache_hit_95 from v$pga_target_advice where ESTD_PGA_CACHE_HIT_PERCENTAGE>=95 and PGA_TARGET_FACTOR<1;
53-
if (exists_lower_pga_cache_hit_100>0) then
51+
select count(*) into exists_low_pga_cachehit_100 from v$pga_target_advice where ESTD_PGA_CACHE_HIT_PERCENTAGE=100 and PGA_TARGET_FACTOR<1;
52+
select count(*) into exists_low_pga_cachehit_95 from v$pga_target_advice where ESTD_PGA_CACHE_HIT_PERCENTAGE>=95 and PGA_TARGET_FACTOR<1;
53+
if (exists_low_pga_cachehit_100>0) then
5454
select PGA_TARGET_FOR_ESTIMATE into pga_target_lower from
5555
(select PGA_TARGET_FOR_ESTIMATE
5656
from v$pga_target_advice
5757
where ESTD_PGA_CACHE_HIT_PERCENTAGE=100 and PGA_TARGET_FACTOR<1
5858
order by ESTD_PGA_CACHE_HIT_PERCENTAGE,PGA_TARGET_FACTOR)
5959
where rownum=1;
60-
elsif (exists_lower_pga_cache_hit_95>0) then
60+
elsif (exists_low_pga_cachehit_95>0) then
6161
select PGA_TARGET_FOR_ESTIMATE into pga_target_lower from
6262
(select PGA_TARGET_FOR_ESTIMATE
6363
from v$pga_target_advice
@@ -66,8 +66,8 @@ else
6666
where rownum=1;
6767
end if;
6868
--Check if exist a sga_target size lower than the actual that have est_db_time_factor at least 0.05 % greater than the actual
69-
select count(*) into exists_lower_est_db_time_factor_105 from v$sga_target_advice where ESTD_DB_TIME_FACTOR<=1.05 and SGA_SIZE_FACTOR<1;
70-
if (exists_lower_est_db_time_factor_105>0) then
69+
select count(*) into exists_low_est_dbtime_105 from v$sga_target_advice where ESTD_DB_TIME_FACTOR<=1.05 and SGA_SIZE_FACTOR<1;
70+
if (exists_low_est_dbtime_105>0) then
7171
select SGA_SIZE into sga_size_lower from
7272
(select SGA_SIZE
7373
from v$sga_target_advice
@@ -77,13 +77,13 @@ else
7777
end if;
7878
DBMS_OUTPUT.PUT_LINE('BEGINOUTPUT');
7979
pga_target_lower := round(pga_target_lower/1024/1024/1024,3);
80-
if (exists_lower_pga_cache_hit_100=0 and exists_lower_pga_cache_hit_95=0) then
80+
if (exists_low_pga_cachehit_100=0 and exists_low_pga_cachehit_95=0) then
8181
DBMS_OUTPUT.PUT_LINE('PGA_TARGET_AGGREGATE_LOWER_GB|||' || 'N/A');
8282
else
8383
DBMS_OUTPUT.PUT_LINE('PGA_TARGET_AGGREGATE_LOWER_GB|||' || pga_target_lower);
8484
end if;
8585
sga_size_lower := round(sga_size_lower/1024,3);
86-
if (exists_lower_est_db_time_factor_105=0) then
86+
if (exists_low_est_dbtime_105=0) then
8787
DBMS_OUTPUT.PUT_LINE('SGA_SIZE_LOWER_GB|||' || 'N/A');
8888
else
8989
DBMS_OUTPUT.PUT_LINE('SGA_SIZE_LOWER_GB|||' || sga_size_lower);

0 commit comments

Comments
 (0)