Skip to content

Daniel Hillebrand

Tech and stuff, mostly .NET and web related.

  • Tools
  • About
  • Contact
  • Privacy Policy

Recent Posts

  • System.InvalidOperationException: IDX20803: Unable to obtain configuration from: ‘System.String’
  • Configure ASP.NET Core ports with Kestrel (Linux)
  • Angular ssl development certificate expired. How to renew it
  • What is my Windows 10 version?
  • Add development certificate in Chrome browser (Windows)

Recent Comments

  • Angular ssl development certificate expired. How to renew it – Daniel Hillebrand on Add development certificate in Chrome browser (Windows)
  • Daniel on How to reset a SQL Server LocalDB instance in Visual Studio
  • Alex on How to reset a SQL Server LocalDB instance in Visual Studio
  • Daniel on “Inconclusive” error in ReSharper unit test runner caused by “async void”
  • Michael Freidgeim on “Inconclusive” error in ReSharper unit test runner caused by “async void”

Archives

  • October 2021
  • July 2021
  • March 2021
  • August 2020
  • July 2019
  • June 2018
  • November 2017
  • September 2017
  • August 2017
  • July 2017

Categories

  • ASP.NET
  • ASP.NET Core
  • ASP.NET Identity
  • Azure
  • blogging
  • C#
  • Debug
  • DevOps
  • DotNet
  • Ergonomy
  • MVC
  • Performance
  • Security
  • SQL
  • SQL Server
  • Testing
  • Tools
  • Uncategorized
  • Visual Studio
  • web development

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Category: SQL

Rename an SQL Server Database that could not be exclusively locked

Quick note about how to rename an SQL Server database that could not be exclusively locked (because it has open connections to it):

ALTER DATABASE currentDbName SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
GO
EXEC sp_renamedb N'currentDbName', N'newDbName';
GO
ALTER DATABASE newDbName SET MULTI_USER WITH ROLLBACK IMMEDIATE;
GO

 

Posted on July 23, 2019Categories SQL, SQL Server
Privacy Policy Proudly powered by WordPress