About the Author:
Lukas Vileikis is an ethical hacker and a frequent conference speaker.
Since 2014, Lukas has found and responsibly disclosed security flaws in some of the most visited websites in Lithuania.
He runs one of the biggest & fastest data breach search engines in the world - BreachDirectory.com, frequently speaks at conferences and blogs in multiple places including his blog over at lukasvileikis.com.
You’re probably a MySQL, Sybase or Oracle DBA which means you have things to do – some of those things might include the monitoring of your database instance(s) with dbWatch. The monitoring of your database instances might prove to be a daunting task which can be indeed made more simple by using dbWatch, but have you ever thought what would you do if the dbWatch server would crash or become otherwise unavailable? You have probably thought about how to back up your dbWatch related data (we explained how to do exactly that in a previous blog), but after you’ve backed up your data you would also need to restore everything to make everything look the same as it has been looking previously – in this blog post, we will tell you how to do exactly that.
How do You Restore dbWatch?
Before we actually tell you how you should restore a dbWatch configuration backup, you should know that all of the configuration files in dbWatch are continously backed up by using git. To restore dbWatch from git you need to:
1. Download the git tools from here or from any other reputable resource:
2. Stop the dbWatch Server and any services related to it. Open up a command prompt that
understands git commands (i.e „Git CMD“) and navigate to the config catalog. This catalog is
located at C:/ProgramData/dbWatchControlCenter/config if a newer version (e.g the ControlCenter) of dbWatch is in use:
3. Take a backup of the config directory in case something goes wrong (the location of the
directory can be found by following the second step)
4. Run the following git command to see the git entries. In the entry list find the entry you want to back up your data from (the entry list should contain the date, the time and the description of the changes):
git log –-pretty=format:“%h %cD %s“
Finding an entry you want to revert to can involve guessing, but seeing the date, time and the description of the changes should make everything so much easier for you. When you find the entry you want to revert to, please note the hash of it. For example an entry like so (that’s the first entry displayed):
7711171f Fri, 26 Feb 2021 22:56:29 +0200 Adding engine
Could be understood like “On the 26th of February, 2021, on 22:56:29 GMT +2 an engine named “MySQL Instance” was added. The hash of the entry would be „771171f“ (knowing the hash of the entry lets you restore dbWatch)
5. To revert to an entry, run the git checkout command (the command lets you navigate
between the branches that are created by git branch): git checkout 771171f ./server_configuration.xml
6. After this, you can also restore some of the data (the following screenshot restores the chat and any relevant resources) from an older copy of dbWatch if you have taken a copy:
7. Now your backup is almost ready! Commit your backup to git by running the following:
git commit –m „Backup“
8. Restart the dbWatch server and, if the services are not started, start them:
9. You have successfully restored dbWatch from a backup copy!
Previously, we have discussed how to back up data belonging to dbWatch – in this guide we have discussed how should you go about restoring a dbWatch configuration from a backup. The process of doing so might seem daunting, but it‘s really not – you just need to know the way around git and as long as you follow this guide, you should be on a good path. As always, if you need any further assistance feel free to reach out to the team – we will be more than happy to assist you.