os: centos 7.4
db: oracle 18c(18.3)
TFA 全称是 Oracle Trace File Analyzer (TFA),是一款非常好用的工具集。
提供 随库安装和独立安装 两种安装方式。
随数据库软件一起安装
安装oracle 18.3软件的最后一步,需要以root用户运行两个脚本:
/u01/app/oraInventory/orainstRoot.sh
/u01/app/oracle/product/18.3.0/db_1/root.sh
运行第二个脚本时会提示是否安装TFA。
# /u01/app/oracle/product/18.3.0/db_1/root.sh
Do you want to setup Oracle Trace File Analyzer (TFA) now ? yes|[no] :
yes
Installing Oracle Trace File Analyzer (TFA).
Log File: /u01/app/oracle/product/18.3.0/db_1/install/root_18c3node1_2018-11-22_16-15-14-147399837.log
Finished installing Oracle Trace File Analyzer (TFA)
fa_install_13325_2018_11_22-16_15_26.log
Starting TFA installation
TFA Version: 181000 Build Date: 201712032224
Running Auto Setup for TFA as user root...
Installing TFA now...
TFA Will be Installed on 18c3node1...
TFA will scan the following Directories
++++++++++++++++++++++++++++++++++++++++++++
.------------------------------------------------------------.
| 18c3node1 |
+-------------------------------------------------+----------+
| Trace Directory | Resource |
+-------------------------------------------------+----------+
| /u01/app/oraInventory/ContentsXML | INSTALL |
| /u01/app/oraInventory/logs | INSTALL |
| /u01/app/oracle/cfgtoollogs | INSTALL |
| /u01/app/oracle/diag | RDBMS |
| /u01/app/oracle/product/18.3.0/db_1/cfgtoollogs | INSTALL |
| /u01/app/oracle/product/18.3.0/db_1/install | INSTALL |
| /u01/app/oracle/product/18.3.0/db_1/rdbms/log | RDBMS |
| /u01/app/oracle/product/18.3.0/db_1/rdbms/trace | RDBMS |
'-------------------------------------------------+----------'
Installing TFA on 18c3node1:
HOST: 18c3node1 TFA_HOME: /u01/app/oracle/tfa/18c3node1/tfa_home
.-------------------------------------------------------------------------------.
| Host | Status of TFA | PID | Port | Version | Build ID |
+-----------+---------------+-------+-------+------------+----------------------+
| 18c3node1 | RUNNING | 13722 | 46405 | 18.1.0.0.0 | 18100020171203222424 |
'-----------+---------------+-------+-------+------------+----------------------'
Running Inventory in All Nodes...
Enabling Access for Non-root Users on 18c3node1...
Summary of TFA Installation:
.--------------------------------------------------------------.
| 18c3node1 |
+---------------------+----------------------------------------+
| Parameter | Value |
+---------------------+----------------------------------------+
| Install location | /u01/app/oracle/tfa/18c3node1/tfa_home |
| Repository location | /u01/app/oracle/tfa/repository |
| Repository usage | 0 MB out of 10240 MB |
'---------------------+----------------------------------------'
TFA is successfully installed...
Moving Install log file to /u01/app/oracle/tfa/18c3node1/log
TFA安装在 $ORACLE_BASE/tfa/$HOSTNAME/tfa_home 目录下,即TFA_HOME=/u01/app/oracle/tfa/18c3node1/tfa_home
# cd /u01/app/oracle/tfa
# ls -l
total 0
drwxr-xr-x 8 root root 220 Nov 22 16:15 18c3node1
drwxr-xr-x 2 root root 20 Nov 22 16:15 bin
drwxr-xr-t 3 root root 22 Nov 22 16:15 repository
# cd /u01/app/oracle/tfa/18c3node1/tfa_home
# ls -l
total 48
drwxr-x--x 8 root root 4096 Nov 22 16:15 bin
-rwx------ 1 root root 3272 Nov 22 16:15 client.jks
-rwx------ 1 root root 939 Nov 22 16:15 client_pub.crt
drwxr-xr-x 26 root root 4096 Nov 22 16:15 ext
drwxr-x--- 2 root root 187 Nov 22 16:15 install
drwxr-x--x 3 root root 4096 Nov 23 09:40 internal
drwxr-x--x 2 root root 230 Nov 22 16:15 jlib
drwxr-x--x 5 root root 185 Nov 22 16:15 jre
drwxr-x--x 5 root root 39 Nov 22 16:15 perl
-rw------- 1 root root 3267 Nov 22 16:15 public.jks
drwxr-x--- 3 root root 22 Nov 22 16:15 receiver
drwxr-xr-x 3 root root 4096 Nov 22 16:20 resources
-rwx------ 1 root root 3270 Nov 22 16:15 server.jks
-rwx------ 1 root root 939 Nov 22 16:15 server_pub.crt
-rw-r----- 1 root root 1713 Nov 22 16:36 tfa_directories.txt
-rwxr-x--- 1 root root 3262 Nov 22 16:15 tfa.jks
-rw-r--r-- 1 root root 0 Nov 23 09:40 tfa.lock
-rw-r--r-- 1 root root 786 Nov 22 16:26 tfa_setup.txt
drwxr-xr-x 2 root root 6 Nov 22 16:20 tmp
配置随OS启动
# systemctl status oracle-tfa.service
# systemctl enable oracle-tfa.service
tfactl
# /u01/app/oracle/tfa/18c3node1/tfa_home
# ./bin/tfactl
WARNING - TFA Software is older than 180 days. Please consider upgrading TFA to the latest version.
tfactl>
tfactl> help
Usage : /u01/app/oracle/tfa/bin/tfactl <command> [options]
commands:diagcollect|collection|analyze|ips|run|start|stop|enable|disable|status|print|access|purge|directory|host|receiver|set|toolstatus|uninstall|diagnosetfa|syncnodes
For detailed help on each command use:
/u01/app/oracle/tfa/bin/tfactl <command> -help
怎么又到 /u01/app/oracle/tfa/bin/tfactl 这去了?
查看状态
tfactl> status
.-------------------------------------------------------------------------------------------------.
| Host | Status of TFA | PID | Port | Version | Build ID | Inventory Status |
+-----------+---------------+------+-------+------------+----------------------+------------------+
| 18c3node1 | RUNNING | 6438 | 37146 | 18.1.0.0.0 | 18100020171203222424 | COMPLETE |
'-----------+---------------+------+-------+------------+----------------------+------------------'
显示信息
tfactl> print
Print requested details.
Usage : /u01/app/oracle/tfa/bin/tfactl print <command> [options]
commands:status|components|config|directories|hosts|receivers|collectors|robjects|actions|repository|runmode|suspendedips|protocols
For detailed help on each command use:
/u01/app/oracle/tfa/bin/tfactl print <command> -help
建议 print 每个 option 都执行一下,看看信息,增进对TFA的了解。
diagcollect
# $TFA_HOME/bin/tfactl diagcollect -all -from "Sep/27/2019 12:00:00" -to "Sep/27/2019 16:00:00"
# $TFA_HOME/bin/tfactl diagcollect -node node1 -from "Sep/27/2019 12:00:00" -to "Sep/27/2019 16:00:00"
参考:
TFA Collector - TFA with Database Support Tools Bundle (Doc ID 1513912.1)
Best Practices: Streamline your data collection for support issues by installing the latest TFA Support Tools Bundle (See Note:1594347.1 )