使用diagcollection.pl脚本打包收集RAC诊断日志文件

在Oracle集群环境的“$ORA_CRS_HOME/bin”目录下提供了diagcollection.pl脚本,以root用户身份执行该脚本便可以完成搜集必要的诊断信息的目的。

1.设置必要的环境变量
因为需要以root用户身份执行该脚本,因此oracle用户下的环境变量在此无效,需要重新设置。
[root@rac1 ~]# export ORACLE_BASE=/oracle/app/oracle
[root@rac1 ~]# export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
[root@rac1 ~]# export ORA_CRS_HOME=/oracle/app/crs

2.确保环境变量的正确性
需要检查的环境变量有:ORACLE_BASE、ORACLE_HOME、ORA_CRS_HOME和HOSTNAME。
[root@rac1 ~]# echo $ORACLE_BASE
/oracle/app/oracle
[root@rac1 ~]# echo $ORACLE_HOME
/oracle/app/oracle/product/10.2.0/db_1
[root@rac1 ~]# echo $ORA_CRS_HOME
/oracle/app/crs
[root@rac1 ~]# echo $HOSTNAME
rac1

环境变量检查通过。

3.执行采集脚本diagcollection.pl
[root@rac1 ~]# cd $ORA_CRS_HOME/bin
[root@rac1 bin]# ./diagcollection.pl --collect --all --crshome $ORA_CRS_HOME
Production Copyright 2004, 2005, Oracle.  All rights reserved
Cluster Ready Services (CRS) diagnostic collection tool
The following CRS diagnostic archives will be created in the local directory.
crsData_rac1.tar.gz -> logs,traces and cores from CRS home. Note: core files will be packaged only with the -core option.
ocrData_rac1.tar.gz -> ocrdump, ocrcheck etc
coreData_rac1.tar.gz -> contents of CRS core files in text format

Collecting crs data
/bin/tar: Removing leading `/' from member names
Collecting OCR data
Collecting information from core files
No corefiles found
The following Oracle Home diagnostic archives will be created in the local directory.
oraData_rac1.tar.gz -> logs, traces and cores from Oracle Home
Collecting oracle home data
/bin/tar: Removing leading `/' from member names

本次生成的打包文件如下:
[root@rac1 bin]# ls -l *tar.gz
-rw-r--r-- 1 root root    138 Nov 18 22:38 coreData_rac1.tar.gz
-rw-r--r-- 1 root root 234507 Nov 18 22:38 crsData_rac1.tar.gz
-rw-r--r-- 1 root root   8000 Nov 18 22:38 ocrData_rac1.tar.gz
-rw-r--r-- 1 root root  81851 Nov 18 22:38 oraData_rac1.tar.gz

4.diagcollection.pl脚本的帮助信息
不带任何参数的情况下diagcollection.pl脚本会给出该脚本的使用帮助信息。
[root@rac1 bin]# ./diagcollection.pl
Production Copyright 2004, 2005, Oracle.  All rights reserved
Cluster Ready Services (CRS) diagnostic collection tool
diagcollection
    --collect
             [--crs] For collecting crs diag information
             [--oh]  For collecting oracle home diag information
             [--all] Default.For collecting all diag information.
             [--core] UNIX only. Does not package core files.
             [--afterdate] UNIX only. Collects archives from the specified date. Specify in mm/dd/yyyy format
             [--crshome] Argument that specifies the CRS Home location
             NOTE:
             1. You can also do the following
                ./diagcollection.pl --collect --crs --oh
             2. ORACLE_HOME env variable needs to be set.

     --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

5.小结
使用Oracle提供的diagcollection.pl脚本可以很方便的对诊断信息进行批量打包。简化了采集故障信息的繁琐流程。
如需要将诊断信息提交给Oracle技术支持人员,使用该方法效率会比较高效。
标签: 暂无标签
oraunix

写了 199 篇文章,拥有财富 1026,被 339 人关注

转播转播 分享分享 分享淘帖
回复

使用道具

成为第一个吐槽的人

您需要登录后才可以回帖 登录 | 加入社区

本版积分规则

意见
反馈