eygle.com   eygle.com
eygle.com eygle
eygle.com  
 

« What Kind Of DBA we need-我们需要什么样的DBA? | Blog首页 | Install MT WYSIWYG plugin FCKeditor »

Oracle HowTo:如何使用split命令分割alert文件
modb.pro

很多时候,由于种种原因,数据库的警告日志(alert_<sid>.log)文件会变得很大,不方便查看。
在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 |

1 Comment

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^


CopyRight © 2004~2020 云和恩墨,成就未来!, All rights reserved.
数据恢复·紧急救援·性能优化 云和恩墨 24x7 热线电话:400-600-8755 业务咨询:010-59007017-7040 or 7037 业务合作: marketing@enmotech.com