问题描述
所以我一直忽略对我的fogbugz 数据库做任何备份,现在fogbugz ldf 文件已经超过了2 个半.这是我们使用fogbugz 的六个月积累起来的.
So I have been neglecting to do any backups of my fogbugz database, and now the fogbugz ldf file is over 2 and half gigs. Thats been built up over the six months we've been using fogbugz.
我备份了数据库,然后我备份并截断了事务日志,但事务日志仍然是 2 个半演出.我对日志文件做了一个缩小,它仍然是 2 个半的演出.我所做的一切似乎都没有缩小文件的大小.
I backed up the database, then I backed up, and truncated the transaction log, yet the transaction log is still 2 and a half gigs. I did a shrink on the log file and its still 2 and a half gigs. Nothing I do seems to shrink the file in size.
有没有办法解决这个问题?或者是此时分离数据库、删除日志文件然后重新附加新的唯一方法?
Is there anyway to fix the problem? Or is the only way back at this point to detach the database, delete the log file and then reattach with a new one?
推荐答案
欢迎来到变化无常的 SQL Server 日志管理世界.
Welcome to the fickle world of SQL Server log management.
有些事情是错误的,但我认为如果没有一些额外的信息,没有人能告诉你更多.例如,此数据库是否曾用于事务性 SQL Server 复制?如果事务尚未复制到订阅者,这可能会导致此类问题.
SOMETHING is wrong, though I don't think anyone will be able to tell you more than that without some additional information. For example, has this database ever been used for Transactional SQL Server replication? This can cause issues like this if a transaction hasn't been replicated to a subscriber.
在此期间,这至少应该允许您杀死日志文件:
In the interim, this should at least allow you to kill the log file:
- 对数据库执行完整备份.不要跳过这个.真的.
- 将数据库的备份方法更改为简单"
- 打开一个查询窗口,输入checkpoint"并执行
- 再次备份数据库
- 将数据库的备份方法改回完整"(或其他任何方法,如果它不是简单的话)
- 执行数据库的最终完整备份.
您现在应该能够缩小文件(如果执行备份对您没有帮助).
You should now be able to shrink the files (if performing the backup didn't do that for you).
祝你好运!
这篇关于如何减小 sql server 日志文件的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!