May 04, 2014

How to compress Listener log file in Linux

How to compress files in Linux

How to compress Listener log file in Linux

Step:-1
-------
cd /u01/app/oracle/10.2.0/db_1/network/admin --- listener log location
du -sh *|sort -n
du -sh listener.log

Step:-2
-------
vi filecompress.sh
cd /u01/app/oracle/10.2.0/db_1/network/admin --- listener log location
cp listener.log listener_currentdate.log
cat /dev/null > listener.log

-- press esc key
:wq

Run the filecompress.sh in nohup
---------------------------------
nohup sh -x filecompress.sh > filecompress.log 2>> filecompress.err &

Step:-3
-------
gzip -9 listener_currentdate.log
du -sh *.gz
--- OR ---
tar -zcvf listener_currentdate.tar.gz listener_currentdate.log
du -sh *.tar.gz

Note:-
====
Listener will be available in the above process and no data loss of listener log file.

For Example, 3 GB file will be compressed to 100M (approx).