VS SSDT project - Compare Azure & on-premises database - azure

Recently we have decided to move our old stuff from SQL Server 2012 to Azure SQL server. I have created a SSDT project using 'Import->Database' option and deployed existing database from SQL Server 2012 to Azure Database.
For some reason we must continue to use existing 'SQL Server 2012' database, so our DBA is changing schema on 'SQL Server 2012' database for new business features. In order to make sure that both the schema ( SQL Server 2012 and Azure SQL Server ) I am planning to use 'Schema compare' option. My source is on-premises 'SQL Server 2012' database and destination is 'Azure SQL Server' database.
After finishing comparison I am getting below error.
"A project which specifies SQL Server 2012 as the target platform cannot be published to SQL Azure."
Is there any way for comparing on-premises database with SQL Azure and push changes to Azure db suing SSDT ?

In the Schema Compare window, click the Options button, go to General, and select "Allow incompatible platforms". This will allow you to compare different platforms such as this. Similarly when publishing you can select this in the Advanced publish options.
I would actually recommend setting the target platform for your database project as Azure rather than SQL 2012, as it enforces a more restrictive set of rules than SQL 2012 does at present. You should be able to deploy anything built with Azure validation to SQL 2012, but the same isn't true the other way around. The same "Allow incompatible platforms" setting will work that way too.

Related

Is Sql Server 2017 Available on Azure Db?

