Error on renaming database in SQL Server 2008 R2 Error on renaming database in SQL Server 2008 R2 sql sql

Error on renaming database in SQL Server 2008 R2


You could try setting the database to single user mode.

https://stackoverflow.com/a/11624/2408095

use masterALTER DATABASE BOSEVIKRAM SET SINGLE_USER WITH ROLLBACK IMMEDIATE    ALTER DATABASE BOSEVIKRAM MODIFY NAME = [BOSEVIKRAM_Deleted]ALTER DATABASE BOSEVIKRAM_Deleted SET MULTI_USER


  1. Set the database to single mode:

    ALTER DATABASE dbNameSET SINGLE_USER WITH ROLLBACK IMMEDIATE
  2. Try to rename the database:

    ALTER DATABASE dbName MODIFY NAME = NewName
  3. Set the database to Multiuser mode:

    ALTER DATABASE NewNameSET MULTI_USER WITH ROLLBACK IMMEDIATE


In SQL Server Management Studio (SSMS):

You can also right click your database in the Object Explorer and go to Properties. From there, go to Options. Scroll all the way down and set Restrict Access to SINGLE_USER. Change your database name, then go back in and set it back to MULTI_USER.