USE [tlhis]
GO
/****** Object: StoredProcedure [dbo].[SP_DBBackup_EveryNight_Local] Script Date: 2013-10-22 21:47:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[SP_DBBackup_EveryNight_Local]
-- Add the parameters for the stored procedure here
AS
BEGIN
declare @backpath2 varchar(50)
declare @command varchar(200)
--将数据库备份到本地
set @backpath2='E:\sqlzuoye\' +replace(replace(Convert(varchar(20),getdate(),20),'-',''),':','') + 'zchis.bak'
backup database tlhis to disk=@backpath2 with INIT ,FORMAT
--将数据库本地备份复制到另一台机器
-- set @command = 'copy '+ @backpath2 + ' z:'
-- exec master..xp_cmdshell @command
END
GO
数据库--sql作业,执行自动备份的存储过程
最新推荐文章于 2024-02-07 22:09:49 发布