Sql Server 2008 清理日志文件

Use LingZhong

Select NAME,size From sys.database_files

ALTER DATABASE LingZhong SET RECOVERY SIMPLE WITH NO_WAIT

ALTER DATABASE LingZhong SET RECOVERY SIMPLE

USE LingZhong

DBCC SHRINKFILE(N'LingZhong_log',0,TRUNCATEONLY)

ALTER DATABASE LingZhong SET RECOVERY FULL WITH NO_WAIT

ALTER DATABASE LingZhong SET RECOVERY FULL

  

解决方案二:

    USE[master]
    GO
    ALTER DATABASE YinJi SET RECOVERY SIMPLE WITH NO_WAIT
    GO
    ALTER DATABASE YinJi SET RECOVERY SIMPLE   --简单模式
    GO
    USE YinJi
    GO
    DBCC SHRINKFILE (N'YinJi_log' , 2, TRUNCATEONLY)  --设置压缩后的日志大小为2M,可以自行指定
    GO
    USE[master]
    GO
    ALTER DATABASE YinJi SET RECOVERY FULL WITH NO_WAIT
    GO
    ALTER DATABASE YinJi SET RECOVERY FULL  --还原为完全模式
    GO

  

 

posted @ 2017-08-28 15:14  虔城墨客  阅读(340)  评论(0编辑  收藏  举报