4 Responses to “SQL Server Truncate Transaction Log script”

  1. Sandeep Says:

    have u tested this ? doesn’t work

    • riteshshah Says:

      Yes, how can I upload the script without testing it? This was working in SQL Server 2000. Which version of SQL Server are you using?

  2. Aaron Says:

    This worked for me on SQL 2005 server….

    USE ;
    GO
    DBCC SHRINKFILE(, 1)
    BACKUP LOG WITH TRUNCATE_ONLY
    DBCC SHRINKFILE(, 1)
    GO

    where is typically ‘_log’

  3. Aaron Says:

    Here is a correction (the < and > were being stripped out). This worked for me on SQL 2005 server….

    USE mydatabase;
    GO
    DBCC SHRINKFILE(mydatabase_log, 1)
    BACKUP LOG mydatabase WITH TRUNCATE_ONLY
    DBCC SHRINKFILE(mydatabase_log, 1)
    GO

    where mydatabase is the name of your databse…


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: