Thursday, May 5, 2011

What is the LDF file in SQL Server?

What is the LDF file in SQL Server? what is its purpose?

can I safely delete it? or reduce its size because sometimes it's 10x larger than the database file mdf.

From stackoverflow
  • ldf saves the log of the db, certainly doesn't saves any real data, but is very important for the proper function of the database.

    You can however change the log model to the database to simple so this log does not grow too fast.

    Check this for example. Check http://support.microsoft.com:80/support/kb/articles/q256/6/50.asp&NoWebContent=1">here for reference

    Richard : If you are not doing separate data and transaction log backups, the log file will grow indefinitely unless you set backups to simple mode. You can then recover disk space by shrinking the log file.
  • The LDF is the transaction log. It keeps a record of everything done to the database for rollback purposes.

    You do not want to delete, but you can shrink it with the 'dbcc shrinkfile' command. You can also right-click on the database in SQL Server Manager and go to tasks->shrink.

  • The LDF file holds the database transaction log. See, for example, http://www.databasedesign-resource.com/sql-server-transaction-log.html for a full explanation. There are ways to shrink the transaction file; for example, see http://support.microsoft.com/kb/873235.

0 comments:

Post a Comment