清理SQLServer数据库日志

来源:互联网 发布:淘宝介入后买家没退货 编辑:程序博客网 时间:2024/05/26 22:59
手动清理:
D:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Log
 

语句清理:
ALTERDATABASE 数据库  SETRECOVERYSIMPLE
ALTERDATABASE 数据库 SETRECOVERYFULL
DBCCSHRINKDATABASE(数据库,0)


Tempdb事务日志满了之后,可以在没有回话占用tempdb的时候,使用下面的语句收缩日志

   use tempdb
   go

   dbcc shrinkfile (tempdev, 'target size in MB')
   go
   -- this command shrinks the primary data file

   dbcc shrinkfile (templog, 'target size in MB')
   go
   -- this command shrinks the log file, look at the last paragraph.
原创粉丝点击