Question

I am using the newest version of Ola's scripts. When backing-up databases, I'm experiencing an issue with excluding certain databases. The website states, if you want to backup all User database except X use the following for @Databases:

USER_DATABASES, -Db1

So, I'm running the following:

EXECUTE Maintdb.[dbo].[DatabaseBackup]
@Databases = 'USER_DATABASES,-AdventureWorks2014 -Sandbox',
@Directory = 'G:\Bckps',
@BackupType = 'FULL',
@Verify = 'Y',
@CleanupTime = '36',
@CleanupMode = 'AFTER_BACKUP',
@CheckSum = 'Y',
@LogToTable = 'Y'

The issue is, all User databases get backed-up. Output is:

The following databases in the @Databases parameter do not exist: [AdventureWorks2014 -Sandbox].
Was it helpful?

Solution

As @LowlyDBA noted, your @Databases parameter is incorrect. It's a CSV list of database names (or database name patterns) and you've omitted a necessary comma.

It should be:

@Databases = 'USER_DATABASES,-AdventureWorks2014, -Sandbox'

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top