用脚本缩小日志
来源:互联网 发布:php处理ajax跨域 编辑:程序博客网 时间:2024/05/01 17:26
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
因为客户使用的数据库时常因为日志过大而导致硬盘空间不够,或者备份出来的文件太大无法通过邮件传送。
闲下有余,参考SQLSERVER的帮助文件,写了如下脚本,可以截断日志,以达到缩小文件的目的。有空大家可以在自己的SQLSERVER上测试下效果哦。。。:)也许对有些情况导致的日志过大没有作用,这点可以同各位同仁互相交流下。
--在MASTER数据库中执行以下脚本(使用查询分析器)
declare@dbnamevarchar(50)
declaretemp_curcursorscrollforselectnamefromsysdatabases
opentemp_cur
fetchfirstfromtemp_curinto@dbname
while@@fetch_status=0
begin
exec('backuplog'+@dbname+'withno_log')
exec('dbccshrinkdatabase('+@dbname+')')
exec('dbcccheckcatalog('+@dbname+')')
exec('dumptransaction'+@dbname+'withno_log')
fetchnextfromtemp_curinto@dbname
end
closetemp_cur
deallocatetemp_cur
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
- 用脚本缩小日志
- 用脚本缩小日志
- 用脚本缩小数据库日志
- 用脚本缩小数据库日志
- 缩小日志
- 缩小SQL日志
- 缩小数据库日志文件
- 缩小日志文件
- 缩小SQLSERVER日志文件
- 缩小SQL日志
- 缩小日志另类方法
- 缩小数据库日志文件
- sqlserver日志文件缩小
- 图片缩小放大脚本
- 缩小数据库日志另类方法
- 缩小SQL SERVER日志文件
- 缩小SQL SERVER日志文件
- 缩小SQL SERVER日志文件
- 取汉字拼音首字母的存储过程
- 中格式化表中的数据
- SQLSERVER的命名规则
- SQLserver锁的机制
- static member variable and static member function in a class
- 用脚本缩小日志
- 用脚本缩小日志
- MSSQL备份和恢复存储过程
- 深入SQLSERVER2000的内存管理机制(三)
- 深入SQLSERVER2000的内存管理机制(二)
- 理解odbc和ole
- SQL备份并压缩备份文件
- SQLSERVER2000SP4新特性概述
- 设计之美——反射测试