Menu
Newbedev LogoNEWBEDEV Python Javascript Linux Cheat sheet
Newbedev LogoNEWBEDEV
  • Python 1
  • Javascript
  • Linux
  • Cheat sheet
  • Contact

How can I detach a database that is in use?

Solution 1:

--Kick all users off of the database NOW
ALTER DATABASE YourDatabase SET SINGLE_USER WITH ROLLBACK IMMEDIATE

--Kick all but after 60 seconds
ALTER DATABASE YourDatabase SET SINGLE_USER WITH ROLLBACK AFTER 60 SECONDS

--restore connection to users
ALTER DATABASE YourDatabase SET MULTI_USER

Solution 2:

Have you tried checking the "Drop Connections" box when you detach it?

Tags:

Sql Server 2005

Related

How to kill a <defunct> process with parent 1 Find out symbolic link target via command line How to use find command to delete files matching a pattern? IIS6 vs. IIS7 and IIS7.5: handling URLs with plus sign (+) in base (not querystring) Easiest way to set up LDAP for dev testing Apache - Redirect to https before AUTH What is gssapi-with-mic? How to join domain and still maintain settings from unjoined user profile? How do I tell if my Windows server is swapping? Linux - What directories should I exclude when backing up a server? Why should I enable IO APIC in VirtualBox? How do you determine what type of CPU socket a linux computer has?

Recent Posts

Pandas how to find column contains a certain value Recommended way to install multiple Python versions on Ubuntu 20.04 Build super fast web scraper with Python x100 than BeautifulSoup How to convert a SQL query result to a Pandas DataFrame in Python How to write a Pandas DataFrame to a .csv file in Python
© 2021 newbedevPrivacy Policy