首页 > 其他分享 >TFA-收集日志及分析

TFA-收集日志及分析

时间:2024-07-30 16:17:01浏览次数:6  
标签:收集 04 19 TFA 2020 EDT 2023 oracle 日志

下载

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=272133523880062&id=1513912.1&_afrWindowMode=0&_adf.ctrl-state=fghvcgapa_617a 

安装

复制代码
[root@rhel75 ~]# ./ahf_setup 

AHF Installer for Platform Linux Architecture x86_64

AHF Installation Log : /tmp/ahf_install_59936_2020_06_04-02_25_33.log

Starting Autonomous Health Framework (AHF) Installation

AHF Version: 20.1.3 Build Date: 202004290950

Default AHF Location : /opt/oracle.ahf

Do you want to install AHF at [/opt/oracle.ahf] ? [Y]|N : Y

AHF Location : /opt/oracle.ahf

AHF Data Directory stores diagnostic collections and metadata.
AHF Data Directory requires at least 5GB (Recommended 10GB) of free space.

Please Enter AHF Data Directory : /opt

AHF Data Directory : /opt/oracle.ahf/data

Do you want to add AHF Notification Email IDs ? [Y]|N : N

Extracting AHF to /opt/oracle.ahf

Configuring TFA Services

Discovering Nodes and Oracle Resources
Successfully generated certificates. 
 
Starting TFA Services
Created symlink from /etc/systemd/system/multi-user.target.wants/oracle-tfa.service to /etc/systemd/system/oracle-tfa.service.
Created symlink from /etc/systemd/system/graphical.target.wants/oracle-tfa.service to /etc/systemd/system/oracle-tfa.service.

.----------------------------------------------------------------------------.
| Host   | Status of TFA | PID   | Port  | Version    | Build ID             |
+--------+---------------+-------+-------+------------+----------------------+
| rhel75 | RUNNING       | 60857 | 13274 | 20.1.3.0.0 | 20130020200429095054 |
'--------+---------------+-------+-------+------------+----------------------'

Running TFA Inventory...

Adding default users to TFA Access list...

.----------------------------------------------------.
|            Summary of AHF Configuration            |
+-----------------+----------------------------------+
| Parameter       | Value                            |
+-----------------+----------------------------------+
| AHF Location    | /opt/oracle.ahf                  |
| TFA Location    | /opt/oracle.ahf/tfa              |
| Orachk Location | /opt/oracle.ahf/orachk           |
| Data Directory  | /opt/oracle.ahf/data             |
| Repository      | /opt/oracle.ahf/data/repository  |
| Diag Directory  | /opt/oracle.ahf/data/rhel75/diag |
'-----------------+----------------------------------'


Starting orachk daemon from AHF ...

AHF binaries are available in /opt/oracle.ahf/bin

AHF is successfully installed

Moving /tmp/ahf_install_59936_2020_06_04-02_25_33.log to /opt/oracle.ahf/data/rhel75/diag/ahf/

[root@rhel75 ~]#  

---查看进程
[root@rhel75 ~]# ps -ef |grep -i ahf
root      60857      1 11 02:26 ?        00:00:26 /opt/oracle.ahf/jre/bin/java -server -Xms32m -Xmx64m -Djava.awt.headless=true -Ddisable.checkForUpdate=true -XX:HeapDumpPath=/opt/oracle.ahf/data/rhel75/diag/tfa oracle.rat.tfa.TFAMain /opt/oracle.ahf/tfa
root      63344  55078  0 02:30 pts/8    00:00:00 grep --color=auto -i ahf
[root@rhel75 ~]# 
复制代码

启停

复制代码
[root@vm01 soft]# tfactl
tfactl> start
Oracle Trace File Analyzer (TFA) is already running
[root@vm01 soft]# tfactl
tfactl> stop
Stopping TFA from the Command Line
Stopped OSWatcher
Nothing to do !
Please wait while TFA stops
Please wait while TFA stops
TFA-00002 Oracle Trace File Analyzer (TFA) is not running
TFA Stopped Successfully
Telemetry adapter is not running
Successfully stopped TFA..
复制代码

使用

仅收集数据库相关日志

复制代码
[root@vm01 soft]# tfactl
tfactl> diagcollect -database orc

