We can shrink SQL Server Database by shrinking their respective logfiles using the below command:
USE YourDatabase
GO
DECLARE @LogFileLogicalName SYSNAME
SELECT @LogFileLogicalName= 'Name'
FROM SYS.DATABASE_FILES WHERE TYPE=1 ---Enter log filename
PRINT @LogFileLogicalName
DBCC Shrinkfile(@LogFileLogicalName,1)
USE YourDatabase
GO
DECLARE @LogFileLogicalName SYSNAME
SELECT @LogFileLogicalName= 'Name'
FROM SYS.DATABASE_FILES WHERE TYPE=1 ---Enter log filename
PRINT @LogFileLogicalName
DBCC Shrinkfile(@LogFileLogicalName,1)
No comments:
Post a Comment