如何估算PGA,SGA的大小,配置数据库服务器的内存
ORACLE給的建議是: OLTP系統? PGA=(Total Memory)*80%*20%。DSS系統PGA=(Total Memory)*80%*50%。
ORACLE建議一個數據庫服務器,分80%的內存給數據庫,20%的內存給操作系統,那怎么給一個數據庫服務器配內存呢?
SQL> select * from v$pgastat;
NAME????????????????????????????????????????????????????????????????? VALUE UNIT
---------------------------------------------------------------- ---------- ------------
aggregate PGA target parameter??????????????????????????????????? 104857600 bytes?
-----這個值等于參數PGA_AGGREGATE_TARGET的值,如果此值為0,表示禁用了PGA自動管理。
aggregate PGA auto target????????????????????????????????????????? 75220992 bytes?????
-----表示PGA還能提供多少內存給自動運行模式,通常這個值接近pga_aggregate_target-total pga inuse.
global memory bound??????????????????????????????????????????????? 20971520 bytes
-----工作區執行的最大值,如果這個值小于1M,馬上增加PGA大小
total PGA inuse??????????????????????????????????????????????????? 30167040 bytes
-----當前分配PGA的總大小,這個值有可能大于PGA,如果PGA設置太小.這個值接近select sum(pga_used_mem) from v$process.
total PGA allocated??????????????????????????????????????????????? 52124672 bytes
-----工作區花費的總大小
maximum PGA allocated????????????????????????????????????????????? 67066880 bytes
total freeable PGA memory???????????????????????????????????????????????? 0 bytes???????? ----沒有了空閑的PGA
process count??????????????????????????????????????????????????????????? 23??????????????????? ----當前一個有23個process
max processes count????????????????????????????????????????????????????? 25
PGA memory freed back to OS?????????????????????????????????????????????? 0 bytes
total PGA used for auto workareas?????????????????????????????????? 8891392 bytes
maximum PGA used for auto workareas??????????????????????????????? 22263808 bytes
total PGA used for manual workareas?????????????????????????????????????? 0 bytes????????????????? ---為0自動管理
maximum PGA used for manual workareas???????????????????????????????????? 0 bytes??????????? ---為0自動管理
over allocation count???????????????????????????????????????????????????? 0????????
如果PGA設置太小,導致PGA有時大于PGA_AGGREGATE_TARGET的值,此處為0,說明PGA沒有擴展大于TARGET的值,如果此值出現過,那么增加PGA大小。
bytes processed?????????????????????????????????????????????????? 124434432 bytes
extra bytes read/written????????????????????????????????????????????????? 0 bytes
cache hit percentage??????????????????????????????????????????????????? 100 percent? ---命中率為100%,如果太小增加PGA
recompute count (total)??????????????????????????????????????????????? 6651
19 rows selected
SQL> select max(pga_used_mem)/1024/1024 M from v$process;?? ----當前一個process消耗最大的內存
???????? M
----------
9.12815189
SQL> select min(pga_used_mem)/1024/1024 M from v$process where pga_used_mem>0; ---process消耗最少內存
???????? M
----------
0.19186878
SQL> select max(pga_used_mem)/1024/1024 M from v$process ;??? ----process曾經消耗的最大內存
???????? M
----------
9.12815189
SQL> select sum(pga_used_mem)/1024/1024 from v$process;???----當前process一共消耗的PGA
SUM(PGA_USED_MEM)/1024/1024
---------------------------
?????????? 28.8192501068115
如何設置PGA呢?我們可以在壓力測試階段,模擬一下系統的運行,然后運行
select (select sum(pga_used_mem)/1024/1024 from v$process)?/(select count(*) from v$process) from dual;得到一個process大約占用了多少的內存,然后估算系統一共會有多少連接,比如一共有500個連接,
那么Sessions=1.1*process +5=500,那么processes=450,再乘以一個process需要消耗的內存,就能大約估算出PGA需要設置多大。
最好將PGA設置的值比計算出的值大一點,PGA值設定好后,就可以根據系統的性質,如果系統為OLTOP,那么總的內存可以設置為PGA/0.16,最后也能估算出SGA的大小,建議還是多配點內存,反正便宜。
下面摘抄eygle的關于一個process能夠分配的最大內存(串行操作)的規則:
10gR1之前,對于串行操作(非并行)一個process能夠分配的最大的內存為min(5%pga_aggregate_target,100m)
10gR2之后,對于串行操作(非并行)一個process能夠分配的最大內存有如下規則:
如果pga_aggregate_target<=500m,那么最大的內存為20%*pga_aggregate_target.
如果500m<pga_aggregate_target<=1000m,那么最大內存為100m.
如果1000m<pga_aggregate_target<=2.5G,那么最大內存為10%*pga_aggregate_target. 如果pga_aggregate_target>2.5G,那么最大內存為2.5G. SQL> SELECT x.ksppinm NAME, y.ksppstvl VALUE, x.ksppdesc describ? 2? FROM SYS.x$ksppi x, SYS.x$ksppcv y
? 3? WHERE x.inst_id = USERENV ('Instance')
? 4? AND y.inst_id = USERENV ('Instance')
? 5? AND x.indx = y.indx
? 6? AND x.ksppinm LIKE '%&par%'
? 7? / NAME???????????????????????????????????????????????????????????????????????????? VALUE??????????????????????????????????????????????????????????????????????????? DESCRIB
-------------------------------------------------------------------------------- -------------------------------------------------------------------------------- --------------------------------------------------------------------------------
_smm_max_size??????????????????????????????????????????????????????????????????? 20480??????????????????????????????????????????????????????????????????????????? maximum work area size in auto mode (serial) SQL> show parameter pga NAME???????????????????????????????? TYPE??????? VALUE
------------------------------------ ----------- ------------------------------
pga_aggregate_target???????????????? big integer 100M
此處我的一個process能夠分配的最大內存為20M,因為我的PGA=100M,符合上面的規則。 隱含參數_smm_max_size表示一個process能夠分配最大的memory.
轉載于:https://www.cnblogs.com/hehe520/archive/2009/12/23/6330633.html
總結
以上是生活随笔為你收集整理的如何估算PGA,SGA的大小,配置数据库服务器的内存的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 国际域名也将列入监管范畴(本文转载自【易
- 下一篇: SQL 去除重复记录 只保留重复记录中的