Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm using Process Explorer to determine what process has a lock on a particular Fox Pro Database file in windows.

It's telling me that System has a lock on it. When I go to kill the "System" process (which if you ask me doesn't sound like a very good idea), it asks me if I'm sure I want to kill the System process. I haven't answered yes yet.

The system has a lock on my file

It's a company server, and I'm thinking that maybe my only option is to tell everybody to get off of it and reboot.

Do I have any other options?

share|improve this question
add comment

1 Answer

You have many other options, but like trying to kill the System process, most of them are bad ideas too. (And it's unlikely that kicking every user off is going to help either, by the way.)

First of all, it's a database file. So there's a file lock on it because something, like the database engine, is reading from or writing to that file. Incidentally, this is what happens 100% of the time that a database is online or available. The database file is locked. It should be; it needs to be. You really shouldn't be doing file-level operations on a database file unless you really know what you're doing anyway, which, pardon me for observing, doesn't seem like a description that fits you.

If you must do file level operations on a database, the proper solution is to use the database management console and/or SQL/ODBC queries to take the database offline and/or "detach" it. You can do this while the database is online only if you have clustering, mirroring or some other HA functionality turned on. (If you have to ask, you don't. Or should pray very hard that you don't.) Once the database is not in use any more, you can play around with the file to your heart's content, though again, you shouldn't unless you really know what you're doing.

Should that not be possible, which happens from time to time, the next best thing is to terminate the database engine, which will be running as a service. It should be possible to do so from the command line with net stop or through the GUI MMC snap-in services.msc, or as a last resort, through task manager by ending the process. This should release the lock and allow you to do whatever it is with the file you're contemplating doing, which, again, is probably a bad idea. If the service can't be stopped and the process can't be killed, you're looking at a system reboot, as the service is hung waiting on a kernel resource, and won't release the file lock.

Now, before you rush off and try to kill the process, maybe another question is in order about how to achieve what you're ultimately trying to achieve. Would seem to be the wiser approach, at least to me.

share|improve this answer
    
Well I don't know about any services that run the database, but I'm not completely ruling it out either...It's fox pro that runs inside a proprietary application so I don't have access to it with vfp. However I can get in there via ODBC using SquirreL SQL, and there are a few access databases that link to it using linked tables. Eventually we just rebooted the server to get rid of that process, and the lock didn't come back, so that really makes me think that there isn't a service. –  leeand00 Aug 30 '12 at 2:45
    
@leeand00 Enh, proprietary garbage running on Access databases... only sure fire fix to that is to nuke from orbit. Having said that, next time you can probably unlock the database file by killing the app. Though, being that it's an Access database and support by MS for exactly no purpose whatsoever, there's no way to say for sure. –  HopelessN00b Aug 30 '12 at 2:58
    
Well the access databases are pretty small and used for purposes of querying the big access database and the big fox pro database. It's a legacy system to be sure... :) –  leeand00 Aug 30 '12 at 4:13
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.