Extreme wait-time when taking a SQL Server database offline

前端 未结 17 917
有刺的猬
有刺的猬 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:57

    In SSMS, set the database to read-only then back. The connections will be closed, which frees up the locks.

    In my case there was a website that had open connections to the database. This method was easy enough:

    1. Right-click the database -> Properties -> Options
    2. Set Database Read-Only to True
    3. Click 'Yes' at the dialog warning SQL Server will close all connections to the database.
    4. Re-open Options and turn read-only back off
    5. Now try renaming the database or taking it offline.

提交回复
热议问题