SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Backup databases in an Availability Group

By Kevin Burgess,

In an availability group it is possible to select whether a backup should be performed on a primary or secondary replica.

This script creates a list of databases that are in an availability group and reside on the primary replica.  Because these are candidates for a backup the script will be run.  When no candidates are present the script will not run.

Simply execute the script with an SQL Server Agent job at the required intervals.

Total article views: 250 | Views in the last 30 days: 13
 
Related Articles
FORUM

Monitoring script

script

FORUM

Script

Need Automated Script

FORUM

drop script

drop script

FORUM

Script component

Script component

Tags
availability    
availability groups (ag)    
backup    
groups    
 
Contribute