Microsoft JET SQL 查询日志记录或“如何调试客户的程序?”

发布于 2024-07-06 13:59:43 字数 1028 浏览 9 评论 0原文

问题:

我们使用我们最大客户编写的程序来接收订单、预订运输以及执行其他与订单相关的操作。 我们别无选择,只能使用该程序,而当涉及到他们的程序出现问题时,客户非常不支持。 我们只需要接受这个计划。

现在,当与两个或更多用户一起使用时,该程序在大多数情况下都非常慢,因此我尝试查看幕后并找到问题的根源。

到目前为止我发现的有关该程序的一些要点:

  • 它是用 VB 6.0 编写的
  • 它使用受密码保护的 Access-DB (Access 2000 MDB),该数据库位于用户计算机上的一个文件夹中。
  • 该文件夹通过网络共享并由所有其他用户使用。
  • 它使用 msjet40.dll 版本 4.00.9704 与访问进行通信。 我猜是ADO吧?

我还使用 Process Monitor 来监视文件访问并找出该程序的原因太慢了:即使程序空闲,它也会对 mdb 文件执行数千次读取操作。 通过网络,这当然非常慢:

进程监视器跟踪 http://img217.imageshack。 us/img217/1456/screenshothw5.png

真正的问题:

有没有办法监视负责读取活动的查询? 我可以设置跟踪标志吗? 挂钩 JET DLL 吗? 我猜想该程序正在执行一些昂贵的查询,导致 JET 在此过程中读取大量数据。

PS:我已经尝试将 mdb 放在我们公司的文件服务器上,并取得了成功,访问它甚至比本地共享还要慢。 我还尝试更改客户端上的锁定机制(机会锁定),但没有成功。

我想知道发生了什么,并需要为我们客户的开发人员提供一些确凿的事实和建议,以帮助他/她更快地编写程序。

The problem:

We use a program written by our biggest customer to receive orders, book tranports and do other order-related stuff. We have no other chance but to use the program and the customer is very unsupportive when it comes to problems with their program. We just have to live with the program.

Now this program is most of the time extremely slow when using it with two or more user so I tried to look behind the curtain and find the source of the problem.

Some points about the program I found out so far:

  • It's written in VB 6.0
  • It uses a password-protected Access-DB (Access 2000 MDB) that is located a folder on one user's machine.
  • That folder is shared over the network and used by all other users.
  • It uses the msjet40.dll version 4.00.9704 to communicate with access. I guess it's ADO?

I also used Process Monitor to monitor file access and found out why the program is so slow: it is doing thousands of read operations on the mdb-file, even when the program is idle. Over the network this is of course tremendously slow:

Process Monitor Trace http://img217.imageshack.us/img217/1456/screenshothw5.png

The real question:

Is there any way to monitor the queries that are responsible for the read activity? Is there a trace flag I can set? Hooking the JET DLL's? I guess the program is doing some expensive queries that are causing JET to read lots of data in the process.

PS: I already tried to put the mdb on our company's file server with the success that accessing it was even slower than over the local share. I also tried changing the locking mechanisms (opportunistic locking) on the client with no success.

I want to know what's going on and need some hard facts and suggestions for our customer's developer to help him/her make the programm faster.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

忘你却要生生世世 2024-07-13 13:59:43

为了让你的手准确地了解 Access 在幕后以查询方式执行的操作,有一个名为 JETSHOWPLAN 的未记录功能 - 当在注册表中打开时,它会创建一个 showplan.out 文本文件。 详细信息在
这篇 TechRepublic 文章 备用,总结如下:

Jet 3.0 中添加了 ShowPlan 选项,并生成文本文件
其中包含查询的计划。 (ShowPlan 不支持子查询。)
您必须通过向注册表添加调试键来启用它,如下所示:

<前><代码>\\HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\JET\4.0\Engines\Debug

在新的 Debug 键下,添加名为 JETSHOWPLAN 的字符串数据类型
(必须全部使用大写字母)。 然后,添加键值ON
启用该功能。 如果 Access 一直在后台运行,您
必须关闭它并重新启动它才能使该功能正常工作。

启用 ShowPlan 后,Jet 将创建一个名为 SHOWPLAN.OUT 的文本文件
(它可能最终位于您的我的文档文件夹或当前的
默认文件夹,具体取决于您使用的 Jet 版本)
time Jet 编译查询。 然后您可以查看此文本文件以获取线索
Jet 如何运行您的查询。

我们建议您通过更改键值来禁用此功能
除非您专门使用它,否则将其设置为OFF。 Jet 将计划附加到
现有文件,最终,该过程实际上会减慢速度
向下。 仅当您需要查看特定内容时才打开该功能
查询计划。 打开数据库,运行查询,然后禁用
功能。

对于追踪噩梦问题来说,它是无与伦比的 - 这是你在昂贵的大型工业数据库中得到的那种东西 - 这个功能很酷 - 它很可爱而且蓬松 - 这是我的朋友......;-)

