--------------------------查询数据库等待时间和实际执行时间的相对百分比---------------------

select *

from v$sysmetric a

where a.METRIC_NAME in

('Database CPU Time Ratio', 'Database Wait Time Ratio')

and a.INTSIZE_CSEC = (select max(intsize_csec) from v$sysmetric);

-------------------------------------查询数据库中过去30分钟引起最多等待的sql语句----------------

select ash.USER_ID,

u.username,

sum(ash.WAIT_TIME) ttl_wait_time,

s.SQL_TEXT

from v$active_session_history ash, v$sqlarea s, dba_users u

where ash.SAMPLE_TIME between sysdate - 60 / 2880 and sysdate

and ash.SQL_ID = s.SQL_ID

and ash.USER_ID = u.user_id

group by ash.USER_ID, s.SQL_TEXT, u.username

order by ttl_wait_time desc

-----------------------------------------查询数据库中的等待事件----------------------

select event, count()

from v$session_wait

group by event

order by count() desc

---------------------------------------查询数据库过去15分钟最重要的等待事件---------------

select ash.EVENT, sum(ash.WAIT_TIME + ash.TIME_WAITED) total_wait_time

from v$active_session_history ash

where ash.SAMPLE_TIME between sysdate - 30 / 2880 and sysdate

group by event

order by total_wait_time desc

----------------------------------------在过去15分钟哪些用户经历了等待---------------------

select s.SID,

s.USERNAME,

sum(ash.WAIT_TIME + ash.TIME_WAITED) total_wait_time

from v$active_session_history ash, v$session s

where ash.SAMPLE_TIME between sysdate - 30 / 2880 and sysdate

and ash.SESSION_ID = s.SID

group by s.SID, s.USERNAME

order by total_wait_time desc;

-------------------------------------查询等待时间最长的对象---------------------------------------

select a.CURRENT_OBJ#,

d.object_name,

d.object_type,

a.EVENT,

sum(a.WAIT_TIME + a.TIME_WAITED) total_wait_time

from v$active_session_history a, dba_objects d

where a.SAMPLE_TIME between sysdate - 30 / 2880 and sysdate

and a.CURRENT_OBJ# = d.object_id

group by a.CURRENT_OBJ#, d.object_name, d.object_type, a.EVENT

order by total_wait_time desc;

--------------------------------------------查询过去15分钟等待时间最长的sql语句---------------------------

select a.USER_ID,

u.username,

s.SQL_TEXT,

sum(a.WAIT_TIME + a.TIME_WAITED) total_wait_time

from v$active_session_history a, v$sqlarea s, dba_users u

where a.SAMPLE_TIME between sysdate - 30 / 2880 and sysdate

and a.SQL_ID = s.SQL_ID

and a.USER_ID = u.user_id

group by a.USER_ID, s.SQL_TEXT, u.username

order by total_wait_time desc;

------------------------------------------那些SQL消耗更多的IO--------------------------------------

select *

from (select s.PARSING_SCHEMA_NAME,

s.DIRECT_WRITES,

substr(s.SQL_TEXT, 1, 500),

s.DISK_READS

from v$sql s

order by s.DISK_READS desc)

where rownum < 20

---------------------------------------查看哪些会话正在等待IO资源-------------------------------------

SELECT username, program, machine, sql_id

FROM V$SESSION

WHERE EVENT LIKE 'db file%read';

----------------------------------查看正在等待IO资源的对象-----------------------------------

SELECT d.object_name, d.object_type, d.owner

FROM V$SESSION s, dba_objects d

WHERE EVENT LIKE 'db file%read'

and s.ROW_WAIT_OBJ# = d.object_id

---------------------------查看redo日志切换频率---------------------------------------------

Select round(FIRST_TIME, 'DD'), THREAD#, Count(SEQUENCE#)

From v$log_history

Group By round(FIRST_TIME, 'DD'), THREAD#

Order By 1, 2

SELECT  trunc(first_time) "Date",

to_char(first_time, 'Dy') "Day",

count(1) "Total",

SUM(decode(to_char(first_time, 'hh24'),'00',1,0)) "h0",

SUM(decode(to_char(first_time, 'hh24'),'01',1,0)) "h1",

SUM(decode(to_char(first_time, 'hh24'),'02',1,0)) "h2",

SUM(decode(to_char(first_time, 'hh24'),'03',1,0)) "h3",

SUM(decode(to_char(first_time, 'hh24'),'04',1,0)) "h4",

SUM(decode(to_char(first_time, 'hh24'),'05',1,0)) "h5",

SUM(decode(to_char(first_time, 'hh24'),'06',1,0)) "h6",

SUM(decode(to_char(first_time, 'hh24'),'07',1,0)) "h7",

SUM(decode(to_char(first_time, 'hh24'),'08',1,0)) "h8",

SUM(decode(to_char(first_time, 'hh24'),'09',1,0)) "h9",

SUM(decode(to_char(first_time, 'hh24'),'10',1,0)) "h10",

SUM(decode(to_char(first_time, 'hh24'),'11',1,0)) "h11",

SUM(decode(to_char(first_time, 'hh24'),'12',1,0)) "h12",

SUM(decode(to_char(first_time, 'hh24'),'13',1,0)) "h13",

SUM(decode(to_char(first_time, 'hh24'),'14',1,0)) "h14",

SUM(decode(to_char(first_time, 'hh24'),'15',1,0)) "h15",

SUM(decode(to_char(first_time, 'hh24'),'16',1,0)) "h16",

SUM(decode(to_char(first_time, 'hh24'),'17',1,0)) "h17",

