4

I need a little help with a restore process, I can't find specific help in other similar questions, sorry if my question does not correspond.

I have this script in my system:

RESTORE DATABASE [Basesistema] FROM DISK = N’C:\Sistema\backup.bak’ WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 10

It work perfect in Windows XP, but not in Windows 7…

The message is:

Error al buscar el archivo ‘C:\Archivos de programa\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\Basesistema.mdf’ en los directorios, error del sistema operativo: 3(failed to retrieve text for this error. Reason: 15105)

English translation:

Failed to find file 'C: \ Program Files \ Microsoft SQL Server \ MSSQL10.SQLEXPRESS \ MSSQL \ DATA \ Basesistema.mdf' directories, operating system error: 3 (failed to retrieve text For This error. Reason: 15105)

What can I do? Thanks for your help!!

Followup:

Well, actually I need restore from a script embedded in my system, not from SSMS; but SSMS (even as Admin) did not have access to the backup file. If I move the file to C: or D: is the same...

I have SQL running under Windows Autentication account (integrated security), my only windows account have admin rights... I don't understand what happens.

The curious is the path "MSSQL10.SQLEXPRESS" doesn't exists, SQL is in "..\MSSQL10_50.SQLEXPRESS\MSSQL..". Does this have something to do?

3
  • 1
    Try running SSMS as an administrator account and then run the restore script
    – billinkc
    Commented Nov 1, 2011 at 19:04
  • @RománColaneri I think you may be misunderstanding my answer but just in case this isn't a permissions problem, can you run the following and add the output to your answer: USE [Basesistema]; SELECT * FROM sys.sysfiles; Commented Nov 2, 2011 at 18:57
  • Missed a bit! USE [Basesistema]; SELECT * FROM sys.sysfiles; RESTORE FILELISTONLY FROM DISK = N'C:\Sistema\backup.bak'; Commented Nov 2, 2011 at 19:10

3 Answers 3

4

You don't need rights to access the backup file, the SQL Service does. Running SSMS as administrator will not help.

Check that the account you have SQL running under is able to read from that directory.

1
  • Exactly, you need to check that the .bak file is available for the SQL Server service user. The default permissions have changed starting with the new series of MS operating systems (W7, W2008..).
    – Marian
    Commented Nov 2, 2011 at 18:41
1

The problem is that the folder that it is trying to put the files into doesn't exist. You either need to create the folders that the files existed in on the old instance, or use the WITH MOVE syntax to put the files into folders that do exist.

RESTORE DATABASE [Basesistema] FROM DISK = N’C:\Sistema\backup.bak’ WITH FILE = 1, 
NOUNLOAD, REPLACE, STATS = 10, 
MOVE 'BaseSistema' TO 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\Basesistema.mdf', 
MOVE 'BaseSistema_Log' TO 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\Basesistema_log.ldf'

You may need to adjust the file names and paths to match what are on your system.

1
  • 1
    +1 I started to wonder the same thing, hence my comment on the question. Commented Nov 2, 2011 at 18:59
0

Simply make new folder "C:\DB\" and restore there your DB with MOVE option - in any case if you again reinstall another SQL Server VERSION on your PC - this path will NOT BE CHANGED.

Your Answer

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