Get the App
SLTechnology News&Howtos  ›  Database  › 

How to get the alarm log within two days in oracle

Shulou Source: shulou.com Published: 2022-05-31 14:22:28 09月25日 Update

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.

Tags: File location pointer file name article log more good practical content article knowledge reference help related Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Shulou Technology Microsoft MariaDB macOS