ORACLE利器之OSWatch监控操作系统性能和RAC心跳

来源:互联网 发布:手机处理照片软件 编辑:程序博客网 时间:2024/05/29 15:49

OSWatch介绍

    今天简单介绍一下ORACLE官方提供的利器OSWatch,它是个:无须安装、支持主流的操作系统(AIX,LINUX,Solaris,HP-UX,WINDOWS)、集成了一些操作系统的基础命令,如topas,traceroute,vmstat,iostat等来监控操作系统的性能。虽然会有一些资源消耗,可别小看这些事故现场的数据信息,因为我们可以依靠这些性能数据还原故障发生前操作系统的资源负载情况和心跳通信情况。另外OSWatch还可以通过自身的java(要求java版本是1.4.2以上)工具生成图形更直观地反应“心电图”。

 

 The OSWatcher Analyzer (oswbba) is a graphing and analysis    utility which comes bundled withOSWatcher v4.0 and higher.  oswbba allows the user to graphically display data collected, generate reports containing these graphs and provides a built in analyzer to analyze the data and provide details on any performance problems it detects. The ability to graph and analyze this information relieves the user of manually inspecting all the files.

 

OSWatch的简单使用

[数据库环境:/oracle/oswatch] ls -lrt
total 2640
-rw-r--r--    1 oracle   oinstall    1341440 Jun 04 11:29 oswbb601.tar            <<<<---从官方下载的压缩包
drwxr-xr-x   10 oracle   oinstall       4096 Sep 17 09:03 oswbb                      <<<<---解压以后生成的目录

[数据库环境:/oracle/oswatch/oswbb] ls -lrt st*.sh             
-rwxr-xr-x    1 oracle   oinstall        542 Oct 11 2012  stopOSWbb.sh             <<<--关闭脚本
-rwxr-xr-x    1 oracle   oinstall       2385 Jan 09 2013  startOSWbb.sh           <<<--启动脚本

 

启动命令:

[数据库环境:/oracle/oswatch/oswbb] nohup sh *start*.sh 15 168 &

--------------------------

nohup command &   将命令放至后台执行

sh *start*.sh         执行startOSWbb.sh脚本

15                        每15秒为间隔收集一次系统信息(topas,vmstat,traceroute等)

168                      保留Nums的小时数据,这些数据是可以复用的,类似于UNDO,redo

--------------------------

[数据库环境:/oracle/oswatch/oswbb] ps -ef  | grep osw         
  oracle 50921778 49676404   0 09:20:49      -  0:04 /bin/sh ./OSWatcherFM.sh 168 /oracle/oswatch/oswbb/archive             <<<<进程信息,另archive就是信息存放的目录
  oracle 51708332 65339518   0 23:47:40  pts/0  0:00 grep osw

[数据库环境:/oracle/oswatch/oswbb/archive] ls -lrt
total 112
drwxr-xr-x    2 oracle   oinstall       8192 Sep 17 23:00 oswvmstat
drwxr-xr-x    2 oracle   oinstall       8192 Sep 17 23:00 oswtop
drwxr-xr-x    2 oracle   oinstall       8192 Sep 17 23:00 oswps
drwxr-xr-x    2 oracle   oinstall       8192 Sep 17 23:00 oswprvtnet
drwxr-xr-x    2 oracle   oinstall       8192 Sep 17 23:00 oswnetstat
drwxr-xr-x    2 oracle   oinstall       8192 Sep 17 23:00 oswmpstat
drwxr-xr-x    2 oracle   oinstall       8192 Sep 17 23:00 oswiostat

[数据库环境:/oracle/oswatch/oswbb/archive] ls -lrt oswprvtne
-rw-r--r--    1 oracle   oinstall     105782 Sep 17 12:59 czdb2_prvtnet_14.09.17.1200.dat
-rw-r--r--    1 oracle   oinstall     105782 Sep 17 13:59 czdb2_prvtnet_14.09.17.1300.dat
-rw-r--r--    1 oracle   oinstall     105782 Sep 17 14:59 czdb2_prvtnet_14.09.17.1400.dat
-rw-r--r--    1 oracle   oinstall     106249 Sep 17 15:59 czdb2_prvtnet_14.09.17.1500.dat
-rw-r--r--    1 oracle   oinstall     105782 Sep 17 16:59 czdb2_prvtnet_14.09.17.1600.dat
-rw-r--r--    1 oracle   oinstall     105782 Sep 17 17:59 czdb2_prvtnet_14.09.17.1700.dat
-rw-r--r--    1 oracle   oinstall     106248 Sep 17 18:59 czdb2_prvtnet_14.09.17.1800.dat
-rw-r--r--    1 oracle   oinstall     105782 Sep 17 19:59 czdb2_prvtnet_14.09.17.1900.dat
-rw-r--r--    1 oracle   oinstall     106248 Sep 17 20:59 czdb2_prvtnet_14.09.17.2000.dat
-rw-r--r--    1 oracle   oinstall     105782 Sep 17 21:59 czdb2_prvtnet_14.09.17.2100.dat
-rw-r--r--    1 oracle   oinstall     105782 Sep 17 22:59 czdb2_prvtnet_14.09.17.2200.dat
-rw-r--r--    1 oracle   oinstall      87608 Sep 17 23:49 czdb2_prvtnet_14.09.17.2300.dat         <<<每一个小时一下文件,这些文件可以用vi等编辑器编辑或查看

 