To get your grubby hands on exactly what Access is doing query-wise behind the scenes there's an undocumented feature called JETSHOWPLAN - when switched on in the registry it creates a showplan.out text file. The details are in
this TechRepublic article alternate, summarized here:

The ShowPlan option was added to Jet 3.0, and produces a text file
that contains the query's plan. (ShowPlan doesn't support subqueries.)
You must enable it by adding a Debug key to the registry like so:

\\HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\JET\4.0\Engines\Debug

Under the new Debug key, add a string data type named JETSHOWPLAN
(you must use all uppercase letters). Then, add the key value ON to
enable the feature. If Access has been running in the background, you
must close it and relaunch it for the function to work.

When ShowPlan is enabled, Jet creates a text file named SHOWPLAN.OUT
(which might end up in your My Documents folder or the current
default folder, depending on the version of Jet you're using) every
time Jet compiles a query. You can then view this text file for clues
to how Jet is running your queries.

We recommend that you disable this feature by changing the key's value
to OFF unless you're specifically using it. Jet appends the plan to
an existing file and eventually, the process actually slows things
down. Turn on the feature only when you need to review a specific
query plan. Open the database, run the query, and then disable the
feature.

For tracking down nightmare problems it's unbeatable - it's the sort of thing you get on your big expensive industrial databases - this feature is cool - it's lovely and fluffy - it's my friend… ;-)

仅此而已 2024-07-13 13:59:43

你不能在网络上放置一个数据包嗅探器(如 Wireshark)来观察一个用户和主机之间的流量吗?

Could you not throw a packet sniffer (like Wireshark) on the network and watch the traffic between one user and the host machine?

黎歌 2024-07-13 13:59:43

如果它使用 ODBC 连接,您可以为其启用日志记录。

  1. 启动 ODBC 数据源管理器。
  2. 选择“跟踪”选项卡
  3. 选择“立即开始跟踪”按钮。
  4. 选择“应用”或“确定”。
  5. 运行应用程序一段时间。
  6. 返回 ODBC 管理器。
  7. 选择“跟踪”选项卡。
  8. 选择立即停止跟踪按钮。
  9. 可以在您最初在“日志文件路径”框中指定的位置查看跟踪。

If it uses an ODBC connection you can enable logging for that.

  1. Start ODBC Data Source Administrator.
  2. Select the Tracing tab
  3. Select the Start Tracing Now button.
  4. Select Apply or OK.
  5. Run the app for awhile.
  6. Return to ODBC Administrator.
  7. Select the Tracing tab.
  8. Select the Stop Tracing Now button.
  9. The trace can be viewed in the location that you initially specified in the Log file Path box.
乙白 2024-07-13 13:59:43

第一个问题:您有 MS Access 2000 或更高版本的副本吗?

如果是这样:
当您说 MDB 受“密码保护”时,您的意思是当您尝试使用 MS Access 打开它时,您只会提示输入密码,还是会提示您输入用户名和密码? (或者给您一条错误消息,指出“您没有使用 foo.mdb 对象所需的权限。”?)

如果是后者(用户级安全性),请查找相应的 .MDW 文件与 MDB 一起。 如果找到的话,这就是“工作组信息文件”,用作打开 MDB 的“密钥”。 尝试创建一个带有如下目标的桌面快捷方式:

"Path to MSACCESS.EXE" "Path To foo.mdb" /wrkgrp "Path to foo.mdw"

然后,MS Access 应该提示您输入用户名和密码(希望)与 VB6 应用程序要求您输入的用户名和密码相同。 这至少允许您打开 MDB 文件并查看表结构以查看是否存在任何明显的设计缺陷。

除此之外,据我所知,Eduardo 是正确的,您非常需要能够在开发人员的源代码上运行调试器,以准确找出实时查询正在做什么......

First question: Do you have a copy of MS Access 2000 or better?

If so:
When you say the MDB is "password protected", do you mean that when you try to open it using MS Access you get a prompt for a password only, or does it prompt you for a user name and password? (Or give you an error message that says, "You do not have the necessary permissions to use the foo.mdb object."?)

If it's the latter, (user-level security), look for a corresponding .MDW file that goes along with the MDB. If you find it, this is the "workgroup information file" that is used as a "key" for opening the MDB. Try making a desktop shortcut with a target like:

"Path to MSACCESS.EXE" "Path To foo.mdb" /wrkgrp "Path to foo.mdw"

MS Access should then prompt you for your user name and password which is (hopefully) the same as what the VB6 app asks you for. This would at least allow you to open the MDB file and look at the table structure to see if there are any obvious design flaws.

Beyond that, as far as I know, Eduardo is correct that you pretty much need to be able to run a debugger on the developer's source code to find out exactly what the real-time queries are doing...

忘你却要生生世世 2024-07-13 13:59:43

如果没有开发人员的帮助,这是不可能的。 对不起。

It is not possible without the help of the developers. Sorry.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文