What is the correct way to handle web requests while maintaining the database?


Scenario: You are going to do scheduled database maintenance. You will hence be unable to serve dynamic content (just assume the caching system in front of the database also needs to be maintained).

During that time, what's the correct way of handling web requests trying to access a dynamic resource?

What's the correct HTTP error code, if any, that goes along with the notice that your service is currently not available? Should you use errors in the 5XX range?

What are the implications in terms of SEO? Will it hurt if search engine crawlers try to access your site and see lots of error codes or pages with the same notice instead of dynamic content? Can you easily recover from that?

503 Service Unavailable is the correct response to use in this situation.