sql server 自动备份教程

1.首先建一个存储过程用于执行备份脚本,并在master下执行sql

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代理引擎)。3d

 =》右击新建做业代理

 

=》新建步骤server

=》新建计划blog

=》点击肯定按钮就完成部署了ip

=》最后执行部署

到此就完成了。能够去指定的备份文件目录看看是否执行了!get

更多资料能够参考:乐草网it

相关文章
相关标签/搜索