I need to restore complete database in a regular basis (weekly). I am using pure PHP + system call to mysqldump and mysql to backup and restore full database. The restore process takes 2 minutes. What would be the correct procedure in order to keep the site in maintenance instead of getting a Drupal database error? Is there some sequence of table restoration?
For example, I use UPDATE variable SET value = 's:1:\"1\";' WHERE name= 'maintenance_mode';" just before the restoration, but obviously as there is a DROP TABLE if exists maintenance_mode in the SQL backup file, the site will show an error instead of the maintenance screen for a moment, and maybe in more occasions if there are incongruences among the different tables as they are updated.
I was thinking of controlling the process with the .htaccess, forwarding all traffic to a static HTML maintenance page.
Update: I have created my own module as there are many other tables which are outside Drupal and the product has to be specifically integrated with the requirements of the customer. So I cannot use the Backup and Migrate module (as suggested in one of the answers).