Friday, May 8, 2015

Shrink transaction Log using linked server 3 part naming


Many times transaction log space gets full on SQL servers. To truncate transaction log we can use below script:
 DECLARE @Query NVARCHAR(1000)
 SET @Query = N'DBCC SHRINKFILE(2,0,''TRUNCATEONLY'')'
 EXEC YourServerName.YourDBName.dbo.sp_executesql
 @statement = @Query
DBCC is database console command, 2 in SHRINKFILE signifies log file.

No comments:

Post a Comment