首先,建立如下存储过程
1 ALTER PROCEDURE [ dbo ] . [ DataBaseName _FULL_BACKUP_PRC ] 2 as 3 begin 4 declare @bakPath varchar ( 100 ) 5 declare @bakFileName varchar ( 50 ) 6 declare @bakDiskPath varchar ( 300 ) 7 8 set @bakPath = ' D:\DB_BAK\ ' 9 10 11 -- print @bakPath 12 -- 完整備份 13 set @bakFileName = ' DataBaseName _Full_Bak ' + Convert ( varchar ( 30 ), getDate (), 23 ) + ' .bak ' 14 set @bakDiskPath = @bakPath + @bakFileName 15 backup database [ DataBaseName ] 16 to disk = @bakDiskPath 17 with name = ' DataBaseName _完整備份 ' 18 19 end
然后,建立JOB,设执行的周期等,这里就不多说了。