Truncate SQL Server Transaction Log file in Microsoft SQL Server
1. Change the recovery mode from full to simple
ALTER DATABASE dbname SET RECOVERY SIMPLE;
2. By using DBCC commands shrink the transaction log file.
DBCC SHRINKFILE (@dbfilename , 1024)
3. Change back the recovery mode of database to full.
ALTER DATABASE dbname SET RECOVERY FULL;
4. Took full backup of database.
Note: If log shipping or database mirroring is establish please do not following the above method.
1. Take full backup of databaseĀ and log file.
2. Shrink the transnational log file of the database:
dbcc shrinkfile(dbfilename,1024);