oracle清理告警日志,Oracle 跟蹤/告警/監聽日志的清理腳本

[root ~]# cat?del_oracle_log.sh

#!/bin/bash

source /home/oracle/.bash_profile

function audit_log()

{?? #---audit_log日志跟蹤文件

#audit_log=$(strings $ORACLE_HOME/dbs/spfile$ORACLE_SID.ora|grep -i audit_file_dest|awk -F'=' '{print $NF}'|sed "s/'//g")

audit_log=`sqlplus? -s /nolog <

connect lottery/lottery

set feedback off

set head off

select value from v\\$parameter where name='audit_file_dest';

END`

cd $audit_log

pwd=`pwd`

if [ $audit_log == $pwd ]

then

ls | xargs -n 10 rm -rf

echo '-------------------清理完------'$audit_log'路徑'

fi

}

function log_xml()

{ ? #---Diag Alert -- log.xml文件的處理? 只保留一個log.xml即可

log_xml=$(dirname `lsnrctl show log_file|grep -i log_file|awk '{print $NF}'`)

cd $log_xml

pwd=`pwd`

if [ $log_xml == $pwd ]

then

echo `ls |grep? -v log.xml` | xargs -n 10 rm -rf

echo '-------------------清理完------'$log_xml'路徑'

fi

}

function listener()

{?? #---listener.log文件的處理

listener_log=$(lsnrctl show trc_directory|grep -i trc_directory|awk '{print $NF}')

cd $listener_log

pwd=`pwd`

if [ $listener_log == $pwd ]

then

echo '' > listener.log

echo '-------------------清理完------'$listener_log'/listener.log'

fi

}

function alert_log()

{ ? #----alert.log以外的文件清理

alert_log=`sqlplus? -s /nolog <

connect lottery/lottery

set feedback off

set head off

select value from v\\$diag_info where upper(name)=upper('Diag trace');

END`

cd $alert_log

pwd=`pwd`

if [ $alert_log? == $pwd ]

then

echo `ls |grep? -v alert `| xargs -n 10 rm -rf

echo '-------------------清理完------'$alert_log'路徑'

fi

}

function main()

{

if [ `ps -ef|grep oracle|grep -i smon|grep -v grep|wc -l` -eq 1 ]

then

echo '----------------'`date`'------------------開始清理---------------------------'

#/*每天清理audit_log(跟蹤)、log_xml*/

audit_log

log_xml

#/*每月1號清理alert_log{異常分析}、listener(監聽log)*/

date_=`date +%d`

if? [ $date_? -eq 1 ]

then

alert_log

listener

fi

echo '----------------'`date`'------------------結束清理---------------------------'

fi

}

main

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/541365.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/541365.shtml
英文地址,請注明出處:http://en.pswp.cn/news/541365.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

python爬蟲之scrapy框架

Scrapy是一個為了爬取網站數據&#xff0c;提取結構性數據而編寫的應用框架。 其可以應用在數據挖掘&#xff0c;信息處理或存儲歷史數據等一系列的程序中。其最初是為了頁面抓取 (更確切來說, 網絡抓取 )所設計的&#xff0c; 也可以應用在獲取API所返回的數據(例如 Amazon As…

oracle中的事務回滾,ORACLE 死事務的回滾

死事務出現在異常關閉數據庫或者事務進程不正常結束&#xff0c;比如KILL -9&#xff0c;shutdown abort的情況下。當前數據庫里的死事務可以通過查詢內部表x$ktuxe來獲得。select ADDR,KTUXEUSN,KTUXESLT,KTUXESQN,KTUXESIZ from x$ktuxe where KTUXECFLDEAD;ADDR …

大數據數據可視化設計原則_數據可視化設計的8頂帽子

大數據數據可視化設計原則8 hats of data visualization are basically the important persons and their roles that are basically required to carry out data visualization are as follows: 數據可視化有8個基本要素&#xff0c;而進行數據可視化所需的基本角色如下&#…

debian8.8安裝谷歌瀏覽器

第一步&#xff1a;下載&#xff1a; wget https://dl.google.com/linux/direct/google-chrome-stable_current_i386.deb //32位 wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb //64位第二步&#xff1a;安裝dpkg -i google-chrome*.deb…

MB_LEN_MAX常數,帶C ++示例

C MB_LEN_MAX宏常量 (C MB_LEN_MAX macro constant) MB_LEN_MAX constant is a macro constant which is defied in climits header, it is used to get the maximum number of bytes in a multibyte character, for any locale, it returns maximum number of bytes that a m…

php谷歌收錄接口,php實現查詢百度google收錄情況(示例代碼)

