Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Script to remove network log/trace files

Re: Script to remove network log/trace files

From: Yechiel Adar <adar666_at_inter.net.il>
Date: Mon, 08 Jan 2007 13:50:23 +0200
Message-ID: <45A22FFF.9060104@inter.net.il>


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
Received on Mon Jan 08 2007 - 05:50:23 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US