记录 ODBC、SQL Server

发布于 2024-08-31 07:55:24 字数 130 浏览 4 评论 0原文

如何记录、跟踪或获取应用程序通过 ODBC 驱动程序发送到 Microsoft SQL Server 2008 的查询(无需修改应用程序...)

也许可以使用 SQL Server 本身来完成,或者 ODBC 有一些查询日志记录?

How to log, trace or get queries that an application send to Microsoft SQL Server 2008 thru ODBC driver (without modifying application...)

Maybe it can be done with SQL Server itself or ODBC has some query logging?

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

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

发布评论

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

评论(2

别忘他 2024-09-07 07:55:24

@davispuh,您可以使用SQL Profiler 跟踪 SQL 语句。
您还可以使用 ODBC 跟踪

@davispuh, you can use the SQL Profiler to trace SQL statements.
you can also use the ODBC Tracing.

闻呓 2024-09-07 07:55:24

使用 SQL-Profiler 创建跟踪:

  1. 在 SQL-Profiler 的“文件”菜单上,单击“新建跟踪”,然后连接到
    SQL Server 的实例。将出现“跟踪属性”对话框。
  2. 在“跟踪名称”框中,键入跟踪的名称。
  3. 在“使用模板”列表中,选择要在其上使用的跟踪模板
    将迹线作为基础,或者如果您不想使用模板,则选择“空白”。
  4. 如果您不使用模板,您可以点击显示所有事件复选框并选择您想要跟踪的事件,您可以在其中选择是否跟踪错误、登录等。有关详细信息,请参阅:指定跟踪文件的事件和数据列 (SQL Server Profiler) 例如,您有一个错误和警告类别,其中包括特殊错误事件。

有关详细信息,请参阅文档

如果您需要执行此操作对于 ODBC,您可以检查以下两个主题:

  1. 配置驱动程序性能数据 ( ODBC)
  2. 记录长时间运行的查询 (ODBC)

希望这有帮助。

To Create a Trace using SQL-Profiler:

  1. On the File menu of SQL-Profiler, click New Trace, and connect to an
    instance of SQL Server. The Trace Properties dialog box appears.
  2. In the Trace name box, type a name for the trace.
  3. In the Use the template list, select a trace template on which to
    base the trace, or select Blank if you do not want to use a template.
  4. If you do not use a template you can hit the Show all Events checbox and choose which events you would like to trace, there you can choose if errors, logins etc are traced. For more information take alook at: Specify Events and Data Columns for a Trace File (SQL Server Profiler) for Example you have a category there Errors and Warnings which include special Error events.

For more information see the documentation

If you need to do this for ODBC you can check the following two topics:

  1. Profile Driver Performance Data (ODBC)
  2. Log Long-Running Queries (ODBC)

Hope this helps.

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