缩小sql server 日志文件

-- Sql Server 2008

 

USE [master]

GO

ALTER DATABASE [UENCDOP1] SET RECOVERY SIMPLE WITH NO_WAIT

GO

ALTER DATABASE [UENCDOP1] SET RECOVERY SIMPLE

 

 --简单模式

GO

USE [UENCDOP1]

GO

DBCC SHRINKFILE (N'PENCDOP1_log' , 11, TRUNCATEONLY)

 

GO

 

--这里的DNName_Log 如果不知道在sys.database_files里是什么名字的话,可以用以下注释的语句进行查询

 

USE [UENCDOP1]

 

GO

 

SELECT  file_id ,

        name

FROM    sys.database_files ;

 

GO

USE [master]

GO

ALTER DATABASE [UENCDOP1] SET RECOVERY FULL WITH NO_WAIT

GO

ALTER DATABASE [UENCDOP1] SET RECOVERY FULL

 --还原为完全模式

GO

 

-- Sql Server 2005

 

BACKUP LOG [HC1Queue] WITH NO_LOG

 

go

DUMP TRANSACTION [HC1Queue] WITH NO_LOG

go

USE [HC1Queue]

DBCC SHRINKFILE (2)

Go

posted @ 2015-06-29 22:54  Laven小叶  阅读(176)  评论(0编辑  收藏  举报