Remove-DbaDatabase
Chrissy LeMaire (@cl), netnerds.net
Remove-DbaDatabase View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Removes user databases using multiple fallback methods to handle stuck or locked databases. Description Removes user databases by attempting three different drop methods in sequence until one succeeds. First tries the standard KillDatabase() method, then attempts to set the database to single-user mode with rollback immediate before dropping, and finally uses the SMO Drop() method. This approach handles databases that are stuck due to active connections, replication, mirroring, or other locks that prevent normal removal.
Read more
dbatools