TFA will collect diagnostics for the last 1 hour(s).
Please enter the time of the incident [YYYY-MM-DD HH24:MI:SS], or <RETURN> to collect for the last 1 hour(s). (Q|q to Quit):


Collecting data for the last 1 hours for this component ...

Collecting data for all nodes

TFA is using system timezone for collection, All times shown in EDT.

Collection Id : 20230419045638vm01

Detailed Logging at : /opt/oracle.ahf/data/repository/collection_Wed_Apr_19_04_56_42_EDT_2023_node_all/diagcollect_20230419045638_vm01.log

Waiting up to 120 seconds for collection to start
2023/04/19 04:56:48 EDT : NOTE : Any file or directory name containing the string .com will be renamed to replace .com with dotcom
2023/04/19 04:56:48 EDT : Collection Name : tfa_Wed_Apr_19_04_56_40_EDT_2023.zip
2023/04/19 04:56:48 EDT : Collecting diagnostics from hosts : [vm01]
2023/04/19 04:56:49 EDT : Getting list of files satisfying time range [04/19/2023 03:56:48 EDT, 04/19/2023 04:56:49 EDT]
2023/04/19 04:56:49 EDT : Collecting Additional Diagnostic Information...
2023/04/19 04:56:51 EDT : Collecting ADR incident files...
2023/04/19 04:56:58 EDT : Executing SQL Script db_feature_usage.sql on orc with timeout of 600 seconds...
2023/04/19 04:56:59 EDT : Completed Collection of Additional Diagnostic Information...
2023/04/19 04:57:01 EDT : Completed Local Collection
2023/04/19 04:57:01 EDT : Not Redacting this Collection ...
2023/04/19 04:57:01 EDT : Completed collection of zip files.

.---------------------------------.
|        Collection Summary       |
+------+-----------+-------+------+
| Host | Status    | Size  | Time |
+------+-----------+-------+------+
| vm01 | Completed | 143kB |  13s |
'------+-----------+-------+------'

Logs are being collected to: /opt/oracle.ahf/data/repository/collection_Wed_Apr_19_04_56_42_EDT_2023_node_all
/opt/oracle.ahf/data/repository/collection_Wed_Apr_19_04_56_42_EDT_2023_node_all/vm01.tfa_Wed_Apr_19_04_56_40_EDT_2023.zip
tfactl> 
复制代码

收集指定时间的所有trace日志

复制代码
tfactl> diagcollect -for Apr/19/2023

Collecting data for all nodes

TFA is using system timezone for collection, All times shown in EDT.
Scanning files for Apr/19/2023

Collection Id : 20230419050047vm01

Detailed Logging at : /opt/oracle.ahf/data/repository/collection_Wed_Apr_19_05_00_51_EDT_2023_node_all/diagcollect_20230419050047_vm01.log

Waiting up to 120 seconds for collection to start
2023/04/19 05:00:58 EDT : NOTE : Any file or directory name containing the string .com will be renamed to replace .com with dotcom
2023/04/19 05:00:58 EDT : Collection Name : tfa_Wed_Apr_19_05_00_50_EDT_2023.zip
2023/04/19 05:00:58 EDT : Collecting diagnostics from hosts : [vm01]
2023/04/19 05:00:59 EDT : Scanning of files for Collection in progress...
2023/04/19 05:00:59 EDT : Collecting Additional Diagnostic Information...
2023/04/19 05:01:12 EDT : Executing Collection for ASM with timeout of 1800 seconds...
2023/04/19 05:01:12 EDT : Executing Collection for AFD with timeout of 1860 seconds...
2023/04/19 05:01:12 EDT : Executing Collection for CRS with timeout of 1920 seconds...
2023/04/19 05:01:13 EDT : Executing Collection for ACFS with timeout of 1980 seconds...
2023/04/19 05:01:13 EDT : Executing Collection for OS with timeout of 2040 seconds...
2023/04/19 05:01:14 EDT : Getting list of files satisfying time range [04/19/2023 00:00:00 EDT, 04/19/2023 05:00:59 EDT]
2023/04/19 05:01:16 EDT : Collecting ADR incident files...
2023/04/19 05:01:16 EDT : Executing Collection for SOSREPORT with timeout of 2100 seconds...
2023/04/19 05:02:45 EDT : Executing Collection for QOS with timeout of 2160 seconds...
2023/04/19 05:02:46 EDT : Executing Collection for DATAGUARD with timeout of 2220 seconds...
2023/04/19 05:02:46 EDT : Executing Collection for SYSLENS with timeout of 2280 seconds...
2023/04/19 05:02:49 EDT : Completed Collection of Additional Diagnostic Information...
2023/04/19 05:02:51 EDT : Completed Local Collection
2023/04/19 05:02:51 EDT : Not Redacting this Collection ...
2023/04/19 05:02:51 EDT : Completed collection of zip files.

