Skip to main content
Home
Live to Learn!

Main navigation

  • Home
  • Learn
    • FoxPro
    • MS-DOS
    • C PRG
    • Java
    • ASP
    • Ruby on Rails
    • ASP.NET
    • E-Books
    • Exam Preparation
    • Tools
  • Blog
  • Forums
  • Contact
User account menu
  • Log in

Breadcrumb

  1. Home
  2. Forums
  3. Programming
  4. Desktop Programming

Unable to rename a database in MS SQL Server Management Studio

By Divya , 28 June, 2013

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…-
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

Forums
Desktop Programming
Profile picture for user admin

admin

11 years 11 months ago

Run the query :

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

  • Add new comment

Featured Blog Posts

Convert Currency in Number to Words (Indian Rupees) - MS Excel
Foxpro Tutorial and Programs
Convert Currency in Number to Words in MS Word
Convert Currency in Number to Words (Indian Rupees) - Version 2
Best way to Use Rupee Symbol in Windows – Easy steps
Convert Currency in Number to Words - MS Access
Creating All in One Windows XP DVD with all Important Applications
RSS feed

© 2009-2025 Live to Learn.In

Terms of Use | Privacy Policy