Quantcast
Channel: SQL Archives - SQL Authority with Pinal Dave
Viewing all articles
Browse latest Browse all 594

SQL SERVER – Master Database in Single User Mode – A Serious Issue

$
0
0

There are some weird situations which I see in SQL Server. This is also a one of the surprising situation. One of my clients reported via below screen shot. Let us see the issue of Master Database in Single User Mode.

SQL SERVER - Master Database in Single User Mode - A Serious Issue master-single-01

Interesting enough, there was no issue with SQL functionality. It was acting just normally which means that we were able to make connections to SQL Server without any issues. They said that there are no users complains and users were able to get multiple connections to the Master as well.

We tried to switch it back to multi_user both in T-SQL and GUI, we get the same error:

Msg 5058, Level 16, State 5, Line 1
Option ‘MULTI_USER’ cannot be set in database ‘master’.

Since, it was interesting, I asked to check sp_helpdb for master and check the same in sys.database catalog views.

SQL SERVER - Master Database in Single User Mode - A Serious Issue master-single-02

SQL SERVER - Master Database in Single User Mode - A Serious Issue master-single-03

Both of the above have conflicting information. While this is an unexpected behavior, how do we come out of this situation?

WORKAROUND/SOLUTION

Here is the solution I offered them.

  • Take the backup of master database using the backup database command.
  • Restored the backup taken in the previous step as a user database. Let’s say master_one.
  • The use ALTER command and get master_one in multiuser mode.
  • Now take the backup of that user database (master_one) and then restored it in master using the below command. To restore the master database, we need to start SQL in single user mode.
Restore database master from disk= 'C:\Temp\Master_one.bak' with replace

Once they followed the above steps, the master database was back to multi user mode. My client was not sure how they ended up in such situation.

Reference: Pinal Dave (http://blog.SQLAuthority.com)

First appeared on SQL SERVER – Master Database in Single User Mode – A Serious Issue


Viewing all articles
Browse latest Browse all 594

Trending Articles