Visual FoxPro - 文件访问被拒绝
我们的 ERP 系统是一个混合系统。实际数据是SQL,但包含用户信息、配置文件、权限、安全性等的表是在Visual FoxPro 中。
我需要获得对 VFP 数据库的独占访问权限。我使用程序本身将每个人从系统中删除,这表明每个人都已离开系统。我得到对以下代码的以下响应:
set excl on
open data l:\M2MDATA\Util\util.dbc excl
我得到的响应是:文件访问被拒绝。我进入服务器管理器,没有人在我们的 VFP 目录中打开任何文件。
VFP 中是否有一个命令可以让我确定谁/什么打开了文件和/或杀死 FoxPro 中任何会话的方法?
我尝试用谷歌搜索但没有运气。
Our ERP system is a hybrid. The actual data is SQL, but the tables which contain user information, profiles, rights, security, etc is in Visual FoxPro.
I need to get exclusive access to the VFP database. I remove everyone from the system using the program itself, and it indicates everyone is out of the system. I get the following response to the following code:
set excl on
open data l:\M2MDATA\Util\util.dbc excl
The response I get is : File Access is Denied. I went into server manager and nobody has any files open in our VFP directory.
Is there a command in VFP that will allow me to determine who/what has the file open and/or a way to kill any sessions within FoxPro that do?
I tried googling it but had no luck.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
您可能想查看 Sysinternals (Microsoft) 的 Process Explorer。
http://technet.microsoft.com/en-us/sysinternals/default.aspx
您可以使用“查找|”文件句柄或 DLL 菜单选项并输入 DBC 文件的名称。 Process Explorer 将告诉您进程 ID 以及打开该文件的进程。
如果您在网络(文件服务器或点对点)上共享文件,请转到“服务器”并运行计算机管理。深入查看共享文件夹>打开文件,您应该会看到网络上其他用户在计算机上打开的文件列表。
瑞克
You might want to check out the Process Explorer from Sysinternals (Microsoft).
http://technet.microsoft.com/en-us/sysinternals/default.aspx
You can use the Find | File Handle or DLL menu option and put in the name of the DBC file. Process Explorer will tell you the process ID and the process that has the file open.
If you are sharing the file on the network (file server or peer-to-peer), head over to the "server" and run Computer Management. Drill down into the Shared Folders > Open Files and you should hopefully see the list of files opened on the computer by other users on the network.
Rick
正如杰夫所提到的,一件事可能是当一个人的计算机崩溃时,他们会与网络断开连接。服务器仍然认为该文件是在某个低级句柄上打开的。然后,当用户重新连接时,所有先前的设置似乎都会神奇地自动释放,返回系统,然后一切看起来都很好。此外,请在计算机管理、共享驱动器下检查“从服务器”,以及谁可能实际打开了文件,即使他们可能有不正常的断开连接。
作为在表上预先测试此类排他性的替代方法,您可能想要尝试对 .DBC 运行查询,因为它本身也只不过是一个表......类似
As mentioned by Jeff, one thing could be when a crash on one person's machine, and they get disconnected from the network. The server still THINKs the file is open at some low-level handle. Then, when the user re-connects, all prior settings appear to auto-magically get released, get back into the system, then all appears to be fine. Additionally, check FROM THE SERVER under computer management, shared drives, and who may have the files actually open even though they may have had an ungraceful disconnect otherwise.
As an alternate to pre-test such exclusiveness on the table, you may want to try and run a query against the .DBC since it too is nothing more than a table itself... Something like
某些程序可能在打开数据库(留下僵尸锁)时崩溃,或者数据库通过不释放资源的网络共享连接。
在这种情况下,我通常只能重新启动数据库所在的服务器或卸载/重新安装数据库所在的磁盘(如果在 SAN 或网络磁盘上)。
It is possible the some program crashed while it had the database open (leaving a zombie lock) or the database is connected via a network share that isn't releasing the resource.
In such cases, I'm usually reduced to either rebooting the server where the database is located or dismounting/remounting the disk where the database resides (if on a SAN or network disk).
请访问 Microsoft 支持网站了解服务器机会锁定和缓存打开设置。您可能需要将 EnableOplocks 设置为 0,将 CachedOpenLimit 设置为 0,如文章所述。此外,按访问病毒扫描也因此类事情而臭名昭著。
除了提到的优秀的 SysInternals Process Explorer 工具之外,我还使用了一个名为 UnLocker 的工具,它允许您右键单击服务器上的任何文件并查看锁定进程。
还有另一个名为“handle”的 SysInternals 工具,它在提示符下运行,并提供有关哪些进程可以处理给定文件的大量信息。
Look on Microsoft's support site for server Opportunistic Locking and Cached Open settings. You may need to set EnableOplocks to 0 and CachedOpenLimit to 0 as the articles describe. Also on-access virus scanning is notorious for this sort of thing.
In addition to the excellent SysInternals Process Explorer tool mentioned, I use a tool called UnLocker which lets you right-click on any file on the server and see the locking processes.
There is also another SysInternals tool called 'handle' which runs at the prompt and gives lots of information on what processes have handles on a given file or files.
您可以尝试以下操作:
重新启动服务器(如果可能)。现在没有人在使用它。
获取链接到 DBC 的表的列表,并编写脚本来单独且独占地打开每个表。是否有任何打开失败?
可能,其中一个表反向链接到另一台服务器上的表。
只是一些想法。
You could try this:
Reboot the server (if possible). Now noone is using it.
Get a list of tables linked to the DBC and write a script to open each table individually and execlusively. Do any of the opens fail?
Possibly, one of the tables is back linked to a table on another server.
Just some ideas.
可能值得确保您可以打开它进行共享访问,以确保这不是权限问题。
Might be worth making sure you can open it for shared access to be sure it's not a permissions issue.
我之前收到过该消息,问题很简单,运行 Windows 资源管理器并尝试打开该文件所在的文件夹。如果您无法访问该文件夹,则 Visual FoxPro 也无法访问该文件夹。我假设您正在使用共享文件夹,因为您提到您正在使用驱动器 L.cmiiw :)
I have got that message before and the problem is simple , run windows explorer and try to open the folder where the file located. if you can not access the folder , so does visual foxpro. I assume you are using sharing folder since you mention that you are using drive L. cmiiw :)
我遇到了同样的问题(没有对 DBC 的独占访问),但还有另一个原因。
我们正在对通过低级命令(FOPEN、FSEEK、FPUTS、FCLOSE、FCREATE)处理的文本文件中的访问和某些活动进行协议。我们从 2000 年 4 月 1 日起就这样做,没有出现任何问题。
在“严重的不良网络事件”之后,我们的系统仍然运行,但速度非常快。规定的每个动作大约需要 5 分钟。 FoxPro 显然在 5 分钟内重试了低级程序,并最终跳过了它们(顺便说一句,没有任何通知)。
文本文件绝不是数据库本身的一部分。尽管如此,DBC 无法通过机器(已关闭)的僵尸锁进行访问,该机器也是文本文件僵尸锁的所有者。 DBC锁只有在thext文件的锁解除后才能释放。
不知道这是如何连接的,但之后一切又恢复正常,而且仍然如此。服务器是Novell Netware,我不太熟悉。
I had the same problem (no exclusive accesses to DBC), but another reason.
We are protocolling access and certain activities in a text file handled via low-level commands (FOPEN, FSEEK, FPUTS, FCLOSE, FCREATE). We are doing so since april 1st, 2000, without any problems.
After a "severe adverse network event" our system still ran, but at hyper-snail speed. Every action protocolled took about 5 minutes. FoxPro obviously retried the low-level procedures during the 5 minutes and finally skipped them (without any notice, btw).
The text file is by no means part of the database itself. Nontheless, DBC was not accessible with a zombie lock from the machine (powered off) which also was the owner of a zombie lock to the text file. DBC lock could only be released after the thext file's lock hat been removed.
No idea, how this is connected, but afterwards, everything was fine again and still is. Server is Novell Netware, which I am not faniliar with.