Exit single-user mode

前端 未结 18 1069
离开以前
离开以前 2020-12-12 09:32

Currently, my database is in Single User mode. When I try to expand me database, I get an error:

The database \'my_db\' is not accessible.(ObjectExplo

18条回答
  •  误落风尘
    2020-12-12 10:11

    First, find and KILL all the processes that have been currently running.

    Then, run the following T-SQL to set the database in MULTI_USER mode.

    USE master
    GO
    DECLARE @kill varchar(max) = '';
    SELECT @kill = @kill + 'KILL ' + CONVERT(varchar(10), spid) + '; '
    FROM master..sysprocesses 
    WHERE spid > 50 AND dbid = DB_ID('')
    EXEC(@kill);
    
    GO
    SET DEADLOCK_PRIORITY HIGH
    ALTER DATABASE [] SET MULTI_USER WITH NO_WAIT
    ALTER DATABASE [] SET MULTI_USER WITH ROLLBACK IMMEDIATE
    GO
    

提交回复
热议问题