finish the database maintenance