Oracle Database11gR2日志收集工具

2011-01-05  张林 

http://www.rickyzhu.com/2170_diagcollection-tool.html

介绍下Oracle Database 11gR2中的日志和日志的收集。

  • 为什么要收集Oracle日志?

    很多时候,遇到问题联系Oracle support或者提交SR的时候,support总是会要求你收集好日志,有时候日志收集不齐全,来来回回几次,时间都浪费在沟通上了。另外即使自己在测试环境进行实验的时候也会遇到一些问题,在论坛提问或者招人帮忙的时候,为了把问题描述清楚,必要的日志也是十分有帮助的。

  • 有哪些日志需要收集?

    随着Oracle Database 11gR2的发布,大量的feature引入,日志的种类和范畴也有了很大的增加。安装出错了,root.sh出错了,建库失败了,asmca失败了。最大的改变是在11gR2中引入了各种各样的agent,资源的管理全部集成到了统一的agent framework中进行,这些包括启动,停止,检查,清除等等,agent因为资源的范畴和权限不同分为了crsd agent, crsd root agent, ohasd agent ohasd root agent。详细不多说,可以参考前面讲过的11gR2的后台进程 ,具体的这些agent如何控制和管理这些资源,以后在专题介绍。

    日志多不要紧,而且目录结构也比较分散,crs 的日志文件,dbca/dbua/netca/asmca这些文件,root.sh日志文件,install的日志文件都是分部在不同地方的,所以就迫切需要一个好用的工具进行收集。

  • 日志收集工具diagcollection.pl

    既然日志收集这么迫切,又这么麻烦,那么有没有一款方便好用的收集工具呢? 答案是肯定的。在GI HOME/bin/目录下就有这么一个好用的脚本 diagcollection.pl,脚本是用perl写成的,所以天生可移植,支持各种平台的日志收集(包括Windows),工具的使用也相当的简单,如下是一个简单的帮助信息:

    sh-3.2# ./diagcollection.pl
    Production Copyright 2004, 2010, Oracle.  All rights reserved
    Cluster Ready Services (CRS) diagnostic collection tool
    diagcollection
        –collect  
                 [–crs] For collecting crs diag information
                 [–adr] For collecting diag information for ADR; specify ADR location
                 [–chmos] For collecting Cluster Health Monitor (OS) data
                 [–all] Default.For collecting all diag information.
                 [–core] UNIX only. Package core files with CRS data
                 [–afterdate] UNIX only. Collects archives from the specified date. Specify in mm/dd/yyyy format
                 [–aftertime] Supported with -adr option. Collects archives after the specified time. Specify in YYYYMMDDHHMISS24 format
                 [–beforetime] Supported with -adr option. Collects archives before the specified date. Specify in YYYYMMDDHHMISS24 format
                 [–crshome] Argument that specifies the CRS Home location
                 [–incidenttime] Collects Cluster Health Monitor (OS) data from the specified time.  Specify in MM/DD/YYYY24HH:MM:SS format
                      If not specified, Cluster Health Monitor (OS) data generated in the past 24 hours are collected
                 [–incidentduration] Collects Cluster Health Monitor (OS) data for the duration after the specified time.  Specify in HH:MM format.
                     If not specified, all Cluster Health Monitor (OS) data after incidenttime are collected
                 NOTE:
                 1. You can also do the following
                    ./diagcollection.pl –collect –crs –crshome <crs Home>
     
         –clean        cleans up the diagnosability
                        information gathered by this script
     
         –coreanalyze  UNIX only. Extracts information from core files
                        and stores it in a text file
    sh-3.2#

    </crs>

    不要被大量的选项吓坏,其实主要的选项就是一个 –collect ,另外清除收集的日志就是–clean。
    这实在是一款居家旅行,老少皆宜的工具,欢迎大家使用。

  • 为什么要介绍这个工具?

    为什么想到突然要介绍这个工具呢,那是在目前版本中这个工具收集的日志范围有限,而我因为目前正在着手对这个工具进行改进,使之功能更加强大,收集的日志种类更多,也欢迎大家对这个工具提出更多建议,并关注后续消息。

  • 还有别的工具可以收集日志吗?

    有的,除了diagcollection.pl 脚本之外,其实Oracle提供了很多其他的工具,比如OSWatcher,还有11gR2新引入的CHM工具 (Cluster Healthy Monitor)等等,下篇我们介绍CHM。


  • 353°/3534 人阅读/0 条评论 发表评论

    登录 后发表评论