olahallengren / sql-server-maintenance-solution

SQL Server Maintenance Solution
https://ola.hallengren.com
MIT License
2.87k stars 737 forks source link

Allow ability to set a backupset name #689

Open jhutchings87 opened 1 year ago

jhutchings87 commented 1 year ago

It would be nice to be able to set the backupset name to something specific or even a default of "Ola Hallengren Backup" within the DatabaseBackup procedure. This would allow tracking of Ola Backups vs VSS vs Veeam, etc. The option I am referring to is highlighted in bold below.

BACKUP DATABASE [Test] TO DISK = N'D:\SQL\Backup\TestBackup.bak' WITH COPY_ONLY, NOFORMAT, NOINIT, NAME = N'Custom Backup Job', SKIP, NOREWIND, NOUNLOAD, STATS = 10 GO

Kevin-S-Lewis commented 1 year ago

A VSS backup would be covered under the flag of is_snapshot. in msdb.dbo.backupset. Veeam takes VSS backups I believe, so you can easily filter between native and those.

https://learn.microsoft.com/en-us/sql/relational-databases/system-tables/backupset-transact-sql?view=sql-server-ver16

Software Vendor Id in the same table is less reliable... you're probably only see Microsoft's, as the other vendors often use Microsoft API calls.

If you want every backup to know its been done via calling Ola's backup maybe use the @Description parameter, i.e.:

EXEC [dbo].[DatabaseBackup] @Databases='USER_DATABASES', @Directory='S:\ThisBackupFolder',@Description='Ola Backup',@BackupType='FULL'

Note: I am not knocking your request, and I do not represent Ola or know him on a personal level.