Oracle TFA系列1:介绍与升级

1. 什么是TFA

前面碰到了几个TFA的问题,参考:

11.2.0.4 打GI PSU补丁 hang住处理

TFA进程太多的Bug

准备对Oracle TFA写个系列,各位看官多支持。
这里讲的TFA,不是指三氟乙酸,而是Oracle 11gRAC全方位、一体化的信息诊断收集工具,全称是:Oracle Trace File Analyzer,它把如orachk、exachk、oswatch、sqlt等这些工具,全部整合在一起。
最初碰到TFA,我是非常不喜欢使用,因为它提供的功能比较弱,而且自已手工都能完成,而且在AIX上打GI PSU时,需要先把TFA给停了,给人的感觉就是惹事的。
参考:AIX: Apply PSU or Interim patch Fails with Copy Failed as TFA was Running (文档 ID 1668630.1)
但是最近再来看,TFA已经完成鸟枪换炮,对于收集诊断信息,非常方便,后面需要好好使用。

1.1 TFA目的

TFA是个11.2版本上推出的用来收集Grid Infrastructure/RAC环境下的诊断日志的工具,它可以用非常简单的命令协助用户收集RAC里的日志,以便进一步进行诊断;TFA是类似diagcollection的一个oracle 集群日志收集器,而且TFA比diagcollection集中和自动化的诊断信息收集能力更强大。
TFA有以下几个特点:

  1. TFA可以在一台机器上执行一条简单的命令把所有节点的日志进行打包,封装;
  2. TFA可以在收集的过程中对日志进行”trim”操作,减少数据的收集量;
  3. TFA可以收集用来诊断用的“一段时间内”的数据;
  4. TFA可以把所有节点的日志收集并封装好放在某一个节点上以便传输阅读;
  5. TFA可以指定Cluster中的某一部分组件进行日志收集,如:ASM ,RDBMS,Clusterware
  6. TFA可以根据条件配置对告警日志进行实时扫描(DB Alert Logs, ASM Alert Logs, Clusterware Alert Logs, etc);
  7. TFA可以根据实时扫描的结果自动的收集诊断日志;
  8. TFA可以根据指定的错误进行对告警日志的扫描;
  9. TFA可以根据指定的错误扫描后的结果收集诊断日志;

1.2 TFA的安装要求

目前TFA支持以下几种平台:

  • Intel Linux(Enterprise Linux, RedHat Linux, SUSE Linux)
  • Linux Itanium
  • Oracle Solaris SPARC
  • Oracle Solaris x86-64
  • AIX (requires bash shell version 3.2 or higher installed)
  • HPUX Itanium
  • HPUX PA-RISC

支持的数据库版本:
TFA目前的设计是脱离RDBMS和CRS进行设计的,所以设计的初衷是针对所有的版本而设计的,不受RDBMS或者CRS的版本限制;

2. TFA升级

在11gR2 RAC安装时,会自动安装TFA,所以11gR2 RAC上已经存在TFA,只是版本比较旧而已,在安装完最新的11.2.0.4.161018的GI PSU后,TFA的版本号为: 12.1.2.7.0,而从1513912.1上下载的安装包升级后,现在的版本是:12.1.2.8.4。
升级TFA,不需要停数据库实例,并且带入了新的、比较好用的功能(比如整合了OSWatch),建议能升就升级。
升级前,确认节点间的root的ssh互信已开,如果有某个节点的TFA没有启动,那这个节点的TFA可能需要手工升级,或者在升级前启动好。
升级TFA并不需要停GI或DB,所以升级还是比较方便的,不需要找停机窗口。升级前检查状态:

#/oracle/product/11.2.0/grid/bin/tfactl print status

.-------------------------------------------------------------------------------------------------.
| Host     | Status of TFA | PID    | Port | Version    | Build ID             | Inventory Status |
+----------+---------------+--------+------+------------+----------------------+------------------+
| xxxxnew1 | RUNNING       | 173527 | 5000 | 12.1.2.1.1 | 12121120141020111402 | COMPLETE         |
| xxxxnew2 | RUNNING       |   3185 | 5000 | 12.1.2.1.1 | 12121120141020111402 | COMPLETE         |
'----------+---------------+--------+------+------------+----------------------+------------------'

