How to upload Visual Studio SQL server LocalDB to Azure - azure-sql-database

I just finished my first website on Visual Studio, using LocalDB with 30 tables and Identity. Then, I tried to move this website to Azure and I just got success to move the app. Unfortunately, the LocalDB is not recognized by Azure. What do I need to do to upload the database schemes and data?

You can migrate your on-premises database to Azure SQL database using SQL Server 2012(SQL Server 2017 and 2019 might face compatibility issues) and SQL Server Management Studio (SSMS).
Firstly, you need to attach your existing database with SSMS. Follow the link.
Follow the below steps in SSMS once your database attached.
Right click on the database you want to migrate. Select Task and from dropdown options select Deploy Database to Microsoft Azure SQL Database
Click on Next on pop-up window. On the very next window you will get options to connect your Azure SQL Server. Provide your Azure SQL server name, server credentials and click on Connect.
Provide the database name you want to give in Azure SQL Server. Fill the Azure SQL Database settings as per your requirement. Click on Next.
Lastly, you will get a summary of all the settings you have done. Click on Finish to migrate the database.
Once your database migrated successfully, you will get summary with Operation Complete message. Click on close. Your database has been migrated.
Check on your Azure Portal to check the migrated database.

Related

How can i view the SQL Agent in Azure Data Studio?

I have installed Azure Data Studio and the extension SQL Agent. I have also installed the Admin package extension as it seems to be under that.
It does not appear when i click on Manage for the connected database.
How can i get it to appear ?
I installed Azure data studio and sql server agent in Azure data studio using extension menu.
Image for reference:
After connection of Sql Server without clicking manage automatically Sql agent is appear in my case.
Image for reference:
If the Login account connecting to Azure data studio is not a part of SysAdmin role in SQL Server, then SQL Server Agent would not be visible to check this run below query in Azure data studio
Select IS_SRVROLEMEMBER('Sysadmin')
If a value is zero, then you are not a Sysadmin and hence you can’t see SQL Server Agent.
I run the above query I got as
Another possible reason would be that SQL Server in not an edition which supports SQL Server Agent. Typically, SQL Server Express edition could be another cause.
To verify, you can run below query in Azure data studio
SELECT SERVERPROPERTY('Edition')
I run above query in my system I got as
If the output is “Express” or “Express Edition with Advanced Services”, then you would not see SQL Server Agent node in Azure data studio.
Kindly check above properties of your sql server.

How to view data on the Azure SQL database

I created a default ASP.NET web form web site using Visual Studio. By default it contains a .mdf database file, Registration page, Login page and some other pages. Then I host this web application on Azure as a web app.
After that I did several registrations for the web site and I need to see the data (data which i used on registration) on the hosted application.
Is there any way to connect to the database file in Azure? In Azure, I did not set up a connection string. I just publish the app and it manages the database connection itself.
There is nothing inside the "Database" section
It seems that you do not publish your asp.net to Azure with Sql Database correctly. So, you could refer to this article to check if you have deploy database correctly.
As you have published, you could go to the database on Azure portal and choose query editor(preview). Click Login and enter the username and password you have set in Azure Sql server.
Also, you could open Microsoft SQL Server Management Studio to get your database. And you also need to login into the Sql Server as above.
After logining into the sql database, you will see all the data you have insert.
BTY, make sure you have synced the data in local database to Azure Sql Database. For more details, you could refer to this article.

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.

Creating/Accessing new database

I have created a new database in SQL Server 2008 R2 on my local machine.
The problem is that for some reason I CAN'T seem to get the it so I can use SQL Server Authentication. I am only able to log in with Windows Authentication.
Would someone describe the steps so that I can access a database that I created with a newly created account?
This will happen when you do not install SQL Server under Mixed Mode Authentication. To change this:
open SQL Server Management Studio (SSMS)
Right click the server
click Properties
click Security
Under "Server Authentication" select "SQL Server and Windows Authentication mode"
See the docs for complete details:
http://msdn.microsoft.com/en-us/library/ms188670(v=sql.105).aspx

FTP Database to webhost server

I have written an asp.net mvc application that is connected to a Microsoft SQL Server Management Studio database and I want to deploy the application to the webhosting server now. I have managed to get the published code onto the server easily. However, I want to ftp the database I created in Microsoft SQL Server Management Studio to the server. Where are these created databases saved and is it possible to ftp the database to the server. The other issue is the web hosting server is using MS SQL Server Express is that a problem?
Normally shared hosts expect you to place the database in the App_Data folder and use it directly from there.
Here is a page to explain connecting to the database
http://msdn.microsoft.com/en-us/library/ms247257.aspx
To find the database on your system open sql management studio right click the Database and click Properties on the Properties windows click on the Files section to show all associated files with your database.
I would recommend checking your providers documentaion though they might have specific requirments for database deployments