After my client's implementation in NAV, the system was working smooth and flawlessly. An important issue was that the client couldn't close their books due to the change in Business Processes and even the customization was evolving as per the changing Business Process. This lead to serious slowing down of the system, filtering and finding records was a pain.
When all the options ran out, we default to calling the Microsoft Support for help!
They suggested upgrading the NAV CU versions which was way painful as all the data needed to migrate and again the system would face a downtime which my client couldn't afford!!
Out of nowhere we were suggested reindexing the tables in NAV which were impacted the most as a periodic activity.
- Microsoft SQL Server Management Studio (SSMS)
- Microsoft Dynamics NAV
- Understanding of SQL
- Understanding of NAV Server Instance
1. Restart NAV Server instance using PowerShell and Task Scheduler:Create a PowerShell with the below command.
Restart-NAVServerInstance -ServerInstance <NavServerInstanceName> -Flags
Then add the Powershell to Task scheduler to schedule the Restart of the NAV Server Instance.
|Trigger for Task Scheduler|
|TaskScheduler calling PowerShell Script|
2. Restart SQL Server to free-up RAM using PowerShell and Task Scheduler:
SQL Server by design consumes a lot of RAM and does not free it up. You can limit the RAM usage but this doesn't account for higher runtime performance during maximum load.
Create a PowerShell Script to restart SQL Server
Get-Module -Name VMware* -ListAvailable | Import-Module Restart-Service -Force 'MSSQLSERVER'
Import-Module SQLPS -DisableNameChecking Set-Service SQLBrowser -StartupType Automatic Start-Service "SQLBrowser"
$instanceName = "localhost"
$managedComputer = New-Object Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer
$sqlServerAgentInstance = $managedComputer.Services['<YOUR SQL SERVER NAME>']
Again, you add this to TaskScheduler.
3. Re-Index the tables in the SQL DB:
Reindexing the table in SQL DB is a maintenance activity that speeds up the fetching activity for Microsoft Dynamics NAV / Business Central.
|Reindexing SQL Script|
|Executing Reindexing Stored Procedures|
Executing the Stored Procedure for ReIndexing. The Stored Procedure for Reindexing can also be triggered as a Job in SQL.