在root用户中解压p21757377_121020_Generic.zip,执行installTFALite命令就完成升级,升级非常简单,升级过程的日志如下:

#./installTFALite
TFA Installation Log will be written to File : /tmp/tfa_install_175321_2017_02_10-10_53_50.log

Starting TFA installation

TFA HOME : /oracle/product/11.2.0/grid/tfa/xxxxnew1/tfa_home
TFA Build Version: 121284 Build Date: 201702061110
Installed Build Version: 121211 Build Date: 201410201114

TFA is already installed. Patching /oracle/product/11.2.0/grid/tfa/xxxxnew1/tfa_home...
TFA patching CRS or DB from zipfile extracted to /tmp/.175321.tfa
TFA patching CRS or DB from zipfile is written to /oracle/product/11.2.0/grid/tfa/xxxxnew1/tfapatch.log

TFA will be Patched on:
xxxxnew1
xxxxnew2

Do you want to continue with patching TFA? [Y|N] [Y]: Y

Checking for ssh equivalency in xxxxnew2
xxxxnew2 is configured for ssh user equivalency for root user

Creating ZIP: /oracle/product/11.2.0/grid/tfa/xxxxnew1/tfa_home/internal/tfapatch.zip

Using SSH to patch TFA to remote nodes :

Applying Patch on xxxxnew2:

TFA_HOME: /oracle/product/11.2.0/grid/tfa/xxxxnew2/tfa_home
Stopping TFA Support Tools...
Shutting down TFA
oracle-tfa stop/waiting
. . . . .
Killing TFA running with pid 3185
. . .
Successfully shutdown TFA..
Copying files from xxxxnew1 to xxxxnew2...

Current version of Berkeley DB in  is 5.0.84, so no upgrade required
Running commands to fix init.tfa and tfactl in xxxxnew2...
Updating init.tfa in xxxxnew2...
Starting TFA in xxxxnew2...
Creating Sym Link /etc/rc.d/rc0.d/K17init.tfa to /etc/init.d/init.tfa
Creating Sym Link /etc/rc.d/rc1.d/K17init.tfa to /etc/init.d/init.tfa
Creating Sym Link /etc/rc.d/rc2.d/K17init.tfa to /etc/init.d/init.tfa
Creating Sym Link /etc/rc.d/rc4.d/K17init.tfa to /etc/init.d/init.tfa
Creating Sym Link /etc/rc.d/rc6.d/K17init.tfa to /etc/init.d/init.tfa
Starting TFA..
oracle-tfa start/running, process 146329
Waiting up to 100 seconds for TFA to be started..
. . . . .
Successfully started TFA Process..
. . . . .
TFA Started and listening for commands
Removing /oracle/product/11.2.0/grid/tfa/xxxxnew2/tfa_home/jlib/commons-io-2.2.jar

Enabling Access for Non-root Users on xxxxnew2...

Applying Patch on xxxxnew1:

Stopping TFA Support Tools...

Shutting down TFA for Patching...

Shutting down TFA
oracle-tfa stop/waiting
. . . . .
Killing TFA running with pid 173527
. . .
Successfully shutdown TFA..

Current version of Berkeley DB is 5.0.84, so no upgrade required

Copying TFA Certificates...

Running commands to fix init.tfa and tfactl in localhost

Starting TFA in xxxxnew1...

Creating Sym Link /etc/rc.d/rc0.d/K17init.tfa to /etc/init.d/init.tfa
Creating Sym Link /etc/rc.d/rc1.d/K17init.tfa to /etc/init.d/init.tfa
Creating Sym Link /etc/rc.d/rc2.d/K17init.tfa to /etc/init.d/init.tfa
Creating Sym Link /etc/rc.d/rc4.d/K17init.tfa to /etc/init.d/init.tfa
Creating Sym Link /etc/rc.d/rc6.d/K17init.tfa to /etc/init.d/init.tfa
Starting TFA..
oracle-tfa start/running, process 177693
Waiting up to 100 seconds for TFA to be started..
. . . . .
Successfully started TFA Process..
. . . . .
TFA Started and listening for commands

