TimesTen的日志文件ttmesg.log

今天帮用户处理问题,突然发现日志文件中只记录了时间,却没有日期,于是决定研究一下ttmesg.log这个日志文件。

日志文件ttmesg.log简介

ttmesg.log位于$TT_HOME/info下, 记录警告和错误信息,对于支持和错误调试非常有用, 我们通常称之为support log。另一个文件tterrors.log我们成为user log。user log是support log的子集。
ttmesg.log的配置文件为 ttendaemon.options, 可以配置日志文件数,是否记录额外信息,日志文件的大小等。

修改日志文件配置:ttendaemon.options

先来看一下ttendaemon.options这个文件, 大部分时候,我们使用缺省设置即可。

[oracle@tt12c info]$ cat ttendaemon.options 
# Commented values are default values
#-supportlog /home/oracle/TimesTen/tt1122/info/ttmesg.log
#-maxsupportlogfiles 10
#-maxsupportlogsize 10485760
#-userlog /home/oracle/TimesTen/tt1122/info/tterrors.log
#-maxuserlogfiles 10
#-maxuserlogsize 0x100000
#
-verbose
-tns_admin /u01/app/oracle/product/12.1.0/dbhome_1/network/admin
-server 53397

影响到日志文件的选项有:
-supportlog path 指定日志文件路径,缺省为ttmesg.log
-maxsupportlogfiles 最多支持的日志文件数,当前日志文件满时,会循环写下一个日志文件,缺省为10个(ttmesg.log.0-ttmesg.log.9)
-maxsupportlogsize nBytes 日志文件最大字节数,缺省为100MB
-userlog logfile 缺省为tterrors.log,也可以指定输出到syslog
-maxuserlogfiles num 最大user log的数量
-maxuserlogsize nBytes 最大user log字节数,缺省为10MB
-showdate 是否在日志文件中显示日期,缺省不显示
-verbose 记录额外的信息,通常是connect和disconnect信息,增加的开销不大。

日志文件显示时间示例

  1. 确认当前日志格式,没有日期
16:14:51.78 Info:    : 10162: Process running as user oracle
16:14:51.78 Info:    : 10162: listening on port 53396
  1. 在ttendaemon.options中添加-showdate
  2. ttdaemonadmin -restart重启TimesTen Daemon
  3. 确认日志已有日期
2016-05-04 20:09:47.13 Info:    :  3393: maind: done with request #11.11
2016-05-04 20:09:57.03 Info:    :  3393: << Date : Wed May  4 20:09:57 2016, daemon port 53396 >>

估算日志文件的增长速度

MOS(文档 ID 1274240.1)提供了一个脚本log.sh,如下:

#!/bin/sh 
log_dir=$1;
log_list='';

log_list=`ls $log_dir`;

for log in $log_list 
do
 echo $log;
 head -1 $log | awk '{print $1,$2, $3}';
 tail -1 $log | awk '{print $1,$2, $3}';
 echo;
done;

运行此脚本, 提取日志文件的首行和末行,即可知道多长时间日志文件进行切换,据此可以再对ttendaemon.options进行调整

/tmp/log.sh '/home/timesten/TimesTen/tt112166_64/info/ttme*'

ttDaemonLog

ttDaemonLog可以控制日志文件记录哪些信息,以及显示哪些信息。
* Control the types of events and categories of messages that are reported in the user error log.
* Display all messages or selected categories of messages from the log to the standard output.

例如:

