简体   繁体   中英

How do you drop an in use database in Azure Sql Managed Instance?

When we ran Sql Server in a virtual machine we were able to use the following sql to drop in use databases.

use master
ALTER DATABASE [TargetDatabase] set single_user with rollback immediate;
Drop database [TargetDatabase]

According to the Managed Instance Documentation and our testing set single_user is not supported. Is there an alternative way to drop in use databases?

I would recommend doing it using powershell. That is more efficient and goes through checks

https://docs.microsoft.com/en-us/powershell/module/az.sql/remove-azsqlinstancedatabase?view=azps-3.5.0

Remove-AzSqlInstanceDatabase -InstanceName '' -ResourceGroupName '' -Name '' -Verbose

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM