I have a database backup from a database, say SourceData
which needs to be restored on another database, same schema, but different name (SourceData_1
) using T-SQL. I don't know why I gets the following error, despite specifying REPLACE
option. For example I used the links below:
http://msdn.microsoft.com/en-us/library/ms190447(v=sql.105).aspx
Based on the posts I found on the internet, first I got the logical names of the backup file using script below:
RESTORE FILELISTONLY
FROM DISK = 'C:\Backups\SourceData_20121227.BAK'
Then used the logical names in the following script:
RESTORE DATABASE SourceData_1
FROM DISK = 'C:\DEV\SourceData_20121227.BAK'
WITH
MOVE 'SourceDate' TO 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\SourceData_1.mdf',
MOVE 'SourceDate_log' TO 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\SourceData_1_log.ldf',
REPLACE
GO
Below is the error I'm getting:
MODIFY FILE encountered operating system error 112 (failed to retrieve text for this error. Reason: 15105) while attempting to expand the physical file 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\SourceData_1_log.ldf'.
RESTORE DATABASE is terminating abnormally.
I checked the disk space and can confirm it is fine. I assume the target database should exist before running the restore. Is that right?
Any suggestion how to fix this issue?
Thanks.
REPLACE
option in yourRESTORE