Link to home
Create AccountLog in
Avatar of Netlink2
Netlink2

asked on

ms sql restore , file cannot be overwritten it is being used by database

I'm trying to restore from a backup file, but I can't restore to a new database (I can't restore anything to anywhere). I get the above error.
I'm running SQL Server 2005 Enterprise on XP.
I set the overwrite option to true.
It may be worth noting that the error says I can't restore to 'Data', but I want to restore to 'New_Data'. It may also be worth noting that the orginal backup is called 'Data'.
Avatar of chapmandew
chapmandew
Flag of United States of America image

Have a look at this article...it is for 2000, but the exact same principles apply

http://searchsqlserver.techtarget.com/tip/0,289483,sid87_gci1173442,00.html#

If you are wanting to use TSQL for the restore, let me know and I will write it out for you.
Avatar of Netlink2
Netlink2

ASKER

Using TSQL will be fine for what I want to do. That would be the easiest way then.
ASKER CERTIFIED SOLUTION
Avatar of chapmandew
chapmandew
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
I did the following and it worked. Thanks.

RESTORE DATABASE ALC_Mick FROM DISK = 'C:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\ALC_Backup'   WITH MOVE 'ALC_Data' TO 'C:\Program Files\Microsoft SQL Server\MSSQL\Data\ALC_Mick_Data.MDF',        MOVE 'ALC_log' TO 'C:\Program Files\Microsoft SQL Server\MSSQL\Data\ALC_Mick_log.LDF'