Check and force database consistency