HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Can a single database be excluded from an AG backup?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
canexcludeddatabasesinglefrombackup

Problem

I want to backup all the databases in an availability group except one. Using the @AvailabilityGroups option in Ola's Maintenance Solution scripts, can a single database in an Availability Group be excluded from a backup?

Solution

Select databases. The keywords SYSTEM_DATABASES, USER_DATABASES,
ALL_DATABASES, and AVAILABILITY_GROUP_DATABASES are supported. The
hyphen character (-) is used to exclude databases, and the percent
character (%) is used for wildcard selection. All of these operations
can be combined by using the comma (,).

Ola Documentation

So as you list the databases to back up, it will look like this:

AVAILABILITY_GROUP_DATABASES,-%Db%...


All databases like Db will be excluded from the backup while the rest of the databases in the availability group will be backed up. Change that Db to be the one you want to not backup and adjust the % signs as applicable to your database.

Code Snippets

AVAILABILITY_GROUP_DATABASES,-%Db%...

Context

StackExchange Database Administrators Q#205575, answer score: 6

Revisions (0)

No revisions yet.