Get the App
SLTechnology News&Howtos  ›  Database  › 

Cannot detach database 'xxx because it is currently using a workaround

Shulou Source: shulou.com Published: 2022-06-01 13:25:23 10月04日 Update

The database is used most of the time, if in the process of use, we have to separate the database for some other operations. Then there will be an error like the one shown below.

So how to solve this problem? In general, when we operate in the SSMS view, we will close the connected users of SQL.

But how do you do it in command-line mode? The figure below is as follows

Execute the detach database command again and OK

Summary and usage

The fundamental reason why the database cannot be separated is that there is a user connection operation. First of all, we have to kill the process if we want to terminate the user connection.

Select spid from sysprocesses dbid=db_id ('eBay market')

Kill 56-- this is the query result of the above statement

Use master

Go

Exec sp_detach_db @ dbname='E_market'

Go

Separation succeeded

Tags: Data database user command success above again reason situation time is in fundamental mode result view statement procedure process error problem Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Xiaomi Apple Shulou Information NVidia