Azure SQL Server System Databases - sql-server

Goal: I need to create a msdb on my Systems Database.
Why: I am trying to move an application database to Azure so multiple computers can connect to it. I created a bacpac file and was able to upload my database, but when I try to connect to the Azure database from the application it won't let me because "msdb..backupset is not supported on this version of SQL Server."
Problem: Azure's SQL Server only has master in its Systems Database. Why does it only have master? How can I get msdb and the others there as well? Do I need a VM?

Problem: Azure's SQL Server only has master in its Systems Database. Why does it only have master? How can I get msdb and the others there as well? Do I need a VM?
yes you need a VM or SQLAZURE managed instance*(which is same as on premises sql server with SQLAgent,clr,...,but with high available capacity of SQLAZure)
The reason why you don't have system databases is ..SQLAZURE is database as service and you just pay for the database you used
*Currently in preview,expected to be GA by the end if this year

Related

Login failed after moving sharded database from self-hosted to Azure Database

Is there a proper way to move a SQL Server 2016 sharded database from self-hosted to Azure Database?
I have a SQL Server 2016 sharded database that is part of the platform (Sitecore 10) I'm working with. It has a Shard Map Manager database and two Shard databases. I want to migrate the databases from self-hosted to Azure Database.
When the database is in a SQL Server Instance, it has one login mapped to the Shard Map Manger user and both Shard users. Everything works great. Since Azure Database does not use logins the same way and the databases are partially contained, I created separate users in each database in Azure with the same name and password.
Next, I migrated the schema with Azure Data Migration Services and then the data. There are some stored procedures that Sitecore provides to setup permissions and I ran those.
Finally, I updated the ServerName and DatabaseName fields in the [__ShardManagement].[ShardsGlobal] table for the ShardMapManager DB and the [__ShardManagement].[ShardsLocal] table in both Shard databases to match the new server and database names.
When I updated the app to use the new database, it spewed errors into the log, ultimately tracking to a failed login for the user. There are 13 other databases for the app which were also migrated and work fine, only the sharded database does not work in the app. I ran a PowerShell script that tests the connection string for all of the databases. All of the connection strings were successful. Backing out only the connection strings for the sharded database fixes the errors proving that the connection to the sharded databases is the problem.
What did I do wrong and what should I do to fix it?
If the requirement is only to migrate the databases from local to Azure, the best possible way is to use SQL Server Management Studio (SSMS).
The advantage is that you can mention the new database name on Azure while migrating itself and hence no need to change later. But just make sure same named database shouldn't available already in Azure SQL Server.
You can follow the migration steps from my this answer.
Also, my suggestion is to go through the official documents Assessment rules for SQL Server to Azure SQL Database migration, Troubleshoot connecting to the SQL Server Database Engine. I'm sure you will find the useful insights there which could help to make migrated database work properly with the apps.

Azure SQL Server restore using .bak file

I have created a SQL Server in Azure and have downloaded the Azure Data Studio. I have a SQL Server database backup file (.bak) and connected to the sever that I created from Azure Data Studio and I am not seeing an option to restore the database.
I just have the back up file available and don't have any on perm database available and I want to directly restore the database to the Azure SQL Server.
Azure SQL database currently does not support this feature. The only way to restore a SQL database in Azure is to import from a BACPAC file as #Larnu said. You can follow this guide to use a BACPAC file to migrate to an Azure SQL database.
Another option:
If you get an account to connect to the local server.You can use SQL Management Studio to migrate it directly to Azure.
You can use the Azure Data Migration Assistant to perform an assessment and migrate to Azure SQL from a local database.
While both replies before mine are correct I want to add something.
You have 3 ways to migrate with a right click:
SSMS: Task > Deploy Database to SQL Azure , which will create a BACPAK file, not a .bak file.
DMA: Assess and migrate
Azure Data Studio: I discovered in this video at minute 00:35 that you can actually use Azure Data Studio with some preview functionality that will help you migrate. I haven't found any plugin and in the video there is a Microsoft e-mail so I asked to try the preview. I don't expect to be better than DMA which is the go-to tool for migration.
EDIT: I sent an e-mail to Microsoft which replied to me
"Hi Francesco,
Thanks for reaching out. We are currently in private preview in East US2 region. Will that work for you ? We will soon be expanding to other regions, so please stay tuned."
So one day migration through Azure Data Studio will be possible but for now it's only to East US2 region

