FAQ
Does anyone have a script for Windows that will archive old network log and
trace files and also remove any that are more than a month old (or at least
be able to run under a monthly scheduled task)? I have done this in UNIX
but not on Windows.

Communicate instantly! Use your Hotmail address to sign into Windows Live
Messenger now. http://get.live.com/messenger/overview

Search Discussions

  • LS Cheng at Jan 7, 2007 at 11:50 pm
    hi

    You can run your unix scripts in cygwin or any other similar tools. I havent
    got idea in windows scripting neither and that is how I do it.

    Rgds
    On 1/7/07, J. Dex wrote:

    Does anyone have a script for Windows that will archive old network log
    and
    trace files and also remove any that are more than a month old (or at
    least
    be able to run under a monthly scheduled task)? I have done this in
    UNIX
    but not on Windows.

    _________________________________________________________________
    Communicate instantly! Use your Hotmail address to sign into Windows Live
    Messenger now. http://get.live.com/messenger/overview

    --
    http://www.freelists.org/webpage/oracle-l

    --
    http://www.freelists.org/webpage/oracle-l
  • Ajay at Jan 8, 2007 at 2:19 am
    There is an utility : at
    on windows similar to unix cron. You can use that. You can get detailed scripting language commands from net/books to create .bat scripts that can be run by at utility. You can do all using that including daily weekly backups. Maybe there are other better ways to do it as well. http://www.nirsoft.net/ also has atnow utility which can be used for one time run at a certain time. I do not know if UNIX has a similar command. Generally on UNIX it has to be scheduled as cron and removed from cron after first run.
    Thanks


    LS Cheng wrote:

    hi


    You can run your unix scripts in cygwin or any other similar tools. I havent got idea in windows scripting neither and that is how I do it.

    Rgds



    On 1/7/07, J. Dex wrote: Does anyone have a script for Windows that will archive old network log and
    trace files and also remove any that are more than a month old (or at least
    be able to run under a monthly scheduled task)? I have done this in UNIX
    but not on Windows.

    Communicate instantly! Use your Hotmail address to sign into Windows Live
    Messenger now. http://get.live.com/messenger/overview

    --
    http://www.freelists.org/webpage/oracle-l

    Do You Yahoo!?
    Tired of spam? Yahoo! Mail has the best spam protection around
    http://mail.yahoo.com
    --
    http://www.freelists.org/webpage/oracle-l
  • J. Dex at Jan 8, 2007 at 3:07 am
    Unfortunately, due to security reasons I am not allowed to download any
    additional tools onto this server so I am looking for a way to do this using
    code that can be used on a Microsoft Server.
    From: "LS Cheng"
    To: cemail_219_at_hotmail.com
    CC: oracle-l_at_freelists.org
    Subject: Re: Script to remove network log/trace files
    Date: Mon, 8 Jan 2007 00:50:35 +0100

    hi

    You can run your unix scripts in cygwin or any other similar tools. I
    havent
    got idea in windows scripting neither and that is how I do it.

    Rgds

    On 1/7/07, J. Dex wrote:

    Does anyone have a script for Windows that will archive old network log
    and
    trace files and also remove any that are more than a month old (or at
    least
    be able to run under a monthly scheduled task)? I have done this in
    UNIX
    but not on Windows.

    _________________________________________________________________
    Communicate instantly! Use your Hotmail address to sign into Windows Live
    Messenger now. http://get.live.com/messenger/overview

    --
    http://www.freelists.org/webpage/oracle-l

    Type your favorite song.  Get a customized station.  Try MSN Radio powered
    by Pandora. http://radio.msn.com/?icid=T002MSN03A07001
  • Alessandro Vercelli at Jan 8, 2007 at 10:15 am
    These are some useful links for Windows batch scripts and HowTo:

    http://www.commandline.co.uk/lib/treeview/index.php

    http://www.fpschultze.de/smartfaq+category.categoryid+12.htm

    http://www.ss64.com/nt/index.html

    Recently, needing some help on a similar issue and having very little know-how on MS platforms batch, I found good starting point; I hope it can help you and others.

    Alessandro
    Unfortunately, due to security reasons I am not allowed to download any
    additional tools onto this server so I am looking for a way to do this using
    code that can be used on a Microsoft Server.

    From: "LS Cheng"
    To: cemail_219_at_hotmail.com
    CC: oracle-l_at_freelists.org
    Subject: Re: Script to remove network log/trace files
    Date: Mon, 8 Jan 2007 00:50:35 +0100

    hi

    You can run your unix scripts in cygwin or any other similar tools. I
    havent
    got idea in windows scripting neither and that is how I do it.

    Rgds

    On 1/7/07, J. Dex wrote:

    Does anyone have a script for Windows that will archive old network log
    and
    trace files and also remove any that are more than a month old (or at
    least
    be able to run under a monthly scheduled task)? I have done this in
    UNIX
    but not on Windows.

    _________________________________________________________________
    Communicate instantly! Use your Hotmail address to sign into Windows Live
    Messenger now. http://get.live.com/messenger/overview

    --
    http://www.freelists.org/webpage/oracle-l

    _________________________________________________________________
    Type your favorite song. Get a customized station. Try MSN Radio powered
    by Pandora. http://radio.msn.com/?icid=T002MSN03A07001

    --
    http://www.freelists.org/webpage/oracle-l

    Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom
    http://click.libero.it/infostrada08gen07
  • Niall Litchfield at Jan 8, 2007 at 10:38 am
    You should bookmark and note
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnanchor/html/scriptinga.asp
    more generally.

    The following vbscript will do what you specifically ask. Fell free to
    remove the debug stuff which just bulks it out once you understand it.

    Rem *****************************************
    Rem * This script deletes archive log files *
    rem * which are more than old *
    Rem * From archive log directory *
    Rem * *
    Rem *****************************************

    Rem

    Rem *****************************************
    Rem * Version History: *
    Rem * 0.1 Niall Litchfield 29/08/2003 *
    Rem *****************************************

    ' Constants alter if necessary
    const iDays = 7 ' Change this to change archive retention period
    const arch_dest = "
    Dim fileSystem ' Filesystem Object
    Dim folder ' Folder
    Dim file ' File Object
    dim debug ' change to enable interactive debugging via

    message boxes

    debug = false
    If debug = true then
    msgBox strFolder
    msgBox modDate
    end if

    ' Create the filesystem object
    set filesystem = createobject("Scripting.FileSystemObject")
    ' get the Folder
    set folder = fileSystem.GetFolder( strFolder)
    ' create a file enumerator
    For each filename in folder.files
    ' get file object
    set file = fileSystem.GetFile( fileName)
    ' get date last modified
    dateLastModified = file.DateLastModified

    if debug = true then
    msgBox "File: " & fileName & vbcrlf & " Last Modified: " &
    dateLastModified

    end if

    ' if file is older than NUMBER_OF_DAYS
    if dateLastModified < modDate then
    ' delete the file if not in debug mode
    if debug = false then
    fileSystem.DeleteFile (fileName)
    end if
    end if

    next
    End Sub
    On 1/7/07, J. Dex wrote:

    Does anyone have a script for Windows that will archive old network log
    and
    trace files and also remove any that are more than a month old (or at
    least
    be able to run under a monthly scheduled task)? I have done this in
    UNIX
    but not on Windows.

    _________________________________________________________________
    Communicate instantly! Use your Hotmail address to sign into Windows Live
    Messenger now. http://get.live.com/messenger/overview

    --
    http://www.freelists.org/webpage/oracle-l

    --
    Niall Litchfield
    Oracle DBA
    http://www.orawin.info

    --
    http://www.freelists.org/webpage/oracle-l
  • Yechiel Adar at Jan 8, 2007 at 11:50 am
    Hello Dex

    I had the same problem and did not found any way to copy or delete or
    move files that are older then 30 days in windows.
    I used a utility called robocopy to do this.

    After your question I researched some more and found a way to do it,
    using a small sql script to generate cmd file that will do the work.

    set heading off
    spool c:\temp\deltraces.cmd

    select 'cd /d d:\oracle\ora92\admin\udump' from dual;
    select 'md temp' from dual;
    select 'xcopy * temp /D:' || to_char(sysdate-30,'MM-DD-YYYY') from dual;
    select 'delete . /Y' from dual;
    select 'move temp\* .' from dual;
    select 'rd temp' from dual;

    spool off
    exit

    The trick is that xcopy have the /D switch that copy only files with
    dates greater then the date in the /D switch.
    So, you copy the files you want to keep, delete all files in the
    directory and then move the files back.

    Adar Yechiel
    Rechovot, Israel

    J. Dex wrote:
    Does anyone have a script for Windows that will archive old network
    log and trace files and also remove any that are more than a month old
    (or at least be able to run under a monthly scheduled task)? I have
    done this in UNIX but not on Windows.
    --
    http://www.freelists.org/webpage/oracle-l
  • Rama.ari_at_accenture.com at Jan 8, 2007 at 3:36 pm
    Dex,

    You can write small batch file with following command and schedule it as
    task scheduler in windows environment. I strongly suggest you test in
    dev/test environment before implementing in prod env.

    forfiles -p D:\oracle\ora92\network\admin\logs -m *.log -d -30 -c "CMD
    /C DEL @FILE"

    Thanks,

    Rama Ari
    -----Original Message-----
    From: oracle-l-bounce_at_freelists.org
    On Behalf Of J. Dex
    Sent: Sunday, January 07, 2007 5:10 PM
    To: oracle-l_at_freelists.org
    Subject: Script to remove network log/trace files

    Does anyone have a script for Windows that will archive old network log
    and
    trace files and also remove any that are more than a month old (or at
    least
    be able to run under a monthly scheduled task)? I have done this in
    UNIX

    but not on Windows.

    Communicate instantly! Use your Hotmail address to sign into Windows
    Live
    Messenger now. http://get.live.com/messenger/overview

    --
    http://www.freelists.org/webpage/oracle-l

    This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.
    --
    http://www.freelists.org/webpage/oracle-l
  • Paul Drake at Jan 8, 2007 at 3:44 pm

    On 1/8/07, rama.ari_at_accenture.com wrote:
    Dex,

    You can write small batch file with following command and schedule it as
    task scheduler in windows environment. I strongly suggest you test in
    dev/test environment before implementing in prod env.

    forfiles -p D:\oracle\ora92\network\admin\logs -m *.log -d -30 -c "CMD
    /C DEL @FILE"
    Thanks,

    Rama Ari
    Rama,

    For some reason, MS likes to change the syntax of the forfiles.exe utility
    with each release of their server operating systems.

    If you're going to use that against a W2K3 Server, the hyphens have been
    replaced by forward slashes. More has changed than just the switch character
    as the functionality of the @FILE, @PATH and @FNAME have also changed.

    Paul
    -----Original Message-----
    From: oracle-l-bounce_at_freelists.org
    On Behalf Of J. Dex
    Sent: Sunday, January 07, 2007 5:10 PM
    To: oracle-l_at_freelists.org
    Subject: Script to remove network log/trace files

    Does anyone have a script for Windows that will archive old network log
    and
    trace files and also remove any that are more than a month old (or at
    least
    be able to run under a monthly scheduled task)? I have done this in
    UNIX
    but not on Windows.

    _________________________________________________________________
    Communicate instantly! Use your Hotmail address to sign into Windows
    Live
    Messenger now. http://get.live.com/messenger/overview

    --
    http://www.freelists.org/webpage/oracle-l




    This message is for the designated recipient only and may contain
    privileged, proprietary, or otherwise private information. If you have
    received it in error, please notify the sender immediately and delete the
    original. Any other use of the email by you is prohibited.
    --
    http://www.freelists.org/webpage/oracle-l

    --
    -- ALTER SESSION SET EVENTS 'immediate trace name hanganalyze level 4';

    --
    http://www.freelists.org/webpage/oracle-l

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouporacle-l @
categoriesoracle
postedJan 7, '07 at 10:10p
activeJan 8, '07 at 3:44p
posts9
users8
websiteoracle.com

People

Translate

site design / logo © 2022 Grokbase