update replace database script to just change instance pointer

Change the script to import the data into a new database and then point
the existing instance at the new database. The new database is called
the same as the old one with the date in yyyymmdd format appended.

For #516
copy across instance settings when replacing db

we need to do this otherwise we lose the description etc.
allow instances to be marked unavailable

Add in middleware to check if an instance has been marked as unavailable
and a script to change the setting

Fixes #516
Set API to use alternative db if required