473,614 Members | 2,361 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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
8 14018
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.goo glegroups.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
> 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.goo glegroups.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
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
You don't get Safe Mode when you press F8?

Greg

<sh*****@igmax. com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.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
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
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.goo glegroups.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
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
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=$HO ME/app/midtier
export LOG_ARCHIVE=$HO ME/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_def ault_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.$dat e && 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.goo glegroups.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2989
by: kris.dorey | last post by:
Hi, Ive got the following code which seems ok but when the user runs the function for a second time I get an error message stating that the mdb is in use by another process. There is still an ldb for the life of the application even after calling oldebconnection.close and gc.collect. Any ideas?
4
2000
by: TomA | last post by:
Hi All, I have a picturebox on a form containing the photo of a person. As you advance through the records, the photo updates. Rather than storing the images in an inefficient blob field in a table, I have the separate images stored in an image directory with primary key as the filename (3476.jpg). If the image exists, I display the image. All this works fine. I have a buttons that allow for the insertion and deletion of photos. ...
1
6472
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting" setting to be "E_ALL", notices are still not getting reported. The perms on my file are 664, with owner root and group root. The php.ini file is located at /usr/local/lib/php/php.ini. Any ideas why the setting does not seem to be having an effect? ...
13
2396
by: NickName | last post by:
"For the vision impaired, SVG offers tremendous potential for interactive Internet mapping applications as discussed by Gardner and Bulatov (2001).". Now, here's an SVG file with fair/medium complexity, http://www.carto.net/papers/svg/samples/canvas.svg, even as a sighted person, I find its source code albeit in xml format hard to "absorb" at the first glance, let alone a visually impaired individual. The most important element seems...
26
3595
by: Don Calloway | last post by:
I have created a <filename>.db1 (where <filenameis the name given to the database) Access database that is being used in multi-user mode. When the <filename>.db1 file is opened by a user, the corresponding locking file appears in the Windows Explorer view pane as well as expected. Occasionally, a "bare" db1 file (extension only without a filename) appears in the Windows Explorer window. Can anyone tell me what that file is and what it...
9
5407
by: tshad | last post by:
I am trying to get access to a file that may still being written because the file is so large (7-10MB). I get an error: The process cannot access the file 'c:\TestDocs\XMLFiles\492172.XML' because it is being used by another process
5
23853
krungkrung
by: krungkrung | last post by:
hi again to everyone! I made a simple program(for my VB.Net practice). The program loads an image file to a picturebox upon clicking a button. after loading the image file i have another button to delete the loaded image file from the directory. But I have a problem deleting the image file used by the picturebox even if I set the "PictureBox1.Image = Nothing" before deletion takes place. The error says, "The process cannot access the file...
1
47437
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click on a link and after a moment or two a file download dialog box pops-up in your web browser and prompts you for some instructions, such as “open” or “save“. I’m going to show you how to do that using a perl script. What You Need Any recent...
0
8179
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8621
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8576
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8272
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6087
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5538
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4049
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1712
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1421
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.