ldb file removal (1 Viewer)

kirkm

Registered User.
Local time
Tomorrow, 11:57
Joined
Oct 30, 2008
Messages
1,257
Hi, I've asked this before and Googled in depth, but not come up with anything that works.
How do you get of an .ldb file (apart from turning off the computer) ?
There must be some kind of reg hack or method to release it ?

Thanks.
 

isladogs

MVP / VIP
Local time
Today, 22:57
Joined
Jan 14, 2017
Messages
18,186
Open Task Manager and then End Task of any running instances of Access.
You can then delete the lock file
 

kirkm

Registered User.
Local time
Tomorrow, 11:57
Joined
Oct 30, 2008
Messages
1,257
Does that work for you? It doesn't here. The task appears to end, but the ldb file is not (and still cannot be) deleted.
Using Office 2010.
 

Sun_Force

Active member
Local time
Tomorrow, 07:57
Joined
Aug 29, 2020
Messages
396
Does that work for you? It doesn't here. The task appears to end, but the ldb file is not (and still cannot be) deleted.
Using Office 2010.
Probably some other app is connected to your database. For example an excel file or some other.
Start Windows in safe mode and you'll be able to delete it.
 

isladogs

MVP / VIP
Local time
Today, 22:57
Joined
Jan 14, 2017
Messages
18,186
It should work if you remove ALL instances of Access from the Task Manager, both from Apps and Background Processes
 

kirkm

Registered User.
Local time
Tomorrow, 11:57
Joined
Oct 30, 2008
Messages
1,257
I'm using XP. That make a difference?. I'm told there is another person or process using it. But nothing I can see is. Is there some way check both apps and Background processes? Or failing that, some way to disconnect any persons or process?
If I reboot (that's the only way to get to Safe mode, isn't it?) that solves the problem, yes. But ideally a solution that doen't need a reboot is what's wanted.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 22:57
Joined
Sep 12, 2006
Messages
15,614
if windows says it's in use, then it's use.
Can you not use admin tools to see any open sessions/shares on the database?
 

isladogs

MVP / VIP
Local time
Today, 22:57
Joined
Jan 14, 2017
Messages
18,186
I'm using XP. That make a difference?. I'm told there is another person or process using it. But nothing I can see is. Is there some way check both apps and Background processes? Or failing that, some way to disconnect any persons or process?
If I reboot (that's the only way to get to Safe mode, isn't it?) that solves the problem, yes. But ideally a solution that doen't need a reboot is what's wanted.
I haven't got a copy of XP to hand. This is what the detailed view of Task Manager looks like in Win10
1617791730061.png
It may look different in XP
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 17:57
Joined
Feb 28, 2001
Messages
27,001
The problem is that in order to touch your Access file, you need one of two things - (1) Access and/or JET or ACE; OR (2) SVCHOST.EXE, which is the app that touches your file when someone across a network is doing the touching with their own copy of Access on their local machine. In this case, the SVCHOST image is a file-server "helper" task. Sometimes in the industry, particularly if there is encryption involved, it is called a "broker." What it does is provide a host process for network connections. It does so because the design of Windows REQUIRES that if you want CPU time to do something, even to process an I/O completion, you must be within a process, because only a process may use the CPU resource.

In Resource Manager (accessible through Windows Task Manager), it is possible to determine which processes are using a file, I think by looking at either locks or file handles. You can then terminate them. However, ... with a local copy of Access or with a remote copy of Access through SVCHOST, you run equal risk of having a file transfer in progress.
 

Isaac

Lifelong Learner
Local time
Today, 15:57
Joined
Mar 14, 2017
Messages
8,738
Does that work for you? It doesn't here. The task appears to end, but the ldb file is not (and still cannot be) deleted.
Using Office 2010.
Then someone, or something, is using the database.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 18:57
Joined
Feb 19, 2002
Messages
42,976
Do you have delete permissions on the folder holding the .ldb file?

Access creates the lock file whenever an Access database is opened and then uses that database to manage file sharing. When the last concurrent user closes a shared .mdb/.accdb, Access also closes the lock file and deletes it because it is no longer needed. Access will NOT delete the lock file if the last person to close the .mdb/.accdb does not have delete permissions on that folder OR if the Access .mdb/.accdb closes abnormally.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 17:57
Joined
Feb 28, 2001
Messages
27,001
Pat, your statement is true but applies at the wrong moment. Absolutely true, Access won't delete the lock file if there is a permissions problem, but an Access lock isn't what is keeping the .LDB file from being deleted. In the case you describe, the Windows File Lock has been released and, if Access is truly closed, the file in that circumstance CAN be deleted by the file owner or someone with MODIFY-level permissions. Had to deal with this a thousand times for the Navy job.

If the owner or an admin cannot delete the file then it still has a Windows File Lock on it.

If every user claims to be out of the system, give the file another several minutes because the network connection will eventually time out. In that case, it eventually can be deleted. HOWEVER, the best way to resolve this short of rebooting the file server is to find and terminate the network session. That is true because unfortunately the "network session timeout" rules are highly variable and nobody here can predict the lifetime of an idle network session. It is AT LEAST a system setting and at worst could be part of a domain Group Policy setting.
 

