Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to delete .mdb file when users (supposedly) are in it?

Status
Not open for further replies.

TroyMcClure

Technical User
Oct 13, 2003
137
US
Ok...I'm at the console of a server and we have a corrupted .mdb file. I can't open it to repair it because it claims someone has it open. Nobody does, this is a fact. I go into the .ldb file and it won't let me delete that bcause of similar 'sharing' violation.

Now, I'm the admin of the machine, I don't care how many 'alleged' users of this file it messes up--I want to delete the damn file. How do I get around the NT locks, etc, and delete this file? This goes for any file, actually, but the current one happens to be an .mdb file. It just seems that, even though it can be dangerous, NT should have an 'emergency' method of deleting a file regardless of whether 100 people are using it or none. Is it possible?
--T
 
If you reboot the NT box you will be able to delete the .ldb file...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
phv,
Thanks, but that won't help. I should have been more clear and said "without rebooting". I know I can delete it after it's been rebooted.

I have a backup and I simply want to replace the damaged .mdb file with the backup. Is there a way within Windows 2000 (or NT or XP, for that matter) that I can delete a file regardless of locks on it?
--T
 
What I do to get rid of the LDB file, which is what prevents deletion of the MDB, is to run a break page.

I use cold fusion so I wrote a break.cfm that just runs a query to the datasource in question. The query is something like:

select * from blahblahblah where xxxx = 0

and you will get an error, and subsequently the server will clear up its use for the resource (your mdb file) and then your ldb file (the lock file) will be removed and you can delete the mdb.

I use break.cfm all the time when Im testing access applications, especially those running on a web server using access as a datasource. You can run this query from any web language like ASP or PHP.
 
strantheman,
I haven't had the opportunity to check your solution, the .mdb hasn't corrupted again for a few days, and I don't know how to force corruption in an Access 97 .mdb.

But are you sure that the simple act of trying a Select statement on an .mdb, then waiting for the '...corrupted and needs to be repaired..." message is enough to clear the .ldb for deletion (and subsequently the .mdb)?
--T
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top