简体   繁体   English

有没有办法跟踪服务器执行的所有查询?

[英]Is there a way to track all the queries that has been executed by the server?

I want to be able to see all the queries that has been executed on the server last 2 days etc. 我希望能够查看服务器上最近2天执行的所有查询等。

see the script, date of execution, sender etc. is there any way? 看到脚本,执行日期,发件人等有什么办法吗?

I am using SQL X 2005. 我正在使用SQL X 2005。

如果没有运行SQL Server Profiler,我不相信这是可能的。

Here is a free, open-source Profiler tool that might help. 这是一个免费的,开源的Profiler工具,可能会有所帮助。

Profiler for Microsoft SQL Server 2005/2008 Express Edition 适用于Microsoft SQL Server 2005/2008 Express Edition的Profiler

Yes you can use SQL-Trace to log each command submitted to the server. 是的,您可以使用SQL-Trace记录提交给服务器的每个命令。 It's the same mechanism used by the profiler, but you do not have to have the profiler or any other tool to use it. 它与探查器使用的机制相同,但您不必使用探查器或任何其他工具来使用它。

There are two modes in which SQL Trace can run - in-memory buffer and disk file. SQL Trace可以运行两种模式 - 内存缓冲区和磁盘文件。 The former is only used by profiler, is not documented and should not be used. 前者仅由分析器使用,未记录且不应使用。 Use the disk-file mode. 使用磁盘文件模式。 The file can later on be opened on the same or different machine and even loaded into a table for analysis. 该文件稍后可以在相同或不同的机器上打开,甚至可以加载到表中进行分析。

To learn more go to this page: http://msdn.microsoft.com/en-us/library/ms191511.aspx and search for section titled "To perform monitoring tasks with SQL Trace by using Transact-SQL stored procedures" 要了解更多信息,请访问此页面: http//msdn.microsoft.com/en-us/library/ms191511.aspx并搜索标题为“使用Transact-SQL存储过程使用SQL跟踪执行监视任务”的部分

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM