title: Backup/Restore from different database causing Restore failed exclusive access could not be obtained
body: <p>I have a database A. I have taken a backup of database A called A.bak. I created a new database B. Now, I right click and Restore B from A.bak. In the Restore Dialog, I checked overwrite existing database and change the LogicalFileName from <code>C:\Program Files\Microsoft SQL Server\MSSQL11.SQLSERVER2012\MSSQL\DATA\A.mdf</code> to <code>C:\Program Files\Microsoft SQL Server\MSSQL11.SQLSERVER2012\MSSQL\DATA\B.mdf</code> and did the same with ldf file. But I am getting </p>
  
  <p><code>Exclusive access could not be obtained because the database is in use</code>.</p>
  
  <p>Also tried,</p>
  
  <pre><code>ALTER DATABASE [B] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
  </code></pre>
  
  <p>Also sp_who2, there was no existing connection of [B]</p>