当前位置 : 技术 / sql server 2005收缩日志

sql server 2005收缩日志

declare @db_name varchar(200)
declare @sql varchar(max)
declare my_cur cursor for
select name from sys.databases
where name not in ('master','tempdb','model','msdb')
open my_cur
fetch next from my_cur into @db_name
while @@fetch_status = 0
begin
set @sql = 'use master;
backup log '+@db_name+' with no_log;
dump transaction '+@db_name+' with no_log;
use '+@db_name+';
DBCC SHRINKFILE (2)
'
exec(@sql)
fetch next from my_cur into @db_name
end
close my_cur
deallocate my_cur

标签: mssql, 2005, 收缩日志

仅有一条评论

  1. 前来拜访

添加新评论