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)
 server: msg 3101 database in use

Author  Topic 

spdykat
Starting Member

5 Posts

Posted - 2004-08-17 : 18:05:25
I am attempting to apply transaction logs manually and am also getting the server: msg 3101 error. When I run sp_who, I see my connection to the db, which I can't kill.
Anyway I had EM open and tried closing it and doing the restore with only the query analyzer open, but got the same error of database in use.
By the way I am able to restore the transaction logs using EM, but since there are many, I am trying to create a script that will allow me to do them all in sequence.
Obviously I am not very good at sql server so can anyone help me with this?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-08-17 : 18:10:56
Before doing the RESTORE, run sp_who to determine who is connected. Make sure you have master database selected in Query Analyzer also (Or run USE master). If not a single user is connected, not even yourself, then run RESTORE command.

Tara
Go to Top of Page

spdykat
Starting Member

5 Posts

Posted - 2004-08-17 : 18:44:17
Thankyou Tara, that approach worked twice after several tries. I am still getting the message now and can't get around it. I'll try from home later.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-08-17 : 18:50:06
So you have master selected in the Query Analyzer drop down? And you have no other QA windows up that are pointing to your database and Enterprise Manager is closed?

Could you describe what worked twice means? So you were able to restore it twice? Once with the full backup, and once with the transaction log backup?

You probably should post your script so that we can tell you where you are going wrong.

Tara
Go to Top of Page

spdykat
Starting Member

5 Posts

Posted - 2004-08-18 : 12:32:44
I did have master selected. By twice I mean that I was applying the transaction logs one at a time through QA, and if I had master selected, knew there were no connections to my particular db, etc, the restore log worked once. then applying the next log failed with the "database in use" error.
Here is a sample segment of my script:
use archive
go
restore database archive from disk = 'D:\MSSQL\BACKUP\Backup\db\archive_db_200408172000' with norecovery
go
restore log archive from disk = 'D:\MSSQL\BACKUP\Backup\archive_tlog_200408172030' with norecovery
go
restore log archive from disk = 'D:\MSSQL\BACKUP\Backup\archive_tlog_200408172200' with norecovery
go
When I get to the last log I have "with recovery"

Please bear with me, I'm a recovering Oracle Apps dba who hasn't touched a database in 3 years thanks to the recession here.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-08-18 : 12:35:33
I wouldn't have the use archive part in there. You should have use master instead. That could be what is causing your problem. You should not do the use archive thing until you are done with the restores.



Tara
Go to Top of Page

spdykat
Starting Member

5 Posts

Posted - 2004-08-18 : 13:42:21
Thank you so much, it seems to be working now. I am still getting errors but now they are more operator errors than anything, I'm sure this will work.
Go to Top of Page
   

- Advertisement -