Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RESTRICTED_USER

Before changing database schema I issue:

ALTER DATABASE SET RESTRICTED_USER

On completion:

ALTER DATABASE SET MULTI_USER

I understand that a running transaction will be permitted to continue until completion.

Q: Is there any way to wait till all regular users are off the database?

Q: Can the regular users issue more transactions? Can they continue working until disconnected from the server?

like image 963
pkario Avatar asked May 22 '09 08:05

pkario


People also ask

What is restricted user mode in SQL Server?

So SET RESTRICTED_USER will wait until all transactions have completed before taking affect. Once in place, regular users cannot issue further transactions, only members of the db_owner fixed database role and dbcreator and sysadmin fixed server roles can connect to the database.

What is the multi user in SQL Server?

This mode is generally used in organizations so that multiple users can access it simultaneously.

What is AutoClose in SQL?

AutoClose is a database option or setting – set on a database by database basis (meaning that it can't be controlled at the server level). According to Books Online: When set to ON, the database is shut down cleanly and its resources are freed after the last user exits.

What is with rollback immediate?

The ROLLBACK IMMEDIATE command tells the SQL Server that if it can't complete the command right away, then the other pending transactions should be rolled back. The NO_WAIT command has the opposite effect as ROLLBACK IMMEDIATE. If the ALTER DATABASE transaction can't be completed then that transaction is terminated.


1 Answers

From SQL Server Books Online

http://msdn.microsoft.com/en-us/library/aa933082(SQL.80).aspx

If the termination clause is omitted, the ALTER DATABASE statement waits indefinitely, until the transactions commit or roll back on their own.

So SET RESTRICTED_USER will wait until all transactions have completed before taking affect.

Once in place, regular users cannot issue further transactions, only members of the db_owner fixed database role and dbcreator and sysadmin fixed server roles can connect to the database.

like image 69
John Sansom Avatar answered Sep 27 '22 21:09

John Sansom