Download Android App in your Android Device from Google Play Store
- Search for "Withoutbook Practice Exam Test" in Mobile/Tablet Play Store
Practice InterviewNew Search by Name or Email

Exams Attended

Make Homepage

Bookmark this page

Subscribe Email Address

MSSQL Interview Questions and Answers

Ques. Why I am getting this error when renaming a database in MS SQL Server?
Ans. If you are trying to rename a database that is in use, you will get an error message like this: "The database could not be exclusively locked to perform the operation."

Before renaming a database, you must stop all client sessions using this database. Otherwise, you will get an error as shown in this tutorial example:

1. Launch one instance of SQL Server Management Studio and run:

USE withoutbook
GO

2. Keep the first instance running and launch another instance of SQL Server Management Studio:

ALTER DATABASE withoutbook
MODIFY NAME = withoutbookdb
GO
Msg 5030, Level 16, State 2, Server LOCALHOSTSQLEXPRESS
The database could not be exclusively locked to perform
the operation.

Obviously, the first instance is blocking the "ALTER DATABASE" statement.
Is it helpful? Yes No

Most helpful rated by users:

©2020 WithoutBook