oracle 诊断利器之一—Procwatcher
本站文章除注明转载外,均为本站原创: 转载自love wife love life —Roger的Oracle/MySQL/PostgreSQL数据恢复博客
本文链接地址: oracle 诊断利器之一—Procwatcher
1 2 3 4 |
今天有人问道,是否有工具来收集系统的诊断信息呢?比如收集crs进程的? 收集某个进程的cpu或内存消耗等等?虽然可以通过shell脚本在实现,但是 oracle其实提供了这样的工具的,那就是Procwatcher,该工具,大家可以从MOS上下载, 那么这个功能是干什么的呢?其解释如下: |
1 2 3 4 5 |
# This script will find clusterware and/or Oracle Background processes and collect # stack traces for debugging. It will write a file called procname_pid_date_hour.out # for each process. If you are debugging clusterware then run this script as root. # If you are only debugging Oracle background processes then you can run as # root or oracle. |
1 2 3 4 5 |
详细信息,大家可以参考MOS文档上的如下文档: <span style="font-size: 12px; color: #0000ff; font-family: monospace;"> Procwatcher: Script to Monitor and Examine Oracle DB and Clusterware Processes [ID 459694.1] </span> 对于该工具,我们其实还可以将其加到oracle clusterware中,如下: |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
[ora11g@11gr2test bin]$ ./crsctl add resource procwatcher -type application -attr "ACTION_SCRIPT=/home/ora11g/prw.sh,START_DEPENDENCIES=hard(ora.roger.db),AUTO_START=always,STOP_TIMEOUT=15" [ora11g@11gr2test bin]$ ./crs_stat -t Name Type Target State Host ------------------------------------------------------------ ora.DATA1.dg ora....up.type ONLINE ONLINE 11gr2test ora....ER.lsnr ora....er.type ONLINE ONLINE 11gr2test ora.asm ora.asm.type ONLINE ONLINE 11gr2test ora.cssd ora.cssd.type ONLINE ONLINE 11gr2test ora.diskmon ora....on.type ONLINE ONLINE 11gr2test ora.evmd ora.evm.type ONLINE ONLINE 11gr2test ora.ons ora.ons.type OFFLINE OFFLINE ora.roger.db ora....se.type ONLINE ONLINE 11gr2test procwatcher application OFFLINE OFFLINE [ora11g@11gr2test bin]$ ./crs_start procwatcher Attempting to start `procwatcher` on member `11gr2test` Start of `procwatcher` on member `11gr2test` succeeded. [ora11g@11gr2test bin]$ ./crs_stat -t Name Type Target State Host ------------------------------------------------------------ ora.DATA1.dg ora....up.type ONLINE ONLINE 11gr2test ora....ER.lsnr ora....er.type ONLINE ONLINE 11gr2test ora.asm ora.asm.type ONLINE ONLINE 11gr2test ora.cssd ora.cssd.type ONLINE ONLINE 11gr2test ora.diskmon ora....on.type ONLINE ONLINE 11gr2test ora.evmd ora.evm.type ONLINE ONLINE 11gr2test ora.ons ora.ons.type OFFLINE OFFLINE ora.roger.db ora....se.type ONLINE ONLINE 11gr2test procwatcher application ONLINE ONLINE 11gr2test [ora11g@11gr2test bin]$ ls -ltr /home/ora11g/prw* -rwxrwxrwx 1 ora11g oinstall 106531 Aug 30 13:47 /home/ora11g/prw.sh -rwxrwxrwx 1 ora11g oinstall 4924 Oct 16 02:19 /home/ora11g/prw_11gr2test.log [ora11g@11gr2test ~]$ crs_stop procwatcher Attempting to stop `procwatcher` on member `11gr2test` Stop of `procwatcher` on member `11gr2test` succeeded. |
1 2 3 4 5 6 |
该工具其实功能非常的强悍,大概有如下方面的功能: 1. 收集cluster等后台进程信息; 2. session process的call stack等 3. 还可以收集session的wait,lock等信息,具体大家可以参考其prw.sh脚本,通过 修改其中的一些参数进行控制,其中主要的如下参数: |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
EXAMINE_CLUSTER=false EXAMINE_BG=true USE_SQL=true RETENTION=7 INTERVAL=90 THROTTLE=5 IDLECPU=3 sessionwait=y lock=y latchholder=y sgastat=y heapdetails=n gesenqueue=y waitchains=y rmanclient=n process_memory=n sqltext=y ash=y |
1 2 3 4 5 6 7 8 9 |
至于每个参数的具体含义,大家去参考prw.sh脚本内容,但是我个人认为在系统资源非常紧张的 情况下使用该工具,可能会存在较大的风险,虽然其中有个参数IDLECPU是控制cpu负载的。 该参数IDLECPU的含义是,当cpu IDLE小于等于3%时,procwatcher将进入sleep状态。 所以在使用的时候,我建议其设置为10 (为了降低潜在风险)。 另外还有一点需要注意的是,当采集的信息越多,该工具消耗的资源越大,所以需要注意。 修改完脚本以后,我们再来看看情况; |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
[ora11g@11gr2test ~]$ crs_start procwatcher Attempting to start `procwatcher` on member `11gr2test` Start of `procwatcher` on member `11gr2test` succeeded. [ora11g@11gr2test ~]$ crs_stat -t Name Type Target State Host ------------------------------------------------------------ ora.DATA1.dg ora....up.type ONLINE ONLINE 11gr2test ora....ER.lsnr ora....er.type ONLINE ONLINE 11gr2test ora.asm ora.asm.type ONLINE ONLINE 11gr2test ora.cssd ora.cssd.type ONLINE ONLINE 11gr2test ora.diskmon ora....on.type ONLINE ONLINE 11gr2test ora.evmd ora.evm.type ONLINE ONLINE 11gr2test ora.ons ora.ons.type OFFLINE OFFLINE ora.roger.db ora....se.type ONLINE ONLINE 11gr2test procwatcher application ONLINE ONLINE 11gr2test [ora11g@11gr2test ~]$ ls -ltr total 304 drwxr-xr-x 3 ora11g oinstall 4096 Oct 9 00:19 oradiag_ora11g drwxr-xr-x 3 ora11g oinstall 4096 Oct 9 00:21 11.2 drwxr-xr-x 3 ora11g oinstall 4096 Oct 9 00:30 localhost drwxr-xr-x 3 ora11g oinstall 4096 Oct 9 01:05 product drwxr-xr-x 2 ora11g oinstall 4096 Oct 9 01:29 checkpoints drwxr-x--- 3 ora11g oinstall 4096 Oct 9 01:55 oradata drwxr-xr-x 7 ora11g oinstall 4096 Oct 9 01:59 cfgtoollogs drwxr-xr-x 3 root root 4096 Oct 9 02:07 oradiag_root drwxr-xr-x 2 ora11g oinstall 4096 Oct 9 06:26 Clusterware drwxr-xr-x 3 ora11g oinstall 4096 Oct 9 06:26 11gr2test drwxr-x--- 4 ora11g oinstall 4096 Oct 9 07:09 admin drwxrwxr-x 11 ora11g oinstall 4096 Oct 9 07:10 diag -rw-r--r-- 1 ora11g oinstall 294 Oct 9 20:26 asm.ora -rwxrwxr-x 1 ora11g oinstall 141 Oct 9 20:50 set_env_asm.sh -rwxrwxr-x 1 ora11g oinstall 111 Oct 9 20:52 set_env_db.sh drwxr-xr-x 2 ora11g oinstall 4096 Oct 12 01:28 cheshi_bbed drwxr-xr-x 2 ora11g oinstall 4096 Oct 13 01:05 backup drwxrwxrwx 2 ora11g oinstall 4096 Oct 16 02:19 PRW_DB_ASM drwxrwxrwx 2 ora11g oinstall 4096 Oct 16 02:19 PRW_DB_roger -rwxrwxrwx 1 ora11g oinstall 15830 Oct 16 02:23 prw_11gr2test_OLD1.log -rwxrwxrwx 1 ora11g oinstall 106554 Oct 16 02:38 prw.sh drwxrwxrwx 2 ora11g oinstall 4096 Oct 16 02:39 PRW_SYS -rwxrwxrwx 1 ora11g oinstall 3413 Oct 16 02:39 prw_11gr2test.log ====== 我们可以看到,其日志会自动进行mv备份。====== +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + PRW_DB_ASM -- asm的信息 + + PRW_DB_roger -- 数据库实例的信息 + + prw_11gr2test_OLD1.log + + prw.sh + + PRW_SYS -- 包含了大量的scripts和执行结果 + + prw_11gr2test.log -- prw.sh执行的log + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ [ora11g@11gr2test PRW_DB_roger]$ ls -ltr total 184 -rwxrwxrwx 1 ora11g oinstall 4344 Oct 16 02:40 pw_sgastat_roger_10-16-11.out -rwxrwxrwx 1 ora11g oinstall 312 Oct 16 02:40 pw_sessionwait_roger_10-16-11.out -rwxrwxrwx 1 ora11g oinstall 160 Oct 16 02:40 pw_pgamemory_roger_10-16-11.out -rwxrwxrwx 1 ora11g oinstall 305 Oct 16 02:40 pw_lock_roger_10-16-11.out -rwxrwxrwx 1 ora11g oinstall 312 Oct 16 02:40 pw_latchholder_roger_10-16-11.out -rwxrwxrwx 1 ora11g oinstall 311 Oct 16 02:40 pw_waitchains_roger_10-16-11.out -rwxrwxrwx 1 ora11g oinstall 1639 Oct 16 02:41 pw_sqltimings_roger_10-16-11.out -rwxrwxrwx 1 ora11g oinstall 8571 Oct 16 02:41 prw_ora_pmon_roger_4611_10-16-11.out -rwxrwxrwx 1 ora11g oinstall 8633 Oct 16 02:41 prw_ora_dbw0_roger_4629_10-16-11.out -rwxrwxrwx 1 ora11g oinstall 8747 Oct 16 02:41 prw_ora_lgwr_roger_4631_10-16-11.out -rwxrwxrwx 1 ora11g oinstall 9533 Oct 16 02:41 prw_ora_ckpt_roger_4633_10-16-11.out -rwxrwxrwx 1 ora11g oinstall 8064 Oct 16 02:41 prw_ora_smon_roger_4635_10-16-11.out -rwxrwxrwx 1 ora11g oinstall 7932 Oct 16 02:41 prw_ora_arc0_roger_4688_10-16-11.out -rwxrwxrwx 1 ora11g oinstall 8019 Oct 16 02:41 prw_ora_arc2_roger_4692_10-16-11.out -rwxrwxrwx 1 ora11g oinstall 7932 Oct 16 02:41 prw_ora_arc1_roger_4690_10-16-11.out -rwxrwxrwx 1 ora11g oinstall 7932 Oct 16 02:41 prw_ora_arc3_roger_4694_10-16-11.out [ora11g@11gr2test PRW_SYS]$ ls -ltr *.sql -rwxrwxrwx 1 ora11g oinstall 1750 Oct 16 02:39 SQLvwaitchains.sql -rwxrwxrwx 1 ora11g oinstall 247 Oct 16 02:39 SQLvsgastat.sql -rwxrwxrwx 1 ora11g oinstall 544 Oct 16 02:39 SQLvsessionwait.sql -rwxrwxrwx 1 ora11g oinstall 389 Oct 16 02:39 SQLvlock.sql -rwxrwxrwx 1 ora11g oinstall 334 Oct 16 02:39 SQLvlatchholder.sql -rwxrwxrwx 1 ora11g oinstall 148 Oct 16 02:39 SQLvinstance.sql -rwxrwxrwx 1 ora11g oinstall 428 Oct 16 02:39 SQLvgesenqueue.sql -rwxrwxrwx 1 ora11g oinstall 418 Oct 16 02:39 SQLrmanclient.sql -rwxrwxrwx 1 ora11g oinstall 336 Oct 16 02:39 SQLpgamemory.sql -rwxrwxrwx 1 ora11g oinstall 702 Oct 16 02:39 SQLheapdetails.sql -rwxrwxrwx 1 ora11g oinstall 632 Oct 16 02:39 SQLgvsessionwait.sql -rwxrwxrwx 1 ora11g oinstall 474 Oct 16 02:39 SQLgvlock.sql -rwxrwxrwx 1 ora11g oinstall 390 Oct 16 02:39 SQLgvlatchholder.sql -rwxrwxrwx 1 ora11g oinstall 416 Oct 16 02:39 SQLgvgesenqueue.sql -rwxrwxrwx 1 ora11g oinstall 163 Oct 16 02:43 SQLvProcess.sql -rwxrwxrwx 1 ora11g oinstall 348 Oct 16 02:43 SQLsqltext.sql -rwxrwxrwx 1 ora11g oinstall 611 Oct 16 02:43 SQLash.sql -rwxrwxrwx 1 ora11g oinstall 1491 Oct 16 02:43 SQLvprocess_memory.sql |
1 |
具体感觉,大家去体验吧,可以从MOS下载或者点击这里进行下载<span style="font-size: 12px; color: #0000ff; font-family: monospace;">459694.1</span>或者email给我,我传给大家! |
3 Responses to “oracle 诊断利器之一—Procwatcher”
求procwatcher。。邮箱:yuncai-008@163.com,万分感谢
to 风云: 已经给你发email了,查收!
thank you
Leave a Reply
You must be logged in to post a comment.