Oracle Trace File Analyzer 详解

Oracle Trace File Analyzer 详解

适用版本:Oracle Database 12c / 19c / 23ai 文档版本:v1.0 / 2026-07


1. 概述

Trace File Analyzer (TFA) 是 Oracle 诊断工具[1]:

详细见:Oracle 日志与诊断文件Oracle 数据库故障诊断


2. 特性

2.1 集中收集

- 收集诊断数据
- trace 文件
- alert 日志
- AWR/ASH

2.2 快速分析

- 自动分析
- 问题定位
- 告警

2.3 集群支持

- RAC 全节点
- 统一收集
- 时间同步

3. 安装

3.1 自动

- 11.2.0.4+ 默认
- GI 安装时
- 或单独

3.2 手动

# 下载
# 从 Oracle Support
# installTFA.jar

java -jar installTFA.jar -c

4. 命令

4.1 tfactl

tfactl
tfactl help
tfactl status

4.2 收集

# 收集诊断
tfactl diagcollect

# 指定时间
tfactl diagcollect -from "2026-07-21 10:00:00" -to "2026-07-21 11:00:00"

# 指定节点
tfactl diagcollect -nodes node1,node2

4.3 查看

tfactl set
tfactl print
tfactl query

5. 诊断

5.1 ORA 错误

# 收集 ORA-600 相关
tfactl diagcollect -oreason "ORA-600"

# 收集特定错误
tfactl diagcollect -oreason "ORA-01555"

5.2 性能

# 性能问题
tfactl diagcollect -oreason "performance"

5.3 自动

- TFA 监控 alert log
- 自动收集
- 触发

6. 分析工具

6.1 内置

- ORA-600/ORA-7445 分析
- Alert log 分析
- 性能分析

6.2 命令

tfactl analyze
tfactl anlz

7. 配置

7.1 自动收集

tfactl set autodiagcollect=ON

7.2 告警

tfactl set alertLogPurge=ON
tfactl set tracePurge=ON

7.3 通知

tfactl set notification=ON
tfactl set [email protected]

8. 输出

8.1 压缩包

- /u01/app/oracle/tfa/repository/
- .zip 格式
- 命名包含时间

8.2 内容

- alert log
- trace 文件
- AWR/ASH 报告
- OS 信息
- 集群信息

9. 应用场景

9.1 故障诊断

- ORA-600
- ORA-7445
- 性能问题

9.2 SR 提交

- 收集诊断
- 提交 Oracle Support
- 快速响应

9.3 性能分析

- AWR/ASH
- 自动收集
- 分析

9.4 升级

- 升级前后
- 收集对比
- 评估

10. 与传统对比

10.1 传统

- 手动收集
- 多文件
- 耗时

10.2 TFA

- 自动
- 一键
- 集群

11. 监控

11.1 状态

tfactl status
tfactl print status

11.2 仓库

tfactl print repository
df -h /u01/app/oracle/tfa/repository

11.3 清理

tfactl purge -older 30d

12. 常见问题

12.1 TFA 未启动

tfactl start
tfactl status

12.2 空间

- 仓库满
- 清理
- 增大

12.3 收集失败

- 权限
- 网络
- 检查

13. 最佳实践

  1. 安装:默认
  2. 自动收集:启用
  3. 告警:配置
  4. 监控:仓库
  5. 清理:定期
  6. SR:使用
  7. 集群:全节点
  8. 测试:收集
  9. 文档:配置
  10. 演练:定期

14. 参考资料

[1] Oracle Trace File Analyzer 19c https://docs.oracle.com/en/database/oracle/oracle-database/19/tgdba/