Renaming Database failed: The database could not be exclusively locked to perform the operation. (Microsoft SQL Server, Error: 5030)
Filed in SQL on Nov.10, 2009
PROBLEM:
Unable to rename [DatabaseName]. (ObjectExplorer)
Rename failed for Database[DatabaseName]. (Microsoft.SqlServer.Smo)
The database could not be exclusively locked to perform the operation. (Microsoft SQL Server, Error: 5030)
ALTER DATABASE <DBNAME> SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
SP_RENAMEDB <oldname>,<Newname>
Go
ALTER DATABASE <NEWDBNAME> SET MULTI_USER — set back to multi user
GO

May 8th, 2010 at 15:30
Good Tip… worked for me.. thanks.