Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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?

share|improve this question

migrated from stackoverflow.com Nov 2 '11 at 16:15

This question came from our site for professional and enthusiast programmers.

1  
Try running SSMS as an administrator account and then run the restore script –  billinkc Nov 1 '11 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; –  Mark Storey-Smith Nov 2 '11 at 18:57
    
Missed a bit! USE [Basesistema]; SELECT * FROM sys.sysfiles; RESTORE FILELISTONLY FROM DISK = N'C:\Sistema\backup.bak'; –  Mark Storey-Smith Nov 2 '11 at 19:10

3 Answers 3

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.

share|improve this answer

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.

share|improve this answer
1  
+1 I started to wonder the same thing, hence my comment on the question. –  Mark Storey-Smith Nov 2 '11 at 18:59

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.

share|improve this answer
    
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 Nov 2 '11 at 18:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.