3

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?

6

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.

4

For excluding a database from the backup script in Ola Hellengren's solution, you will need to add it like the below:

AVAILABILITY_GROUP_DATABASES, -UserDb : All databases in AG , except Db1

The above will backup all databases in AG except UserDb. For more information please go through the Databases parameter in the below link

Ola hellengren

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.