Friday, April 23, 2010

SQL Backup database - plan using same file name

How to SQL backup database, using scheduled maintenance plans to overwrite the same file name every time the backup is processed?

Solution:

Create a maintenance plan with t-sql in the job step similar to:

exec master.dbo.xp_backup_database @database = '', @filename = 'E:\Backup\_Daily.Bak', @backupname = ' backup', @desc = 'Backup of daily', @logging = 0, @with = 'SKIP', @init= 1, @with = 'STATS = 10'

Note, if the files with same name are overwriting with each backup, there will never be more than one archived backup on that destination.

No comments: