Friday, June 29, 2007

How To Resize A SQL Server Transaction Log

This is sample for resize a SQL Server transaction log.

USE AdventureWorks;
GO
-- Truncate the log by changing the database recovery model to SIMPLE.
    ALTER DATABASE AdventureWorks
    SET RECOVERY SIMPLE;
    GO
    
    -- Shrink the truncated log file to 1 MB.
    DBCC SHRINKFILE (AdventureWorks_Log, 1);
    GO

    -- Reset the database recovery model.
    ALTER DATABASE AdventureWorks
    SET RECOVERY FULL;
    GO

No comments:

Post a Comment