--备份数据库
declare @db_filename nvarchar(100)
declare @filename nvarchar(100)
set @db_filename='E:\DB_bak62\AOSmith_MSCRM62_'+convert(char(8),getdate(),112) + '.bak'
set @filename=N'AOSmith_MSCRM62_'+convert(char(8),getdate(),112)
backup database [AOSmith_MSCRM] to disk=@db_filename
WITH NOFORMAT, NOINIT ,NAME =@filename,SKIP, REWIND, NOUNLOAD, COMPRESSION, STATS = 10
--(备份事务日志)
declare @log_filename nvarchar(100)
declare @filename nvarchar(100)
set @log_filename='E:\DB_bak62\AOSmith_MSCRM62_log_'+convert(char(8),getdate(),112) + '.bak'
set @filename=N'AOSmith_MSCRM62_log_'+convert(char(8),getdate(),112)
backup log [AOSmith_MSCRM] to disk=@log_filename
WITH NOFORMAT, NOINIT ,NAME =@filename,SKIP, REWIND, NOUNLOAD, COMPRESSION, STATS = 10
-- 收缩日志到50个G
dbcc shrinkfile(mscrm_log,50000)