??????????
???????????? ???????[ 2015/12/31 10:35:49 ] ????????????? ???????
????--????????
sp_configure 'show advanced options'?? 1;
GO
RECONFIGURE;
GO
sp_configure 'xp_cmdShell'?? 1;
GO
RECONFIGURE
GO
declare @currentDate datetime??@Day varchar(20)
set @currentDate=getdate()
set @Day= cast(year(@currentDate) as varchar(4))+'_'+cast(month(@currentDate) as varchar(2))+'_'+cast(day(@currentDate) as varchar(2))
declare @cmd varchar(1000)
--set @cmd=N'mkdir D:Program FilesMicrosoft SQL Server?????MSSQL11.SQL0MSSQLBackupAdventureWorks2012_'+@Day
set @cmd=N'mkdir D:Program FilesAdventureWorks2012_'+@Day
--set @cmd=N'mkdir D:dbAdventureWorks2012_'+@Day
select @cmd
exec xp_cmdshell @cmd
????--??
go
declare @strDate varchar(30)??@backupFile varchar(200)??@backupLogFile varchar(200)??@currentDate datetime??@Day varchar(20)
set @currentDate=getdate()
set @Day= cast(year(@currentDate) as varchar(4))+'_'+cast(month(@currentDate) as varchar(2))+'_'+cast(day(@currentDate) as varchar(2))
set @strDate=@Day+'_'+cast(datepart(hour??@currentDate) as varchar(2))+'_'+cast(datepart(minute??@currentDate) as varchar(2))+'_'+cast(datepart(ss??@currentDate) as varchar(2))
set @backupFile = 'D:dbAdventureWorks2012_'+@Day+'AdventureWorks2012_'+@strDate+'.bak'
backup database AdventureWorks2012 to disk=@backupFile WITH NOFORMAT?? NOINIT??
NAME = N'AdventureWorks2012-???? ????? ????'??
SKIP?? NOREWIND?? NOUNLOAD
????--log????
go
declare @strDate varchar(30)??@backupFile varchar(200)??@backupLogFile varchar(200)??@currentDate datetime??@Day varchar(20)
set @currentDate=getdate()
set @Day= cast(year(@currentDate) as varchar(4))+'_'+cast(month(@currentDate) as varchar(2))+'_'+cast(day(@currentDate) as varchar(2))
set @strDate=@Day+'_'+cast(datepart(hour??@currentDate) as varchar(2))+'_'+cast(datepart(minute??@currentDate) as varchar(2))+'_'+cast(datepart(ss??@currentDate) as varchar(2))
set @backupLogFile='D:dbAdventureWorks2012_'+@Day+'AdventureWorks2012_'+@strDate+'.trn'
backup log AdventureWorks2012 to disk=@backupLogFile
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11