PHP$SEOdetail array();$domain !empty($_GET[q]) ? $_GET[q] : www.mycodes.net;baidudetail($domain);googledetail($domain);var_dump($SEOdetail);function baidudetail($domain) {$baidu_site http://www.baidu.com/baidu?wordsite%3A . $domain;$baidu_link http:/…

Linux學習第三步(Centos7安裝mysql5.7數據庫)

版本&#xff1a;mysql-5.7.16-1.el7.x86_64.rpm-bundle.tar 前言&#xff1a;在linux下安裝mysql不如windows下面那么簡單&#xff0c;但是也不是很難。本文向大家講解了如何在Centos7下如何安裝mysql5.7版本,如果有什么問題和錯誤的地方&#xff0c;歡迎大家指出。 注釋&…

linux oracle刪除恢復數據恢復,Linux下Oracle誤刪除數據文件恢復操作

檢查數據文件的位置如下&#xff1a;SQL> select name from v$datafile;NAME--------------------------------------------------------------------------------/u01/app/Oracle/oradata/marven/system01.dbf/u01/app/oracle/oradata/marven/undotbs1.dbf/u01/app/oracle/…

數據庫如何處理數據庫太大_網絡數據庫中的數據處理

數據庫如何處理數據庫太大Before learning the data manipulation in a network model, we are discussing data manipulation language, so what is the data manipulation language? 在學習網絡模型中的數據操作之前&#xff0c;我們正在討論數據操作語言&#xff0c;那么什…

oracle12537錯誤,ORA-12537:TNS:connection closed錯誤處理方法

1.ORA-12537:TNS:connection closed錯誤處理過程檢查監聽正常&#xff0c;Oracle服務也是正常啟動的&#xff0c;但是登錄不進去。2.解決方案1. cd $ORACLE_HOME/bin/ 進入bin目錄2. ll oracle-rwxrwxrwx. 1 ora12 dba 323762222 6?. 14 19:12 oracle3.chmod 6571 oracle 更改…

操作系統中的死鎖_操作系統中的死鎖介紹

操作系統中的死鎖1.1究竟什么是僵局&#xff1f; (1.1 What exactly is a deadlock?) In a multiprogramming environment, there may be several processes with a finite number of resources. A process may request another resource while still holding some of the oth…

《云數據管理:挑戰與機遇》2.3 數據庫系統

本節書摘來自華章出版社《云數據管理》一書中的第2章&#xff0c;第3節&#xff0c;作者迪衛艾肯特阿格拉沃爾&#xff0c;更多章節內容可以訪問云棲社區“華章計算機”公眾號查看本節中&#xff0c;我們將為數據庫系統中的一些主要概念提供一個相當抽象、簡潔和高層次的描述。…

sql server與oracle的分頁,詳解SQLServer和Oracle的分頁查詢

不管是DRP中的分頁查詢代碼的實現還是面試題中看到的關于分頁查詢的考察&#xff0c;都給我一個提示&#xff1a;分頁查詢是重要的。當數據量大的時候是必須考慮的。之前一直沒有花時間停下來好好總結這里。現在又將Oracle視頻中關于分頁查詢的內容看了一遍&#xff0c;發現很容…

java treemap_Java TreeMap lastEntry()方法與示例

java treemapTreeMap類的lastEntry()方法 (TreeMap Class lastEntry() method) lastEntry() method is available in java.util package. lastEntry()方法在java.util包中可用。 lastEntry() method is used to return the entry (key-value pairs) that exists with the large…

LeetCode OJ 之 Valid Anagram

題目&#xff1a; Given two strings s and t, write a function to determine if t is an anagram of s. For example,s "anagram", t "nagaram", return true.s "rat", t "car", return false. Note: You may assume the string…

oracle光標位置無效,解決在Form表單中光標移動不了問題

apply p8727236_10123 for Developer Suite 10.1.2.3 in Linux首先到oracle的技術支持下載所需補丁,然后1先打補丁7121788&#xff0c;把p7121788_10123_LINUX.zip解壓到/home/oracledev目錄下(ORACLE_HOME為/u01/app/oracledev/OraHome_dev)$cd /home/oracledev/7121788$expo…

java treemap_Java TreeMap HigherKey()方法與示例

java treemapTreeMap類HigherKey()方法 (TreeMap Class higherKey() method) higherKey() method is available in java.util package. HigherKey()方法在java.util包中可用。 higherKey() method is used to return the lowest key value element higher than the given key e…

centos配置ipv6地址

首先打開網站注冊一個賬號&#xff1a;http://www.tunnelbroker.net創建一個ipv6的地址&#xff1a;把下面的命令在linux上執行一遍&#xff0c;這個方式是臨時生效&#xff0c;重啟網卡和重啟系統自動失效。把上面的命令保存到一個配置文件中&#xff1a;vi /etc/sysconfig/ne…

php oracle 需要libmysql.dll么_,Windows7環境下Apache+PHP+MySQL完美配置

寫作此篇文章的目的在于記錄Windows 7環境下成功配置WAMP環境, 初學者在不使用整合好的WAMPServer和XAMPP的情況下徒手配置整合環境貌似有很多意想不到的問題. 這將是我們需要討論的.我將重現幾個經典的問題, 并一一排除. 希望對各位看官有點借鑒作用.一. Apache在整合PHP后無法…