0

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?

leemicw
  • 751
  • 8
  • 15

1 Answers1

1

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

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

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

Rizwan
  • 318
  • 1
  • 5
  • Per your suggestion I removed the database from `Azure Managed Instance`, using `PowerShell` and it worked great. Thanks for sharing your thoughts. – nam Oct 04 '20 at 22:23