Oracle TFA系列3:收集数据

1. 请求式收集(On-Demand Collections)

当自行无法解决问题时,就可以使用TFA收集相关信息,这些收集的信息可以提供给SUPPORT人员来帮助诊断。请求式收集里分三种收集方式

1.1 默认方式收集(Default Collections)

默认收集方式会从所有节点、所有组件中收集所有重要文件、诊断数据。
默认收集方式收集的数据会非常大,当然如果信息量过大,TFA会自行判断该收集多少。
默认收集方式收集的时间是默认最近的4小时,不建议使用太长的时间,会导致收集时间过长

# /oracle/product/11.2.0/grid/bin/tfactl diagcollect -help

Usage: /oracle/product/11.2.0/grid/bin/tfactl diagcollect [-all | -database <all|d1,d2..> | -asm | -dbwlm | -tns | -crs | -wls | -emagent | -oms | -ocm | -emplugins | -em | -acfs | -install | -cfgtools | -os | -ashhtml | -ashtext | -awrhtml | -awrtext | -chmos | -srdc <srdc_profile> ] [-node <all | local | n1,n2,..>] [-tag <tagname>] [-z <filename>] [-last <n><h|d>| -from <time> -to <time> | -for <time>] [-nocopy] [-notrim] [-silent] [-collectalldirs]

Options:
  -all       Collect all logs (If no time is given for collection then files
             for the last 4 hours will be collected)
  -asm       Collect ASM logs
  -dbwlm     Collect DBWLM logs
  -tns       Collect TNS logs
  -crs       Collect CRS logs
  -wls       Collect WLS logs
  -emagent   Collect EMAGENT logs
  -oms       Collect OMS logs
  -ocm       Collect OCM logs
  -emplugins  Collect EMPLUGINS logs
  -em        Collect EM logs
  -acfs      Collect ACFS logs
  -install   Collect Oracle Installation related files
  -cfgtools  Collect CFGTOOLS logs
  -os        Collect OS files such as /var/log/messages
  -ashhtml   Collect Generate ASH HTML Report
  -ashtext   Collect Generate ASH TEXT Report
  -awrhtml   Collect AWRHTML logs
  -awrtext   Collect AWRTEXT logs
  -srdc      Service Request Data Collection (SRDC).
  -database  Collect database logs from databases specified
  -chmos     Collect CHMOS files (Note that this data can be large for
             longer durations)
  -nocores   Do not collect Core files when it would normally have been
             collected
  -collectalldirs Collect all files from a directory marked "Collect All"
                  flag to true
  -node      Specify comma separated list of host names for collection
  -nocopy    Does not copy back the zip files to initiating node from all nodes
  -notrim    Does not trim the files collected
  -silent    This option is used to submit the diagcollection as a background
             process

  -last  <n><h|d>    Files from last 'n' [d]ays or 'n' [h]ours 
  -since Same as -last. Kept for backward compatibility.
  -from "Mon/dd/yyyy hh:mm:ss"    From &lt;time&gt;
  -to   "Mon/dd/yyyy hh:mm:ss"    To &lt;time&gt;
  -for  "Mon/dd/yyyy"             For &lt;date&gt;.
  -tag &lt;tagname&gt; The files will be collected into tagname directory inside
                 repository 

  -z <zipname> The files will be collected into tagname directory with the
               specified zipname
Examples:
  /oracle/product/11.2.0/grid/bin/tfactl diagcollect
    Trim and Zip all files updated in the last 24 hours as well as chmos/osw data
    from across the cluster and collect at the initiating node

    Note: This collection could be larger than required but is there as the
    simplest way to capture diagnostics if an issue has recently occurred.

  /oracle/product/11.2.0/grid/bin/tfactl diagcollect -all -last 8h
    Trim and Zip all files updated in the last 8 hours as well as chmos/osw data
    from across the cluster and collect at the initiating node

  /oracle/product/11.2.0/grid/bin/tfactl diagcollect -database hrdb,fdb -last 1d -z foo
    Trim and Zip all files from databases hrdb &amp; fdb in the last 1 day and
    collect at the initiating node

  /oracle/product/11.2.0/grid/bin/tfactl diagcollect -crs -os -node node1,node2 -last 6h
    Trim and Zip all crs files, o/s logs and chmos/osw data from node1 &amp; node2
    updated in the last 6 hours and collect at the initiating node

  /oracle/product/11.2.0/grid/bin/tfactl diagcollect -asm -node node1 -from Mar/4/2013 -to "Mar/5/2013 21:00:00"
    Trim and Zip all ASM logs from node1 updated between from and to time and
    collect at the initiating node

  /oracle/product/11.2.0/grid/bin/tfactl diagcollect -for "Mar/2/2013"
    Trim and Zip all log files updated on "Mar/2/2013" and collect at the
    initiating node

  /oracle/product/11.2.0/grid/bin/tfactl diagcollect -for "Mar/2/2013 21:00:00"
    Trim and Zip all log files updated from 09:00 on March 2 to 09:00 on March 3
    (i.e. 12 hours before and after the time given) and collect at the initiating node

