Dear colleagues,
I use SQL Server 2012. The exact version info is:
Microsoft SQL Server 2012 - 11.0.2100.60 (X64) Feb 10 2012 19:39:15 Copyright (c) Microsoft Corporation Standard Edition (64-bit) on Windows NT 6.2 <X64> (Build 9200: ) (Hypervisor)
I am flabbergasted. I try to drop a database, but that won't work because it says it is in use. But it isn't. I think I should no what to do, but actually I don't. Below, the SQL I use. Per statement, in the comment below, you can see the result. I cancelled the 'SET SINGLE_USER WITH ROLLBACK IMMEDIATE' after 4 minutes because nothing happened. This probably points to the real problem, but I cannot think what it is.
Kind Regards,
Chris Sijtsma
USE [master] GO EXEC msdb.dbo.sp_delete_database_backuphistory @database_name = N'Start10_64892_DB'; -- Commands completed successfully. -- Completion time: 2020-04-15T07:09:32.7893007+02:00 GO DROP DATABASE [Start10_64892_DB]; -- Msg 3702, Level 16, State 4, Line 9 -- Cannot drop database "Start10_64892_DB" because it is currently in use. -- Completion time: 2020-04-15T07:10:10.1496410+02:00 GO SELECT COUNT(1) FROM master.sys.sysprocesses p WHERE p.dbid = DB_ID(N'Start10_64892_DB'); -- Returns the value 0 GO ALTER DATABASE [Start10_64892_DB] SET SINGLE_USER WITH ROLLBACK IMMEDIATE; -- : -- Nonqualified transactions are being rolled back. Estimated rollback completion: 0%. -- Nonqualified transactions are being rolled back. Estimated rollback completion: 0%. -- Msg 5069, Level 16, State 1, Line 10 -- ALTER DATABASE statement failed. -- Query was canceled by user. GO