Quantcast
Viewing latest article 1
Browse Latest Browse All 2

Answer by RLF for Couldn't restore database and couldn't change Single user mode to Multi user mode

Here is what I do to ensure that I get the ONE (1) connection for SINGLE_USER.

USE MyDB;  -- Use the database you want to make SINGLE_USERGOALTER DATABASE MyDB SET SINGLE_USER WITH ROLLBACK IMMEDIATE;GORESTORE DATABASE ----; /* Or whatever you need to do. */GOALTER DATABASE MyDB SET MULTI_USER;GO

The trick is to be in the database already when you switch to SINGLE_USER mode. This way, you are the SINGLE_USER and nobody else can get in until you return the database to MULTI_USER.

NOTE: If you exit the database while in SINGLE_USER mode someone else can take over the database. This can also cause you problems.


Viewing latest article 1
Browse Latest Browse All 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>