Ai
1 Star 1 Fork 0

冯际成/Oracle_SQL_Scripts

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
perf_active_sql_io_logical.sql 2.04 KB
一键复制 编辑 原始数据 按行查看 历史
Abdul mohammed 提交于 2016-02-06 08:58 +08:00 . Fri Feb 5 18:58:16 CST 2016
-- | PURPOSE : Report on top SQL statements ordered by disk reads. |
-- | NOTE : As with any code, ensure to test this script in a development |
-- | environment before attempting to run it in production. |
-- +----------------------------------------------------------------------------+
SET PAGESIZE 9999
SET VERIFY off
COLUMN sid FORMAT 99999 HEADING 'Sid'
COLUMN disk_reads FORMAT 999,999,999,999,999 HEADING 'Disk Reads'
COLUMN buffer_gets FORMAT 999,999,999,999,999 HEADING 'Buffer Gets'
COLUMN cpu_time FORMAT 999,999,999,999,999 HEADING 'CPU Time'
COLUMN elapsed_time FORMAT 999,999,999,999,999 HEADING 'Elapsed Time'
COLUMN executions FORMAT 999,999,999,999 HEADING 'Executions'
COLUMN reads_per_exec FORMAT 999,999,999,999,999 HEADING 'Reads / Executions'
COLUMN sql FORMAT a120 word_wrap HEADING 'SQL Statement'
prompt
prompt =============================================
prompt SQL with disk reads greater than 1000 (ACTIVE)
prompt If you want to see all session, Comment out a.BUFFER_GETS > 1000
prompt =============================================
SELECT
s.sid sid
,a.disk_reads disk_reads
,a.buffer_gets buffer_gets
,a.cpu_time cpu_time
,a.elapsed_time elapsed_time
,a.hash_value hash_value
, a.executions executions
, a.BUFFER_GETS / decode(a.executions, 0, 1, a.executions) reads_per_exec
, sql_text || chr(10) || chr(10) sql
FROM
sys.v_$sqlarea a,
sys.v_$session s
WHERE
s.sql_address = a.address
and a.BUFFER_GETS > 1000
and s.status = 'ACTIVE'
AND S.TYPE != 'BACKGROUND'
ORDER BY
BUFFER_GETS desc;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/sapall/Oracle_SQL_Scripts.git
git@gitee.com:sapall/Oracle_SQL_Scripts.git
sapall
Oracle_SQL_Scripts
Oracle_SQL_Scripts
master

搜索帮助