Today I wanted to rename a SQL Server 2008 database so I would have a rollback if my create from script went bad.
Upon rename SQL Server Management Studio 2008 gave me the error 'The database could not be exclusively locked to perform the operation. (Microsoft SQL Server, Error: 5030)'
I executed this in a query window connected to the master database:
Looking at the DBName column in the results for each match of the db I was trying to rename I executed 'kill xxx' where xxx was equal to the SPID of the row.
After doing this for all the rows rename succeeded immediately.