Take a database backup using Red Gate SQL Backup

Share your PowerShell scripts for Deployment Manager

Moderators: Mike Upton, justin.caldicott, csmith, chirayu, DavidSimner

Take a database backup using Red Gate SQL Backup

Postby david.conlin » Mon Sep 02, 2013 4:38 pm

A lot of people want to back up their database before they deploy to it.

One way to do this using Red Gate's SQL backup tool is to package up the script below and to deploy it as a step before doing a database deployment.

Code: Select all
& "$SqlBackupLocation\\$ServerInstanceName\\SQLBackupC.exe" -SQL "BACKUP DATABASE `"$RedGateDatabaseName`" TO DISK = '$BackupLocation\\<auto>' WITH PASSWORD = '$Password'"


You'll need to configure the following variables in Deployment Manager for this step:

SqlBackupLocation: The place you installed SQL Backup to.

ServerInstanceName: The name of the SQL Server, as it's saved on your SQL Backup configuration

RedGateDatabaseName: The name of the database to be backed up

BackupLocation: Where to put the backup

Password: The password to encrypt the backup with.

For example:
Image
David Conlin
Software Developer
Deployment Manager
david.conlin
 
Posts: 50
Joined: Fri May 04, 2012 3:44 pm

Return to Deployment Manager PowerShell Scripts

Who is online

Users browsing this forum: No registered users and 0 guests

cron