How to check Database is in restricted mode or not