Views:

Summary



Attempting to restore a SQL database. The old database exists. I have Enterprise manager open and want to restore an older copy of this database to the original location.

Symptoms



SQL Enterprise manager can keep a database open in such a state that restore will fail. The error message typically looks like:

127.0.0.1 2/9/2007 1:47:02pm SNBEHD3069E 2300: Source: Microsoft SQL-DMO (ODBC SQLState: 42000)

127.0.0.1 2/9/2007 1:47:02pm SNBEHD3069E 2300: Description: [Microsoft][ODBC SQL Server Driver][SQL Server]Exclusive access could not be obtained because the database is in use.

127.0.0.1 2/9/2007 1:47:02pm SNBEHD3069E 2300: [Microsoft][ODBC SQL Server Driver][SQL Server]RESTORE DATABASE is terminating abnormally.

127.0.0.1 2/9/2007 1:47:02pm SNBEHD3069E 2300: SQL statement 'RESTORE DATABASE [TESTDB2] FROM VIRTUAL_DEVICE='BEXVDI.1171046806.7' ' failed, rc = -2147218403

 



Resolution



Close Enterprise manager and make sure no clients are attached to the DB instance, and re-try the restore.