当前位置:网站首页>DBA common SQL statements (2) - SGA and PGA
DBA common SQL statements (2) - SGA and PGA
2022-04-23 09:57:00 【Grainger】
Check sga
show sga
select * from v$sga;
see buffer cache Set up suggestions
select
size_for_estimate,
estd_physical_read_factor,
to_char(estd_physical_reads,99999999999999999999999) as"estd_physical_reads"
from v$db_cache_advice where name = 'DEFAULT';
COL pool FORMAT a10;
SELECT
(
SELECT ROUND(value/1024/1024,0)
FROM v$parameter
WHERE name = 'db_cache_size'
) "Current Cache(Mb)",
name "Pool",
size_for_estimate "Projected Cache(Mb)",
ROUND(100-estd_physical_read_factor,0) "Cache Hit Ratio%"
FROM v$db_cache_advice
WHERE block_size = (SELECT value FROM v$parameter
WHERE name = 'db_block_size')
ORDER BY 3;
see cache pool
show parameter cache
see buffer cache in defalut pool shooting
select name,1-(physical_reads)/(consistent_gets+db_block_gets)
from v$buffer_pool_statistics;
Check shared pool
show parameter shared
Check shared pool in library cache
select namespace,pinhitratio from v$librarycache;
Check the overall hit rate (library cache)
select sum(pinhits)/sum(pins) from v$librarycache;
select sum(pins) "hits",
sum(reloads) "misses",
sum(pins)/(sum(pins)+sum(reloads)) "Hits Ratio"
from v$librarycache;
Check shared pool free space
SELECT * FROM V$SGASTAT
WHERE NAME = 'free memory'
AND POOL = 'shared pool';
Each child shared pool Separate shared pool latch Protect , Check their hit rate shared pool latch, be used for shared pool Space recycling is allocated to latch
col name format a15
select
addr,name,gets,misses,1-misses/gets
from v$latch_children
where name='shared pool';
Use v$shared_pool_advice The calculation is different shared pool Size case , response time , S Company
SELECT
'Shared Pool' component,
shared_pool_size_for_estimate estd_sp_size,
estd_lc_time_saved_factor parse_time_factor,
CASE
WHEN
current_parse_time_elapsed_s + adjustment_s < 0 THEN 0
ELSE
current_parse_time_elapsed_s + adjustment_s
END response_time
FROM (
SELECT
shared_pool_size_for_estimate,
shared_pool_size_factor,
estd_lc_time_saved_factor,
a.estd_lc_time_saved,
e.VALUE / 100 current_parse_time_elapsed_s,
c.estd_lc_time_saved - a.estd_lc_time_saved adjustment_s FROM v$shared_pool_advice
a,
(SELECT * FROM v$sysstat WHERE NAME = 'parse time elapsed') e,
(SELECT estd_lc_time_saved FROM v$shared_pool_advice
WHERE shared_pool_size_factor = 1) c)
/
see shared pool in All kinds of chunk The size and quantity of
SELECT
KSMCHCLS CLASS,
COUNT(KSMCHCLS) NUM,
SUM(KSMCHSIZ) SIZ,
To_char( ((SUM(KSMCHSIZ)/COUNT(KSMCHCLS)/1024)),'999,999.00')||'k' "AVG SIzE"
FROM X$KSMSP GROUP BY KSMCHCLS;
Check if there are waiting events related to the library buffer
select
sid,seq#,event,p1,p1raw,p2,p2raw,p3,p3raw,state
from v$session_wait
where event like 'library%';
Inquire about sga In each pool situation
COL name FORMAT a32;
SELECT
pool, name, bytes
FROM v$sgastat
WHERE pool IS NULL
OR pool != 'shared pool'
OR (pool = 'shared pool'
AND (name IN('dictionary cache','enqueue','library
cache','parameters',
'processes','sessions','free memory')))
ORDER BY pool DESC NULLS FIRST, name;
SELECT * FROM V$SGAINFO;
View usage shard_pool Retention pool
SELECT request_misses, request_failures, free_space
FROM v$shared_pool_reserved;
Oracle A special area is built from the shared pool to allocate memory and keep these large blocks . The default size of this reserved shared pool is... Of the shared pool 5%(_shared_pool_reserved_pct 5 control ) oracle The construction is set to 10% . Size by parameter SHARED_POOL_RESERVED_SIZE Change . It is allocated from the shared pool , Not directly from SGA Allocated in , It is the reserved part of the shared pool , Dedicated to storing large segments #shared pool Memory in is greater than _SHARED_POOL_RESERVED_MIN_ALLOC Put in shared pool Keep the pool , The retention pool maintains a separate freelist,lru , And not in lru List save recreatable type chunks , Ordinary shared pool Release and shared pool Retention pool independent .
About settings SHARED_POOL_RESERVED_SIZE
- If the system appears ora-04031, It is found that the requested memory is greater than _SHARED_POOL_RESERVED_MIN_ALLOC (default 10GR2 4400) , And v$shared_pool_reserved There's a lot of REQUEST_MISSES( And you can see LAST_MISS_SIZE ) Express SHARED_POOL_RESERVED_SIZE Too small, request for large memory failed , Then we need to increase SHARED_POOL_RESERVED_SIZE
- If ora-04031 The requested memory appears in 4100-4400 And create shared pool lru Merge , Aging swap out memory , It can be turned down _SHARED_POOL_RESERVED_MIN_ALLOC Let this part of memory enter shared reserved pool, Increase accordingly SHARED_POOL_RESERVED_SIZE
- from v$shared_pool_reserved To judge , If REQUEST_FAILURES>0( There have been ora-04031) And LAST_FAILURE_SIZE( Last request memory size )>_SHARED_POOL_RESERVED_MIN_ALLOC Express shared reserved pool Missing contiguous memory , Can increase SHARED_POOL_RESERVED_SIZE, Reduce _SHARED_POOL_RESERVED_MIN_ALLOC Put fewer objects , And relatively increase shared_pool_size. If the other way around REQUEST_FAILURES>0( There have been ora-04031) And LAST_FAILURE_SIZE( Last request memory size )<_SHARED_POOL_RESERVED_MIN_ALLOC, Express stay shared pool Missing contiguous memory in , Can increase or decrease _SHARED_POOL_RESERVED_MIN_ALLOC Put more objects , Reduce sharedpool pressure , Appropriately increase shared_pool_size,SHARED_POOL_RESERVED_SIZE
The query remains in library cache in , The one with the most parsing and execution times sql( analysis * perform )
COL sql_text FORMAT A38;
SELECT * FROM(
SELECT parse_calls*executions "Product", parse_calls
"Parses"
,executions "Execs", sql_text FROM v$sqlarea ORDER BY 1 DESC)
WHERE ROWNUM <= 10;
see pga
show parameters area_size
SELECT * FROM v$pgastat;
see pga Suggest
SELECT (SELECT ROUND(value/1024/1024,0) FROM v$parameter
WHERE name = 'pga_aggregate_target') "Current Mb"
, ROUND(pga_target_for_estimate/1024/1024,0) "Projected Mb"
, ROUND(estd_pga_cache_hit_percentage) "%"
FROM v$pga_target_advice
ORDER BY 2;
版权声明
本文为[Grainger]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230952211397.html
边栏推荐
- php 二维数组指定元素相等后相加否则新增
- DBA常用SQL语句 (5) - Latch 相关
- Construire neuf capacités de fabrication agile à l'ère métacosmique
- Odoo server setup notes
- 论文阅读《Integrity Monitoring Techniques for Vision Navigation Systems》——3背景
- 杰理之通常影响CPU性能测试结果的因素有:【篇】
- 2022年制冷与空调设备运行操作考试练习题及模拟考试
- [untitled]
- 0704、ansible----01
- Rain produces hundreds of valleys, and all things grow
猜你喜欢
SAP RFC_ CVI_ EI_ INBOUND_ Main BP master data creation example (Demo customer only)
【无标题】
MapReduce核心和基础Demo
ABAP 7.4 SQL Window Expression
ABAP implementation publishes restful services for external invocation example
SAP CR transmission request sequence and dependency check
SAP debug debug for in, reduce and other complex statements
实践六 Windows操作系统安全攻防
中控学习型红外遥控模块支持网络和串口控制
从知识传播的维度对比分析元宇宙
随机推荐
NEC infrared remote control coding description
Epidemic prevention registration applet
Sim Api User Guide(5)
F-niu Mei's apple tree (diameter combined)
SAP salv14 background output salv data can directly save files and send emails (with sorting, hyperlink and filtering format)
ansible playbook语法和格式 自动化云计算
Using idea to develop Spark Program
Setnx command execution failed due to full redis memory
Dropout技术之随机神经元与随机深度
2022年流动式起重机司机考试题库模拟考试平台操作
通过流式数据集成实现数据价值(4)-流数据管道
Go语言实践模式 - 函数选项模式(Functional Options Pattern)
DBA常用SQL语句 (5) - Latch 相关
Computer network security experiment II DNS protocol vulnerability utilization experiment
構建元宇宙時代敏捷制造的九種能力
论文阅读《Integrity Monitoring Techniques for Vision Navigation Systems》——4视觉系统中的多故障
ansible 云计算 自动化 命令行精简版
LeetCode-608. 树节点
通过流式数据集成实现数据价值(5)- 流分析
Rain produces hundreds of valleys, and all things grow