THIS IS NOT A RECOMMENDED PRACTICE for production
systems... You will lose your ability to recover.
Requires membership in the sysadmin fixed
server role or the db_owner fixed database role.
Syntax
DBCC SHRINKFILE
([Logical log file name],target size in MB)
Example
-- Shrink the truncated log file to 1 MB.
USE STUDENT
DBCC SHRINKFILE (Student_log, 1);
GO
In this command some time log file size will be not reduce because of Database recovery MODE
is FULL, You need to set recovery mode as SIMPLE.
USE STUDENT
ALTER DATABASE
STUDENT
SET RECOVERY
SIMPLE;
GO
-- Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE (Student_log, 1);
GO
-- Reset the database recovery model.
ALTER DATABASE
STUDENT
SET RECOVERY
FULL;
GO