




已阅读5页,还剩3页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
监控数据库性能的 SQL 语句汇总 下面是一些监控数据库性能的 SQL 语句 希望对大家有帮助 1 监控事例的等待 select event sum decode wait Time 0 0 1 Prev sum decode wait Time 0 1 0 Curr count Tot from v session Wait group by event order by 4 2 回滚段的争用情况 select name waits gets waits gets Ratio from v rollstat a v rollname b where a usn b usn 3 监控表空间的 I O 比例 select df tablespace name name df file name file f phyrds pyr f phyblkrd pbr f phywrts pyw f phyblkwrt pbw from v filestat f dba data files df where f file df file id order by df tablespace name 4 监控文件系统的 I O 比例 select substr a file 1 2 substr a name 1 30 Name a status a bytes b phyrds b phywrts from v datafile a v filestat b where a file b file 5 在某个用户下找所有的索引 select user indexes table name user indexes index name uniqueness column name from user ind columns user indexes where user ind columns index name user indexes index name and user ind columns table name user indexes table name order by user indexes table type user indexes table name user indexes index name column position 6 监控 SGA 的命中率 select a value b value logical reads c value phys reads round 100 a value b value c value a value b value BUFFER HIT RATIO from v sysstat a v sysstat b v sysstat c where a statistic 38 and b statistic 39 and c statistic 40 7 监控 SGA 中字典缓冲区的命中率 select parameter gets Getmisses getmisses gets getmisses 100 miss ratio 1 sum getmisses sum gets sum getmisses 100 Hit ratio from v rowcache where gets getmisses 0 group by parameter gets getmisses 8 监控 SGA 中共享缓存区的命中率 应该小于 1 select sum pins Total Pins sum reloads Total Reloads sum reloads sum pins 100 libcache from v librarycache select sum pinhits reloads sum pins hit radio sum reloads sum pins reload percent from v librarycache 9 显示所有数据库对象的类别和大小 select type count name num instances sum source size source size sum parsed size parsed size sum code size code size sum error size error size sum source size sum parsed size sum code size sum error size size required from dba object size group by type order by 1 10 监控 SGA 中重做日志缓存区的命中率 应该小于 1 SELECT name gets misses immediate gets immediate misses Decode gets 0 0 misses gets 100 ratio1 Decode immediate gets immediate misses 0 0 immediate misses immediate gets immediate misses 100 ratio2 FROM v latch WHERE name IN redo allocation redo copy 11 监控内存和硬盘的排序比率 最好使它小于 10 增加 sort area size SELECT name value FROM v sysstat WHERE name IN sorts memory sorts disk 12 监控当前数据库谁在运行什么 SQL 语句 SELECT osuser username sql text from v session a v sqltext b where a SQL address b address order by address piece 13 监控字典缓冲区 SELECT SUM PINS RELOADS SUM PINS LIB CACHE FROM V LIBRARYCACHE SELECT SUM GETS GETMISSES USAGE FIXED SUM GETS ROW CACHE FROM V ROWCACHE SELECT SUM PINS EXECUTIONS SUM RELOADS CACHE MISSES WHILE EXECUTING FROM V LIBRARYCACHE 后者除以前者 此比率小于 1 接近 0 为好 SELECT SUM GETS DICTIONARY GETS SUM GETMISSES DICTIONARY CACHE GET MISSES FROM V ROWCACHE 14 找 Oracle 字符集 select from sys props where name NLS CHARACTERSET 15 监控 MTS select busy busy idle shared servers busy from v dispatcher 此值大于 0 5 时 参数需加大 select sum wait sum totalq dispatcher waits from v queue where type dispatcher select count from v dispatcher select servers highwater from v mts servers highwater 接近 mts max servers 时 参数需加大 16 碎片程度 select tablespace name count tablespace name from dba f ree space group by tablespace name having count tablespace name 10 alter tablespace name coalesce alter table name deallocate unused create or replace view ts blocks v as select tablespace name block id bytes blocks segment name from dba free space union all select tablespace name block id bytes blocks segment name from dba extents select from ts blocks v select tablespace name sum bytes max bytes count block id from dba free space group by tablespace name 查看碎片程度高的表 SELECT segment name table name COUNT extents FROM dba segments WHERE owner NOT IN SYS SYSTEM GROUP BY segment name HAVING COUNT SELECT MAX COUNT FROM dba segments GROUP BY segment name 17 表 索引的存储情况检查 select segment name sum bytes count ext quan from dba extents where tablespace name select segment name count from dba extents where segment type INDEX and owner 18 找使用 CPU 多的用户 session 12 是 cpu used by t
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年国家统计局北海调查队招聘1人备考练习试题及答案解析
- 柴桑区总医院自聘人员招聘【21人】备考练习题库及答案解析
- 成都市第一幼儿园公开招聘员额教师(5人)备考练习题库及答案解析
- 2025山东东营市春晖小学招聘劳务派遣教师3人备考练习题库及答案解析
- 2025四川德阳市罗江区事业单位考核招聘工作人员11人考试参考试题及答案解析
- 2025石家庄中考数学试卷及答案
- 2025年数学必修2考试题及答案
- 桥梁检测专业题库及答案
- 2025人保财险河南新乡红旗支公司招聘6人考试参考试题及答案解析
- 2025浙江台州第一技师学院招聘编外教师3人考试参考试题及答案解析
- 学校食堂菜谱及定价方案
- 万象城商业年终总结
- 人教版四年级数学上册【全册教案】
- 个人开车与单位免责协议书经典版
- 劳动关系协调师竞赛技能竞赛考试题及答案
- 小学体育与健康教学设计-中华武术:五步拳 |人教版
- 八年级上册湖南地方文化常识教案
- 《第2课 多样的数据》参考课件1
- 十年(2015-2024)高考真题数学分项汇编(全国)专题02 复数(教师卷)
- 神经源性肠道功能障碍的康复护理
- QB/T 8006-2024 年糕 国家标准(正式版)
评论
0/150
提交评论