在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技术支持人员,使用该方法效率会比较高效。
6附注脚本
[root@rac1 bin]# export ORACLE_BASE=/u01/oracle
[root@rac1 bin]# export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
[root@rac1 bin]# export ORA_CRS_HOME=$ORACLE_BASE/product/10.2.0/crs_1
[root@rac1 bin]# echo $ORACLE_BASE
/u01/oracle
[root@rac1 bin]# echo $ORACLE_HOME
/u01/oracle/product/10.2.0/db_1
[root@rac1 bin]# echo $ORA_CRS_HOME
/u01/oracle/product/10.2.0/crs_1
[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
Unknown option: crshome
The following CRS diagnostic archives will be created in the local directory.
crsData_rac1.gz -> logs,traces and cores from CRS home
ocrData_rac1.gz -> ocrdump, ocrcheck etc
coreData_rac1.gz -> contents of CRS core files in text format
Collecting crs data
/bin/tar: Removing leading `/' from member names
Collecting OCR data
PROT-306: Failed to retrieve cluster registry data
Collecting information from core files
Previous frame. inner to this frame. (corrupt stack?)
The following Oracle Home diagnostic archives will be created in the local directory.
oraData_rac1.gz -> logs, traces and cores from Oracle Home
Collecting oracle home data
/bin/tar: Removing leading `/' from member names
/bin/tar: /u01/oracle/product/10.2.0/db_1/admin/*: Cannot stat: No such file or directory
/bin/tar: Error exit delayed from previous errors
The following Oracle Base diagnostic archives will be created in the local directory.
basData_rac1.gz -> logs,traces from Oracle base
Collecting oracle base data
/bin/tar: Removing leading `/' from member names
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22821701/viewspace-694833/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/22821701/viewspace-694833/