.--------------------------------.
|       Collection Summary       |
+------+-----------+------+------+
| Host | Status    | Size | Time |
+------+-----------+------+------+
| vm01 | Completed | 11MB | 113s |
'------+-----------+------+------'

Logs are being collected to: /opt/oracle.ahf/data/repository/collection_Wed_Apr_19_05_00_51_EDT_2023_node_all
/opt/oracle.ahf/data/repository/collection_Wed_Apr_19_05_00_51_EDT_2023_node_all/vm01.tfa_Wed_Apr_19_05_00_50_EDT_2023.zip
复制代码

也可以单独指定数据库和集群 也是比较常用的

复制代码
[root@rac19cn1 diag]# ls
asm  clients  crs  rdbms  tnslsnr
//监听日志 集群日志默认也会收集


***********只收集 2020.11.2的database trace日志***********:
tfactl> diagcollect -database ora19c -for Nov/2/2020

***********只收集 2020.11.2的集群日志***********:
tfactl> diagcollect -crs -for Nov/2/2020
复制代码

收集指定时间范围的数据库日志:

复制代码
tfactl> diagcollect -database ora19c -from “2020-11-02 18:00:00” -to “2020-11-03 08:00:00”

Collecting data for all nodes
Scanning files from nov/02/2020 18:00:00 to nov/03/2020 08:00:00
Collection Id : 20201106090421rac19cn1
Detailed Logging at : /oracle/gridbase/tfa/repository/collection_Fri_Nov_06_09_04_21_CST_2020_node_all/diagcollect_20201106090421_rac19cn1.log
2020/11/06 09:04:31 CST : NOTE : Any file or directory name containing the string .com will be renamed to replace .com with dotcom
2020/11/06 09:04:31 CST : Collection Name : tfa_Fri_Nov_06_09_04_21_CST_2020.zip
2020/11/06 09:04:32 CST : Collecting diagnostics from hosts : [rac19cn1, rac19cn2]
2020/11/06 09:04:32 CST : Scanning of files for Collection in progress...
2020/11/06 09:04:32 CST : Collecting additional diagnostic information...
2020/11/06 09:04:57 CST : Getting list of files satisfying time range [11/02/2020 18:00:00 CST, 11/03/2020 08:00:00 CST]
2020/11/06 09:05:47 CST : Completed collection of additional diagnostic information...
2020/11/06 09:12:57 CST : Collecting ADR incident files...
2020/11/06 09:12:57 CST : Completed Local Collection
2020/11/06 09:12:58 CST : Remote Collection in Progress...
.-------------------------------------.
|          Collection Summary         |
+----------+-----------+-------+------+
| Host     | Status    | Size  | Time |
+----------+-----------+-------+------+
| rac19cn2 | Completed | 10kB  |  83s |
| rac19cn1 | Completed | 185kB | 505s |
'----------+-----------+-------+------'

Logs are being collected to: /oracle/gridbase/tfa/repository/collection_Fri_Nov_06_09_04_21_CST_2020_node_all
/oracle/gridbase/tfa/repository/collection_Fri_Nov_06_09_04_21_CST_2020_node_all/rac19cn1.tfa_Fri_Nov_06_09_04_21_CST_2020.zip
/oracle/gridbase/tfa/repository/collection_Fri_Nov_06_09_04_21_CST_2020_node_all/rac19cn2.tfa_Fri_Nov_06_09_04_21_CST_2020.zip

***********收集一小时内数据库日志***********:
tfactl> diagcollect –database ora19c –since 1h
复制代码

收集指定节点数据库日志:

diagcollect -database ora19c -node rac19cn1 -for Nov/2/2020

日志分析

Oracle提供了analyze命令来帮助我们分析数据库当前的trace文件

