Friday, December 27, 2019

Fixing database Is In Use Error While Restoring Database from Backup

I have found an error while restore Sql database like "Error While Restoring Database from Backup"

So i have did below thing to resolve this issue and issue is resolved.

--use master
--Create Database *****_OLD
--alter database *****_OLD set offline with rollback immediate;

After you successful restore execute the below line to make it  available to all.

--use master
--alter database *****_OLD set online with rollback immediate;


In case above steps wont work then change the database name *****_OLD to your .bak file database Name, then i am sure it will works