Shrink SQL Database log file to One MB

Every AX administrator should know how to shrink AX database logs from the SQL management studio. You can run below SQL command with respect to your AX database.

** Replace ‘AdventureWorks2012‘ with your database name

USE AdventureWorks2012;
GO
/*Truncate the log by changing the database recovery model to SIMPLE*/
ALTER DATABASE AdventureWorks2012
SET RECOVERY SIMPLE;
GO
/*Shrink the truncated log file to 1 MB*/
DBCC SHRINKFILE (AdventureWorks2012_Log, 1);
GO
/*Reset the database recovery model*/
ALTER DATABASE AdventureWorks2012
SET RECOVERY FULL;
GO

For more information, please refer MSDN site

“Yours, Ravi Theja Madisetty”

Disclaimer: This posting is provided “AS IS” with no warranties or guarantees, and confers no rights.

2 comments

  1. Wow, your advise is not based on best practices. The log file size must be managed by implementing proper database backup strategy.
    Your advice makes the database log chain broken and the database is not recoverable till failure time, means the AX database will loose data once disaster occurs.

    Warmest Regards,
    Hamid J. Fard

  2. Hi Hamid,

    Thanks for suggestion. I will add your point in notes in the same post. That will alert site visitors.

    Best Regards,
    Ravi Theja Madisetty

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: