在 SQL Server 2008 Express 数据库上记录所有查询? [英] Logging ALL Queries on a SQL Server 2008 Express Database?

查看:29
本文介绍了在 SQL Server 2008 Express 数据库上记录所有查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法告诉 SQL Server 2008 Express 将每个查询(包括每个 SELECT 查询!)记录到一个文件中?

Is there a way to tell SQL Server 2008 Express to log every query (including each and every SELECT Query!) into a file?

这是一台开发机器,所以记录选择查询的负面影响不是问题.

It's a Development machine, so the negative side effects of logging Select-Queries are not an issue.

在有人建议使用 SQL Profiler 之前:这在 Express 中不可用(有人知道它在 Web 版中是否可用吗?)我正在寻找一种即使我不在时也可以记录查询的方法.

Before someone suggests using the SQL Profiler: This is not available in Express (does anyone know if it's available in the Web Edition?) and i'm looking for a way to log queries even when I am away.

推荐答案

SQL Server Profiler:

SQL Server Profiler:

  • 文件 → 新建跟踪
  • 显示常规"选项卡.
  • 在这里您可以选择保存到文件:"以便将其记录到文件中.
  • 查看事件选择"标签
  • 选择要记录的项目.
  • TSQL → SQL:BatchStarting 将为您提供 sql 选择
  • 存储过程 → RPC:Completed 将为您提供存储过程.

来自 Microsoft 的更多信息:SQL Server 2008 联机丛书 - 使用 SQL Server Profiler

More information from Microsoft: SQL Server 2008 Books Online - Using SQL Server Profiler

更新 - SQL Express 版:

有人评论说 MS SQL Server Profiler 不适用于 Express 版本.
似乎确实有一个免费的替代方案:Microsoft SQL Server 2005 Express Edition 的分析器

A comment was made that MS SQL Server Profiler is not available for the express edition.
There does appear to be a free alternative: Profiler for Microsoft SQL Server 2005 Express Edition

这篇关于在 SQL Server 2008 Express 数据库上记录所有查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