I have a sql server database running on Azure. Is it possible yet to upgrade this to Sql Server 2017?
I have searched, but only found data on running 2017 in a VM.
I looked in the Portal, but I did not see any option for specifying the version of Sql Server.
"Upgrade" is the wrong word. SQL Azure runs a newer version of SQL than SQL Server 2017. As such, even if were to get the file from SQL Azure (it is not exposed as a feature to do this), SQL 2017 would not be able to open it. (A later version of SQL Server might be able to read it, however). You are welcome to export a SQL Azure database using the Import/Export service to logically copy the database out. You can also use Data Sync or other replication techniques to export the data as it changes.
https://learn.microsoft.com/en-us/sql/relational-databases/import-export/overview-import-export?view=sql-server-2017
https://learn.microsoft.com/en-us/azure/sql-database/sql-database-get-started-sql-data-sync
The closest direct answer is:
It is based on the latest stable version of Microsoft SQL Server database engine.
This is quoted from the first paragraph on https://learn.microsoft.com/en-us/azure/sql-database/sql-database-technical-overview
Additionally, if you are using SSMS 18, or Azure Data Studio, you should be able to change the compatibility level of the database to a higher level such as 150 for SQL Server 2019.
Azure SQL database and AZure SQL Managed Instance use a different versioning than the On- premises product.
For example: Microsoft SQL Azure (RTM) - 12.0.2000.8 Aug 5 2019 05:50:58 Copyright (C) 2019 Microsoft Corporation
The above version is from a Managed instance and Azure SQL also has same version :
As explained by Conor, under the hood it runs the latest possible SQL Server version.
If you want SQL Server 2017 specifically,the you might need to try Azure VM with SQL Server 2017 installed.
As 2019-08-26 Microsoft states the version used in Azure SQL is v12 which corresponds with Azure SQL Server 2014 (source: https://learn.microsoft.com/en-gb/azure/sql-database/sql-database-technical-overview#sql-database-frequently-asked-questions-faq)
It seems we have no upgrade option available.

How can I deploy my database from SQL Server 2008 Express to Azure SQL Database

I am using Visual Studio Community 2013, SQL Server 2008 R2 Express Edition for an MVC web application using entity framework code first migrations for my database.
I am trying to get my local application hosted on the Microsoft Azure platform.
I have registered for a trial account which expires in 30 days, and deployed my MVC5 app out which has been successful.
However, this app requires a database which I am struggling to deploy.
What is the easiest way to get my database deployed out to Azure as I do not seem to have the :
"Tasks" -> "Deploy Database to Microsoft Azure SQL Database" option available to me in SSMS.
I have extracted a Data-tier Application of my local database and have it stored on my C drive, however if I connect to my Azure Account in a second window, and right click the server then select Deploy Data-tier Application, it fails on "Creating schema object in database" with the following error:
TITLE: Microsoft SQL Server Management Studio
An exception occurred while executing a Transact-SQL statement or
batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------ ADDITIONAL INFORMATION:
Users cannot be mapped to certificates, asymmetric keys, or Windows
logins in this version of SQL Server. (Microsoft SQL Server, Error:
40528)
I'm assuming its tried to create my local account plus the IIS APPPOOL account I had to set up to host the website on my local network, however I do not see a way of removing them from the .dacpac export.
When I refresh the Databases node, there is still no database, I'm fairly lost now as to how I might get my db deployed to this server?
If you can extract a compatible Data-tier application and then Deploy it to your target server using your current version of Management studio, then this approach should work, see this link for more reading on ensuring your database is compatible.
Failing this, as was in my case. I downloaded Management Studio 2015, which gave me the option to deploy database to Azure by simply right clicking the required database.
Again, this threw up the error regarding my database level IISAPPOOL user, but not my server account user. As a way around this, I took a backup/restore of the database and removed this user then deployed the copy database obviously minus the problem account.
Now all that was left to do was add a transform to my Release web.config with the Azure connection string as provided on the Azure dashboard, and re-deploy the website.
Problem solved.

SSMS 2014 can't deploy databases to SQL Azure

I am trying to deploy my sql server 2014 database to SQL Azure using SQL Server Management Studio (SSMS) 2014 and i get the following error:
I selected a Business edition while selecting which SQL Edition in the Sql deploy Wizard.
If you're trying to deploy to the Business tier, it's now retired. The wizard may not be updated to reflect this change. The tier that you will want to select for similar performance is probably one of the Standard tiers, but Premium is also available. For more information, view https://azure.microsoft.com/en-us/blog/azure-sql-database-introduces-new-service-tiers/
Upon further checking (see below) it seems that the tools are not upgraded to reflect the current tiers. So the problem is with SSMS in this case.

I can't manage a server in SQL Azure

I have two servers in my SQL azure Portal. One of them allow me "manage", so I can login and manage my database. However, in the other one the button "manage" don't display. In this server just two options are displayed.
What can I do?
I hypothesize that one server is of version v11 and the other is v12.
Clicking the ‘Manage’ button in Azure Management portal launches the SQL Azure Management (SilverLight) Portal in a new tab in the browser. At this time, we do not plan to support this SilverLight-based SQL Azure Management Portal with V12 databases and servers.
We are working hard on an HTML-based T-SQL editor experience that will deeply integrate with the preview Azure Management Portal. Until then, we encourage customers to use Visual Studio Community 2013 which is a full-featured free version of Visual Studio 2013 to connect to Azure SQL databases for tasks such as running T-SQL, designing schema and for offline and online database development.
You can click the the ‘Open in Visual Studio’ in the database page in the Azure Management portal to launch VS2013 on your computer and easily connect to your SQL Database.
In addition, you can also use SQL Server Management Studio 2014 with CU6 to connect to Azure SQL Database. More details are on this blog post.

How to restore my Local database to Windows Azure Database?

I have uploaded my application to Windows Azure Now I want to store My Local database to Windows Azure Database.
Please Suggest me how do I create table and backup the table there?
There are couple of ways to do that:
The most reliable (that I usually use) is using the SQL Azure Migration Wizard
Then you have the "Generate Scripts" option in your SSMS (SQL Server Management Studio 2008 R2 or later). The generate Scripts option does have a feature to make SQL Azure compliant script. It can also script data. But I suggest using method one if you want to migrate data, too. SQL Azure Migration Wizard uses BCP tool, which dumps the data into binary files, while SSMS just generates inline INSERT Statements
SSIS (SQL Server Integration Services) - you can create a Data Transfer task, but I would use it very rare for small DBs.
Export/Import data tier application (using DACPAC package) - this will migrate your schema and can migrate your data as well.
UPDATE 2017-10-24
Azure SQL Database now supports transactional replication from your on-premises SQL Server. You can configure your Azure SQL Database as subscriber and your SQL Server on-premise as publisher. You can read more about database migration options and strategies here: https://learn.microsoft.com/en-us/azure/sql-database/sql-database-cloud-migrate
Update 2017-12-23
SQL Azure Migration Wizard has been replaced by Data Migration Assistant: https://learn.microsoft.com/en-us/azure/sql-database/sql-database-cloud-migrate
If you already have a database on local machine then you can migrate it directly on Azure using SQL Management Studio. Follow these steps:
Right click on the database name in SSMS
Follow the wizard that appears then
There are a few ways in which to achieve this functionality.
SQL Azure Import/Export. "DACPAC" & "BACPAC"
Microsoft Codename "Data Transfer"
SQL Azure Data Sync Windows Azure SQL Data Sync
Migrating Databases using Import/Export Wizard in SSMS
SQL Azure Migration Wizard (As Mentioned in other Answers)
I'm assuming you're referring to SQL Azure? If so, you'll probably want to use the SQL Azure Migration Wizard # http://sqlazuremw.codeplex.com/
SQL Server 2012 Management Studio and SQL Azure Tools also now has this option I believe.
In SSMS if you right click on the Databases root, there is an option "Import Data-tier Application...", which allows you to restore a BACPAC (you can also right click on a database, and select "Export Data-tier Application..." to export an existing database to a BACPAC).
SQL Server Data Tools enables Visual Studio 2010 with a Data Compare option, which can also be used to move data between two database instances (which would be suited to smaller data patches).

Resources