4

When the RESTORE command is executed on Azure SQL Database Managed Instance it cannot be stopped because this is executed asynchronously:

RESTORE DATABASE wwidb FROM URL =
  'https://mitutorials.blob.core.windows.net/databases/WideWorldImporters-Standard.bak'

How can we cancel this request? The database is in the restoring state (sometime shown with GUID name) and cannot be dropped. The request cannot be canceled until it finishes.

np_6
  • 514
  • 1
  • 6
  • 19
Jovan MSFT
  • 13,232
  • 4
  • 40
  • 55

1 Answers1

3

During restore, the database is registered in Managed Instance using their physical name. Once restore finishes, physical name will be replaced with the name placed in the RESTORE command.

The only way to cancel the request is to drop the database via Azure CLI or Azure PowerShell using the name specified in the RESTORE command:

Azure CLI:

az sql midb delete -g my_resource_group --mi myInstance --name wwi

Azure PowerShell

Remove-AzSqlInstanceDatabase -Name "wwi" -InstanceName myInstance1 -ResourceGroupName my_resource_group
Jovan MSFT
  • 13,232
  • 4
  • 40
  • 55
  • Another way seems to be by killing the other SPID (the one with ApplicationName="RestoreService"), which is running the RESTORE command internally. – Razvan Socol Feb 01 '20 at 05:03