ttDaemonLog -nologcomponent replication
ttDaemonLog -loglevel 4
ttDaemonLog -show all <-输出和cat tterrors.log一样
[oracle@tt12c info]$ ttdaemonlog -show server
Displaying log entries from file '/home/oracle/TimesTen/tt1122/info/tterrors.log'
[oracle@tt12c info]$ grep Display tterrors.log 
[oracle@tt12c info]$ ttdaemonlog -show cache
Displaying log entries from file '/home/oracle/TimesTen/tt1122/info/tterrors.log'
16:34:03.81 Err : CAC:  8099: TT40011-8099--1081366784-xxagent02918: CACHEDB1_1122 Cache agent exiting, main daemon gone
16:34:08.79 Warn: CAC:  8099: TT44000-8099--1077618944-xxagent06349: CACHEDB1_1122 Warning: Statement SQLDisconnect(agentHdbc)
16:34:08.79 Err : CAC:  8099: TT40046-8099--1077618944-bcStuff01106: CACHEDB1_1122 Error: [TimesTen]TT0994: Data store connection terminated. Please reconnect. -- file "dbAPI.c", lineno 3171, procedure "sb_dbDisconnect()", ODBC SQL state = S1000, Additional Warning = 994
16:34:08.79 Err : CAC:  8099: TT40050-8099--1077618944-bcStuff01131: CACHEDB1_1122 Detected invalid data store.
16:34:08.79 Err : CAC:  8099: TT40046-8099--1077618944-bcStuff01106: CACHEDB1_1122 Error: [TimesTen]TT0798: Daemon reports error -102 -- file "db.c", lineno 16862, procedure "sbDbAppExit", ODBC SQL state = 08001, Additional Warning = 798
16:34:08.81 Warn: CAC:  8099: TT44000-8099--1077618944-xxagent06355: CACHEDB1_1122 Warning: Statement SQLDisconnect(timerHdbc)
16:34:08.81 Err : CAC:  8099: TT40046-8099--1077618944-bcStuff01106: CACHEDB1_1122 Error: [TimesTen]TT0994: Data store connection terminated. Please reconnect. -- file "dbAPI.c", lineno 3171, procedure "sb_dbDisconnect()", ODBC SQL state = S1000, Additional Warning = 994
16:34:08.81 Err : CAC:  8099: TT40050-8099--1077618944-bcStuff01131: CACHEDB1_1122 Detected invalid data store.
16:34:08.81 Err : CAC:  8099: TT40046-8099--1077618944-bcStuff01106: CACHEDB1_1122 Error: [TimesTen]TT0798: Daemon reports error -102 -- file "db.c", lineno 16862, procedure "sbDbAppExit", ODBC SQL state = 08001, Additional Warning = 798

[oracle@tt12c info]$ grep CAC tterrors.log 
16:34:03.81 Err : CAC:  8099: TT40011-8099--1081366784-xxagent02918: CACHEDB1_1122 Cache agent exiting, main daemon gone
16:34:08.79 Warn: CAC:  8099: TT44000-8099--1077618944-xxagent06349: CACHEDB1_1122 Warning: Statement SQLDisconnect(agentHdbc)
16:34:08.79 Err : CAC:  8099: TT40046-8099--1077618944-bcStuff01106: CACHEDB1_1122 Error: [TimesTen]TT0994: Data store connection terminated. Please reconnect. -- file "dbAPI.c", lineno 3171, procedure "sb_dbDisconnect()", ODBC SQL state = S1000, Additional Warning = 994
16:34:08.79 Err : CAC:  8099: TT40050-8099--1077618944-bcStuff01131: CACHEDB1_1122 Detected invalid data store.
16:34:08.79 Err : CAC:  8099: TT40046-8099--1077618944-bcStuff01106: CACHEDB1_1122 Error: [TimesTen]TT0798: Daemon reports error -102 -- file "db.c", lineno 16862, procedure "sbDbAppExit", ODBC SQL state = 08001, Additional Warning = 798
16:34:08.81 Warn: CAC:  8099: TT44000-8099--1077618944-xxagent06355: CACHEDB1_1122 Warning: Statement SQLDisconnect(timerHdbc)
16:34:08.81 Err : CAC:  8099: TT40046-8099--1077618944-bcStuff01106: CACHEDB1_1122 Error: [TimesTen]TT0994: Data store connection terminated. Please reconnect. -- file "dbAPI.c", lineno 3171, procedure "sb_dbDisconnect()", ODBC SQL state = S1000, Additional Warning = 994
16:34:08.81 Err : CAC:  8099: TT40050-8099--1077618944-bcStuff01131: CACHEDB1_1122 Detected invalid data store.
16:34:08.81 Err : CAC:  8099: TT40046-8099--1077618944-bcStuff01106: CACHEDB1_1122 Error: [TimesTen]TT0798: Daemon reports error -102 -- file "db.c", lineno 16862, procedure "sbDbAppExit", ODBC SQL state = 08001, Additional Warning = 798

参考

  • Oracle® TimesTen In-Memory Database Operation Guide | Chapter 3: Working with the TimesTen Data Manager Daemon | Managing TimesTen daemon options | Modifying informational messages
  • Oracle® TimesTen In-Memory Database Reference
  • Managing TTMESG log files (文档 ID 2048766.1)
  • HOWTO : Verify And Enable TimesTen -showdate Configuration To Print Dates In The TimesTen ttmesg And tterrors Logs (文档 ID 755483.1)
  • HOWTO : Understand TimesTen Logging Overhead For The -verbose Configuration Option (文档 ID 455196.1)
  • HOWTO : Create A Shell Script And Configure TimesTen ttmesg and tterrors Logs To Archive For A Specific Period Of Time (文档 ID 1274240.1)

你可能感兴趣的:(日志文件,timesten,support)