Error restoring database in SQL Express 2005

Posted on 2007-07-24
Last Modified: 2008-01-09
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:


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:



Question by:ApexCo
    LVL 35

    Accepted Solution


    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.

    LVL 8

    Author Comment

    Well, this database was in the App_Code folder on the 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.
    LVL 8

    Author Comment

    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.


    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    by Mark Wills PIVOT is a great facility and solves many an EAV (Entity - Attribute - Value) type transformation where we need the information held as data within a column to become columns in their own right. Now, in some cases that is relatively…
    INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now