Sql-server – Adding new databases to existing maintenance backup plan

sql server

I am trying to automate our backup plans to add newly created backups automatically on SQL server 2008. Is there a way to do this?
Since it wont let me comment on this to clarify. I am trying to add new databases that we have created to an existing Management Maintenance Plan on SQL Server 2008. I am trying to make it a script that we can run that will automatically add the database when created. Is this possible?

Best Answer

Yes, you can use the well used ola hallengren.scripts.

Make use of the SQL Server Backup scripts available on the above.

Eg:

Back up all user databases, using checksums and compression; verify the backup; and delete old backup files

EXECUTE dbo.DatabaseBackup
@Databases = 'USER_DATABASES',
@Directory = 'C:\Backup',
@BackupType = 'FULL',
@Verify = 'Y',
@Compress = 'Y',
@CheckSum = 'Y',
@CleanupTime = 24

Then run the above script on SQL server agent job as per the backup plan strategy to execute this.

Also, just to mention you need to first create the scripts CommandExecute.sql and DatabaseBackup.sql in order to use the backup plan.