日志文件满而造成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










最新评论
You really make it seem so easy with your presentation but I find this topic to be actually something which I think I would never understand. It seems too complicated and extremely broad for me. I'm looking forward for your next post, I will try to get the hang of it!
Hey There. I found your blog using msn. This is an extremely well written article. I will be sure to bookmark it and come back to read more of your useful info. Thanks for the post. I will definitely comeback.
Hello there, You have done a fantastic job. I'll certainly digg it and in my opinion suggest to my friends. I am confident they'll be benefited from this website.
I am sure this post has touched all the internet users, its really really nice piece of writing on building up new website.
I'll right away snatch your rss as I can not to find your email subscription link or e-newsletter service. Do you've any? Please permit me realize so that I may just subscribe. Thanks.
It's going to be ending of mine day, but before finish I am reading this wonderful post to improve my know-how.
Just desire to say your article is as amazing. The clearness to your put up is just spectacular and i can think you're knowledgeable on this subject. Fine along with your permission let me to snatch your RSS feed to keep up to date with drawing close post. Thank you one million and please continue the enjoyable work.
You have made some really good points there. I checked on the web for more information about the issue and found most individuals will go along with your views on this site.