In SQL Server, it is important to keep the size of the transaction log at a decent size. If the transaction log fills up your disk drive. It can hang up the database. T-log is like archived redo log files in oracle database. Instead of storing multiple files, SQL server stores the t-log as a single file with extension .ldf . The t-log file consists of multiple virtual files with the log sequence no. ( out of scope for this article 🙂 )
Procedure to shrink transaction log :
C:\> osql -u sa
password: ****
–1)
BACKUP LOG dbname WITH TRUNCATE_ONLY
GO
–2)
USE dbname;
SELECT * FROM sysfiles;
GO
–3)
Then, using the logfile name that sysfiles revealed in the last
step, shrink log size to the –desired size in mb, in this case 500.
USE dbname;
DBCC SHRINKFILE(logfilename,500)
GO