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 careful these settings should not be changed in the production without consulting DBA as it will affect the recovery time in case of a crash. More appropriate to do it on Test or Development machines to catch up on disk space.


Use <DatabaseName>
GO
DBCC SHRINKFILE(<Database_Log>,100)
GO

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

Comments

Popular posts from this blog

D365: SSRS Report Development/ Customization

D365: X++ code to add custom lookup on worker to show specific workers team workers only

Error message when you log on to a Microsoft Dynamics AX 4.0 client: "You are not a recognized user of Microsoft Dynamics AX"