Import into Azure - Could not import package, Unable to connect to target server - azure-sql-database

I am trying to move a small database from the SQL Server Express on my PC to SQL Azure.
I exported the BACPAC file successful to a storage container. On Azure side, I + New, Data Services, SQL Database, Import and used the UI to select the BACPAC file in the storage container. I gave the database a name and selected an existing SQL Server in my subscription.
After a minute or so, I get:
Import database 'xxxx' failed
Successfully retrieved the BLOB storage access key.
Successfully submitted the import request: operation ID 14a9d202-4a22-4b41-beae-cca2ddb877c8.
Import database 'xxxx' failed
Error encountered during the service operation. Could not import package. Unable to connect to target server.
What does the error message mean and what target server is it referring to?

When submitting an import request for Azure SQL Database, you will need to select the source BACPAC file from an Azure Storage container, and provide the SQL Authentication to log in to the SQL server you are trying to import into. The import operation will proceed as follows:
Attempt to retrieve the BLOB (aka the BACPAC file) from Azure Storage.
Submit the request to Azure SQL.
Attempt to log in, with SQL server authentication, to the target database server you want to import into.
Create an empty database to import the BACPAC file into.
Run the import operation to insert all data from the BACPAC file into the new database.
As mentioned in my comment above, the SQL Authentication provided was incorrect. This resulted in Azure to be unable to log in to the SQL server and connect in the third step.

Related

Moving SQL Data into Azure SQL PaaS

I have a database in the SQL Server installed on Azure VM. DB Size is 2 GB.
How and what is the best approach to move all data into Azure SQL PAAS Service?
While the method posted by #Harris Xu is absolutely correct, I am adding the issues which I faced when I migrated my 500+ GB SQL Server DB from Azure VM to PaaS using .bacpac method.
Azure SQL DB is in a away limited when compared to On-prim SQL Server or SQL Server on VM's.
You will not face these issues while creating the .bacpac file but when you try to import, it might give some of the following compatibility issues.
Master Keys , Symmetric Keys, Service Queues and certificates cannot
be migrated to cloud. Drop them before preparing bacpac.
Drop orphaned Users.
If you are using XP_CMDSHELL, Trace Flags, DBCC commands or column store indexes, you got to remove them too.
Cross DB Queries are not allowed on Azure SQL DB. Remove all occurrences of ..
If you are calling an API from your stored proc then that too is not possible in Azure SQL DB. As a workaround you can use Logic Apps on Azure.
Moreover, Microsoft Migration assistant can help you find compatibility issues before hand too. You can download it here.
NOTE : This no way the full list of issues, I faced them because I was using all above features, if you are not using them you will not face them.
SQL Migration using data-tier application export/import (BACPAC)
The BACPAC file encapsulates the database schema as well as the data stored in a database application that can be simple imported to an Azure SQL Database.
Workloads using the source database need to be taken offline during the export process to ensure that the exported BACPAC file contains all data in a complete and consistent state.
Export to bacpac file in SQL Server Management Studio (SSMS)
You can follow this post.
Open and connect database file in SQL Server Management Studio (SSMS).
To export a database file, right click on the name of the database. In the context menu, select Tasks > Export Data-tier Application.
The option will open the wizard. Click Next> Introduction page and go to the Export Settings.
Import a bacpac file to Azure SQL
After you connect to your Azure sql, go to Object Explorer pane, right click the database, and select Import Data-tier.
The option will open the wizard. Click Next> Introduction page and go to the Import Settings.
The Import settings are requested to the bacpac file to import.

Not able to delete Azure SQL database

