Note: Maintenance Plan does not need to be implemented in a SQL Schedule post-9.3 as this is already implemented to the existing maintenance.
This maintenance will revitalize and get your database running smoother. However, please note this needs to be done during a maintenance window as each step can take a very long time. The time it takes to process depends on the current database size and the performance of the SQL Server. I would recommend setting a large block of time committed to doing this.
1) Stop all Kaseya-related services and IIS.
2) Backup your SQL Database through SQL Server Manager.
3) Run each script located in database-cleanup.zip, simply open each script and execute them in SQL Server Manager. (Note: Some of these may take a long time to run)
4) Once all those scripts are ran, unzip database-maintenance.zip and run the shrinkTransactionLog.sql script.
5) Next, run the shrink database sql script. (Note: This may take a long time to run.)
6) Next, run the numbered scripts in the numbered order. (Note: It is common that these scripts return "red" text but does not indicate an error. Furthermore, if the stored procedures already exist, the first two scripts will return an error, and can be safely ignored.)
7) run the shrinkTransactionLog.sql script. again.
8) Finally, restart all Kaseya-related services and IIS.
Additionally, you can take the scripts in database-cleanup.zip and create a reoccurring database maintenance plan in SQL Server Manager to keep your database from growing too large in the future:
For information on how to create a database maintenance plan, please see here.