1、SQL Server Management Studio(SMSS) 維護計劃html
【參考】SQL SERVER如何按期自動備份數據庫sql
2、Windows 級 任務計劃程序( MSSQL Express)數據庫
1) 新建Sql存儲過程(master-可編程性-存儲過程)編程
USE [master] GO /****** Object: StoredProcedure [dbo].[sp_BackupDatabases] Script Date: 07/08/2019 15:22:51 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ============================================= -- Author:<十有三> -- Create date: <2015-03-07> -- Description: <完整備份InformationManagementSystem> -- ============================================= ALTER PROCEDURE [dbo].[sp_BackupDatabases] AS BEGIN --設置備份數據庫的存放目錄 DECLARE @diskPath NVARCHAR(300) SET @diskPath='X:\**bak\數據庫名_' +CONVERT(VARCHAR, GETDATE(),112)+'_' +REPLACE(CONVERT(VARCHAR, GETDATE(),108),':','')+'.BAK' BACKUP DATABASE BJMS_SMSS TO DISK = @diskPath WITH FORMAT; END
2)新建批處理spa
sqlcmd -S . -E -Q "EXEC 數據庫.dbo.sp_BackupDatabases"
3)添加任務計劃程序 指定任務執行時間code