关闭命令:

关闭的命令也非常简单,直接执行脚本stopOSWbb.sh

$ sh stopOSWbb.sh

 

为了使OSWatch能监控到心跳网络的情况,我们需要稍加配置,配置过程非常简单:

1. 查看example文件

[数据库环境:/oracle/oswatch/oswbb] cat Exampleprivate.net

####################################################################### This file contains examples of how to monitor private networks. To# monitor your private networks create an executable file in this same# directory named private.net. Use the example for your host os below.# Make sure not to remove the last line in this file. Your file# private.net MUST contain the rm lock.file line.#######################################################################Solaris Example######################################################################echo "zzz ***"`date`traceroute -r -F <node1-priv>traceroute -I -r -F <node1-priv>traceroute -r -F <node2-priv>traceroute -I -r -F <node2-priv>#######################################################################HP Example######################################################################echo "zzz ***"`date`traceroute -r -F <node1-priv> traceroute -r -F <node2-priv> #######################################################################Linux Example######################################################################echo "zzz ***"`date`traceroute -r -F <node1-priv> traceroute -r -F <node2-priv>#######################################################################Tru64 Example######################################################################echo "zzz ***"`date`traceroute -r -f <node1-priv>traceroute -r -f <node2-priv>#######################################################################AIX Example######################################################################echo "zzz ***"`date`traceroute -r <node1-priv>traceroute -r <node2-priv>####################################################################### DO NOT DELETE THE FOLLOWING LINE!!!!!!!!!!!!!!!!!!!!!######################################################################rm locks/lock.file

 

根据文件描述,我们新建一个private.net文件,内容如下:

[数据库环境:/oracle/oswatch/oswbb] ls -lrt private.net

-rwxr-xr-x    1 oracle   oinstall        839 Jun 04 14:44 private.net[数据库环境:/oracle/oswatch/oswbb] cat private.net####################################################################### This file contains examples of how to monitor private networks. To# monitor your private networks create an executable file in this same# directory named private.net. Use the example for your host os below.# Make sure not to remove the last line in this file. Your file# private.net MUST contain the rm lock.file line.#######################################################################AIX Example######################################################################echo "zzz ***"`date`traceroute -r czdb1-privtraceroute -r czdb2-priv####################################################################### DO NOT DELETE THE FOLLOWING LINE!!!!!!!!!!!!!!!!!!!!!######################################################################rm locks/lock.file


[数据库环境:/oracle/oswatch/oswbb] grep priv /etc/hosts

172.168.1.11     czdb1-priv172.168.1.12     czdb2-priv


只要private.net文件创建好,就会将心跳信息存放在archive/oswprvtne目录下了. 

 

 仔细看,以下内容是心跳异常时候的输入

zzz ***Thu Jun 5 04:08:48 CST 2014trying to get source for czdb1-privsource should be 172.168.1.12traceroute to czdb1-priv (172.168.1.11) from 172.168.1.12 (172.168.1.12), 30 hops maxoutgoing MTU = 1500 1  czdb1-priv (172.168.1.11)  1 ms  0 ms  0 mstrying to get source for czdb2-privsource should be 172.168.1.12traceroute to czdb2-priv (172.168.1.12) from 172.168.1.12 (172.168.1.12), 30 hops maxoutgoing MTU = 1500 1  czdb2-priv (172.168.1.12)  0 ms  0 ms  0 mszzz ***Thu Jun 5 04:09:04 CST 2014trying to get source for czdb1-privsource should be 172.168.1.12traceroute to czdb1-priv (172.168.1.11) from 172.168.1.12 (172.168.1.12), 30 hops maxoutgoing MTU = 1500<span style="color:#ff0000;"><span style="font-size:18px;"><strong> 1  * * * 2  * * *</strong></span></span> 3  czdb1-priv (172.168.1.11)  0 ms  0 ms  0 ms

以上表明有两次监测不到心跳通信.众所周知,在RAC环境中如果心跳网络不稳定,集群为了避免"脑裂"现象的发生,利用VOTINGDISK仲裁盘投票将强制将权重低的节点驱逐出集群.这一动作的完成,可以从CRS的相关日志可以看到evting,reconfigure等操作,但OSWatch的这部分信息无疑更有说服力,说明心跳不稳定,对问题的排查提供了强有力的证据.

 

如果对OSWatch有兴趣的朋友,可以查看文档 461053.1,文章里描述了如何利用jar包生成图形报告.

没有OSWatch工具包的朋友可以把邮箱地址留言给我,我逐一发送。

 

-------------------------------------------------------------------------------------------------

本文来自于我的技术博客 http://blog.csdn.net/robo23

转载请标注源文链接,否则追究法律责任!

0 0