--在master數據庫中執行以下腳本(使用查詢分析器) 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 '[email protected]+' with no_log') exec ('dbcc shrinkdatabase('[email protected]+')') exec ('dbcc checkcatalog ('[email protected]+')') exec ('dump transaction '[email protected]+' with no_log') fetch next from temp_cur into @dbname end close temp_cur deallocate temp_cur