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 Administration (2000)
 Help - Restore of Database

Author  Topic 

vaddi
Posting Yak Master

145 Posts

Posted - 2006-10-20 : 11:49:03
Hello ,

I have brought the backfiles from the Production server to the Test server using SFTP and placed the backfiles in the location
D:\Testbackup\c2k_db_full.bak

On the Test server , I am trying to restore the " TestDB " Database with the backfiles I brought from the prodcution server.
I am using the sql statement :

RESTORE DATABASE TestDB
FROM DISK = 'D:\TestBackup\c2k_db_full.bak'
WITH MOVE 'TestDB_Data' TO 'D:\MSSQL\Data\TestDB_Data.mdf',
MOVE 'TestDB _Log' TO 'D:\MSSQL\Data\TestDB_log.ldf'

But I am getting the Error:

Server: Msg 3101, Level 16, State 2, Line 1
Exclusive access could not be obtained because the database is in use.
Server: Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.

What should I be doing now.

Thanks

mfemenel
Professor Frink

1421 Posts

Posted - 2006-10-20 : 12:01:10
Run sp_who2 and find any other logins using the db. Once you find them, use the kill command to end their process. Make sure you're not the guilty party and have the db open in enterprise manager.

Mike
"oh, that monkey is going to pay"
Go to Top of Page

vaddi
Posting Yak Master

145 Posts

Posted - 2006-10-20 : 12:12:21
The above problem was resolved and now I get the error:

Server: Msg 3234, Level 16, State 2, Line 1
Logical file 'TestDB_data' is not part of database 'TestDB'. Use RESTORE FILELISTONLY to list the logical file names.
Server: Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.

Do I need to change any logical file names.

Thanks
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-10-20 : 12:22:58
Use this script to generate your restore command, and then modify as necessary.


Create Restore Command from DB Backup File
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=71665

CODO ERGO SUM
Go to Top of Page

vaddi
Posting Yak Master

145 Posts

Posted - 2006-10-20 : 12:36:57
Hello VJ,

Thanks for the script. I will go throught it and do the required changes.

Thanks
Go to Top of Page
   

- Advertisement -