SUM(decode(to_char(first_time, 'hh24'),'18',1,0)) "h18",

SUM(decode(to_char(first_time, 'hh24'),'19',1,0)) "h19",

SUM(decode(to_char(first_time, 'hh24'),'20',1,0)) "h20",

SUM(decode(to_char(first_time, 'hh24'),'21',1,0)) "h21",

SUM(decode(to_char(first_time, 'hh24'),'22',1,0)) "h22",

SUM(decode(to_char(first_time, 'hh24'),'23',1,0)) "h23"

FROM    V$log_history

group by trunc(first_time), to_char(first_time, 'Dy')

Order by 1

oracle 等待原因查找,oracle等待事件相关查询相关推荐

  1. oracle查询一列汇总,【学习笔记】Oracle数据筛选 查找oracle所有表中的特定列中的某些数据...

    天萃荷净 开发DBA反映,根据需求需要查找Oracle数据库中所有表中特定的列中指定的关键词的数据,和数据内容和数量 找出数据库中所有表表中REMARK列中含有WN.wind.wlr中表名和数量 de ...

  2. oracle alert.log查找,oracle alert.log位置

    Oracle 11g的日志文件(有点变化) 从Oracle 11g 开始,Oracle以XML与传统的文本两种格式提供Alert日志. 新的日志位置由Automatic Diagnostic Repo ...

  3. oracle 等待原因查找,查询引起锁等待的SQL语句

    本帖最后由 bfc99 于 2014-9-22 17:34 编辑 主要通过四个性能视图: 1.v$locked_object  查看当前哪些对象上有锁,及其所属的会话. 2.v$session_blo ...

  4. oracle如何快速查找,Oracle 如何快速查找和删除重复记录

    今天整理用户系统的人员库,发现有很多人员有重复,需要删除掉这些冗余的人员信息:在网上查了一下,基本上有两种解决办法: 在Oracle中,每一条记录都有一个rowid,rowid在整个数据库中是唯一的, ...

  5. oracle公共同义词查找,[Oracle]同义词(synonym)

    (一)同义词的概念 同义词是数据库中表.视图.索引或其他模式对象的别名,与视图相似,同义词不占用实际的存储空间,在数据字典中只存同义词的定义. 在开发数据库时,应尽量避免直接引用表.视图或其他数据库对 ...

  6. 查看oracle当前消耗,查找Oracle高消耗语句的方法

    在运行下面的脚本之前需要先用生成AWR报告的SQL(程序脚本一般保存在$ORACLE_HOME下的rdbms/admin中,名称为awrrpt.sql,需要输入生成AWR报告的天数范围)找到开始和结束 ...

  7. ORACLE等待事件相关

    一.等待事件发展 oracle等待事件引入,可以更加细粒度直观地观察Oracle行为,提供oracle优化入口,大致分为三个阶段: 以命中为主要参考指标:以各种命中率为主要的优化入口依据,常见的有&q ...

  8. Oracle 常见的33个等待事件

    Oracle 常见的33个等待事件 一. 等待事件的相关知识: 1.1 等待事件主要可以分为两类,即空闲(IDLE)等待事件和非空闲(NON-IDLE)等待事件. 1). 空闲等待事件指ORACLE正 ...

  9. oracle in查询 一直等待,学习笔记:Oracle awr 分析解决inactive transaction branch等待事件...

    天萃荷净 通过Oracle AWR报告分析inactive transaction branch等待事件的原因 分析一份awr,发现不太熟悉的等待事件"inactive transactio ...

最新文章

  1. cad文本改宋体字型lisp_CAD绘图员必须掌握的15个高能技巧,别人3天工作量你半天搞定!...
  2. ARM非对齐操作异常解决过程
  3. [css] css怎么更改表单的单选框或下拉框的默认样式?
  4. Python依赖文件requirements.txt的生成和安装
  5. 解决电脑总是“正在识别”,无法获取合法地址
  6. 阿里云keepalived的虚拟ip怎么让外网访问_Nginx之Keepalived高可用工具
  7. Linux驱动开发-编写OLED显示屏驱动
  8. matlab解反应扩散方程,反应扩散方程Matlab编程
  9. 关于使用VBA调用AutoCAD的学习
  10. 风笑天社会研究方法第5版笔记和课后答案
  11. 区块链游戏企鹅大陆面世了,会是腾讯的区块链游戏吗?
  12. 类微信卡包应用实现(附源码)
  13. 端午节(文章来源于网络)
  14. About Oracle Database Performance Method
  15. 中小企业掀起“减碳潮”,“上云”提高产品绿色竞争力
  16. SeetaFace2-master在Windows10 VS2019编译的两种方法
  17. CSS - 响应式布局(二)响应式栅格系统
  18. 互联网+下的慧算账体验式营销
  19. EasyExcel导出xlsx时,某一列的数据为空
  20. 旺店通与金蝶云星空对接集成采购入库单接口

热门文章

  1. 爬取词库,使用jieba分词库,自定义dict.txt文件+将搜狗词库.scel文件为.txt文件
  2. 如何通过反射来解决AlertDialog标题由于字数过多显示不全的问题
  3. 论文阅读课4-Long-tail Relation Extraction via Knowledge Graph Embeddings(GCN,关系抽取,2019,远程监督,少样本不平衡,2注意
  4. 企业——Docker容器的搭建及简单应用
  5. JavaScript之event事件
  6. 关于字节对齐以及内存占用
  7. 【VS开发】CTimeSpan类
  8. 高通全系列手机处理器深度解析 (升级选手机必备)附参数对比表
  9. hwnd = 0 各种粗心大意啊!
  10. [SCM]源码管理 - perforce快速入门