When you restore a database, the restore process (
RESTORE DATABASE ...) is running in the context of your account.
Your account might not have access to the
C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\ directory.
This is because when you install SQL Server, the directories are created in the context of an internal SQL Server Login / Account. The account is normally in the form:
NT Service\MSSQL$<INSTANCE_NAME> (e.g. in your case
If you run the following commands in an Administrative CMD Shell against the last directory level you can access in Windows Explorer, then you can see which accounts have access to the
C:\> cd "C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\"
C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL> cacls DATA
C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA
! --> NT SERVICE\MSSQL$<INSTANCE_NAME>:(OI)(CI)F
C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL>
This is a list of accounts and/or Windows Groups that are allowed to access the
DATA directory of your SQL Server instance. (On your laptop you might see other accounts and some accounts may be missing.)
In Windows Explorer click through the directories until you are presented with a pop-up informing you that you don't have access to the directory:
If you click on Continue in this message, then your Windows account will be added to the list of accounts that are allowed to access the
Note: You will have to do the same procedure for the TLOG / DATA directory to be allowed to restore the
*.ldf file to the required sub-directory.
RESTORE DATABASE ... command should then work.