Azure restore a SQL Server database from blob - azure

I am trying to restore a SQL Server database in Azure from a database backup file stored in a blob. I have followed this link but got this error
TITLE: Microsoft SQL Server Management Studio
An error occurred while loading data.
ADDITIONAL INFORMATION:
The type of a blob in the container is unrecognized by this version. (Microsoft.SqlServer.StorageClient)
The remote server returned an error: (409) Conflict. (System)
I have also tried this:
CREATE CREDENTIAL mycredential1
WITH IDENTITY= 'jjt', -- this is the name of the storage account you specified when creating a storage account
SECRET = 'storage account key'
Then try to use the credential to restore the sql db from the azure blob, but failed on the above step with the following error:
Msg 40514, Level 16, State 1, Line 1
'CREATE CREDENTIAL' is not supported in this version of SQL Server.
What is the correct way?

You cannot use CREATE CREDENTIAL on Azure SQL Database, you need to create a CREATE DATABASE SCOPED CREDENTIAL as shown below:
CREATE DATABASE SCOPED CREDENTIAL UploadInvoices
WITH IDENTITY = 'SHARED ACCESS SIGNATURE',
SECRET = 'QLYMgmSXMklt%2FI1U6DcVrQixnlU5Sgbtk1qDRakUBGs%3D';
For more information, please read this article.
Additionally, you cannot restore a native SQL Server backup into an Azure SQL Database. The article you are making reference is restoring a bacpac. You can restore a bacpac into an Azure SQL Database.
Please create a bacpac of your SQL Server (on-premises) database using Microsoft SQL Server Management Studio (SSMS), make a right click on the database, choose Tasks, then choose Export Data-tier Application to create the mentioned bacpac. Once the bacpac has been created you can then import it to Azure SQL Database as a new database.
A better method to migrate your database from a SQL Server instance to Azure SQL database is using the latest version of Data Migration Assistant which you can download from here. This tool would perform an assessment of your SQL Server assessment, it will let you know about any adjustments you need to make to make the database compatible to Azure SQL Database. If the database is compatible, the tool will migrate the database to an Azure SQL Database logical server.

Related

ADF Unable to connect to Synapse Link SQL Pool External Tables

I am trying to create an ADF Linked Service connection to a Synapse Link Serverless SQL Pool connected to ADSL Storage. I can successfully get a connection but when I try and use a dataset to access the data I get a permission issue.
I can successfully access the data via Synapse studio :
This is the error I get when I use the data set in ADF.
I can also look at the schemas in SSMS , where they appear as External tables. But get a similar credential error at the same point.
Has anyone come across this issue please ?
There are a few pieces of information you haven’t supplied in your question but I believe I know what happened. The external table worked in Synapse Studio because you were connected to the Serverless SQL pool with your AAD account and it passed through your AAD credentials to the data lake and succeeded.
However when you setup the linked service to the Serverless SQL Pool Im guessing you used a SQL auth account for the credentials. With SQL auth it doesn’t know how to authenticate with the data lake so looked for a server scoped credential but couldn’t find one.
The same happened when you connected from SSMS with a SQL auth account I’m guessing.
You have several options. If it’s important to be able to access the external table with SQL auth you can execute the following to tell it how to access the data lake. This assumes the Synapse Workspace Managed Service Identity has Storage Blob Data Reader or Storage Blob Data Contributor role on the data lake.
CREATE CREDENTIAL [https://<YourDataLakeName>.dfs.core.windows.net]
WITH IDENTITY = 'Managed Identity';
Or you could change the authentication on the linked service to use the Managed Service Identity.

How to import a local SQL database back-up file to an Azure SQL server database?

I have a project that is running on a local SQLExpress server. I have exported my database to a .bacpac file.
I am trying to restore that DB to an Azure SQL server. So what I am trying to do is to create a DB on Azure using this back-up file.
How can I do that?
The easiest way to migrate a database to Azure SQL Database is using Data Migration Assistant (DMA). This tool performs an assessment first to verify the database does not use incompatible statements with Azure SQL Database, and it also migrate the schema and/or the data, as you wish. Download it from here.
I imported it through SSMS by connecting to my Azure SQL server and doing import data-tier application

Export Azure Managed Instance Database backup to storage account

I am looking for an alternative to :
New-AzureRmSqlDatabaseExport
For the purpose of taking Managed Instance Database backup and export it to storage account. The above command, I think supports only SQL Server.
Yes, your're right, Powershell command doesn't support export the Azure SQL managed instance for now, you could reference this document:Export to a BACPAC file using PowerShell:
Besides, the document also gives the other ways:
Exporting a BACPAC of a database from a managed instance using Azure PowerShell is not currently supported. Use SQL Server Management Studio or SQLPackage instead.
Export to a BACPAC file using the SQLPackage utility
Export to a BACPAC file using SQL Server Management Studio
(SSMS)
At least, you also can use T-SQL to backup the Azure SQL manage instance to Blob Storage:
First, you would need to store credentials that would be used to access Azure Blob Storage:
CREATE CREDENTIAL [https://myacc.blob.core.windows.net/testcontainer]
WITH IDENTITY='SHARED ACCESS SIGNATURE'
, SECRET = 'sv=2014-02-14&sr=c&sig=GV0T9y%2B9%2F9%2FLEIipmuVee3jvYj4WpvBblo%3D&se=2019-06-01T00%2A%3AZ&sp=rwdl';
Once you create a credential, you can backup any database using standard BACKUP T-SQL command:
BACKUP DATABASE tpcc2501
TO URL = 'https://myacc.blob.core.windows.net/testcontainer/tpcc2501.bak'
WITH COPY_ONLY
Reference this Azure blog: Native database backup in Azure SQL Managed Instance.
Hope this helps.

Creating a Azure Oracle Database and Import Database dump file placed in BLOB storage into Oracle Instance in Azure

I want to resolve below problems:
1) Take Database dump from a Oracle Database(On Prem)
2) Create a Oracle Database in Azure
3) Place the On Prem Database dump file on BLOB storage and import the database in the Azure Oracle Database.
For creating database dump, i am trying to use SQL Developer Database Export utility. But struggling with the output format.
For Azure Oracle DB, i have deployed Oracle Standard 12.2 from MarketPlace, but don't know how to create a DB and import DB using BLOB storage DUMP file
You could use Copy Activity in Azure Data Factory.
It supports Oracle Database connector and Azure Blob Storage connector.
Here is an official detailed guide about transferring data from or to Oracle DB on-prem.

'CREATE CREDENTIAL' is not supported in this version of SQL Server

I am still new to azure and need to migrate on premise databases to azure. I have created a blob storage but for sime reasons, I can't create a credential. See query below:
CREATE CREDENTIAL [https://mystorage.blob.core.windows.net/databases]
WITH IDENTITY = 'SHARED ACCESS SIGNATURE'
, SECRET = '?sv=2018-03-28&ss'
Then, am getting an error below:
Msg 40514, Level 16, State 1, Line 1
'CREATE CREDENTIAL' is not supported in this version of SQL Server.
I have searched many online resources but still nothing has helped me
Is there anything am missing out here? Please help
CREATE CREDENTIAL is only supported in Azure SQL Managed Instance. Azure SQL Database Managed Instance is a fully managed SQL Server Database Engine Instance hosted in Azure cloud. A full feature comparison between Azure SQL and Azure SQL Managed Instance can be found here.

Resources