« What Kind Of DBA we need-我们需要什么样的DBA? | Blog首页 | Install MT WYSIWYG plugin FCKeditor »
Oracle HowTo:如何使用split命令分割alert文件
作者:eygle | 【转载请注出处】|【云和恩墨 领先的zData数据库一体机 | zCloud PaaS云管平台 | SQM SQL审核平台 | ZDBM 数据库备份一体机】
链接:https://www.eygle.com/archives/2005/12/oracle_howto_split_alert_file.html
很多时候,由于种种原因,数据库的警告日志(alert_<sid>.log)文件会变得很大,不方便查看。链接:https://www.eygle.com/archives/2005/12/oracle_howto_split_alert_file.html
在Unix/Linux上我们可以通过split命令,把alert文件分割为较小的文件,便于查看。
$ which split /bin/split $ split -b 10m -a 3 alert_mmsdb.log alert $ ls -l al* -rw-r--r-- 1 oracle dba 187266549 Dec 2 10:43 alert_mmsdb.log -rw-r--r-- 1 oracle dba 10485760 Dec 2 10:45 alertaaa -rw-r--r-- 1 oracle dba 10485760 Dec 2 10:45 alertaab -rw-r--r-- 1 oracle dba 10485760 Dec 2 10:45 alertaac -rw-r--r-- 1 oracle dba 10485760 Dec 2 10:45 alertaad -rw-r--r-- 1 oracle dba 10485760 Dec 2 10:45 alertaae -rw-r--r-- 1 oracle dba 10485760 Dec 2 10:45 alertaaf -rw-r--r-- 1 oracle dba 10485760 Dec 2 10:45 alertaag -rw-r--r-- 1 oracle dba 10485760 Dec 2 10:45 alertaah -rw-r--r-- 1 oracle dba 10485760 Dec 2 10:45 alertaai -rw-r--r-- 1 oracle dba 10485760 Dec 2 10:45 alertaaj -rw-r--r-- 1 oracle dba 10485760 Dec 2 10:45 alertaak -rw-r--r-- 1 oracle dba 10485760 Dec 2 10:45 alertaal -rw-r--r-- 1 oracle dba 10485760 Dec 2 10:45 alertaam -rw-r--r-- 1 oracle dba 10485760 Dec 2 10:45 alertaan -rw-r--r-- 1 oracle dba 10485760 Dec 2 10:45 alertaao -rw-r--r-- 1 oracle dba 10485760 Dec 2 10:45 alertaap -rw-r--r-- 1 oracle dba 10485760 Dec 2 10:45 alertaaq -rw-r--r-- 1 oracle dba 9008629 Dec 2 10:45 alertaar |
以上用到的参数,-b指定分割的每个piece的大小,-a指定后缀的位数,最后的alert为指定的文件名前缀。
本例是Solaris上的操作示范,Linux上稍有不同。
历史上的今天...
>> 2016-12-02文章:
>> 2011-12-02文章:
>> 2007-12-02文章:
>> 2006-12-02文章:
By eygle on 2005-12-02 11:02 | Comments (1) | HowTo | 556 |
I will run the scripts below once about half month
LG=alert_mmsdb.log && cat $LG | gzip -9c > bak/$LG.bak.`date +%Y%m%d`.gz && cat /dev/null > $LG
简单的LG=alert_mmsdb.log 换成其他LOG file名字,如listener.log就可以用来backup listener log^