Oracle的一些脚本工具总结

41 篇文章 0 订阅
15 篇文章 0 订阅

一、操作系统性能

在linux 6 之后,建议使用dstat监控操作系统的各项指标。

使用方法:

yum install dstat

dstat -cdlrgmnpsy

二、we.sql

https://download.csdn.net/download/zengxiangbo/89601165

Oracle脚本工具,查看数据库性能情况,查看当前数据库会话情况

支持10G 以上版本。

@we.sql

三、snapper.sql

https://download.csdn.net/download/zengxiangbo/89601176

国外大神写的脚本

可以到Tanel Poder Consulting 网站下载

 An easy to use Oracle session-level performance measurement tool which does NOT require any database changes nor creation of any  database objects!

@snapper.sql 5  做一次快照,间隔时间是5s,snapper.sql 详见文章关联附件。

根据snapper脚本查看redo情况。

https://download.csdn.net/download/zengxiangbo/89601177

--  Examples:

--      NB! Read the online examples, these are more detailed and list script output too!

--

--          http://tech.e2sn.com/oracle-scripts-and-tools/session-snapper

--

--      @snapper ash,stats 1 1 515

--      (Output one 1-second snapshot of session 515 using dbms_output and exit

--       Wait, gv$sesstat and gv$sess_time_model statistics are reported by default

--       Starting from V3 the ASH style session activity report is shown as well)

--

--      @snapper stats,gather=w 1 1 515

--      (Output one 1-second snapshot of session 515 using dbms_output and exit

--       only Wait event statistics are reported, no ASH)

--

--      @snapper ash,gather=st 1 1 515

--      (Output one 1-second snapshot of session 515 using dbms_output and exit

--       only gv$sesstat and gv$sess_Time_model statistics are gathered + ASH)

--

--      @snapper trace,ash,gather=stw,pagesize=0 10 90 117,210,313

--      (Write 90 10-second snapshots into tracefile for session IDs 117,210,313

--       all statistics are reported, do not print any headers)

--

--      @snapper trace,ash 900 999999999 all

--      (Take a snapshot of ALL sessions every 15 minutes and write the output to trace,

--       loop (almost) forever )

--

--      @snapper out,trace 300 12 "select inst_id,sid from gv$session where username='APPS'"

--      (Take 12 5-minute snapshots of all sessions belonging to APPS user, write

--       output to both dbms_output and tracefile)

查看一次会话产生的日志情况,间隔3秒

@snapper "stats,gather=s,sinclude=redo size" 3 1 all

查看一次所有会话 db time 情况,间隔3秒

@snapper "stats,gather=t,tinclude=DB Time" 3 1 all

四、oratop

这是oracle官方提供的一个脚本,需要根据数据库版本下载对应的oratop版本。

oratop -h

oratop: Release 14.1.2

Usage:

 oratop [ [Options] [Logon] ]

 Logon:

{username[/password][@connect_identifier] | / }

[AS {SYSDBA|SYSOPER}]

connect_identifier:

     o Net Service Name, (TNS) or

     o Easy Connect (host[:port]/[service_name])

 Options:

     -d : real-time (RT) wait events, section 3 (default is Cumulative)

     -k : FILE#:BLOCK#, section 4 lt is (EVENT/LATCH)

     -m : MODULE/ACTION, section 4 (default is USERNAME/PROGRAM)

     -s : SQL mode, section 4 (default is process mode)

     -c : database service mode (default is connect string)

     -f : detailed format, 132 columns (default: standard, 80 columns)

     -b : batch mode (default is text-based user interface)

     -n : maximum number of iterations (requires number)

     -i : interval delay, requires value in seconds (default: 5s)

     -v : oratop release version number

     -h : this help

 

举例:

oratop -f -d -m / as sysdba

在11.2.0.4之后的版本中,oracle已经自带这个脚本。

五、ash_total.sql

https://download.csdn.net/download/zengxiangbo/89601179

用于收集ash统计信息

@ash_total.sql

第一个参数:几个小时之前开始的,即开始时间。

第二个参数:收集多久的ash,即收集多长时间。

第三个参数:按多少分钟分类展示。

比如:收集2小时前开始的ash,总共收集1小时,按照每2分钟分类展示。

六、ash_object_by_waitclass.sql

https://download.csdn.net/download/zengxiangbo/89601180

具体等待事件分类,一般在ash_total.sql后使用。

@ash_object_by_waitclass.sql

第一个参数:几个小时之前开始的,即开始时间。

第二个参数:收集多久的ash,即收集多长时间。

第三个参数:等待事件,比如 on cpu,根据@ash_total.sql的结果中最多的分类

第四个参数:按多少分钟分类展示。

七、数据库启停脚本

关闭数据库:

perl shutdown.pl -h

https://download.csdn.net/download/zengxiangbo/89601187

启动数据库

https://download.csdn.net/download/zengxiangbo/89601185

启动后会检查大页等。

  • 33
    点赞
  • 27
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值