使用案例:

# /oracle/product/11.2.0/grid/bin/tfactl diagcollect

Collecting data for the last 4 hours for all components...
Collecting data for all nodes

Collection Id : 20170210145958xxxxxxdb01

Repository Location in xxxxxxdb01 : /oracle/grid/tfa/repository

Collection monitor will wait up to 60 seconds for collections to start
2017/02/10 15:00:00 CST : NOTE : Any file or directory name containing the string .com will be renamed to replace .com with dotcom
2017/02/10 15:00:00 CST : Collection Name : tfa_Fri_Feb_10_14_59_58_CST_2017.zip
2017/02/10 15:00:00 CST : Sending diagcollect request to host : xxxxxxdb02
2017/02/10 15:00:00 CST : Scanning of files for Collection in progress...
2017/02/10 15:00:00 CST : Collecting extra files...
2017/02/10 15:00:05 CST : Getting list of files satisfying time range [02/10/2017 11:00:00 CST, 02/10/2017 15:00:05 CST]
2017/02/10 15:00:05 CST : Starting Thread to identify stored files to collect
2017/02/10 15:00:05 CST : Getting List of Files to Collect
2017/02/10 15:00:05 CST : Trimming file : xxxxxxdb01/oracle/product/11.2.0/grid/log/xxxxxxdb01/agent/crsd/oraagent_grid/oraagent_grid.log with original file size : 3.2MB
2017/02/10 15:00:05 CST : Trimming file : xxxxxxdb01/oracle/product/11.2.0/grid/log/xxxxxxdb01/agent/crsd/oraagent_oracle/oraagent_oracle.log with original file size : 1.1MB
2017/02/10 15:00:05 CST : Trimming file : xxxxxxdb01/oracle/product/11.2.0/grid/log/xxxxxxdb01/agent/crsd/orarootagent_root/orarootagent_root.log with original file size : 787kB
2017/02/10 15:00:05 CST : Trimming file : xxxxxxdb01/oracle/product/11.2.0/grid/log/xxxxxxdb01/agent/ohasd/oraagent_grid/oraagent_grid.log with original file size : 3.6MB
2017/02/10 15:00:05 CST : Trimming file : xxxxxxdb01/oracle/product/11.2.0/grid/log/xxxxxxdb01/agent/ohasd/orarootagent_root/orarootagent_root.log with original file size : 7.1MB
2017/02/10 15:00:05 CST : Trimming file : xxxxxxdb01/oracle/product/11.2.0/grid/log/xxxxxxdb01/crsd/crsd.log with original file size : 1.3MB
2017/02/10 15:00:05 CST : Finished Getting List of Files to Collect
2017/02/10 15:00:05 CST : Trimming file : xxxxxxdb01/oracle/product/11.2.0/grid/log/xxxxxxdb01/cssd/ocssd.log with original file size : 11MB
2017/02/10 15:00:06 CST : Trimming file : xxxxxxdb01/oracle/product/11.2.0/grid/log/xxxxxxdb01/ohasd/ohasd.log with original file size : 3.1MB
2017/02/10 15:00:06 CST : Trimming file : xxxxxxdb01/tnslsnr/xxxxxxdb01/listener/trace/listener.log with original file size : 504kB
2017/02/10 15:00:08 CST : Could not create trim file for /var/log/messages
2017/02/10 15:00:08 CST : xxxxxxdb01: Zipped 100 Files so Far
2017/02/10 15:00:08 CST : Collecting ADR incident files...
2017/02/10 15:00:08 CST : Waiting for collection of extra files
2017/02/10 15:03:12 CST : Completed collection of extra files...
2017/02/10 15:03:13 CST : Completed Zipping of all files
2017/02/10 15:03:13 CST : Cleaning up temporary files
2017/02/10 15:03:13 CST : Finished Cleaning up temporary files
2017/02/10 15:03:13 CST : Finalizing the Collection Zip File
2017/02/10 15:03:13 CST : Finished Finalizing the Collection Zip File
2017/02/10 15:03:13 CST : Total Number of Files checked : 659
2017/02/10 15:03:13 CST : Total Size of all Files Checked : 570MB
2017/02/10 15:03:13 CST : Number of files containing required range : 103
2017/02/10 15:03:13 CST : Total Size of Files containing required range : 129MB
2017/02/10 15:03:13 CST : Number of files trimmed : 10
2017/02/10 15:03:13 CST : Total Size of data prior to zip : 102MB
2017/02/10 15:03:13 CST : Saved 30MB by trimming files
2017/02/10 15:03:13 CST : Zip file size : 13MB
2017/02/10 15:03:13 CST : Total time taken : 193s
2017/02/10 15:03:14 CST : Remote Collection in Progress...
2017/02/10 15:03:21 CST : xxxxxxdb02:Completed Collection
2017/02/10 15:03:21 CST : Completed collection of zip files.