Enabling Access for Non-root Users on xxxxnew1...

.----------------------------------------------------------------.
| Host     | TFA Version | TFA Build ID         | Upgrade Status |
+----------+-------------+----------------------+----------------+
| xxxxnew1 |  12.1.2.8.4 | 12128420170206111019 | UPGRADED       |
| xxxxnew2 |  12.1.2.8.4 | 12128420170206111019 | UPGRADED       |
'----------+-------------+----------------------+----------------'

xxxxnew1:[/root/tfa]#
xxxxnew1:[/root/tfa]#/oracle/product/11.2.0/grid/bin/tfactl print status

.-------------------------------------------------------------------------------------------------.
| Host     | Status of TFA | PID    | Port | Version    | Build ID             | Inventory Status |
+----------+---------------+--------+------+------------+----------------------+------------------+
| xxxxnew1 | RUNNING       | 177748 | 5000 | 12.1.2.8.4 | 12128420170206111019 | COMPLETE         |
| xxxxnew2 | RUNNING       | 146384 | 5000 | 12.1.2.8.4 | 12128420170206111019 | COMPLETE         |
'----------+---------------+--------+------+------------+----------------------+------------------'

如果只升级某个节点,可以使用:./installTFALite -local,其它帮助参考:

# ./installTFALite -h
TFA Installation Log will be written to File : /tmp/tfa_install_20381_2017_02_10-11_08_55.log

   Usage for ./installTFALite

   ./installTFALite [[-local][-deferdiscovery][-tfabase <install dir>][-javahome <path to JRE>][-silent]|-extractto <extract dir> ]

        -local            -    Only install on the local node
        -deferdiscovery   -    Discover Oracle trace directories after installation completes
        -tfabase          -    Install into the directory supplied
        -javahome         -    Use this directory for the JRE
        -silent           -    Do not ask any install questions
        -extractto        -    Extract TFA into the directory supplied (non daemon mode)
        -tmploc           -    Temporary location directory for TFA to extract the install archive to (must exist)
        -debug            -    Print debug tracing and do not remove TFA_HOME on install failure

   Note: Without parameters TFA will take you through an interview process for installation
         /tfa will be appended to -tfabase if it is not already there.

TFA存在两个目录:
$GRID_HOME/tfa
TFA的可执行程序和配置文件
$ORACLE_BASE/tfa
这个是TFA的信息库目录,保存TFA的元数据和log文件

3. TFA用法

TFA使用主要在命令是tfactl,这个命令有些参数只能在root下执行,有些只能在grid下执行。
当前帮助信息

# /oracle/product/11.2.0/grid/bin/tfactl -h

Usage : /oracle/product/11.2.0/grid/bin/tfactl <command> [options]
<command> =
          start        Starts TFA
          stop         Stops TFA
          enable       Enable TFA Auto restart
          disable      Disable TFA Auto restart
          print        Print requested details
          access       Add or Remove or List TFA Users
          purge        Delete collections from TFA repository
          directory    Add or Remove or Modify directory in TFA
          host         Add or Remove host in TFA
          diagcollect  Collect logs from across nodes in cluster
          collection   Manage TFA Collections
          analyze      List events summary and search strings in alert logs.
          set          Turn ON/OFF or Modify various TFA features
          toolstatus     Prints the status of TFA Support Tools
          run <tool>     Run the desired support tool
          start <tool>   Starts the desired support tool
          stop <tool>    Stops the desired support tool
          syncnodes      Generate/Copy TFA Certificates
          diagnosetfa    Collect TFA Diagnostics
          uninstall      Uninstall TFA from this node

For help with a command: /oracle/product/11.2.0/grid/bin/tfactl <command> -help

后续分几篇描述TFA的详细使用方法

关于紫砂壶

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