3702: Cannot drop database because it is currently in use
SQL ServerWhat does it mean?
An attempt was made to drop or rename a database, but it was rejected because the database is still in use by active connections. SQL Server cannot drop a database that is in use.
Why does it happen?
Other sessions (an application pool, an open SSMS tab, background jobs) are connected to the database being dropped. Even your own session having that database as its context (USE) can trigger it. Open connections from monitoring/backup tools are also a common cause.
How to fix it
Switch to another database before dropping (USE master;). Find and close the connected sessions, or first put the database in single-user mode: ALTER DATABASE [db] SET SINGLE_USER WITH ROLLBACK IMMEDIATE; then run DROP DATABASE [db]; Stop application connection pools and make sure monitoring tools are not opening connections.
More from this engine
- 8645A time out occurred while waiting for memory resources to execute the query
- 8651Could not perform the operation because the requested memory grant was not available
- 5061ALTER DATABASE failed because a lock could not be placed on database
- 15138The database principal owns a schema in the database, and cannot be dropped
- 1934INSERT/UPDATE failed because the following SET options have incorrect settings
- 468Cannot resolve the collation conflict
- 4864Bulk load data conversion error (type mismatch or invalid character)