February 5, 2005 at 7:51 am
Hi
I am struggling to restore the backup of a database onto a different server, but using T-SQL or EM I get the message:
Exclusive access could not be obtained because the database is in use.
Please can you tell me how to tackle this?
This is my script:
Use DP
GO
RESTORE FILELISTONLY
FROM DISK = 'C:\DP\BACKUPS\DP05.BAK' -- location of backup
RESTORE DATABASE DP
FROM DISK = 'C:\DP\BACKUPS\DP05.BAK'
WITH RECOVERY,
MOVE 'DPTemp_Data' TO 'C:\Program Files\Microsoft SQL Server\MSSQL\Data\DP_DATA.mdf',
MOVE 'DPTemp_Log' to 'C:\Program Files\Microsoft SQL Server\MSSQL\Data\DP_log.Ldf',
REPLACE
Thanks
February 5, 2005 at 6:42 pm
Do you already have a database called DP on the second server? You get this error if there are currently connections accessing the database.
Your error is "Use DP". That creates a connection to DP, so you can't do the restore. CHange your script to "Use Master".
Aunt Kathi Data Platform MVP
Author of Expert T-SQL Window Functions
Simple-Talk Editor
February 7, 2005 at 3:03 am
You've made my day - thanks sooo much!
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply