DBAsupport.com Forums - Powered by vBulletin
Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: shell script to maintain the log files

  1. #1
    Join Date
    Oct 2000
    Location
    Charlotte, USA
    Posts
    330

    Red face

    hi all
    can anyboby help me to make shell scripts to do
    1.Maintanence of alert log files-to have only last two months of log files
    2.maintanence of listner.log and sqlnet.log files to have only two weeks of logs.
    meaning Scripts to delete log files everymonth/2weeks.
    I badly need those immediatly to implement in our office.(Right now we are manually doing)
    Please help me.
    Thanks in Advance.
    Thanigaivasan

  2. #2
    Join Date
    Oct 2000
    Location
    Saskatoon, SK, Canada
    Posts
    3,925
    Check the oracle magazine's tips archive and they have a few which ou have to customize for your need.

    Sam
    Thanx
    Sam



    Life is a journey, not a destination!


  3. #3
    Join Date
    Oct 2000
    Location
    Charlotte, USA
    Posts
    330

    shell scripty to maintain the log files

    Thanks,
    sam,
    Let me try and get back.
    Thanks onceagain.
    Thanigaivasan

  4. #4
    Join Date
    Oct 2000
    Location
    Charlotte, USA
    Posts
    330

    shell script to

    hi sam,
    I have gone thru that page and there is no scripts for the alert log cleaning
    I need to create even to check the error in alertlog file too.I made the script to clean the the files and I am testing it.Once it is ok I can post that in scripts.Now I am in need for the error check script
    any help please.
    Thanks.
    Thanigaivasan.

  5. #5
    Join Date
    Oct 2000
    Posts
    211
    #!/bin/ksh
    . /oracle1/.profile

    ORACLE_HOME=/oracle1/product/8.1.6; export ORACLE_HOME
    ORACLE_SID=THANIGAI; export ORACLE_SID

    egrep "ORA-|Shut|shut" /backup/scripts/pagertest.txt>/dev/null 2>&1
    if test $? -eq 0
    then mailx -s "Check alert log THANIGAI for oracle errors.."
    123456@abcde.com < /backup/scripts/pagertext.log
    mailx -s "Check alert Log THANIGAI for Oracle Error.. "
    thanigai@xyz.com < /backup/scripts/pagertest.txt
    fi
    ~

    HTH
    manjunath

  6. #6
    Join Date
    Feb 2000
    Location
    New York,U.S.A.
    Posts
    245
    Try this:
    find /.../exp -name \*.log -mtime +60 -exec rm -f {} \;

    This short script will delete the files older than 60 days.

    Hope it helps

    dragon

  7. #7
    Join Date
    Oct 2000
    Location
    Charlotte, USA
    Posts
    330

    shell script to maintain

    Thanks Dragon and Manju
    I will try and it will work.
    Thanks.
    Thanigaivasan

  8. #8
    Join Date
    Nov 2000
    Posts
    245
    for alert file,

    find $ORACLE_BASE/admin/$ORACLE_SID/bdump -ctime +60 -name alert_$ORACLE_SID.log -exec rm {} \;

    listener file,

    find $ORACLE_HOME/network/log -name listener.log -ctime +14 -exec rm {} \;

    sqlnet file,

    find $ORACLE_HOME/network/log -name sqlnet.log -ctime +14 -exec rm {} \;

  9. #9
    Join Date
    Oct 2000
    Location
    Charlotte, USA
    Posts
    330

    shell sript

    Thanks.Jim
    it is working.
    Thanks again.
    thanigaivasan

  10. #10
    Join Date
    Sep 2000
    Posts
    362
    Hi,
    I notice that in the above replties jm has used the -ctime to check for older file name and dragon99 has used the -mtime parameter. whats the difference between the two. Please bear with my little knowledge of unix.

    Also is there any way we can do a similar thing on NT also. This script is basically for unix.



    Thanks
    Anurag

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width