2016-08-25 34 views
0
Declare @db varchar(255) 
declare c cursor for 
select name from sys.databases where is_read_only=0 and state=0 and name NOT In ('master','model','tempdb','msdb') 
open c 
fetch c into @db 
while @@fetch_status=0 
Begin 
     exec SP_dboption @db,'trunc. log on chkpt.','true' 
     DBCC shrinkdatabase (@db) 
     fetch next from c into @db 
End 
close c 
Deallocate c 
+1

那麼,您的程序「SP_dboption」位於何處,您在哪裏執行此腳本? – NickyvV

+3

已棄用。請參閱http://dba.stackexchange.com/questions/27879/sp-dboption-is-not-available-in-sql-server-2012 – Serg

回答

相關問題