﻿USE [FPBT_Training_V1.1]
GO
/****** Object:  StoredProcedure [dbo].[Proc_DataBak]    Script Date: 05/29/2016 02:50:51 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<数据库备份>
-- =============================================
CREATE PROCEDURE [dbo].[Proc_DataBak] 
@fileUrl nvarchar(250)
AS
begin
--SUBSTRING(CONVERT(VARCHAR(50), GETDATE(), 120),1,10)为当时日期，格式为yyyy-mm-dd

  --备份[AAA]数据库
  
  DECLARE @S VARCHAR(250)
  SET @S = @fileUrl+'FPBT_Training_V1.1[' + SUBSTRING(CONVERT(VARCHAR(50), GETDATE(), 120),1,10) + '].bak'
  BACKUP DATABASE [FPBT_Training_V1.1] TO 
  DISK = @S
  WITH NOFORMAT, NOINIT, 
  NAME = N'FPBT_Training_V1.1-完整 数据库 备份',
  SKIP, NOREWIND, NOUNLOAD
  
  --备份[BBB]数据库
  
  --DECLARE @S VARCHAR(250)
  SET @S = @fileUrl+'FPBT_Structure_V1.1[' + SUBSTRING(CONVERT(VARCHAR(50), GETDATE(), 120),1,10) + '].bak'
  BACKUP DATABASE [FPBT_Structure_V1.1] TO 
  DISK = @S
  WITH NOFORMAT, NOINIT, 
  NAME = N'FPBT_Structure_V1.1-完整 数据库 备份',
  SKIP, NOREWIND, NOUNLOAD

  --备份[CCC]数据库
  
  --DECLARE @S VARCHAR(250)
 SET @S = @fileUrl+'FPBT_Resource_V1.1[' + SUBSTRING(CONVERT(VARCHAR(50), GETDATE(), 120),1,10) + '].bak'
  BACKUP DATABASE [FPBT_Resource_V1.1] TO 
  DISK = @S
  WITH NOFORMAT, NOINIT, 
  NAME = N'FPBT_Resource_V1.1-完整 数据库 备份',
  SKIP, NOREWIND, NOUNLOAD
  
  
    --备份[ddd]数据库
  
  --DECLARE @S VARCHAR(250)
 SET @S = @fileUrl+'FPBT_Exam_V1.1[' + SUBSTRING(CONVERT(VARCHAR(50), GETDATE(), 120),1,10) + '].bak'
  BACKUP DATABASE [FPBT_Exam_V1.1] TO 
  DISK = @S
  WITH NOFORMAT, NOINIT, 
  NAME = N'FPBT_Exam_V1.1-完整 数据库 备份',
  SKIP, NOREWIND, NOUNLOAD
  
  
    --备份[ddd]数据库
  
  --DECLARE @S VARCHAR(250)
 --SET @S = @fileUrl+'FPBT_DataSync_V1.1[' + SUBSTRING(CONVERT(VARCHAR(50), GETDATE(), 120),1,10) + '].bak'
 -- BACKUP DATABASE [FPBT_Exam_V1.1] TO 
 -- DISK = @S
 -- WITH NOFORMAT, NOINIT, 
 -- NAME = N'FPBT_DataSync_V1.1-完整 数据库 备份',
 -- SKIP, NOREWIND, NOUNLOAD

    insert DataBackOperate(CreateTime) values(GETDATE())
end