2015-04-02 46 views
1

我試圖刪除數據庫(從Sql Server Management Studio),我收到此錯誤:事務(進程ID)已被死鎖:SQL Server Management Studio中

Transaction (Process ID 52) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction. (.Net SqlClient Data Provider)

我GOOGLE了很多(有很多結果也在這裏),但我找不到任何解決方案。

我真的需要刪除(並恢復這個分貝),但我被困住了。

有什麼建議嗎?

+0

你試過了嗎?死鎖條件通常是暫時的,通常在死鎖解決後不久就會消失。 – RBarryYoung 2015-04-02 20:45:21

+1

等一下,你正試圖刪除一個數據庫並導致死鎖?你的意思是TABLE嗎? – 2015-04-02 20:50:13

+0

@KrisGruttemeyer:不,不,我的意思DATABASE – ff8mania 2015-04-02 20:54:27

回答

0

我想你已經打開了交易。例如,對於數據庫StackOverflow我這樣打開一個交易:

USE StackOverflow 
BEGIN TRAN 

USE StackOverflow 
exec sp_whoisactive 

enter image description here

所以,當我嘗試刪除它:

enter image description here

我收到以下錯誤:

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

Cannot drop database "StackOverflow" because it is currently in use. (Microsoft SQL Server, Error: 3702)

如果我從刪除界面選擇close existing connections數據庫被成功刪除。

+0

是我的想法,但正如你看到我的錯誤不是很清楚:( – ff8mania 2015-04-02 21:31:26

相關問題