Restoring Azure SQL Server to a previous point without replicas - sql-server

I am reading some guides to see how to backup/restore a Microsoft Azure SQL Server database.
Searching Microsoft documentation, it seems that:
Azure SQL Database has automated backups, so Azure Data Studio doesn't perform Azure SQL Database backup and restore. For more information, see Learn about automatic SQL Database backups.
After further reading, I see we can indeed restore a DB by creating a replica of it at a previous time point, but this costs ~80 euros if I read it correctly, as it basically creates a second instance of the db. Also, It seems to be able to go back in time only some limited time.
Is there a cost-less (without incurring additional cost to the existing costs) way to create a "permanent" off line copy of the database and restore it to an Azure SQL Database?
The first part of this question is similar to Is there a way to download the azure sql database managed backups - though I am not asking if it's possible, and I do not care about any format of the backup, and do not want to download the Azure backups. I would be happy creating my own backup so I am pretty sure the answer to my question is that is possible even though that answer is probably impossible.

Is there a cost-less (without incurring additional cost to the
existing costs) way to create a "permanent" off line copy of the
database and restore it to an Azure SQL Database?
You would have to install an extension to use DACPAC and BACPAC features in Azure Data studio.
Name: SQL Server Dacpac
Id: microsoft.dacpac
Description: Manage data-tier applications
Version: 1.8.0
Publisher: Microsoft
Here is a simple way to export DB as Bacpac, you can similarly use the [Import Bacpac] Operation to restore.
I am Connected to Microsoft SQL Server, backing up a SQL DB. But you can do this connecting to on-premise SQL server too.

What's the actual objective?
You can restore an Azure SQL to a point in time. Go into the Azure portal and do it in there. (Azure Data Studio may not have a nice way for you to do this)
By offline do you mean an on-premises (non cloud) copy? again what is the objective? Is it disaster recovery? Your on premises copy is more likely to be lost than the Azure one.
You can also point in time restore to another Azure database. If your DB <2Gb then you can just retore to the basic edition which is 4.25 Euro a month. Or you can use the serverless option which is even cheaper
But you have to consider why you are doing this. Azure has a lot of redundancy already built in which makes these kinds of manual offline copies and processes unecessary.

Related

Best possible ways to move the data from On-prem SQL Server to Cloud SQL instance with very minimal downtime

I have a requirement to move around 30 DB's from On-prem SQL Server to google Cloud SQL instance with very minimal downtime.
I thought of doing Logshipping/High avaialbility but Gcloud SQL is not supporting sysadmin role to add secondary instance in On-prem SQL Server.
Please let me know if there are any other ways to do this
The easiest way to do this is with a backup and a restore, but you're going to have downtime in that regard. Quite a lot of it really.
The one way you can do this is through replication. No other facility is likely to help you move to Google Cloud SQL without downtime. Here's an example of how to set it up.
This document applies exactly to your case and it's the best way to do it, basically the steps are:
Enable the Cloud Storage and Cloud SQL APIs
Create the SQL instance and Cloud Storage bucket (where you will deposit the backup created from your On-prem DB)
Create a backup from your On-prem DB, this steps depends on your version but I think that the step detailed gives you and idea, and then upload it into the just created bucket
Import the backup created into Google Cloud SQL from your Storage bucket
The last step performed in the guide is just to validate recent imported data by connecting to the instance and execute a query.
For SQL Server 2017 this is the exact same guide but for that specific version.

Azure Database automated export to local machine

I want to make an automated backup of an Azure Database. I don’t want use Azures build in point in time restore. My plan was something like making an automated export to an Azure storage blob and download it daily from there. But since MS dropped the automated export function (01.03.2017) that fell apart. Is there still a way to do this or maybe a better approach? Basically my goal is to get a local automated backup from my Azure Database so I can restore it without needing to rely on Azure.
My plan was something like making an automated export to an Azure storage blob and download it daily from there. But since MS dropped the automated export function (01.03.2017) that fell apart. Is there still a way to do this or maybe a better approach?
Firstly, as you said, Azure SQL Database Automated Export is retired on March 1, 2017, now we could use long-term backup retention or Azure Automation to archive SQL databases, and database backups are stored in an Azure Recovery Services vault instead of Azure storage Blob, the Recovery services vault seems not enable us to download database backups to local machine.
Secondly, Azure SQL Database REST API do not provide operations for backup and export Azure SQL Database to Azure storage or local machine.
Thirdly, we could create a maintenance plan to backup database in SQL Server Management Studio, but it does not enable us to create a maintenance plan to schedule and automate backup Azure SQL.
I suspect it does not enable to backup Azure SQL Database to our local machine currently.
You can use Automation Account to schedule Azure DB export to Azure Storage
see tutorial here

