I know from SQL 2012 you can backup directly to Azure, but I have a SQL 2008 R2 instance where I'm needing to get the backups up to Azure for off-site backup reasons.
Anyone have some good options for what could be considered here?
You can write a PowerShell script, which will backup your database using Backup-SqlDatabase cmdlet, and then copy the BAK file to Azure Blob Storage using Set-AzureStorageBlobContent cmdlet. Of course, you can also use your existing backup solution, but it may be more difficult to plug the call to Set-AzureStorageBlobContent in it. If you use SQL Server Agent, you can add a step with PowerShell or call to external executable to upload the recently made backup.
# Upload file from local disk to Azure Blob Storage
Set-AzureStorageBlobContent -Container "SQLServerBackups" -File "E:\Backups\MyDatabase-2018-01-01.bak" -Blob "MyDatabase-2018-01-01"
Related
I have a folder with more than 300 .mdf and .ldf microsof SQL server database files(recovered from a ransomware attack to our ESXI server then I have no access to SQL server Master db)
Without access to SQL server system databases to fetch database names and ..., How can I bulk convert all these database files to SQL server backup (.bak) files with no need to manually attach them one by one to sql server in SQL management studio.
You won't be able to convert the MDF/LDF to a BAK file, so you are going to need to reattach the databases.
The database name is usually in the file name; do you know the structure of these databases - did they have more than one data/log file for example?
You could use Powershell to generate a list of discrete names using:
Get-ChildItem
Select-Object -unique
And then iterate through that list and use Invoke-SQLCMD to run the CREATE DATABASE FOR ATTACH commands using:
foreach
Where-Object {$listOfFiles -like "$currentItem*.mdf/ldf"}
Invoke-SQLCMD
MSSQLTips Article on Attach/Detach with T-SQL examples
I have an Azure Database backed up as a .bacpac file.
However, my new hosting platform does not allow .bacpac imports. (only .bak)
I was wondering if it were possible to backup to a .bak file, using SSMS.
If not, is it possible to convert a .bacpac to a .bak?
I'm going to add 1 more thing to this...
After research, I understand this is possible with SQL Server. (not SSMS)
Does anyone know if it's possible to do a .bak backup with SQL Server 2014 Express?
Ok, so after some research... Here is the solution that worked for me:
First, download SQL Server 2014 Express, from Microsoft (Or whatever version/instance you prefer)
Microsoft SQL Server 2014 Express
Next, set it up correctly by watching this very helpful YouTube Video:
YouTube SQL Server 2014 Express Setup Video
Note: You will also need a version of SSMS, which you can also do/figure out by watching the YouTube video.
Then, on your Azure account (or wherever your Database is that doesn't allow you to create a .BAK file is, do the following)
Connect to it and navigate to Tasks > Export Data-tier Application.
Save that to your computer. (That will give you a .bacpac file.)
Next, connect to your "local" SQL Server instance.
Then, Import data-tier Application. (Will need the .bacpac file)
Lastly, (after fully imported) you will now have the option to do Tasks > Back Up
This will allow you to save a local file as a .BAK file!
Then, just upload this file to your new hosting platform.
This worked like a charm for me. :-)
Hope this helps someone else.
.bacpac contains less information than .bak file, for example no transaction logs. Best approach would be to restore backpac on some other server and then create backup.
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.
I'm reading about Red Gate SQL Backup, and I liked the concept of creating a database backup compressed and writing on disk the compressed backup directly without an intermediate SQL Server native backup.
And I'm wondering how this type of software make backups. It accesses the database files directly? It uses some sort of SQL Server or Windows API? Windows Shadow Copy?
The SQL Server has an API for backup providers to plug in elements into he backup pipeline. See INFORMATIONAL: SHEDDING LIGHT on VSS & VDI Backups in SQL Server, or have a look at the SQL Server Compressed Backup project on sourceforge.
More information at:
A Guide for SQL Server Backup Application Vendors
SQL Server 2005 Virtual Backup Device Interface (VDI) Specification
It uses the "SQL Server Virtual Device Interface (VDI)" as per the Datasheet.
You can't shadow copy or use a Windows API to backup SQL server files
CodeProject VDI wrapper if you want to write your own
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.