Logs are being collected to: /oracle/grid/tfa/repository/collection_Fri_Feb_10_14_59_58_CST_2017_node_all
/oracle/grid/tfa/repository/collection_Fri_Feb_10_14_59_58_CST_2017_node_all/xxxxxxdb01.tfa_Fri_Feb_10_14_59_58_CST_2017.zip
/oracle/grid/tfa/repository/collection_Fri_Feb_10_14_59_58_CST_2017_node_all/xxxxxxdb02.tfa_Fri_Feb_10_14_59_58_CST_2017.zip

当然可以指定收集的时间范围
tfactl diagcollect –last 2h
tfactl diagcollect –last 3d
tfactl diagcollect -from “2016-08-15”
tfactl diagcollect -from “2016-08-15” -to “2016-08-17”
tfactl diagcollect -from “2017-02-10 10:00:00” -to “2017-02-10 15:00:00”
指定收集某一天的日志
tfactl diagcollect -for “2016-08-15”

1.2 SR请求方式收集(Service Request Data Collections)

针对某个错误或事件进行收集所有重要的文件和诊断数据。
SRDC是指:SR Data Collection。在开SR时,可能Oracle的支持人员会要求使用TFA收集一些数据。
SRDC支持收集的内容

  • OERR
    ora600
    ora7445
    ora700
    ora4031
    ora4030
    ora27300
    ora27301
    ora27302
  • 数据库性能问题
    dbperf
  • 数据库内部严重错误
    internalerror
# /oracle/product/11.2.0/grid/bin/tfactl diagcollect -srdc -help

SRDC diagostic collections must be run as an oracle privileged user - not root

SDRC方式需要以grid用户(TFA的安装用户)执行

$ tfactl diagcollect -srdc -help

Service Request Data Collection (SRDC).

Usage: /oracle/product/11.2.0/grid/bin/tfactl -srdc [-tag ] [-z ] [-last <h|d>| -from <time> -to <time> | -for <time>] -database </time></time></time>

Options:
-tag The files will be collected into tagname directory inside
repository

-z The files will be collected into tagname directory with the
specified zipname
-last <h|d> Files from last 'n' [d]ays or 'n' [h]ours
-since Same as -last. Kept for backward compatibility.
-from "Mon/dd/yyyy hh:mm:ss" From <time>
-to "Mon/dd/yyyy hh:mm:ss" To <time>
-for "Mon/dd/yyyy" For .
can be any of the following,
dbperf SRDC for database performance problems.
internalerrors SRDC for all other types of internal database errors.
ORA-27300 SRDC for ORA-27300. OS system dependent operation:open failed with status: (status).
ORA-27301 SRDC for ORA-27301. OS failure message: (message).
ORA-27302 SRDC for ORA-27302. failure occurred at: (module).
ORA-4030 SRDC for ORA-04030. OS process private memory was exhausted.
ORA-4031 SRDC for ORA-04031. More shared memory is needed in the shared/streams pool.
ORA-600 SRDC for ORA-00600. Internal error code.
ORA-700 SRDC for ORA-00700. Soft internal error.
ORA-7445 SRDC for ORA-07445. Exception encountered, core dump.
  • 收集案例
$ tfactl diagcollect -srdc ORA-600 -last 2d
Enter the Database Name [&lt;RETURN&gt;=ALL] :
No events matching the timestamp Feb/08/2017 11:28:26-Feb/10/2017 11:28:26.
The timestamp must be between  and .

