Harri's profilePainKiller´s C# CornerBlogListsNetworkMore Tools Help

Blog


    Truncate log on SQL 2008

    Some times old tricks just dies, thats what happend with "BACKUP LOG WITH TRUNCATE_ONLY"
    When you run that on a SQL 2008 server you will read: "truncate_only' is not a recognized BACKUP option"
    It´s gone deprecated because of misuse (what?), anywhay this the new style of doing the same thing wich is to clear the logfile.
     
    USE dbname;
    GO
    -- Truncate the log by changing the database recovery model to SIMPLE.
    ALTER DATABASE dbname
    SET RECOVERY SIMPLE;
    GO
    -- Shrink the truncated log file to 1 MB.
    DBCC SHRINKFILE (2, 1);  -- here 2 is the file ID for trasaction log file,you can also mention the log file name (dbname_log)
    GO
    -- Reset the database recovery model.
    ALTER DATABASE dbname
    SET RECOVERY FULL;
    GO

    Comments

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.

    To add a comment, sign in with your Windows Live ID (if you use Hotmail, Messenger, or Xbox LIVE, you have a Windows Live ID). Sign in


    Don't have a Windows Live ID? Sign up

    Trackbacks

    The trackback URL for this entry is:
    http://csharp3.spaces.live.com/blog/cns!E0D0E097982463FD!186.trak
    Weblogs that reference this entry
    • None