By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,558 Members | 1,533 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,558 IT Pros & Developers. It's quick & easy.

deleting a file, even if it is being used by another person or process

P: n/a
I have a file I need to delete or truncate. I tried using the KILL
command in VB6. I tried using the file.delete command in VB.net. I
tried manually deleting, renaming, and copying over the file... but
nothing works.

I keep getting the error: Cannot delete access_log: it is being used by
another person or program.

I tried shutting down services, I tried killing processes using the
task manager, I tried rebooting, and still, I get the same error.

Is there a way to delete a file regardless of who is using it? My
preference is to use VB because eventually I need to automate this task
to happen daily, but I'm really open do anything that works! Doesn't
it seem there was an old command years ago in DOS that would do it?
XDEL or DELTREE or something like that?

Is there a way to pinpoint which process is holding this file hostage?
Does anyone have any tricky tricks up their sleeves I might try?

Nov 21 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
If windows the file is in use, there is no way to remove it that I ever
heard of. What would stop people from deleting the windows virtual memory
file then? The only way I found to do what you want to do is to reboot into
safe mode, then the service/process that is holding the file won't start.
If it is still locked when you go into safe mode, you probably shouldn't be
touching it. Other than shutting down the service that is holding the file,
I know of no way to automate this process. What is the file you are having
issue with?
<sh*****@igmax.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I have a file I need to delete or truncate. I tried using the KILL
command in VB6. I tried using the file.delete command in VB.net. I
tried manually deleting, renaming, and copying over the file... but
nothing works.

I keep getting the error: Cannot delete access_log: it is being used by
another person or program.

I tried shutting down services, I tried killing processes using the
task manager, I tried rebooting, and still, I get the same error.

Is there a way to delete a file regardless of who is using it? My
preference is to use VB because eventually I need to automate this task
to happen daily, but I'm really open do anything that works! Doesn't
it seem there was an old command years ago in DOS that would do it?
XDEL or DELTREE or something like that?

Is there a way to pinpoint which process is holding this file hostage?
Does anyone have any tricky tricks up their sleeves I might try?

Nov 21 '05 #2

P: n/a
> Is there a way to pinpoint which process is holding this file hostage?
Does anyone have any tricky tricks up their sleeves I might try?
http://www.sysinternals.com/ntw2k/fr.../procexp.shtml

HTH,
Greg

<sh*****@igmax.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...I have a file I need to delete or truncate. I tried using the KILL
command in VB6. I tried using the file.delete command in VB.net. I
tried manually deleting, renaming, and copying over the file... but
nothing works.

I keep getting the error: Cannot delete access_log: it is being used by
another person or program.

I tried shutting down services, I tried killing processes using the
task manager, I tried rebooting, and still, I get the same error.

Is there a way to delete a file regardless of who is using it? My
preference is to use VB because eventually I need to automate this task
to happen daily, but I'm really open do anything that works! Doesn't
it seem there was an old command years ago in DOS that would do it?
XDEL or DELTREE or something like that?

Is there a way to pinpoint which process is holding this file hostage?
Does anyone have any tricky tricks up their sleeves I might try?

Nov 21 '05 #3

P: n/a
Chris,

Thanks for your response. The file is an Oracle 9iAS log file that
gets written to every few seconds (apache/logs/access_log.) It grows
by about 20 meg each day. I have some third party software (FogLight)
that monitors Oracle for me, but that file overgrew the ability of
FogLight to open it. (It is currently at 6 gig)

I tried to work with Oracle to come up with a solution, but their
"fixes" didn't work, and the work-around they have is to archive and
truncate that file on a regular basis. That's not a problem, except
that I can't get it to truncate! It is being used by some process.
Oracle told me which "service" it is that keeps that file open, and I
tried shutting that service down (in fact I shut down every oracle
service on the machine!) but I get the same error.

I tried booting in Safe Mode, but Server 2003 doesn't give me that
option in its startup sequence (either that or I'm just a programmer
instead of a network administrator and I'm missing something obvious.)
I see the previous post that mentions a piece of software that tells
what process is holding a file open. perhaps that will do it for me!
Thanks for your post!

Shandra

Nov 21 '05 #4

P: n/a
You don't get Safe Mode when you press F8?

Greg

<sh*****@igmax.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Chris,

Thanks for your response. The file is an Oracle 9iAS log file that
gets written to every few seconds (apache/logs/access_log.) It grows
by about 20 meg each day. I have some third party software (FogLight)
that monitors Oracle for me, but that file overgrew the ability of
FogLight to open it. (It is currently at 6 gig)

I tried to work with Oracle to come up with a solution, but their
"fixes" didn't work, and the work-around they have is to archive and
truncate that file on a regular basis. That's not a problem, except
that I can't get it to truncate! It is being used by some process.
Oracle told me which "service" it is that keeps that file open, and I
tried shutting that service down (in fact I shut down every oracle
service on the machine!) but I get the same error.

I tried booting in Safe Mode, but Server 2003 doesn't give me that
option in its startup sequence (either that or I'm just a programmer
instead of a network administrator and I'm missing something obvious.)
I see the previous post that mentions a piece of software that tells
what process is holding a file open. perhaps that will do it for me!
Thanks for your post!

Shandra

Nov 21 '05 #5

P: n/a
Chris,

Thanks for your response. The file is an Oracle 9iAS log file that
gets written to every few seconds (apache/logs/access_log.) It grows
by about 20 meg each day. I have some third party software (FogLight)
that monitors Oracle for me, but that file overgrew the ability of
FogLight to open it. (It is currently at 6 gig)

I tried to work with Oracle to come up with a solution, but their
"fixes" didn't work, and the work-around they have is to archive and
truncate that file on a regular basis. That's not a problem, except
that I can't get it to truncate! It is being used by some process.
Oracle told me which "service" it is that keeps that file open, and I
tried shutting that service down (in fact I shut down every oracle
service on the machine!) but I get the same error.

I tried booting in Safe Mode, but Server 2003 doesn't give me that
option in its startup sequence (either that or I'm just a programmer
instead of a network administrator and I'm missing something obvious.)
I see the previous post that mentions a piece of software that tells
what process is holding a file open. perhaps that will do it for me!

Thanks for your post!

Shandra

Chris, Master of All Things Insignificant wrote:
If windows the file is in use, there is no way to
remove it that I ever heard of. What would stop
people from deleting the windows virtual memory
file then? The only way I found to do what you
want to do is to reboot into safe mode, then the
service/process that is holding the file won't
start. If it is still locked when you go into
safe mode, you probably shouldn't be touching it.
Other than shutting down the service that is
holding the file, I know of no way to automate
this process. What is the file you are having
issue with?


Nov 21 '05 #6

P: n/a
You could have a look at WhoLockMe at

http://www.dr-hoiby.com/WhoLockMe/

to find out the process that has the lock.

HTH

Charles
<sh*****@igmax.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I have a file I need to delete or truncate. I tried using the KILL
command in VB6. I tried using the file.delete command in VB.net. I
tried manually deleting, renaming, and copying over the file... but
nothing works.

I keep getting the error: Cannot delete access_log: it is being used by
another person or program.

I tried shutting down services, I tried killing processes using the
task manager, I tried rebooting, and still, I get the same error.

Is there a way to delete a file regardless of who is using it? My
preference is to use VB because eventually I need to automate this task
to happen daily, but I'm really open do anything that works! Doesn't
it seem there was an old command years ago in DOS that would do it?
XDEL or DELTREE or something like that?

Is there a way to pinpoint which process is holding this file hostage?
Does anyone have any tricky tricks up their sleeves I might try?

Nov 21 '05 #7

P: n/a
Charles,

This is so nice from starting new threads, the OP told that it was about
users on a netwerk using other computers.

Cor
Nov 21 '05 #8

P: n/a
I'm not too sure if this will help, but I got it from Oracle's website...

Rotating logs

The log files will quickly grow quite large because of the performance
logging data.
You may wish to set up a rotation system, so that periodically the logs are
archived.
Note that on UNIX, the logs are kept open by the running process, so simple
doing a 'mv' will not be effective.

Example:

export date=`date +%Y.%m.%d_%H:%M`
export ORACLE_HOME=$HOME/app/midtier
export LOG_ARCHIVE=$HOME/logging/archive
export LOG_HOME=$HOME/logging

cd $ORACLE_HOME/Apache/Apache/logs
cp error_log $LOG_ARCHIVE/error_log.$date && cat /dev/null > error_log

cd
$ORACLE_HOME/j2ee/OC4J_Portal/application-deployments/portal/OC4J_Portal_default_island_1
cp application.log $LOG_ARCHIVE/application.log.$date && cat /dev/null >
application.log

cd $ORACLE_HOME/webcache/logs
cp access_log $LOG_ARCHIVE/access_log.$date && cat /dev/null > access_log
It is suggested that you load the archived log files rather than the current
ones, to eliminate the need to delete
old data first. If you collect and load the current log files, then be sure
to specify -delete_old_logs, otherwise,
reloading these files will cause duplicate data to be loaded.

Automation
You can install the previous script as a cron job. See the UNIX man page for
cron for more information.
Purging/deleting old data

The amount of data in the OWA_LOGGER table can grow quite large. You should
purge or delete old data periodically.

If you have only a few physical hosts, this can be combined with loading new
data:

perl loadlogs.pl -logical_host <host> -physical_hosts "<host1 host2
host3...>" -delete_old_logs
or

perl loadlogs.pl -logical_host <host> -physical_hosts "<host1 host2
host3...>" -purge_old_logs <n>

However, it is much more efficient to purge data for all hosts at once
before loading new data:

perl loadlogs.pl -purge_old_logs <n>
perl loadlogs.pl -logical_host <host> -physical_hosts "<host1 host2
host3...>"

Automation
You can install the previous commands as a cron job. See the UNIX man page
for cron for more information.
I do hope it helps,

Scott
<sh*****@igmax.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Chris,

Thanks for your response. The file is an Oracle 9iAS log file that
gets written to every few seconds (apache/logs/access_log.) It grows
by about 20 meg each day. I have some third party software (FogLight)
that monitors Oracle for me, but that file overgrew the ability of
FogLight to open it. (It is currently at 6 gig)

I tried to work with Oracle to come up with a solution, but their
"fixes" didn't work, and the work-around they have is to archive and
truncate that file on a regular basis. That's not a problem, except
that I can't get it to truncate! It is being used by some process.
Oracle told me which "service" it is that keeps that file open, and I
tried shutting that service down (in fact I shut down every oracle
service on the machine!) but I get the same error.

I tried booting in Safe Mode, but Server 2003 doesn't give me that
option in its startup sequence (either that or I'm just a programmer
instead of a network administrator and I'm missing something obvious.)
I see the previous post that mentions a piece of software that tells
what process is holding a file open. perhaps that will do it for me!
Thanks for your post!

Shandra

Nov 21 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.