core: database restore fixes

This patch enables restoring the database from a old backup and will
perform all necessary data and schema updates using the upgrade.sh
script that is executed after the restore is completed.
The upgrade step also forces truncation of the async_tasks and
business_entity_snapshot tables since those tables contain data that is
relevant for asynchronous tasks and might lead to exceptions if
restored.
You can omit the execution of the upgrade step with the -o flag.

The recommended way for restoring your database is.
1) backup current with backup.sh
2) run restore.sh and give other database instance name as the target
3) edit JBOSS standalone.xml to run the new restored database instance
4) verify that all tasks in the application are completed
5) restart JBOSS

Change-Id: Ib2fc6b61e8e679db40acf2a074fc4737873d5707
Signed-off-by: Eli Mesika <emesika@redhat.com>