Migrating to Azure Sql Database with external dependencies in another database

The question: Is it possible to point a view in database A running on Azure SQL Database service to tables/views on a SQL server running in a VM? I've tried external tables but come up short.
Scenario:
Two applications that is exchanging data, from two different vendors.
We've got three databases in total. One for each application and an integration database with views that both applications use either directly or through views.
The issue now is that we want to migrate to Azure and would prefer to use the Azure SQL Database service as much as possible, but one of the applications is not ready for it and therefor it's database has to be hosted on either a managed instance or in a VM.
The issue now is that there's view's in database A (running on Azure SQL Database service) that points to views and tables in the integration database, which again references tables in database B (running on SQL Server on the VM).
The short answer is "no". You can use external tables to query other SQL Azure databases, but there is no exact analogue for linked servers in Azure SQL Database. You can use SQL Azure Managed Instance (which supports SQL-SQL linked servers but not arbitrary linked servers).
There is a workaround, however. You can run SQL Server in an Azure VM and have it point to SQL Azure as a target as well as the other sources you want to connect. Then you can push data to/from Azure SQL DB using the SQL Server in a VM. You don't have the same management overhead in this approach since you don't really need to host data in the SQL Server if you don't want to do so. Note that this will be slower than doing direct connections to SQL Azure, but you can try to do this for a period of time if it would help you during a migration.

Azure Data Factory - Azure SQL Server Destination Schema

I need to copy several hundred tables from an on-premise SQL Server to an Azure SQL Server using ADF. I don't have access to the DB or the network it's on, but I was able to get the on-prem data gateway installed, given an AD account with sufficient DB privileges, and then use the "Copy Data (Preview)" to copy all tables to blob storage.
My problem is that I don't have access to the DB's schema, so I can't easily provision the Azure SQL Server with the necessary tables/columns since there are several hundred tables & performing manually would be extremely time consuming. I found that copying to an Azure Data Warehouse has a "Auto table creation" feature & I am able to copy from on-prem SQL Server directly to Azure DW without defining a schema at the destination, but this isn't supported on Azure SQL Server.
Is there a way to obtain the same script/method that provisions the Azure DW schema & use it for Azure SQL Server? Is there any other way to obtain the source DB's schema via the on-prem data gateway?
given that you were able to run the Copy Data tool to extract data out of on-premises SQL Server, you must have credentials to access the database. Can you run SSMS (SQL Server Management Studio) on the on-prem data gateway and examine/extract the schema?
"Auto table creation" feature is currently only available for Azure Data Warehouse. Supporting this feature when loading into Azure SQL Server is on our backlog but we don't have a committed timeline for this yet.
Shirley Wang
Couldn't you use DMG to run a query against the database to generate the schema for your tables, assuming your AD account has read access to the metadata?
So with your pipeline, instead of it selecting * from each table, have it run a query to exract the schema, some examples here: How can I show the table structure in SQL Server query?
You would then output that to a blob.

How do I backup the data in SQL Server 2008 on a third party host?

I have a SQL Server 2008 database that is hosted by a third party host (heart internet).
How would I go about backing this up?
I used SQL Server Management Studio Express 2008 to create the tables within the database, but the backup options within this app seem to be only of use if you have direct access to the server machine (which I don't)
It's also worth noting that I am using change tracking - I presume this data would be lost should any backup be restored?
Thanks In Advance!
(PS - SQL Server 2008 novice here!)
If they allow you to run backups to a particular folder that you have access to you can just do it with the regular backup command:
backup database dbname to disk = 'y:\users\YourHomePath'
If they do not do that you might want to use the Database Publishing Wizard to script out your database (depending on the size this might be very slow)
You can create a .DAT file into a shared disk and to download it through FTP.

Resources