SQL-收缩数据库日志文件 [英] SQL - shrink database log file

查看:303
本文介绍了SQL-收缩数据库日志文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试缩小数据库日志文件.我尝试运行:

I am trying to shrink my database log file. I have tried to run:

USE databasename 
BACKUP log databasename
WITH truncate_only 
DBCC shrinkfile (databasename_log, 1)

我收到错误消息:

155消息,第15层,状态1,第3行 无法识别"truncate_only" BACKUP选项.

Msg 155, Level 15, State 1, Line 3 'truncate_only' is not a recognized BACKUP option.

我想念什么吗?

推荐答案

SQL Server 2008不再允许NO_LOG/TRUNCATE_ONLY选项.

SQL Server 2008 no longer allows the NO_LOG / TRUNCATE_ONLY options.

要截断事务日志,您必须备份(真实)或将数据库的恢复模型切换为简单".后者可能是您真正想要的.除非您要进行常规的事务日志备份以使其能够恢复到一天中的某个时间点,否则不需要完全恢复.

To truncate your transaction log, you either have to back it up (for real) or switch the database's Recovery Model to Simple. The latter is probably what you really want here. You don't need Full recovery unless you are making regular transaction log backups to be able to restore to some point mid-day.

这篇关于SQL-收缩数据库日志文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