Is it possible to restore a SQL Server database in Azure? - sql

I have a backup of a SQL Server 2008 database. I'd like to restore it as an Azure SQL Server database. Is this possible?
P.S. I've seen a couple of questions to this effect from 2014. Is it possible today?

AFAIK, no it's not possible.
The Unsupported in SQL Azure doco https://azure.microsoft.com/en-us/documentation/articles/sql-database-transact-sql-information/ directs you to BOL and RESTORE shows it's not available in SQL Azure.
https://msdn.microsoft.com/en-us/library/ms186858.aspx

Are you able to restore the backup to an instance of SQL 2008 on-premises/locally first? If so you can then use management studio to Export the data and schema as a BACPAC or DACPAC file (export data tier application), which can then be imported into an Azure database using the Import data tier application. You can also use the Taks -> Generate Scripts option from the database node in the management studio, ensure you check on include schema and data - then the SQL files can be executed against your SQL Azure instance as well.
There are some features which aren't available in SQL Azure that are on the server product, but the import will tell you about those if there are any - things like FILESTREAM aren't supported in Azure. Here is the link to take you through steps to migrate from SQL server to SQL Azure - and here are the differences in supported features between the two.
I have some production databases in Azure and frequently download them as data tier apps, import them into a local instance of SQL Server to do some debugging or testing, its a painless process.

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.

Upload .db file to Azure SQL

I have a .db file, with a bunch of tables and data (and a few one to many relationships), instead of rewriting everything, is there a way for me to just upload this database directly to Azure SQL?
My suggestion is to install SQL Server Developer Edition on your laptop or local computer and import those database files to that SQL instance as explained here, if they are Dbase files.
Once you have imported the .dbf files to the local SQL Server instance, use SQL Server Management Studio to deploy the database to Azure as shown here and here, or you can use Data Migration Assistant to migrate to Azure as explained here.

SQL server to Azure process workflow migration

We are supporting a legacy system for our organisation. In the current scenario, we receive a SQL Server backup (.bak files) from the application vendor on an FTP location. For every weekend on Sunday it is a Full backup and for every other day its the differential one.
On our side, we have a SQL server instance running which has custom stored procedures written and scheduled to check the location every morning and then restore the backups every day. These restored backups are then used by the organisation for internal reporting purposes. There are 100s of other stored procedures written for different reports in different DBs on the same instance.
Since SQL Server 2008 is now out of support and for cost-saving purposes of running on-premise system, my team has been given a task to look into migrating this whole system to Azure SQL database.
My question is what is the most effective way in which we can move this workflow to the cloud? I have an azure trial account set up for me to try but haven't been successful in restoring the .bak files on Azure SQL instance.
Thanks.
You essentially have two options for Azure, either perform a fairly linear Lift and Shift to SQL Server on an Azure VM or go with a more advanced Azure PaaS offering in Azure SQL Database Managed Instance. The specific deployment Azure SQL Database (Single Instance) will not support your current solution requires with regard to the .bak file support, and I have detailed that below. For further details between the difference between Azure SQL Database Single Instance versus Managed Instance, please see: Features comparison: Azure SQL Database and Azure SQL Managed Instance
The second option, is to leverage the Azure Enterprise Ready Analytics Architecture (AERAA) (link) of Azure (PaaS) Analytics services. With Azure SQL Database (PaaS) services, as opposed to on-premise SQL Server or SQL Server on an Azure VM, there is no Integration Runtime or Analysis Services as a bundled service component. These services are separate PaaS offerings and with the help of the linked AERAA blog, you can gain a better understanding of the Azure Analytics services.
The .bak versus .bacpac support dilemma:
Since the main requirement for your solution is support of .bak files, you need to understand where .bak and where .bacpac files are supported. The term Azure SQL Database applies to both a specific deployment option for an Azure SQL database (PaaS) service and as a general term for Azure SQL cloud databases. As for the specific deployment option, Azure SQL Database (Single Instance nor Elastic Pools) will support your scenario with .bak files. This deployment option will support export/import functionality via .bacpac file format. It will not support full/partial restore functionality. The backup/restore functionality although configurable, is only in scope for the specific database hosted by an Azure SQL (logical) Server instance. Basically, you can not restore an external file. You can import, which is always a full copy. So, for that reason, for an Azure PaaS database service you will need Azure SQL Database Managed Instance for .bak file support or deploy an SQL Server VM image to an Azure VM, and migrate your objects via Azure Database Migration Service.
Regards,
Mike

Can't Export Data-tier Application for Azure

I am trying to create a .bacpac file of my SQL 2012 database.
In SSMS 2012 I right click my database, go to Tasks, and select Export Data-tier Application. Then I click Next, and it gives me this error:
Error SQL71564: Element Login: [myusername] has an unsupported property IsMappedToWindowsLogin set and is not supported when used as part of a data package.
(Microsoft.SqlServer.Dac)
I am trying to follow this tutorial so that I can put my database on Azure's cloud:
http://blogs.msdn.com/b/brunoterkaly/archive/2013/09/26/how-to-export-an-on-premises-sql-server-database-to-windows-azure-storage.aspx
How can I export a .bacpac file of my database?
SQL Azure doesn't support windows authentication so I guess you'll need to make sure your database users are mapped to SQL Server Authentication logins instead.
I found this post referenced below which seems to answer my question. I wonder if the is a way to do this without having to delete my user from my local database...
"... there are some features in on premise SQL Server which are not
supported in SQL Azure. You will need to modify your database before
extracting. This article and several others list some of the
unsupported features.
This blog post explains how you can use SQL Server Data Tools to
modify your database to make it Azure compliant.
It sounds like you added clustered indices. Based on the message
above, it appears you still need to address TextInRowSize and
IsMappedToWindowsLogin."
Ref. http://social.msdn.microsoft.com/Forums/fr-FR/e82ac8ab-3386-4694-9577-b99956217780/aspnetdb-migration-error?forum=ssdsgetstarted
Edit (2018-08-23): Since the existing answer is from 2014, I figured I'd serve it a fresh update... Microsoft now offers the DMA (Data Migration Assistant) to migrate SQL Server databases to Azure SQL.
You can learn more and download the free tool here: https://learn.microsoft.com/en-us/azure/sql-database/sql-database-migrate-your-sql-server-database
As of 9/2018, there is a new tool called the Data Migration Assistant that can help with the task of migrating an existing on-premise SQL Server Database to Azure. While the tool will NOT resolve the issue of migrating Windows Logins, it will at least help you get your database schema and data migrated up to Azure.
Here is the overview of the tool: https://learn.microsoft.com/en-us/sql/dma/dma-overview?view=sql-server-2017
You can download the Data Migration Assistant here:
https://www.microsoft.com/en-us/download/details.aspx?id=53595
Once you have migrated your database up to Azure, you can configure an AD Administrator on the SQL Server, then create contained users in your database to allow users to login to your SQL Database with their Windows accounts.

Restore a SQL Server database from single instance to cluster

I need to transfer a database from a SQL Server instance test server to a production environment that is clustered. But SQL Server doesn't allow you to use backup/restore to do it from single instance to cluster. I'm talking about a Microsoft CRM complex database here.
Your help is greatly appreciated.
Have a look at the Microsoft SQL Server Database Publishing Wizard:
SQL Server Database Publishing Wizard
enables the deployment of SQL Server
databases into a hosted environment on
either a SQL Server 2000 or 2005
server. It generates a single SQL
script file which can be used to
recreate a database (both schema and
data) in a shared hosting environment
where the only connectivity to a
server is through a web-based control
panel with a script execution window.
If supported by the hosting service
provider, the Database Publishing
Wizard can also directly upload
databases to servers located at the
shared hosting provider.
Optionally, SQL Server Database
Publishing Wizard can integrate
directly into Visual Studio 2005
and/or Visual Web Developer 2005
allowing easy publishing of databases
from within the development
environment.
You don't have to use the server-side piece; the client-side 'create a script' piece is generally enough.