Reputation: 104821
I want to be able to see all the queries that has been executed on the server last 2 days etc.
see the script, date of execution, sender etc. is there any way?
I am using SQL X 2005.
Upvotes: 1
Views: 84
Reputation: 8274
Yes you can use SQL-Trace to log each command submitted to the server. 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. 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"
Upvotes: 1
Reputation: 32851
Here is a free, open-source Profiler tool that might help.
Profiler for Microsoft SQL Server 2005/2008 Express Edition
Upvotes: 1
Reputation: 14743
I don't believe it's possible without SQL Server Profiler running.
Upvotes: 2