by Ashish Upadhyay
Below script can be used to shrink log file from all the user databases if the log file name created as default name DatabaseName _log.
EXEC sp_MSforeachdb 'IF ''?'' NOT IN (''master'', ''model'', ''msdb'',
''tempdb'')
BEGIN
DECLARE @SQL nVARCHAR(255)
SET @SQL = ''USE [?] DBCC
SHRINKFILE (N''''?_log'''' , 0, TRUNCATEONLY)''
EXEC (@SQL)
END'
GO
No comments:
Post a Comment