sql2008 because the database is in use, it can not gain exclusive access to the database --- restore or delete database solutions ...

Because the database is in use, it can not gain exclusive access to the database --- restore or delete database solutions

 
When the server 2008 database, often occur:

"Because the database is in use, it can not gain exclusive access to the database of the" final solution is as follows



Key SQL statement:

ALTER
DATABASE [datebase] SET OFFLINE WITH ROLLBACK IMMEDIATE


After the run again

ALTER database  [datebase]   set online

 

 

 

Title: in the Microsoft SQL Server Management Studio
------------------------------

Restore failed for server "WIN-jirigala". (Microsoft.SqlServer.SmoExtended)

For help, please click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.0.1600.22+((SQL_PreRelease).080709-1414+)&EvtSrc=Microsoft.SqlServer.Management. & EvtId Smo.ExceptionTemplates.FailedOperationExceptionText = reduction + Server & LinkId = 20476

------------------------------
Other information:

System.Data.SqlClient.SqlError: Because the database is in use, it can not gain exclusive access to the database. (Microsoft.SqlServer.Smo)

For help, please click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.0.1600.22+((SQL_PreRelease).080709-1414+)&LinkId=20476


 

 

 

Reproduced in: https: //my.oschina.net/iwenr/blog/227754

Guess you like

Origin blog.csdn.net/weixin_33696106/article/details/91675438