复制代码
常用:
tfactl> analyze -search "ORA-" -since 1d                                                                                         INFO: analyzing all (Alert and Unix System Logs) logs for the last 1440 minutes...  Please wait...
INFO: analyzing host: rac19cn1
                    Report title: Analysis of Alert,System Logs
               Report date range: last ~1 day(s)
      Report (default) time zone: CST - China Standard Time
             Analysis started at: 06-Nov-2020 09:28:08 AM CST
           Elapsed analysis time: 15 second(s).
              Configuration file: /oracle/grid/crs_1/tfa/rac19cn1/tfa_home/ext/tnt/conf/tnt.prop
             Configuration group: all
                       Parameter: ORA-
             Total message count:         24,938, from 25-Aug-2020 06:22:19 PM CST to 06-Nov-2020 09:20:01 AM CST
Messages matching last ~1 day(s):          2,180, from 05-Nov-2020 09:30:01 AM CST to 06-Nov-2020 09:20:01 AM CST
                  Matching regex: ORA-
                  Case sensitive: false
                     Match count: 0

INFO: analyzing all (Alert and Unix System Logs) logs for the last 1440 minutes...  Please wait...
INFO: analyzing host: rac19cn2

                    Report title: Analysis of Alert,System Logs
               Report date range: last ~1 day(s)
      Report (default) time zone: CST - China Standard Time
             Analysis started at: 06-Nov-2020 09:28:26 AM CST
           Elapsed analysis time: 8 second(s).
              Configuration file: /oracle/grid/crs_1/tfa/rac19cn2/tfa_home/ext/tnt/conf/tnt.prop
             Configuration group: all
                       Parameter: ORA-
             Total message count:         35,060, from 25-Aug-2020 06:30:24 PM CST to 06-Nov-2020 09:20:02 AM CST
Messages matching last ~1 day(s):          4,940, from 05-Nov-2020 09:30:01 AM CST to 06-Nov-2020 09:20:02 AM CST
                  Matching regex: ORA-
                  Case sensitive: false
                     Match count: 0
以上os、db、asm、crs等所有日志都分析.

仅分析最近两天数据库实例的日志
tfactl> analyze -comp db -since 2d
-comp参数可以指定级别为os、db、asm、acfs、crs、all,默认的话是all,表示所有的都收集。
复制代码

其他操作

复制代码
查看当前哪些用户可以使用tfactl
tfactl> access lsusers                                                                  
.---------------------------------.
|      TFA Users in rac19cn1      |
+-----------+-----------+---------+
| User Name | User Type | Status  |
+-----------+-----------+---------+
| grid      | USER      | Allowed |
'-----------+-----------+---------'
.---------------------------------.
|      TFA Users in rac19cn2      |
+-----------+-----------+---------+
| User Name | User Type | Status  |
+-----------+-----------+---------+
| grid      | USER      | Allowed |
'-----------+-----------+---------'

TFA工具默认仅对root用户和grid用户授予使用权限
[oracle@rac19cn1 bin]$ ./tfactl 
TFA-00519 Oracle Trace File Analyzer (TFA) is not installed.
//oracle用户使用出现未安装

授予oracle用户使用TFA的权限
[root@rac19cn1 bin]#tfactl access add -user oracle
Successfully added 'oracle' to TFA Access list.
.---------------------------------.
|      TFA Users in rac19cn1      |
+-----------+-----------+---------+
| User Name | User Type | Status  |
+-----------+-----------+---------+
| grid      | USER      | Allowed |
| oracle    | USER      | Allowed |
'-----------+-----------+---------'
.---------------------------------.
|      TFA Users in rac19cn2      |
+-----------+-----------+---------+
| User Name | User Type | Status  |
+-----------+-----------+---------+
| grid      | USER      | Allowed |
| oracle    | USER      | Allowed |
'-----------+-----------+---------'
  

查看当前主机状态
tfactl> print status                                                                                        
.-----------------------------------------------------------------------------------------------.
| Host     | Status of TFA | PID  | Port | Version    | Build ID             | Inventory Status |
+----------+---------------+------+------+------------+----------------------+------------------+
| rac19cn1 | RUNNING       | 9127 | 5000 | 18.3.3.0.0 | 18330020190315044534 | COMPLETE         |
| rac19cn2 | RUNNING       | 1848 | 5000 | 18.3.3.0.0 | 18330020190315044534 | COMPLETE         |
'----------+---------------+------+------+------------+----------------------+------------------'
复制代码

 新增一下 ahf 的官档

