J
Joe Cool
I am working on an application that uses a Microsoft SQL database. I
want to implement a Restore database from backup function. While
running it has two connections to the server, one to the master
database and one to the applicaiton's database.
When the user kicks of the restore, it closes the current connection
to the application database. Then it loops through all entries from an
sp_who query where the dbname matches the applicaiton database and
kills them, making sure it kills my spid last. I then run the RESTORE
transact-sql command using the connection to the master database.
After a few seconds, it throws an exception with the message:
Exclusive access could not be obtained because the database is in use.
RESTORE DATABASE is terminating abnormally.
I thought I doing everything I could to make sure there were no active
connections.
Any help would be appreciated.
want to implement a Restore database from backup function. While
running it has two connections to the server, one to the master
database and one to the applicaiton's database.
When the user kicks of the restore, it closes the current connection
to the application database. Then it loops through all entries from an
sp_who query where the dbname matches the applicaiton database and
kills them, making sure it kills my spid last. I then run the RESTORE
transact-sql command using the connection to the master database.
After a few seconds, it throws an exception with the message:
Exclusive access could not be obtained because the database is in use.
RESTORE DATABASE is terminating abnormally.
I thought I doing everything I could to make sure there were no active
connections.
Any help would be appreciated.