Friday, September 27, 2013

Shrink the Dynamics AX Database Log Files

The Database log(.ldf) can be shrunk to recover some of the disk space on the DB server. Just ensure you have appropriate backups of the data file(.mdf)

The command can be executed when the database recovery option is set to Simple. The recovery option can be found under Database Properties > Options > Recovery Model

Just be mindful these settings should not be changed in the production without consulting DBA as it will affect the recovery time incase of a crash. More appropriate to do it on Test or Development machines to catch up on disk space.

Use <DatabaseName>
DBCC SHRINKFILE(Database_Log,100)

The first parameter is the logical name for the DB log, which can be found from the Database Properties > Files > Logical Name Column. The second parameter is for size in MB to be set.

No comments:

Post a Comment