To get exclusive access to the database to perform maintenance tasks etc. you can set the database to Single User Mode, which permits only one database connection at a time. At that moment if other users try to access the database while you are working on that active connection, they will receive an error.