简体   繁体   English

如何截断和缩小日志文件?

[英]How to truncate and shrink log files?

How to truncate and shrink large log files in SQL Server 2005? 如何截断和收缩SQL Server 2005中的大型日志文件? How to apply truncation at regular intervals? 如何定期应用截断?

Is there any difference between truncation and shrinking? 截断和缩小之间有什么区别吗?

Thanks in advance 提前致谢

Use DBCC SHRINKFILE and schedule it as a job that runs regularly (preferably during off-hours). 使用DBCC SHRINKFILE并将其安排为定期运行的工作(最好在非工作时间)。

Just be aware that there is a performance hit from regularly growing and shrinking the log file. 请注意,定期增长和缩小日志文件会对性能造成影响。 If you have the space, you may want to set the file size to the maximum that it normally grows to and just leave it. 如果你有空间,你可能想要将文件大小设置为它通常增长到的最大值,然后保留它。

使用DBCC SHRINKFILE语句。

Reliable shrinking is achieved by 通过实现可靠的收缩

  • Backup (can be truncate only) 备份(只能截断)
  • Checkpoint 检查站
  • Shrink 收缩

首先,您应该在属性 - >选项 - >恢复模型上更改数据库恢复模式并将其更改为简单,然后从右键单击 - >任务 - >收缩 - >文件中收缩日志文件,然后选择文件类型“日志”并单击确定

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM