根据metalink脚本学习undo(七)
来源:互联网 发布:共享网络下的防监听 编辑:程序博客网 时间:2024/06/10 02:11
--undo 压力部分与锁 还有部分的undo统计
set lines 120set pages 999clear colset termout offset trimout onset trimspool onconnect / as sysdbaalter session set nls_date_format='dd-hh24:mi';spool undopressure.outpromptprompt ############## RUNTIME ############## promptcol rdate head "Run Time"select sysdate rdate from dual;prompt prompt ############## WAITS FOR UNDO (Since Startup) ############## prompt col inst_id head "Instance#"col eq_type format a3 head "Enq"col total_req# format 999,999,999,999,999,999 head "Total Requests"col total_wait# format 999,999 head "Total Waits"col succ_req# format 999,999,999,999,999,999 head "Successes"col failed_req# format 999,999,999999 head "Failures"col cum_wait_time format 999,999,999 head "Cummalitve|Time"select * from v$enqueue_stat where eq_type='US' --Undo Segmentunionselect * from v$enqueue_stat where eq_type='HW' --high water /prompt prompt ############## LOCKS FOR UNDO ############## prompt col addr head "ADDR"col KADDR head "KADDR"col sid head "Session"col osuser format a10 head "OS User"col machine format a15 head "Machine"col program format a17 head "Program"col process format a7 head "Process"col lmode head "Lmode"col request head "Request"col ctime format 9,999 head "Time|(Mins)"col block head "Blocking?"--当前锁状态select /*+ RULE */ a.SID, --session id b.process, --process id b.OSUSER, --登录者os username b.MACHINE, --登录机器 b.PROGRAM, --登录所用终端 addr, -- address of lock state object kaddr, --lock address lmode, --LOCK MODE request, --Lock mode in which the process requests the lock: round(ctime/60/60,0) ctime, block --发生的时间from v$lock a, v$session b where a.sid=b.sidand a.type='US'/prompt prompt ############## TUNED RETENTION HISTORY (Last 2 Days) ############## prompt ############## LOWEST AND HIGHEST DATA ############## prompt col low format 999,999,999,999 head "Undo Retention|Lowest Tuned Value"col high format 999,999,999,999 head "Undo Retention|Highest Tuned Value"--找出两条内tuned_undoretention最短的时段select end_time, tuned_undoretention from v$undostat where tuned_undoretention = (select min(tuned_undoretention) lowfrom v$undostatwhere end_time > sysdate-2)/--找出两条内tuned_undoretention最长的时段select end_time, tuned_undoretention from v$undostat where tuned_undoretention = (select max(tuned_undoretention) highfrom v$undostatwhere end_time > sysdate-2)/prompt prompt ############## CURRENT TRANSACTIONS ############## prompt col sql_text format a40 word_wrapped head "SQL Code"select a.start_date, --开始时间 a.start_scn, --开始scn a.status, --事务状态 c.sql_text --sql语句 from v$transaction a, v$session b, v$sqlarea c where b.saddr = a.ses_addr and c.address = b.sql_address and b.sql_hash_value = c.hash_value/select current_scn from v$database/col a format 999,999 head "UnexStolen"col b format 999,999 head "ExStolen"col c format 999,999 head "UnexReuse"col d format 999,999 head "ExReuse"prompt prompt ############## WHO'S STEALING WHAT? (Last 2 Days) ############## prompt select unxpstealcnt a, --试图偷取未过期undo block的次数 expstealcnt b, --试图偷取过期undo block的次数 unxpblkreucnt c, --同一回滚段事务重用未过期undo block的数量 expblkreucnt d --同一回滚段事务重用过期 undo block的数量from v$undostatwhere (unxpstealcnt > 0 or expstealcnt > 0)and end_time > sysdate-2/spool offset termout onset trimout offset trimspool offclear col
0 0
- 根据metalink脚本学习undo(七)
- 根据metalink脚本学习undo(一)
- 根据metalink脚本学习undo(二)
- 根据metalink脚本学习undo(三)
- 根据metalink脚本学习undo(四)
- 根据metalink脚本学习undo(五)
- 根据metalink脚本学习undo(六)
- 根据metalink脚本学习undo(八)
- shell 脚本学习七
- Metalink
- undo系列学习之oracle DBA常用的脚本
- oracle 估算undo脚本
- linux学习(七) shell脚本(4)
- Unity3d C#脚本学习小结(七)[OnTriggerEnter的使用方法]
- 【Shell】【学习笔记】Linux Shell脚本应用(七)
- 详细介绍Linux shell脚本基础学习(七)
- Shell脚本基础学习(七)----for while until循环
- (七)用BlazeMeter录制JMeter测试脚本---学习笔记
- Extjs之Extjs工具栏和菜单栏
- NSArray,NSSet,NSEnumerator,NSDictionary及对应Mutable介绍
- [Object-C]OC实例变量初始化方法
- mysql 新增 删除用户和权限分配
- 如何登录一个网站
- 根据metalink脚本学习undo(七)
- Theory:kmp 处理字符串
- Android中使用Notification并通过点击Notification重新启动Activity
- JavaScript基础
- 浮点数在内存中的存放方式
- ios学习笔记—— 定位服务
- ns2 中arp的注释
- 大话设计模式____单一职责模式
- 三个annotation类型(RetentionPolicy,ElementType)