One of the first things I have to do after I’ve installed Dynamics GP and created the DYNAMICS, TWO and company databases, is setup jobs to backup and optimize those databases. The best method I’ve found to do that is a free solution developed by Ola Hallengren that can be found here. This solution received the 2010 Editor’s Choice Bronze Award for best Free SQL Tool, while the SQL Server Community gave it the Gold. After a previous write-up of this solution Ola contacted me directly asking for my feedback, and he has been in touch several times since – he clearly cares about his solution and makes regular improvements as SQL Server features are added or changed.
The solution can be installed by downloading and running a single sql script – direct link here. Upon opening the script in SQL Management Studio, I typically make two changes. First I change the value of the @BackupDirectory parameter, highlighted below, to point to the location I want the backups stored. The backup job will create a folder with the server name in this folder, with folders for each database below that, followed by folders for each of the backup types – full, differential, and log.
The second change I make is that I like to keep 3 days worth of backups on disk if possible, and the scripts defaults to cleaning up backups older than 24 hours, so I like to change that to 72 hours. This can certainly be done afterwards by editing the job step but I like to do it up front. I usually do a quick find and replace operation on “24, ” replacing with 72.
After the replace is completed, I run the script and the highlighted jobs below are created. From there I open each job, set the desired schedule for each one, and I’m done.
I use this script because I want consistently configured backup and database maintenance jobs on all of the SQL Servers I manage for my customers. It takes 10-15 minutes to configure and I love that it’s smart enough to not throw an error on the whole transaction log job if someone creates a new company and the recovery is still set to Simple – it skips that database and moves on to the next one. It is also much smarter then the SQL Server Maintenance Plans about whether it rebuilds or reorganizes the databases indexes. Visit Ola’s site, http://ola.hallengren.com to read more about the solution or view the documentation.