Please choose the event : 1-0 [1]

1.3 自定义收集(Custom collection)

默认情况下TFA会收集所有节点的信息,可以指定收集某个节点

# tfactl diagcollect -last 1d -node myserver65

指定收集某些组件

# tfactl –diagcollect –database hrdb,fdb –last 1d

收集CRS、操作系统日志、CHMOS/OSW数据

# tfactl diagcollect -crs -os -node node1,node2 -last 6h

收集指定时间范围内某个节点的ASM信息

# tfactl diagcollect -asm -node node1 -from "2016-08-15" -to "2016-08-17"

2. 查看收集的信息

tfactl可以查看所有收集的数据

$ tfactl print collections
######################################
CollectionId: 20170210145958xxxxxxdb01
TFAVersion: 12.1.2.8.4
TFABuildId: 12128420170206111019
Manual Collection: true
RequestUser: root
MasterHost: xxxxxxdb01
NodeList: [xxxxxxdb02]
Collection Name: /oracle/grid/tfa/repository/collection_Fri_Feb_10_14_59_58_CST_2017_node_all
ZipFileName: tfa_Fri_Feb_10_14_59_58_CST_2017.zip
DiagcollectLog: diagcollect_20170210145958_xxxxxxdb01.log
ComponentList: [cfgtools, tns, crs, ocm, install, emplugins, oms, rdbms, wls, asm, chmos, em, emagent, acfs, dbwlm, os, sundiag, asmproxy]
StartTime: Fri Feb 10 11:00:00 CST 2017
EndTime: Fri Feb 10 15:00:00 CST 2017
FilesInRange: 103
SizeOfFilesInRange: 129030
SizeOfExtraFiles: 3205
SizeOfFilesBeforeZip: 102224
ZipFileSize: 13246
NumTrimmedFiles: 10
TrimSavings: 30010
CollectionTime: 193
Collection Score: 0
######################################
CollectionId: 20170210150829xxxxxxdb01
TFAVersion: 12.1.2.8.4
TFABuildId: 12128420170206111019
Manual Collection: true
RequestUser: root
MasterHost: xxxxxxdb01
NodeList: [xxxxxxdb02]
Collection Name: /oracle/grid/tfa/repository/collection_Fri_Feb_10_15_08_29_CST_2017_node_all
ZipFileName: tfa_Fri_Feb_10_15_08_29_CST_2017.zip
DiagcollectLog: diagcollect_20170210150829_xxxxxxdb01.log
ComponentList: [cfgtools, tns, crs, ocm, install, emplugins, oms, rdbms, wls, asm, chmos, em, emagent, acfs, dbwlm, os, sundiag, asmproxy]
StartTime: Fri Feb 10 10:00:00 CST 2017
EndTime: Fri Feb 10 15:00:00 CST 2017
FilesInRange: 116
SizeOfFilesInRange: 144705
SizeOfExtraFiles: 3331
SizeOfFilesBeforeZip: 119433
ZipFileSize: 14943
NumTrimmedFiles: 9
TrimSavings: 28603
CollectionTime: 199
Collection Score: 0
######################################
CollectionId: 20170210152048xxxxxxdb01
TFAVersion: 12.1.2.8.4
TFABuildId: 12128420170206111019
Manual Collection: true
RequestUser: root
MasterHost: xxxxxxdb01
NodeList: [xxxxxxdb02]
Collection Name: /oracle/grid/tfa/repository/collection_Fri_Feb_10_15_20_48_CST_2017_node_all
ZipFileName: tfa_Fri_Feb_10_15_20_48_CST_2017.zip
DiagcollectLog: diagcollect_20170210152048_xxxxxxdb01.log
ComponentList: [crs, tns, os, chmos]
StartTime: Fri Feb 10 09:20:50 CST 2017
EndTime: Fri Feb 10 15:20:50 CST 2017
FilesInRange: 104
SizeOfFilesInRange: 158557
SizeOfExtraFiles: 3226
SizeOfFilesBeforeZip: 134230
ZipFileSize: 16281
NumTrimmedFiles: 8
TrimSavings: 27553
CollectionTime: 189
Collection Score: 0

TFA文章系列:
11.2.0.4 打GI PSU补丁 hang住处理
TFA进程太多的Bug
Oracle TFA系列1:介绍与升级
Oracle TFA系列2:分析数据
Oracle TFA系列3:收集数据

关于紫砂壶

感悟技术人生
此条目发表在工具分类目录,贴了标签。将固定链接加入收藏夹。