Link to home
Start Free TrialLog in
Avatar of qdsinc
qdsinc

asked on

How do I delete the records from the MSSQL Log File ?

How do I delete the records from the MSSQL Log file and shrink the file size?
Avatar of dirkmartin
dirkmartin
Flag of United States of America image

The active portion of the transaction log can never be truncated. The active portion of the log is the part of the log needed to recover the database at any time. It must always be present in the database in case the server fails because it will be required to recover the database when the server is restarted. The record at the start of the active portion of the log is identified by the minimum recovery log sequence number (MinLSN).

The log records before the MinLSN are only needed to maintain a sequence of log backups. If a log backup sequence is not being maintained, all log records before the MinLSN can be truncated at any time. If a log backup sequence is being maintained, the part of the log before the MinLSN cannot be truncated until those log records have been copied to a log backup.

If a database log backup sequence is not being maintained for a database, the database can be set into log truncate mode. The trunc. log on chkpt. database option must be set to TRUE for a database to be eligible for log truncate mode.

When a log backup sequence is not being maintained, either set on the trunc. log on chkpt. database option, or schedule BACKUP LOG WITH NO_LOG or BACKUP LOG WITH TRUNCATE_ONLY statements at intervals frequent enough to keep the log from growing past the desired size.
ASKER CERTIFIED SOLUTION
Avatar of amitpagarwal
amitpagarwal
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial