我有一个由两个实例组成的 Windows Azure 角色。有时,事务会失败,并出现带有以下文本的 SqlException
事务(进程 ID N)在锁资源上与另一个进程发生死锁,并被选为死锁牺牲品。重新运行事务。
现在我已经用谷歌搜索了一段时间并阅读了 这篇文章是关于使用 SQL Server 日志识别死锁的。
问题是...
我该如何在 SQL Azure 中做到这一点?我使用什么工具来访问 SQL Azure 的内部并获取足够的数据?
I have a Windows Azure role that consists of two instances. Once in a while a transaction will fail with an SqlException
with the following text
Transaction (Process ID N) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
Now I've Googled for a while and read this post about identifying deadlocks using SQL Server logs.
The problem is...
How do I do it in SQL Azure? What tools do I use to access the internals of SQL Azure and getting enough data?
发布评论
评论(3)
SQL Azure 的监控比 SQL Server 受到更多限制,但您可以更方便地查看这些工具:
http://social.technet.microsoft.com/wiki/contents/articles/troubleshoot-and-optimize-queries-with-sql-azure.aspx
Monitoring of SQL Azure is more limited than SQL Server, but the tools are becoming more available for you to look underneath:
http://social.technet.microsoft.com/wiki/contents/articles/troubleshoot-and-optimize-queries-with-sql-azure.aspx
在 SQL Azure 数据库中的“Master”数据库上运行以下查询,
此查询存在性能问题,如果超时请尝试以下操作,
第二个查询包含与正在执行的进程相关的 XML 格式的数据。祝你好运!
Run the following query on "Master" database in SQL Azure db,
There was a performance issue with this query, if it gets timed out try following,
Second query has data in XML format relating to the processes being executed. Good luck!
现在,Azure SQL 数据库支持两种获取死锁 xml 报告的方法。您可以使用database_xml_deadlock_report事件创建一个db范围的XE会话来自己跟踪它们,或者您可以修改先前答案中的sys.fn_xe_telemetry_blob_target_read_file调用以使用“dl”而不是“el”。死锁现在被路由到自己的文件,而不是与登录事件混合在一起。
这篇 MSDN 文章包含最新的信息。
Now Azure SQL database supports two ways to get deadlock xml reports. You can create a db-scoped XE session with the database_xml_deadlock_report event to track them yourself, or you can modify the sys.fn_xe_telemetry_blob_target_read_file call from the earlier answer to use 'dl' instead of 'el'. Deadlocks are now routed to their own file instead of being mixed in with login events.
This MSDN article has the latest information.