SQL Server 清除数据库日志脚本
SQL Server 清除数据库日志脚本
-
清除mssql数据库日志的代码:
Use master
go
declare dbname varchar(50)
declare temp_cur cursor scroll for select name from sysdatabases
open temp_cur
fetch first from temp_cur into dbname
while fetch_status =0
begin
exec ('backup log ['+dbname+'] with no_log')
exec ('dbcc shrinkdatabase(['+dbname+'])')
exec ('dbcc checkcatalog (['+dbname+'])')
exec ('dump transaction ['+dbname+'] with no_log')
fetch next from temp_cur into dbname
end
close temp_cur
deallocate temp_cur
上一篇:解决并清除SQL被注入<script>恶意代码 下一篇:解决DB2中出现的SQL1032N错误现象
相关文章
最新评论 查看全部评论
发表评论
不能超过500字节,请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论,否则后果自负。