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.
Related
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.
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
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.
Presently i am generating SQL scripts everyday to take the backup of SQL Azure database. I need to automate this process using some freeware. How can i achieve this?
Note:- I need to take the backup in form of SQL Script to some local machine.
Option 1: Run some code/script to backup the database
You could run the SQL using the SQLCMD utility.
http://msdn.microsoft.com/en-us/library/ms162773.aspx
To schedule this, just use the Windows Task Scheduler.
http://msdn.microsoft.com/en-us/library/bb756979.aspx
Option 2: Use Azure Data Sync
Keep a local database in sync with your SQL Azure database, like a constant backup.
http://msdn.microsoft.com/en-us/library/windowsazure/hh456371.aspx
Option 3: Use BacPac
There is an API available in Azure to backup your database to a BACPAC format.
http://msdn.microsoft.com/en-us/library/windowsazure/hh335292.aspx
A RedGate tool then allows you to restore to a local SQL Server.
http://www.red-gate.com/products/dba/sql-azure-backup/
Edit
I have since created a command line tool which will create a copy of your database, and back it up to BacPac using the Azure Management API:
https://github.com/richorama/SQLDatabaseBackup
You could try RedGate Azure Sql backup http://www.red-gate.com/products/dba/sql-azure-backup/
That can be also scheduled using Task Scheduler.
I have written some ideas on how to do that:
http://anttitech.wordpress.com/2011/11/06/azure-sql-backup-and-restore-scenarios-using-bacpac-exportimport/
SQL Azure Database does not support SQL Server Agent or jobs. You can,
however, run SQL Server Agent on your on-premise SQL Server and
connect to SQL Azure Database.
Source: http://msdn.microsoft.com/en-us/library/windowsazure/ee336245.aspx
SQL Server Agent is a Microsoft Windows service that executes
scheduled administrative tasks, which are called jobs...For example,
if you want to back up all the company servers every weekday after
hours, you can automate this task. Schedule the backup to run after
22:00 Monday through Friday
Source: http://msdn.microsoft.com/en-us/library/ms189237.aspx
Create an in-the-cloud backup of the database (to get a consistent snapshot) and then use the Data-Tier Application Framework (DACFx) client tool to copy the snapshot to your local machine, as described in Automating Windows Azure SQL Database Backup.
I have come across a free tool that makes backups of your SQL Azure Databases. Backups can be stored locally or on blob. You can also schedule backup operations with its built-in scheduler, or use the Windows Scheduler and the provided command-line utilities.
Source: http://blog.idera.com/sql-server/backup-and-recovery/announcing-new-free-tool-azure-sql-database-backup/
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.