Isaac

Lifelong Learner
Local time
Today, 15:57
Joined
Mar 14, 2017
Messages
8,738
If there is any chance of concurrent logins (to a server box, or to a Citrix workspace) where something kind of went wrong, that might complicate things a bit
 

kirkm

Registered User.
Local time
Tomorrow, 11:57
Joined
Oct 30, 2008
Messages
1,257
> In Resource Manager (accessible through Windows Task Manager), it is possible to determine which processes are using a file, I think by looking at either locks or file handles. You can then terminate them.

I went into task manager and see a Folder Icon with a magnifying glass and the Access mdb name. (No Access icon though.) I right clicked it and chose Go To Process. This Highlit Explorer suggesting it was using it, so I ended Task on Explorer. All Desktop icons vanished. Restarted Explorer but was back to square one, and the .ldb file would not delete.

>HOWEVER, the best way to resolve this short of rebooting the file server is to find and terminate the network session.

Went to Control Panel - Network Connections and disabled the one active connection. No change "Cannot delete... close any programs etc.."

I noticed the drive with this Access Folder if shared, so I temporarily removed the share and tried to delete but still no change.

Was that correct and is there anything else I can try? Are there any 3rd party apps that will remove a file no matter what ?

Thanks. I don't know what initially cause the problem. I do have Network sharing. And I can delete other files in the folder, just not the ldb one.
 

kirkm

Registered User.
Local time
Tomorrow, 11:57
Joined
Oct 30, 2008
Messages
1,257
I looked at the ldb file in a hex editor, it was 60 bytes long and contained the computer name and "Admin". I could change them and save ok. So I zeroed everything out so it can't work anymore, but still won't delete.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 17:57
Joined
Feb 28, 2001
Messages
27,001
Let's try this on Win10. Here is something from my system. Opened Task Manager, went to Performance tab, at the bottom found Open Performance Monitor, did that. Look at three exhibits in the same frame in the attachment.

#1 - the Disk panel shows file names in the 3rd column, PID (Process IDs) in the 2nd, and task/image names in the 1st. Look in the exhibit at the entry for C:\$LogFile (NTFS Volume Log), opened by PID 8196, Firefox.exe, which is my browser of choice. You can see the file path as part of the name in this particular exhibit.

#2 - the CPU panel shows Image names, PIDs, and a description. Firefox is PID 8196 there, too. See also that a SVCHOST instance is listed as a network support task.

#3 - the Network panel shows Image names, PIDs, and IP addresses. Again, Firefox is shown, this time with multiple connections. You can also see a bunch of SVCHOST images acting as network brokers. You will have one of those for each active network connection.

OK, what you want to do is open PerfMon on the system that has the locked .MDB file. Scroll through the DISK panel to see if you can find the file you want to delete. Get the PID of the process holding the file open. I believe if you click in the column header, that triggers a sort so you could see if the process has more than one connection. If it really IS a network support task, it has one local file and the other connection is through the network. (You will confirm that in the Network panel.)

Now look at the CPU part, which scrolls independently. Find the PID and see if it is a SVCHOST process. This is just for verification because the image name was in the Disk panel as well.

Next, look at the network panel, which ALSO scrolls independently. Find the PID and verify that it is, in fact, a network task. (You know it is a network task because (a) it is in the Network list and (b) has an IP address associated with it.) You got the PID from the disk section. This PID will never be longer than maybe a 5-digit number, probably never more than 16K (roughly) if that much. If it is all consistent (i.e. that the file is being held open by a network-related SVCHOST.EXE) then you have a shot. If the holder is NOT in the network list and is NOT a SVCHOST then try to figure out what it actually is from the descriptive data. But in that case, the holder will be local and YOUR system's reboot would also handle the problem pretty well.

Now get out of PerfMon and switch back to Task Manager. Swap to the Processes tab. Click on the column heading for PID so that it sorts, either top to bottom or bottom to top, doesn't matter which. Now find the PID. From there, if you right-click on the individual task line, you will get the option to End Task. As previously warned, this has a chance of corrupting the DB if someone was lying and actually was doing something in the DB at the time. However, you can see the network traffic and tell if there is any data flowing through that connection.

If that doesn't do it then you have a hung lock which can only be reset by a reboot.
 

Attachments

  • Perfmon.png
    Perfmon.png
    199.7 KB · Views: 221

kirkm

Registered User.
Local time
Tomorrow, 11:57
Joined
Oct 30, 2008
Messages
1,257
Thanks for the detailed help. I may be stuck and the machine with the offending file is running XP. However I shared the folder and could see it in Win10. I tried the steps you outlined, but could no mention of the file or folder in PerfMon. Only one mention (under Network) of the XP machines name. So I suspect a reboot is only way. It is really annoying! It's time like this you wonder about the common sense at Microsoft. Because until deleted I can't use (open) my database.
 

kirkm

Registered User.
Local time
Tomorrow, 11:57
Joined
Oct 30, 2008
Messages
1,257
I found a program called Unlocker which let me delete the .ldb file but the database still would not open. Until a reboot.
Just wanted to thank all for their input.
 

Users who are viewing this thread

Top Bottom