This was originally posted by Tony Dizon, and updated by Phil Kennedy in August 2024.
If you ever had a need to run the Sage 500 Database Synchronization Utility from a command line, then this will be of interest to you.
The Syntax
Open a Command Window and change the directory to "C:\Program Files (x86)\Sage Software\Sage MAS 500 Database Utilities\DBSync" or the location where your Database Synchronization Utility is located.
Type dbsync.exe /? and a screen will display showing all the switches that you have available. Plus there is an example command line for a simple synchronization too.
As you can see, you can also pass the /R to re-register the database. One thing to note about that is that the database should already have the Customer Number, Serial Number, and Unlock Key stored within it.(Specifically in tsmSiteProfile) . So you cannot use the command line DBSync tool to register the database for the very first time, but anytime thereafter you could.
Command Line Example
The line below shows an example of synchronizing and registering the database Sage500_2014_app on SQL Server named SQLServer2008R2 using the admin logon with no password
dbsync.exe /SSQLServer2008R2 /Uadmin /P /ASage500_2014_app /R
Create a batch file
If you have an environment where you frequently make copies of your production database to a test environment, you could create a batch file like the following to avoid having to type in the long command line over and over.
- Go to Windows Explorer and change the location to be the same as the location of the DBSync.exe file.
- Create a new text file, named DBSyncIT.txt
- Open DBSyncIT.txt and copy paste dbsync.exe /SSQLServer2008R2 /Uadmin /P /ASage500_2014_app and save the file, but before you do make sure you are passing your environment specific information (your SQL Server name, database name etc...)
- Rename the DBSyncIT.txt file to DBSyncIT.bat.
- Run it
Last notes
This tip is most useful for synchronizing database(s) that are restored frequently as would be the case in test environments. Typically in production, the database doesn't move so this command would not be as useful. Also notice that if you look under the location of the DBSync Utility, "C:\Program Files (x86)\Sage Software\Sage MAS 500 Database Utilities\DBSync", you will see the details in the DBSync.Log file, just like when running the DBSync conventionally. You can also run a T-SQL query to look at tsmDBHistory and tsmDBHistoryDetl tables to see what the DBSync tool logged.
I hope you find this tip useful
-Tony