I have created one database from ssms 2017 version on azure sql server with .bacpac file, but when I am trying to access it from azure portal it is not showing under azure sql server instance. But when I am login into that instance with SSMS it is showing that database. Need help on this, can anyone face this problem.
regards
Sandy
I did the same operation successfully. I imported a new database with a BACPAC file to my Azure SQL Database. Please reference my steps:
connect to my Azure SQL Database instance with SSMS, right-click Databsse, choose Import Data-tire Application. I import the DB2 database from my BACPAC files.
Import Settings.
Complete the import. After the import job finished, we can see the database DB2.
Check the database on Azure Portal. Login my portal, choose the SQL server which our database instance host on in home page.
Click in the SQL server and we can find the new database DB2.
My SSMS version is the latest v17.9.1.
Hope this helps.
From azure portal I raise ticket regarding this issue, they solved my problem. Added my Azure Sql database to my subscription. During .bacpac file restore some issue occur due to which it wasn't show on portal. Also I am able to delete that datbase from SSMS generated delete script for database.

Import data tier application using bacpac

I had Export my Database backup from Azure DB in .bacpac form successfully, but when I'am going to import that .bacpac it will throw an error.
You probably had blob auditing enabled on your Azure SQL, right?
Please have a look at this article: Exported database from Azure SQL failed to be imported to Azure SQL or to local SQL Server
Taken from that article:
The cause:
This caused by a different behavior between Azure SQL DB and Local SQL Server installation
a master key without password is an Azure SQL DB only feature, while local SQL Server installation must have password encryption for master key.
Resolution:
Option 1
to mitigate import to Azure SQL DB use the import from the Azure portal.
to mitigate import to local SQL Server installation you can alter the existing master key and add password encryption to it.
this should be done before you export the database
ALTER MASTER KEY ADD ENCRYPTION BY PASSWORD = '<PasswordHere>';
Option 2
for short term mitigation we provide you PowerShell script that do the following:
remove the master key object from the bacpac
remove the credential object from the bacpac
after running this PS script on the bacpac you will have new bacpac file with "patched" suffix.
Before exporting your database as bacpac you need to do the following steps:
Disable Database Auditing if you have it enabled.
Drop the database master key with DROP MASTER KEY command.
After that export your database again and import it on your local SQL Server.
I successfully resolve this issue, first I execute CREATE MASTER KEY script in azure db instance, then export that Database. And then import that database to local SQL server.

How to import SQL database from file to Azure

How to load my SQL database created in MySQL Workbench on Azure cloud?
I created a database which consists of some tables - for now, there is now data in them, it's just a small script created by MySQL Workbench. I also created a database on Azure cloud, created login & password and when I want to use 'automated export' option (I have Storage account, I enter valid login with password) I have error:
'Could not find any bacpac files in the specified storage account.'
I tried google this phrase but I completely do not understand the idea behind these bacpac files and I do not know what to do with it. Can anyone describe me step-by-step how to put my database on Azure cloud?
I want to connect to this DB on Azure in the future because I would like to do a webapplication and android app which will use a remote DB available online.
Azure SQL Database is a custom SQL Server, so if you want to use MySQL you should create a Clear DB (which is a Microsoft partner that offers MySQL on azure). Other option, you can create a Virtual Machine and install by yourself a MySQL.
After that, you can import your tables / records.

Internal error import BACPAC file to windows azure sql database

I am using MSSQL2014 version CTP2.
Running my databases through Windows Azure SQL Database management.
I've created a BACPAC file via MSSQL of my local database and want to import it to Windows Azure.
I create the BACPAC file and upload it to my BLOBSTORAGE container.
In Windows Azure click SQL DATABASES
Bottom left click New
Click IMPORT
Choose my BACPAC URL which is the file contained in my BLOBSTORAGE
Name the DB and choose the server
Click the tick
I then get this error:
Error encountered during the service operation. Could not import
package. Internal Error. The database platform service with type
Microsoft.Data.Tools.Schema.Sql.Sql120DatabaseSchemaProvider is not
valid. You must make sure the service is loaded, or you must provide
the full type name of a valid database platform service. Internal
Error. The database platform service with type
Microsoft.Data.Tools.Schema.Sql.Sql120DatabaseSchemaProvider is not
valid. You must make sure the service is loaded, or you must provide
the full type name of a valid database platform service.
I can create a new database via Windows Azure which is fine but I'm trying to get my DB up because it has all my data in it.
What am I doing wrong?
I believe the issue was that I needed to assign the same DB owner to my db on my local machine as the one that was setup on my azure setup.