Extreme wait-time when taking a SQL Server database offline

前端 未结 17 1198
有刺的猬
有刺的猬 2021-01-29 17:05

I\'m trying to perform some offline maintenance (dev database restore from live backup) on my dev database, but the \'Take Offline\' command via SQL Server Management Studio is

17条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-29 17:40

    I tried all the suggestions below and nothing worked.

    1. EXEC sp_who
    2. Kill < SPID >

    3. ALTER DATABASE SET SINGLE_USER WITH Rollback Immediate

      ALTER DATABASE SET OFFLINE WITH ROLLBACK IMMEDIATE

      Result: Both the above commands were also stuck.

    4 . Right-click the database -> Properties -> Options Set Database Read-Only to True Click 'Yes' at the dialog warning SQL Server will close all connections to the database.

    Result: The window was stuck on executing.

    As a last resort, I restarted the SQL server service from configuration manager and then ran ALTER DATABASE SET OFFLINE WITH ROLLBACK IMMEDIATE. It worked like a charm

提交回复
热议问题