I’ve got an email from a friend. He was made backup of a database, and restore that backup file to another new database but he got error “Exclusive access could not be obtained because the database is in use”. I’m trying by myself to restore a database in my machine with the same scenario and got the full error as the following picture :
Once I look at this error, I just know that his new database was in use. First thing i have to do is find out which process or session that using his database using sp_who2 stored procedure, and kill that process.
From sp_who2 stored procedure result, I’ve found out that a connection with SPID 58 has using my database. Just kill that process and try again to restore that database and the error has gone.