Ai
1 Star 1 Fork 0

冯际成/Oracle_SQL_Scripts

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
perf_file_io_physical.sql 2.21 KB
一键复制 编辑 原始数据 按行查看 历史
Abdul mohammed 提交于 2016-02-06 08:58 +08:00 . Fri Feb 5 18:58:16 CST 2016
-- | PURPOSE : Reports on Read/Write datafile activity. This script was |
-- | designed to work with Oracle8i or higher. It will include all |
-- | tablespaces using any type of extent management as well as true |
-- | TEMPORARY tablespaces. (i.e. use of "tempfiles") |
-- | 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 ts_name FORMAT a15 HEAD 'Tablespace'
COLUMN fname FORMAT a45 HEAD 'File Name'
COLUMN phyrds FORMAT 999,999,999,999,999 HEAD 'Physical Reads'
COLUMN phywrts FORMAT 999,999,999,999,999 HEAD 'Physical Writes'
COLUMN read_pct FORMAT 999.99 HEAD 'Read Pct.'
COLUMN write_pct FORMAT 999.99 HEAD 'Write Pct.'
BREAK ON report
COMPUTE SUM OF phyrds ON report
COMPUTE SUM OF phywrts ON report
COMPUTE AVG OF read_pct ON report
COMPUTE AVG OF write_pct ON report
SELECT
df.tablespace_name ts_name
, df.file_name fname
, fs.phyrds phyrds
, (fs.phyrds * 100) / (fst.pr + tst.pr) read_pct
, fs.phywrts phywrts
, (fs.phywrts * 100) / (fst.pw + tst.pw) write_pct
FROM
sys.dba_data_files df
, v$filestat fs
, (select sum(f.phyrds) pr, sum(f.phywrts) pw from v$filestat f) fst
, (select sum(t.phyrds) pr, sum(t.phywrts) pw from v$tempstat t) tst
WHERE
df.file_id = fs.file#
UNION
SELECT
tf.tablespace_name ts_name
, tf.file_name fname
, ts.phyrds phyrds
, (ts.phyrds * 100) / (fst.pr + tst.pr) read_pct
, ts.phywrts phywrts
, (ts.phywrts * 100) / (fst.pw + tst.pw) write_pct
FROM
sys.dba_temp_files tf
, v$tempstat ts
, (select sum(f.phyrds) pr, sum(f.phywrts) pw from v$filestat f) fst
, (select sum(t.phyrds) pr, sum(t.phywrts) pw from v$tempstat t) tst
WHERE
tf.file_id = ts.file#
ORDER BY phyrds 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

搜索帮助