设为首页 加入收藏

TOP

oracle巡检脚本-部分(九)
2015-07-24 11:22:48 来源: 作者: 【 】 浏览:42
Tags:oracle 巡检 脚本 -部分
ading off;
set feedback off;
set termout off;
set pagesize 0;
set verify off;
set echo off;
spool 510.txt

select rownum as rank, a.*
from (
select elapsed_Time,
executions,
buffer_gets,
disk_reads,
cpu_time
hash_value,
sql_text
from v\$sqlarea
where cpu_time > 20000
order by cpu_time desc) a
where rownum < 11;

spool off
exit;
!01


cechon "5.10 Top 10 most expensive SQL (CPU Time) is: " red
echo
cat 510.txt
echo
rm -rf 510.txt


#5.11 Top 10 most expensive SQL (Buffer Gets by Executions)

sqlplus -S "${ora_user}/${ora_pass} as sysdba" </dev/null #禁止sqlplus执行结果回显
set heading off;
set feedback off;
set termout off;
set pagesize 0;
set verify off;
set echo off;
spool 511.txt

select rownum as rank, a.*
from (
select buffer_gets,
executions,
buffer_gets/ decode(executions,0,1, executions) gets_per_exec,
hash_value,
sql_text
from v\$sqlarea
where buffer_gets > 50000
order by buffer_gets desc) a
where rownum < 11;

spool off
exit;
!01


cechon "5.11 Top 10 most expensive SQL (Buffer Gets by Executions) is: " red
echo
cat 511.txt
echo
rm -rf 51.txt

#5.12 Top 10 most expensive SQL (Physical Reads by Executions)

sqlplus -S "${ora_user}/${ora_pass} as sysdba" </dev/null #禁止sqlplus执行结果回显
set heading off;
set feedback off;
set termout off;
set pagesize 0;
set verify off;
set echo off;
spool 512.txt

select rownum as rank, a.*
from (
select disk_reads,
executions,
disk_reads / decode(executions,0,1, executions) reads_per_exec,
hash_value,
sql_text
from v\$sqlarea
where disk_reads > 10000
order by disk_reads desc) a
where rownum < 11;

spool off
exit;
!01


cechon "5.12 Top 10 most expensive SQL (Physical Reads by Executions) is: " red
echo
cat 512.txt
echo
rm -rf 512.txt

#5.13 Top 10 most expensive SQL (Rows Processed by Executions)

sqlplus -S "${ora_user}/${ora_pass} as sysdba" </dev/null #禁止sqlplus执行结果回显
set heading off;
set feedback off;
set termout off;
set pagesize 0;
set verify off;
set echo off;
spool 513.txt

select rownum as rank, a.*
from (
select rows_processed,
executions,
rows_processed / decode(executions,0,1, executions) rows_per_exec,
hash_value,
sql_text
from v\$sqlarea
where rows_processed > 10000
order by rows_processed desc) a
where rownum < 11;

spool off
exit;
!01


cechon "5.13 Top 10 most expensive SQL (Rows Processed by Executions) is: " red
echo
cat 513.txt
echo
rm -rf 513.txt


#5.14 Top 10 most expensive SQL (Buffer Gets vs Rows Processed)

sqlplus -S "${ora_user}/${ora_pass} as sysdba" </dev/null #禁止sqlplus执行结果回显
set heading off;
set feedback off;
set termout off;
set pagesize 0;
set verify off;
set echo off;
spool 514.txt

select rownum as rank, a.*
from (
select buffer_gets, lpad(rows_processed ||
decode(users_opening + users_executing, 0, ' ','*'),20) "rows_processed",
executions, loads,
(decode(rows_processed,0,1,1)) *
buffer_gets/ decode(rows_processed,0,1,
rows_processed) avg_cost,
sql_text
from v\$sqlarea
where decode(rows_processed,0,1,1) * buffer_gets/ decode(rows_processed,0,1,rows_processed) > 10000
order by 5 desc) a
where rownum < 11;

spool off
exit;
!01


cechon "5.14 Top 10 most expensive SQL (Rows Processed by Executions) is: " red
echo
cat 514.txt
echo
rm -rf 514.txt


#5.15 full table scan

sqlplus -S "${ora_user}/${ora_pass} as sysdba" </dev/null #禁止sqlplus执行结果回显
set heading off;
set feedback off;
set termout off;
set pagesize 0;
set verify off;
set echo off;
spool 515.txt

SELECT OPNAME,TARGET,B.NUM_ROWS,B.TABLESPACE_NAME,COUNT(TARGET) FROM
V\$SESSION_LONGOPS A,
ALL_ALL_TABLES B
WHERE A.TARGET=B.OWNER||'.'||B.TABLE_NAME
HA

首页 上一页 6 7 8 9 10 11 12 下一页 尾页 9/12/12
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Sybase查询表结构的方法(类似于O.. 下一篇oracle学习入门系列之三Unix、Lin..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·在 Redis 中如何查看 (2025-12-26 03:19:03)
·Redis在实际应用中, (2025-12-26 03:19:01)
·Redis配置中`require (2025-12-26 03:18:58)
·Asus Armoury Crate (2025-12-26 02:52:33)
·WindowsFX (LinuxFX) (2025-12-26 02:52:30)