TFA是Oracle從11.2版本開始推出的一種類似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可以根據指定的錯誤掃描后的結果收集診斷日志;
TFA工作方式
-
DBA發出diagcollect命令,啟動TFA日志收集進程。
-
本地TFA發送收集請求至其他節點的TFA,在其他節點上開始日志收集工作。
-
本地TFA也同時開始進行日志收集工作。
-
所有涉及節點的TFA日志都歸檔至發起diagcollect命令的"master"節點。
-
DBA提取已歸檔的TFA日志信息,進行分析或提交SR進行處理
在安裝12C的程序的最后一步執行root腳本的時候,會有如下提示
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Do you want to setup Oracle Trace File Analyzer (TFA) now ? yes|[no] :
Oracle Trace File Analyzer (TFA - User Mode) is available at :
/u01/app/oracle/product/12.2.0/dbhome_1/suptools/tfa/release/tfa_home/bin/tfactl
OR
Oracle Trace File Analyzer (TFA - Daemon Mode) can be installed by running this script :
/u01/app/oracle/product/12.2.0/dbhome_1/suptools/tfa/release/tfa_home/install/roottfa.sh
如果選擇no,那就不會安裝該工具,默認是no
有兩種方法啟動TFA
一種是直接到
/u01/app/oracle/product/12.2.0/dbhome_1/suptools/tfa/release/tfa_home/bin/tfactl目錄下執行命令操作
另一種是安裝到系統
/u01/app/oracle/product/12.2.0/dbhome_1/suptools/tfa/release/tfa_home/install/roottfa.sh,執行完畢會有如下提示
/u01/app/oracle/product/12.2.0/dbhome_1/suptools/tfa/release/tfa_home/install/roottfa.sh
Installing Oracle Trace File Analyzer (TFA).
Log File: /u01/app/oracle/product/12.2.0/dbhome_1/install/root_12cr2.yudean.com_2017-03-14_15-53-55.log
Finished installing Oracle Trace File Analyzer (TFA)
tfactl start/stop 啟動和關閉tfactl
tfactl> access lsusers 查看當前哪些用戶可以使用tfactl
tfactl> print status 查看當前TFA主機的狀態
tfactl> print config 列出當前TFA的配置信息
tfactl> print directories 列出對哪些目錄進行了統計
增加目錄
tfactl directory add dir [ -public ]
[ -exclusions | -noexclusions | -collectall ]
[ -node all | n1,n2,... ]
刪除目錄
tfactl directory remove dir [ -node all | n1,n2,... ]
僅收集數據庫相關日志
[root@12cr2 ~]# export LANG=en_US
[root@12cr2 ~]# echo $LANG
en_US
[root@12cr2 ~]# tfactl diagcollect -database PROD1
Collecting data for the last 12 hours for this component ...
Collecting data for all nodes
Collection Id : 2017032117030312cr2
Detailed Logging at : /u01/app/oracle/tfa/repository/collection_Tue_Mar_21_17_03_03_CST_2017_node_all/diagcollect_20170321170303_12cr2.log
2017/03/21 17:03:07 CST : Collection Name : tfa_Tue_Mar_21_17_03_03_CST_2017.zip
2017/03/21 17:03:07 CST : Collecting diagnostics from hosts : [12cr2]
2017/03/21 17:03:07 CST : Scanning of files for Collection in progress...
2017/03/21 17:03:07 CST : Collecting additional diagnostic information...
2017/03/21 17:03:12 CST : Getting list of files satisfying time range [03/21/2017 05:03:07 CST, 03/21/2017 17:03:12 CST]
2017/03/21 17:03:13 CST : Collecting ADR incident files...
2017/03/21 17:03:29 CST : Completed collection of additional diagnostic information...
2017/03/21 17:03:33 CST : Completed Local Collection
.---------------------------------.
| Collection Summary |
+-------+-----------+------+------+
| Host | Status | Size | Time |
+-------+-----------+------+------+
| 12cr2 | Completed | 63kB | 26s |
'-------+-----------+------+------'
Logs are being collected to: /u01/app/oracle/tfa/repository/collection_Tue_Mar_21_17_03_03_CST_2017_node_all
/u01/app/oracle/tfa/repository/collection_Tue_Mar_21_17_03_03_CST_2017_node_all/12cr2.tfa_Tue_Mar_21_17_03_03_CST_2017.zip
# $TFA_HOME/bin/tfactl diagcollect -all -from "Jan/21/2013 00:00:00" -to "Jan/21/2013 13:00:00"
此命令將收集指定時間段rdbms、ASM、grid、OS的各類型日志,如alert日志、trace文件、clusterware各組件的日志、listener日志、操作系統日志。執行過程中,對alert日志、listener日志等連續性的日志處理也比較智能,能夠截取指定時段的日志,而不會將整個日志文件copy。如果部署有osw工具,還會自動收集osw的日志。
模板:tfactl diagcollect -all -from "Mon/dd/yyyy hh:mi:ss" -to "Mon/dd/yyyy hh:mi:ss"
tfactl set autodiagcollect=ON TFA開啟自動收集
tfactl analyze -since 7d
這條命令將分析查找所有(包括DB/ASM/CRS/ACFS/OS/OSW/OSWSLABINFO)日志7天內ERROR級別的錯誤信息並提取。
root用戶使用以下命令可以將oracle用戶加入授權用戶列表:
tfactl access add -user oracle