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)
 Restoring My Database

Author  Topic 

jesus4u
Posting Yak Master

204 Posts

Posted - 2004-08-03 : 15:45:05
From my shared host account I used Enterprise Manager to make a full backup of my database. That file has no file extension to it but it is 8 megs. So I am assuming it is the full database.

When I try to restore it to my development machine's SQL using EM I keep getting the error:

Exclusive Access could not be obtained because the database is in use. RESTORE DATABASE is terminating abnormally.

How do I fix?

Thanks

X002548
Not Just a Number

15586 Posts

Posted - 2004-08-03 : 15:53:59
Use code in QA

Create Proc usp_Restore_Production as



ALTER DATABASE TaxReconDB_Prod SET SINGLE_USER WITH ROLLBACK IMMEDIATE

RESTORE DATABASE TaxReconDB_Prod
FROM DISK = 'D:\Tax\BackUp\TaxReconDB.dmp'
WITH MOVE 'TaxReconDB_Data' TO 'D:\Database\NJROS1D151DEV\MSSQL$NJROS1D151DEV\Data\TaxReconDB_Prod_Data.MDF'
, MOVE 'TaxReconDB_Log' TO 'D:\Database\NJROS1D151DEV\MSSQL$NJROS1D151DEV\Data\TaxReconDB_Prod_Log.LDF'
, REPLACE


ALTER DATABASE TaxReconDB_Prod SET READ_WRITE


Brett

8-)
Go to Top of Page

kidrobotron
Starting Member

1 Post

Posted - 2004-09-01 : 11:23:25
Hi,

Please help. If I set the database to single user and run the restore and set back (as per the script above) in QA, I have no problems and it works like a dream.

If i try and run the same statements via DTS or a script it still complains about excluse access. Any ideas why this happens? I need to be able to run a restore via a script for scheduling purposes.

Thanks.
Brett

Go to Top of Page
   

- Advertisement -