Sometimes we want to make a changes to the database or create a backup, but the users must be disconnected for this time. The easiest way is to set the database to the offline state:
ALTER DATABASE dbname SET OffLine WITH ROLLBACK IMMEDIATE
ALTER DATABASE dbname SET OnLine WITH ROLLBACK IMMEDIATE
The alternative is to set the Restrict Access to the Restricted User in the database Properties/Options.