question

MartinekJiri-1931 avatar image
0 Votes"
MartinekJiri-1931 asked OuryBa-MSFT commented

Import database to Azure SQL database - How to prevent error?

I have bacpac file importable to azure by SQL management studio (tested), but I wish to use the import database functionality in Azure in SQL server blade.
Success never happens - nothing is displayed in export/import history.
Although database is created and it is blank without structure and without data.
But there is error in activity log - of course saying nothing to me :
Create Deployment fails - inside the step is this:
Operation name Performs a database extension operation.
Time stamp Mon May 09 2022 10:30:54 GMT+0200 (Central European Summer Time)

Error code InternalServerError
Message An unexpected error occured while processing the request. Tracking ID: '5bef29b3-f111-4217-821e-b9eba778552e'

There is Internal Server Error (HTTP Status Code: 500) in JSON.

Does the import work at all? What are the success conditions?
Thank you.

azure-sql-database
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AlbertoMorillo avatar image
0 Votes"
AlbertoMorillo answered

Please allow me to suggest you the easiest path to migrate to Azure SQL. Use Data Migration Assistant (DMA) to perform an assessment of the database to migrate to Azure and after eradicating blocking points you can use the same tool to migrate the database without the need to deal with bacpac validations.

Importing bacpacs you may lose a huge amount of hours but with DMA the migration journey is easier and almost no time consuming.



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MartinekJiri-1931 avatar image
0 Votes"
MartinekJiri-1931 answered

I have used DMA for the first migration, but now I need establish regular process for dev/test team to migrate prod (SQL in Azure VM ) to test (Azure SQL database).

Thinking the import must somehow work - or ... :)

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AlbertoMorillo avatar image
0 Votes"
AlbertoMorillo answered AlbertoMorillo edited

Let me know if this PowerShell script helps you automate the task successfully. If import is sucessfull using Azure PowerShell instead of the portal.

Alternatively, you can use sqlpackage utility from the VM command line. This can later be automated using Windows scheduled tasks.

 sqlpackage.exe /a:import /tcs:"Data Source=<serverName>.database.windows.net;Initial Catalog=<migratedDatabase>;User Id=<userId>;Password=<password>" /sf:AdventureWorks2008R2.bacpac /p:DatabaseEdition=Premium /p:DatabaseServiceObjective=P6

 sqlpackage.exe /Action:Import /tsn:sqlsrv1.database.windows.net /tdn:worldwide /tu:morillo /tp:MySecretPwd /sf:c:\sql\WideWorldImporters-Standard.bacpac





5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MartinekJiri-1931 avatar image
0 Votes"
MartinekJiri-1931 answered OuryBa-MSFT commented

Still no success, but based the New-AzureRmSqlDatabaseImport - something is saying to me ... it probably doesn't support database and storage account in different subscriptions .. does it ?

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

You don't need an Azure Storage Account to import a bacpac to Azure SQL Database. See example below importing the bacpac from a local drive:

 sqlpackage.exe /Action:Import /tsn:sqlsrv1.database.windows.net /tdn:worldwide /tu:morillo /tp:MySecretPwd /sf:c:\sql\WideWorldImporters-Standard.bacpac


0 Votes 0 ·

@MartinekJiri-1931 Please do not forget to mark as accept answer if the above reply was helpful. It will be helpful of others community members facing the same.

Regards,
Oury

0 Votes 0 ·