Exclusive access could not be obtained because the database is in use during database restoration

I had faced this error recently during Dynamics AX database restoration in one of my development environment. During my restoration to over come this issue, I selected Overwrite the existing database (WITH REPLACE) in options in restoration window and restarted SQL services too but no luck.

Finally, I run below SQL query to resolve the issue.

USE [master] ALTER DATABASE Your database name
SET SINGLE_USER WITH ROLLBACK IMMEDIATE;

After running above script my restoration went smoothly.

“Yours, Ravi Theja Madisetty”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: