Microsoft SQL Server
ALTER DATABASE baza SET SINGLE_USER WITH ROLLBACK IMMEDIATE
Above command does:
- Forces all of the users from database.
- Restricts access to database to all users:
- except one and only user that has executed the command
- any other user even super-user can not get access to database
- even the same user that put database in single user mode but in second connection is restricted to database
Db2
QUIESCE DATABASE IMMEDIATE
- Forces all users from database.
- Restricts access to database to all users:
- except all users with SYSADM, SYSMAINT, DBADM, or SYSCTRL authorities.
Is there single user mode in Db2 v11.5/Linux, so only one single user that has put database into single user mode has access to it in one single session?
connect to <dbname> in exclusive mode
?SELECT 1 FROM TABLE (MON_GET_CONNECTION (NULL, -2)) WHERE APPLICATION_HANDLE <> MON_GET_APPLICATION_HANDLE() LIMIT 1
returns a row.