Troubleshooting Guide: Error 923 – Database in Restricted Mode (SQL Server 2025)
Why This Error Happens
This error occurs because the database’s user access option has been explicitly set to RESTRICTED_USER, which limits connectivity strictly to the database owner (dbo) and members of the dbcreator or sysadmin fixed server roles. This configuration is typically triggered manually during maintenance (such as restoring a database or running single-user diagnostic scripts) or automatically following certain recovery operations. If your current login is mapped to a standard user role without sysadmin privileges, SQL Server will reject the connection attempt and throw Error 923.
Step-by-Step Resolution Guide
Step 1: Verify Current Database State
- Open SQL Server Management Studio (SSMS) or Azure Data Studio and connect using an account known to have
sysadminprivileges. - Run the following query to check the current access state of the database:
SELECT name, user_access_desc FROM sys.databases WHERE name = 'YourDatabaseName';
- Confirm that the
user_access_desccolumn returnsRESTRICTED_USER.
Step 2: Reset the Database Access Mode
- Execute the
ALTER DATABASEcommand to revert the database to multi-user mode, allowing standard logins to reconnect. - Run this command in a New Query window:
ALTER DATABASE [YourDatabaseName] SET MULTI_USER;
- If the command hangs, ensure no other blocking transactions are preventing the state change by checking
sys.dm_exec_requests.
Step 3: Validate User Roles and Permissions
- If setting the database to
MULTI_USERdoes not resolve the access issue for specific logins, verify that the user attempting to connect is correctly mapped to the database. - Navigate to Security > Logins in SSMS, right-click the specific login, and select Properties.
- Under the User Mapping tab, ensure the checkbox for the target database is selected and assign the
db_ownerrole if standard access is required moving forward.
Step 4: Restart the SQL Server Service (If Stuck)
- If the
ALTER DATABASEcommand fails due to a stuck session or lingering lock from the previous maintenance window, a service restart may be required. - Open Services.msc on Windows Server 2025 or Windows 11.
- Locate SQL Server (MSSQLSERVER), right-click, and select Restart.
- Re-attempt the connection via SSMS once the service status returns to “Running.”
Alternative or Verification Steps
- Verification: Attempt to log in using a standard, non-administrative domain account to confirm the Error 923 message no longer appears and the connection succeeds.
- Alternative: If
ALTER DATABASEfails due to active connections, useALTER DATABASE [YourDatabaseName] SET MULTI_USER WITH ROLLBACK IMMEDIATE;to forcefully terminate blocking sessions and apply the change immediately.