Implement database optimization feature.

Fix restart with maintenance mode sometimes not work properly.
Add description for restart with maintenance mode.