Copying SQL Server Transaction Logs from Local Server to Azure

I've Googled this a lot and can't really find anything. The SQL Server for our main system is on-premise, not in the cloud. I figured out how to copy our nightly SQL Server backup to Azure. I also want to copy the Transaction Logs each time they roll so if our server dies we have the transaction logs, can restore to that point and only lose at most five minutes of work, not potentially a full day.
I'm really new to Azure, just starting to learn it. Is there an easy way to copy the logs to Azure? Can it be done within SSMS? Does someone already have a script they'd be willing to share? Thanks for any tips you might have!
Yes, there is SQL Server Backup to Azure Tool
Microsoft SQL Server Backup to Microsoft Azure Tool enables backup to
Azure Blob Storage and encrypts and compresses SQL Server backups
stored locally or in the cloud.
There's also Powershell option:
Use PowerShell to Backup Multiple Databases to Windows Azure Blob Storage Service
This topic provides sample scripts that can be used to automate backups to Windows Azure Blob storage service using PowerShell cmdlets. PowerShell support for Backup and Restore to Windows Azure Blob Storage service is introduced in SQL Server 2012 SP1 CU4.
The parent article gives you TSQL options as well.

Is it possible to restore a SQL Server Standard 2014 backup to Azure SQL?

We currently have a SQL Server Standard 2014 database on one of our servers that is backed up daily to Azure Blob Storage. Those backups are working well and have restored beautifully to the original server in manual tests.
However, to ensure that our backups continue to be valid, I want to put in place some sort of automated restore testing. Due to performance/disk constraints, I'd rather not do this automated testing on our primary database server. But we can't spend the money to buy more SQL Server Standard licenses to set up another server. And we can't use SQL Server Express, because our database is too large (about 20 GB).
Given that our backups are stored in Azure, I thought the best way to test backup restoration would be to restore the backup directly into an Azure SQL database. I could do this roughly once per week, run some quick checks on the restored data, and then automatically delete the database, and pay for less than 1 hour of service/week. This would result in minimal expense. However, I'm not sure it's possible. Google searches for instructions on how to restore a SQL Server backup directly to Azure SQL haven't turned up anything so far. Is it possible for me to restore my SQL Server backups directly to Azure Managed SQL like this?
If it isn't possible, my next thought is that I could just create an SQL Server VM in Azure and activate/deactivate it as needed for my automated restore tests. That'd be a bit more complicated though, so I'm saving that approach for plan B.
Not Directly. You can only directly import a bacpac file into SQL Azure.
What you can do is use SQL Server on an Azure VM to test your backup files.
Pretty sure you can write a script to automatically pull down the latest .bak file and restore it to the SQL Server Instance on the VM.

How to migrate from Azure SQL to SQL Server? [duplicate]

This question already has answers here:
How do I copy SQL Azure database to my local development server?
(24 answers)
Closed 9 years ago.
Okay this is not about migrating existing sql server database to azure database. Its the other way round.
I want to stop using azure sql database, and moved to full version of SQL Server. How do I migrate existing database in AZURE Sql to a new SQL Server 2008 database?
If you don't want to lose any data, you have to stop using it for the moment of transfer. I can suggest you couple of ways:
First way is to use the SQL Azure Migration Wizard. Yes. Although it is originally designed to migrate your local SQL DB to SQL Azure, it can be used the other way around. I've done in numerous times. Just first point the migration wizard to your SQL Azure instance, then target the local server.
Second way is to use the Azure SQL Database backup. Create a bacpac archive either using the portal or via SSMS. Then import this BacPac package into your local SQL Server instance.
If you don't want downtime and want full data synchronization I will suggest doing the following:
Move schema and data initially using any of the above methods (for live systems I highly recommend to first a new database AS COPY and then create the BacPac from it, or use the Migration wizard to transfer it).
Enable the SQL Data Sync to begin synchronizing local data with on-going live data.
Wait while local is fully in sync.
Switch the connection strings in your app.
Cut down SQL Azure.
There are a lot of third party tools that will allow you to synchronize your SQL Azure database with full SQL Server database. Just use any of these to synchronize structures and then data.
You can try tools from Red Gate, ApexSQL, Idera or any other… Even though these tools are not really cheap you can still use them in trial mode (its fully functional in most cases) to get the job done.

Resources