DBAtlas · Database operations atlas

3702: Cannot drop database because it is currently in use

SQL Server

What 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.

Open in DBAtlas →

More from this engine