Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Database is in use error

Author  Topic 

Mamatha
Posting Yak Master

102 Posts

Posted - 2005-01-19 : 01:54:22
Hi

i have two ASP pages with SQL server database.
In those two page restores the backup database file and one file retrieves the table names from database.
For example some database ABC is existed on SQL Server and those two pages are restore.asp,tblnames.asp.
Through tblnames.asp i tried to retrieve table names from ABC database and at the same time i want to restore ABC backup file.I think at the time of overwritting it gives error like
Microsoft SQL-DMO (ODBC SQLState: 42000) (0x800A0C1D)
[Microsoft][ODBC SQL Server Driver][SQL Server]Exclusive access could not be obtained because the database is in use. [Microsoft][ODBC SQL Server Driver][SQL Server]RESTORE DATABASE is terminating abnormally.

How can i identify whether this database is in use.If you know the solution please let me know,thanks in advance.

Mamatha

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-01-19 : 03:54:49
Run sp_who in the Query Analyser
Then you can know which databases are used by which users

In the ASP Code, when restoring the database close all the connections that uses the database which is to be restored. Make a new connection using Master Database and try to restore using this connection

Madhivanan
Go to Top of Page
   

- Advertisement -