Autonomous Health Framework (AHF) - Including TFA and ORAchk/EXAchk (Doc ID 2550798.1)

本文来自博客园,作者:蚌壳里夜有多长,转载请注明原文链接:https://www.cnblogs.com/dbahrz/p/17333971.html

标签:收集,04,19,TFA,2020,EDT,2023,oracle,日志
From: https://www.cnblogs.com/seasonzone/p/18332719

相关文章

  • 设置mybatis 是否打印日志
    @Bean(name="dbzyqsV102SqlSessionFactory")//@Qualifier表示查找Spring容器中名字为blogDataSource的对象publicSqlSessionFactorydbzyqsV102SqlSessionFactory(@Qualifier("dbzyqsV102DataSource")DataSourcedatasource)throwsEx......
  • 一篇文章搞懂docker日志的查看(转)
    命令docker查看容器日志使用的命令是:dockerlogs下面是dockerlogs的命令格式$dockerlogs[OPTIONS]CONTAINEROptions:--details显示更多的信息-f,--follow跟踪实时日志--sincestring显示自某个timestamp之后的日志,或相对时间,......
  • go-zero 微服务框架如何将日志输出到文件
    在go-zero中,默认日志是输出到控制台的,项目运行起来后,往往都是输出到日志,今天看看go-zero框架的API功能的日志配置。目前网上关于go-zero的配置相对少,找了一圈,没找到更多的资料或者案例,而且官方给的doc又是一笔带过,不多说,下面看看吧。我们直接给出对应的配置:userapi.......
  • 在python日志输出的每一行前面添加变量缩进
    我正在将日志记录构建到一个Python应用程序中,我希望它是人类可读的。目前,调试日志记录了调用的每个函数以及参数和返回值。这意味着,实际上,嵌套函数调用的调试日志可能如下所示:2024-07-2916:52:26,641:DEBUG:MainController.initialize_componentscalledwithargs<control......
  • Java中的应用监控与日志分析:ELK Stack
    Java中的应用监控与日志分析:ELKStack大家好,我是微赚淘客系统3.0的小编,是个冬天不穿秋裤,天冷也要风度的程序猿!今天我们来讨论如何使用ELKStack(Elasticsearch,Logstash,Kibana)进行Java应用的监控与日志分析。ELKStack是目前非常流行的一种解决方案,能够帮助开发者轻松地收集、......
  • netcore日志与异常
    ILogger简单使用asp.netcore的webApplicationBuilder中自带了一个日志组件。无需手动注册服务就能直接在控制器中构造注入。publicHomeController(ILogger<HomeController>logger){_logger=logger;}_logger.LogTrace("trace{path}",HttpContext.Request.Path);_......
  • SQL Server慢查询日志
    如何让SQLServer像MySQL一样拥有慢查询日志(SlowQueryLog慢日志)如何让SQLServer像MySQL一样拥有慢查询日志(SlowQueryLog慢日志)SQLServer一直以来被人诟病的一个问题是缺少了像MySQL的慢日志功能,程序员和运维无法知道数据库过去历史的慢查询语句。因为SQLServer默认是不捕......
  • Java如何通过日志排查问题
    问题:大家有没有遇到过这样一种场景,在一个接口或者方法当中,业务逻辑很复杂,方法嵌套调用层级很深,此时要定位业务流程的走向,是不是要在每个方法中打日志,而这些日志是不串联的,比如,一个接口调用下来,程序没有报错,但没有按预期执行,怎么排查,就得翻这个方法调用时的每一条记录日志,而代......
  • 设计模式实战:日志系统的设计与实现
    问题描述设计一个日志系统,支持在应用程序中记录日志信息。系统需要确保日志记录器是唯一的实例,支持不同的日志记录方法(如文件、数据库),并且能够适配不同的日志格式(如JSON、XML)。设计分析单例模式单例模式确保一个类只有一个实例,并提供一个全局访问点。日志系统中的日志记......
  • SQL Server数据库的黑匣子:实现自定义日志记录
    SQLServer数据库的黑匣子:实现自定义日志记录在数据库管理中,日志记录是监控和审计数据库活动的重要手段。SQLServer提供了多种日志记录机制,但有时这些默认的日志记录可能无法满足特定的业务需求。在这种情况下,实现数据库的自定义日志记录就显得尤为重要。本文将详细介绍如......