Search code examples
azure-sql-database

How can i restore an Azure SQL Database?


I have a bacpac file and am trying to restore. Now this file is about 11g compressed so it a 130G database. Or should i create a .bak full backup ?

I have tried Azure restore , I have tried powershell , I have tried sqlpackage , I have tried SSMS and nothing seems to work , I am getting some memory error or process cant be completed error.

Surely if we can backup to bacpac we can restore .

How can i do this ? any help would be appreciated.

UPDATE:

let "randomIdentifier=$RANDOM*$RANDOM"
location="East US"
resourceGroup="msdocs-azuresql-rg-$randomIdentifier"
tag="backup-database"
server="msdocs-azuresql-server-$randomIdentifier"
database="msdocsazuresqldb$randomIdentifier"
login="azureuser"
password="Pa$$w0rD-$randomIdentifier"
storage="msdocsazuresql$randomIdentifier"
container="msdocs-azuresql-container-$randomIdentifier"
bacpac="backup.bacpac"

az sql db export --admin-password $password --admin-user $login -- 
storage-key $key --storage-key-type StorageAccessKey --storage-uri 
"https://$storage.blob.core.windows.net/$container/$bacpac" --name 
$database --resource-group $resourceGroup --server $server

Solution

  • My suggestion about this topic is to avoid importing bacpacs directly to Azure SQL. Restore the bacpac to its original SQL Server instance then use the Data Migration Assistant tool to perform an assessment first and verify there are no incompatibilities with Azure SQL on that database, if no incompatibilities exist the same tool can do the migration of the database for you. This is the easiest method to move a database to Azure SQL without the waste of time and the surprises that involve the use of bacpacs.