This article is a mirror article of machine translation, please click here to jump to the original article.

View: 9218|Reply: 0

[Source] SQL SERVER looks at the database connection and disconnects

[Copy link]
Posted on 12/4/2020 6:12:00 PM | | | |
Requirements: When renaming a database, the rename fails due to some sessions establishing a connection with the database, and the error is as follows:

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

Itsvse_V2091 cannot be renamed. (ObjectExplorer)

------------------------------
Additional information:

Rename of database "Itsvse_V2091_bak" failed.  (Microsoft.SqlServer.Smo)

For help information, click:https://go.microsoft.com/fwlink? ... er=16.100.44091.28+(SMO-master-A)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Rename+Database&LinkId=20476

------------------------------

An exception occurred when executing a Transact-SQL statement or batch processing. (Microsoft.SqlServer.ConnectionInfo)

------------------------------

The database cannot be locked with an exclusive lock to perform the operation. (Microsoft SQL Server, Error: 5030)

For help information, click:http://go.microsoft.com/fwlink?P ... 30&LinkId=20476

------------------------------
Button:

Are you sure
------------------------------
View connections to the 'Itsvse_V2091_bak' database





Query the connection status of a database user

Close the connection

The above query can get the spid, according to the spid, just close the process.








Previous:SQL Server empties the data in the table
Next:Set up the system IE proxy using .NET/C#
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com