Shrinking the Database Log File:
1.Take complete database backup before performing any operation
First you need to take the Backup of .mdf and .ldf files, follow the below steps to complete process
2. Stop the Dynamics Ax Services:-
Start -> Run-> Type Services.msc -> Locate the Dynamics Ax Object Server -> Stop
3. Take the Database Offline Mode :
Open the SQL Server Management Studio and connect to appropriate Database Server
Right click on the database -> Tasks -> Take Offline
It will release all the resources gracefully.
4. Copy the .mdf and .ldf files :
Generally these file exist on the path C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA
If you are not sure about the database location Right Click on the Database -> Properties ->Select File (Located on Left Side Corner)
Than you can find the path for both .mdf and .ldf files
5. Bring the database online Mode:
After taking the backup, we need to make the database online mode
Right Click on the Database -> Task -> Bring Online
6. Query to Shrink log database file :
Run the following Query to shrink the log database file
Note: Do not run this query until you have proper backup
USE DynamicsAXLive (.mdf file name)
GO
ALTER DATABASE DynamicsAXLive (.mdf file name)
SET RECOVERY SIMPLE;
GO
DBCC SHRINKFILE(DynamicsAX_log, 5000); (log database file Name & minimum size to shrink)
GO
ALTER DATABASE DynamicsAXLive (.mdf file name)
SET RECOVERY FULL;
GO