开发者

SQL Server - Query logs?

开发者 https://www.devze.com 2023-01-28 00:13 出处:网络
any idea where I can read logs of recent queries? Errors are coming back when using Django for queries that seem to be alright, and cannot understand what is wro开发者_如何学Pythonng.

any idea where I can read logs of recent queries?

Errors are coming back when using Django for queries that seem to be alright, and cannot understand what is wro开发者_如何学Pythonng.

Any ideas?


As I understanded you need MS SQL Profiler. But it log only new queries.


There are no logs of recent queries. You can use SQL Profiler / SQL Trace to monitor queries ongoing though.

You can also look in sys.dm_exec_cached_plans for recent plans and associated text which might help depending on whether the error was a parse/compilation error or not.

select text from
sys.dm_exec_cached_plans
cross apply sys.dm_exec_sql_text(plan_handle)


If you are using SQL Server 2005 and above, you can track the DDL queries using the Default Trace.

0

精彩评论

暂无评论...
验证码 换一张
取 消