脚本: use master; go ---声明变量 declare @dbName nvarchar(max)='MG_DATA'; ),) +'_'+ DateName(hour,GetDate())+DateName(minute,GetDate()) +DateName(second,GetDate())+'.bak'; ---备份数据库 ) SET @kid='' )) FROM master..sysprocesses WHERE dbid=DB_ID(@dbName) PRINT…