Error restoring database in SQL Express 2005

I'm receiving an error trying to restore from a backup .bak file. I originally created this database withing Visual Studio 2005 IDE and then attached it to the SQL Express, made a backup, and now I'm trying to restore it to a proper database instead of being attached to VS.

Here is the error I'm receiving.

TITLE: Microsoft SQL Server Management Studio Express
------------------------------

Restore failed for Server 'DWEBSTER2K3\SQLEXPRESS'.  (Microsoft.SqlServer.Express.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.3042.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Restore+Server&LinkId=20476

------------------------------
ADDITIONAL INFORMATION:

System.Data.SqlClient.SqlError: The operating system returned the error '5(Access is denied.)' while attempting 'RestoreContainer::ValidateTargetForCreation' on 'C:\Archive.mdf'. (Microsoft.SqlServer.Express.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.3042.00&LinkId=20476

------------------------------
BUTTONS:

OK
------------------------------

Thanks!
LVL 8
ApexCoAsked:
Who is Participating?
 
David ToddSenior DBACommented:
Hi,

Did you specify the locations for each of the data and log files? Most likely on a production server, the SQL service doesn't have write access to C:\. This is a good thing imho, as it has stopped you dumping a database into the root directory on the boot drive. Think about where the data file should go.

Regards
  David
0
 
ApexCoAuthor Commented:
Well, this database was in the App_Code folder on the asp.net project, so I attached it to the SQL Express management piece and then did a backup.

Now whenever I try to restore that file to my development machine I'm receiving that error, doesn't really matter where I place the backup.
0
 
ApexCoAuthor Commented:
I didn't realize that it was attempting to restore it to some place that didn't exist. I pointed it to a folder and had it create the file, problem solved.

Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.