2

I have a virtual machine running SQL Server 2012 in Azure and have also generated a script of my database to be run on the SQLSERVER2012 VM on Azure, however I am getting an error

"C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\PXDEV.mdf" failed with the operating system error 3 (The system cannot find the path specified.).

I have checked that path and the file is actually there on the source server.

4
  • 1
    Are you getting the error on the destination server? Is the path present on the destination server? Sep 21, 2015 at 9:17
  • Does the account that is running the script (not sure if it 's a TSQL error or not) have permissions to that directory? Sep 22, 2015 at 20:32
  • @CraigEfrein can you post your comment as an answer so I can mark it as correct? Sep 23, 2015 at 22:22
  • Hi Johnathon, glad that worked out for you. Sep 24, 2015 at 7:59

2 Answers 2

1

Are you getting the error on the destination server?

Is the path present on the destination server?

You need to make sure that the paths defined in your CREATE DATABASE script exist on the destination server or you need to create them there.

0

Run the restore with file list only eg.

restore FILELISTONLY from disk= 'D:\MSSQL\full.bak'

to see where it is attempting to place the database files (observe the PhysicalName column). if that location (not the file the location) doesn't exist then you will need to move the file

This can be done by

RESTORE DATABASE @DatabaseName
FROM DISK = @filename
WITH
    MOVE N'Filename1' TO N'D:\MSSQL\Datafiles\Primary.mdf',
    MOVE N'Filename2' TO N'D:\MSSQL\Datafiles\SecondFile.ndf'

for example

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.