1.首先建一个存储过程用于执行备份脚本,并在master下执行
USE [master]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: lity
-- Create date: 2015-12-12
-- Description: Database Back
-- =============================================
CREATE PROCEDURE [dbo].[ProcDatabaseDailyBack]
AS
BEGIN
----------------------------------
SET NOCOUNT ON;
DECLARE @RootPath nvarchar(50),@fileName nvarchar(100),@DbName nvarchar(50);
set @RootPath='G:\bak\';
set @DbName='DatabaseName';
SET @fileName=@RootPath+@DbName+'_' + CONVERT(varchar(100), GETDATE(), 23) + '.bak';
BACKUP DATABASE @DbName TO DISK = @fileName WITH INIT , NOUNLOAD ,COMPRESSION,
NAME = @DbName, NOSKIP , STATS = 10, NOFORMAT;
END
2.打开vss环境,找到sql server代理=>作业(当然要启动sql server代理引擎)。
=》右击新建作业
=》新建步骤
=》新建计划
=》点击确定按钮就完成部署了
=》最后执行
到此就完成了。可以去指定的备份文件目录看看是否执行了!
更多资料可以参考:乐草网