You must have seen below error while renaming or deleting database.
The database could not be exclusively locked to perform the operation. (Microsoft SQL Server, Error: 5030)"
Above error normally occurs when the database is in Multi User mode where users are accessing your database or some objects are referring to your database.
To resolve this error.
First set the database in Single user mode.
ALTER DATABASE DemoData SET SINGLE_USER WITH ROLLBACK IMMEDIATE
Perform the required action.
Again set the database in multi user mode.
ALTER DATABASE DemoData SET MULTI_USER WITH ROLLBACK IMMEDIATE
The database could not be exclusively locked to perform the operation. (Microsoft SQL Server, Error: 5030)"
Above error normally occurs when the database is in Multi User mode where users are accessing your database or some objects are referring to your database.
To resolve this error.
First set the database in Single user mode.
ALTER DATABASE DemoData SET SINGLE_USER WITH ROLLBACK IMMEDIATE
Perform the required action.
Again set the database in multi user mode.
ALTER DATABASE DemoData SET MULTI_USER WITH ROLLBACK IMMEDIATE
Nice.
ReplyDelete