Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to get the alarm log within two days in oracle

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article will explain in detail how to obtain the alarm log within two days in oracle. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

#! / bin/bash

# author: Rui Zhang

# date: 2017-08-09

# email: sharpzhang_2008@126.com

Export LANG=en_US.UTF-8

Dir_name=/tmp/tday_log/

Log_name=/tmp/tday_log/tday_log_ `date +'% F'`

Log_name=/tmp/tday_log/10.4.57.129_tday_ `date +'% F'`. Log

Yday= `date-d-1day +'a b d '`

Tday= `date +'a b d '`

Yday_num= `date-d-1day +'% F'`

Tday_num= `date +'% F'`

Yday_md= `date-d-1day +'b% e'`

Tday_md= `date +'b% e'`

Yday_lis= `date-d-1day +'% d-%b-%Y'| tr [Amurz] [Amurz] `

Tday_lis= `date +'% d-%b-%Y'| tr [Amurz] [Amurz] `

If [!-d "$dir_name"]; then

Mkdir-p $dir_name

Fi

If [- f "$log_name"]; then

Rm-f $log_name

Fi

Echo "# # / var/log/messages##" > > $log_name

Echo "" > > $log_name

Echo "" > > $log_name

Egrep "${yday_md} | ${tday_md}" / var/log/messages > > $log_name

# egrep "Jul\ 3 | Jul\ 2" / var/log/messages > > $log_name

Echo "" > > $log_name

Function chk_db_log () {

File_name=$1

Count_1=0

While read line

Do

Count_1=$ [$count_1+1]

If [[$line = ~ $yday]]; then

Break

Elif [[$line = ~ $tday]]; then

Break

Fi

Done = count_1); then

Echo "$line" > > $log_name

Fi

Done > $log_name

}

Function chk_grid_log () {

File_name=$1

Count_1=0

While read line

Do

Count_1=$ [$count_1+1]

If [[$line = ~ $yday_num]]; then

Break

Elif [[$line = ~ $tday_num]]; then

Break

Fi

# echo $line

# echo $count_1

# done > $log_name

Fi

# done $log_name

}

Function chk_listener_log () {

File_name=$1

Count_1=0

While read line

Do

Count_1=$ [$count_1+1]

If [[$line = ~ $yday_lis]]; then

Break

Elif [[$line = ~ $tday_lis]]; then

Break

Fi

# echo $line

# echo $count_1

# done > $log_name

Fi

# done $log_name

}

# echo $count_1

Echo "# # db_log##" > > $log_name

Echo "" > > $log_name

Echo "" > > $log_name

Chk_db_log / u01/app/oracle/diag/rdbms/test/test1/trace/alert_test1.log

Echo "# # asm_log##" > > $log_name

Echo "" > > $log_name

Echo "" > > $log_name

Chk_db_log / u01/app/oracle/diag/asm/+asm/+ASM1/trace/alert_+ASM1.log

Echo "# # grid_log##" > > $log_name

Echo "" > > $log_name

Echo "" > > $log_name

Chk_grid_log / u01/app/11.2.0/grid/log/zhangr/alertzhangr.log

Echo "# listener_log##" > $log_name

Echo "" > > $log_name

Echo "" > > $log_name

# 11g##

# chk_grid_log / u01/app/oracle/diag/tnslsnr/zhangr/listener/alert/log.xml

# 11g##

# 10g##

Chk_listener_log / u01/app/oracle/diag/tnslsnr/zhangr/listener/trace/listener.log

# 10g##

This is the end of the article on "how to get the alarm log within two days in oracle". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report