Thursday, October 5, 2023

Optimizing Disk Space Managing MSSQL Logs on Dynamics 365 (Drive H)

Occasionally, you may encounter disk space issues on your H-drive (logs) due to the continuous filling of the transaction log.




In the displayed screenshot, it's evident that logs partition is nearing its capacity. This has hindered the import of an additional database, as SQL Server notifies me of insufficient disk space.

There is a solution suitable for development settings has been identified.

Follow these steps to manage logs in the AxDB database:

Launch SSMS
In the Object Explorer, navigate to the Databases folder, and right-click on 'AxDB'

In the properties of AxDB, you will see something like below


Here take the name of the second file and replace the name in the below query

Select 'New Query' from the context menu.
In the new query window, input the following code:



USE AxDB;
GO

ALTER DATABASE AxDB
SET RECOVERY SIMPLE;
GO

DBCC SHRINKFILE (AXdb277_log, 1);
GO

ALTER DATABASE AxDB
SET RECOVERY FULL;
GO


Executing this query can help manage the log files in AxDB, improving the performance and maintainability of your Dynamics 365 development environment.



If you've made it this far, please leave a kind word. Your encouragement fuels my desire to produce and share even more valuable content.