Unable to rename a database in MS SQL Server Management Studio

2 posts / 0 new
Last post
#1 28 June, 2013 - 07:36
Divya
Divya's picture

Unable to rename a database in MS SQL Server Management Studio

I am using MS SQL server 2008, unable to rename a database... I closed all the applications. But could not able to rename. 
The error message appears as 

TITLE: Microsoft SQL Server Management Studio

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

Unable to rename testdb1. (ObjectExplorer)

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

ADDITIONAL INFORMATION:

Rename failed for Database 'test'.  (Microsoft.SqlServer.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10....((KJ_PCU_Main).110617-
0026+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExce
ptionText&EvtID=Rename+Database&LinkId=20476

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

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

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

The database could not be exclusively locked to perform the operation. (Microsoft SQL Server, Error: 5030)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10....
nkId=20476

29 June, 2013 - 22:02
admin
admin's picture

Run the query :
use master
exec sp_who

This will list all the processes with SPID, that running in the SQL Server Instance
Note the SPID of the process which uses the database you wish to rename.
For e.g. if SPID is 52
Then execute the query : KILL 52

Log in to post comments