Monday, 9 July 2012

SQL Database Restore Error: Restore failed for Server 'Name'. (Microsoft.SqlServer.Smo) - Exclusive access could not be obtained because the database is in use.

We are in the process of troubleshooting a database corruption issue that happened due to a RAID 1 array failure on an older SBS 2003 R2 server configured with a pair of software RAID 1 arrays.

When we went to restore the database from the most recent .BAK file we always ended up with the following error:

image

Microsoft SQL Server Management Studio

Restore failed for Server 'Name'. (Microsoft.SqlServer.Smo)

Additional Information:
System.Data.SqlClient.SqlError: Exclusive access could not be obtained because the database is in use. (Microsoft.SqlServer.Smo)

It took a number of searches to finally come up with the answer:

Following the steps listed by pogo69:

  1. Right-click on the database name
  2. Click on Properties context menu item
  3. Click on Options menu item on the left
  4. In the grid, scroll down to the bottom
  5. Change 'Restrict Access' to SINGLE_USER

Once we ran the above steps we were able to restore the database successfully.

image

Microsoft SQL Server Management Studio

The restore of database 'NAME' completed successfully.

We were then back into our client's LoB.

Philip Elder
MPECS Inc.
Microsoft Small Business Specialists
Co-Author: SBS 2008 Blueprint Book

*Our original iMac was stolen (previous blog post). We now have a new MacBook Pro courtesy of Vlad Mazek, owner of OWN.

Windows Live Writer

1 comment:

Anonymous said...

Thank you, This helped me out. - Figs