This article is half-done without your Comment! *** Please share your thoughts via Comment ***
If you are a beginner for SQL DBA profile, an interviewer may as this question like What is the difference between SINGLE_USER, RESTRICTED_USER and MULTI_USER in SQL Server.
If you confuse and want to give your answer in one line, you can say like These are the ALTER DATABASE SET commands which we can use to get exclusive access to SQL Server Database.
SINGLE_USER: Only one user can connect to the database at a time
1 2 3 |
ALTER DATABASE Database_Name SET SINGLE_USER WITH ROLLBACK IMMEDIATE GO |
RESTRICTED_USER: Only DB_OWNER, DB_CREATOR or SYSADMIN roles can connect to the database
1 2 3 |
ALTER DATABASE Database_Name SET RESTRICTED_USER WITH ROLLBACK IMMEDIATE GO |
MULTI_USER: Any number of users can connect to the database
1 2 3 |
ALTER DATABASE Database_Name SET MULTI_USER GO |
Leave a Reply