日志文件满而造成SQL数据库无法写入文件时,可用两种方法:
一种方法:清空日志。
1.打开查询分析器,输入命令
DUMPTRANSACTION数据库名WITHNO_LOG
2.再打开企业管理器–右键你要压缩的数据库–所有任务–收缩数据库–收缩文件–选择日志文件–在收缩方式里选择收缩至XXM,这里会给出一个允许收缩到的最小M数,直接输入这个数,确定就可以了。
另一种方法有一定的风险性,因为SQLSERVER的日志文件不是即时写入数据库主文件的,如处理不当,会造成数据的损失。
1:删除LOG
分离数据库企业管理器->服务器->数据库->右键->分离数据库
2:删除LOG文件
附加数据库企业管理器->服务器->数据库->右键->附加数据库
此法生成新的LOG,大小只有500多K。
注意:建议使用第一种方法。
如果以后,不想要它变大。
SQL2000下使用:
在数据库上点右键->属性->选项->故障恢复-模型-选择-简单模型。
或用SQL语句:
alterdatabase数据库名setrecoverysimple
另外,Truncatelogoncheckpoint(此选项用于SQL7.0,SQL2000中即故障恢复模型选择为简单模型)当执行CHECKPOINT命令时如果事务日志文件超过其大小的70%则将其内容清除在开发数据库时时常将此选项设置为TrueAutoshrink定期对数据库进行检查当数据库文件或日志文件的未用空间超过其大小的25%时,系统将会自动缩减文件使其未用空间等于25%当文件大小没有超过其建立时的初始大小时不会缩减文件缩减后的文件也必须大于或等于其初始大小对事务日志文件的缩减只有在对其作备份时或将Truncatelogoncheckpoint选项设为True时才能进行。
注意:一般立成建立的数据库默认属性已设好,但碰到意外情况使数据库属性被更改,请用户清空日志后,检查数据库的以上属性,以防事务日志再次充满。

神马VPS










最新评论
I like this post, enjoyed this one appreciate it for posting.
Definitely, what a splendid blog and enlightening posts, I surely will bookmark your site.Best Regards!
As I website possessor I conceive the content here is very fantastic, thanks for your efforts.
I was suggested this website by my cousin. I am not sure whether this post is written by him as nobody else know such detailed about my difficulty. You are wonderful! Thanks!
Hello! I just would like to give a huge thumbs up for the great info you have here on this post. I will be coming back to your blog for more soon.
My brother suggested I might like this web site. He was totally right. This post actually made my day. You can not imagine just how much time I had spent for this information! Thanks!
I haven¦t checked in here for a while since I thought it was getting boring, but the last several posts are good quality so I guess I will add you back to my everyday bloglist. You deserve it my friend :)
I went over this website and I believe you have a lot of good info , bookmarked (:.