Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Express Edition and Compact Edition (2005)
 Attach Database Error

Author  Topic 

Slovo
Starting Member

4 Posts

Posted - 2005-06-16 : 14:04:05
I am trying to attach a database to SQLEXPRESS. I get an error, [Directory Lookup for the file C:\ . . . \Data\ORION.mdf" failed with the operating system error 5(Access is denied.)]

I tried to attach another database and got the same error. I have attached databases to SQLEXPRESS before successfully. I tried to attach using single file to no avail.

I am using the query, "sp_attach_db @dbname=N'ORION', @filename1=N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\ORION.MDF'
go"

ORION.mdf is in the Data folder for SQLEXPRESS

What am I doing wrong or what did I change inadvertently to restrict my access to the file?

Randy Fair

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-06-16 : 14:39:59
Access is denied is referring to some permission problem. Check permissions on the MDF file as well as on the directories. Are you local admin on this server?

Tara
Go to Top of Page

Slovo
Starting Member

4 Posts

Posted - 2005-06-16 : 14:52:07
The server is on my computer (local). How do I check permissions on the MDF?

Randy Fair
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-06-16 : 15:09:12
Windows Explorer...right click on file, properties. Check if the file or directories are read-only. Check out what the Security tab shows for permissions.

Tara
Go to Top of Page

Slovo
Starting Member

4 Posts

Posted - 2005-06-16 : 15:15:26
All folders from Microsoft SQL Server down to data have the read-only box filled by a colored box (not a ckeck) I clear the box, Apply and close then open properties again and the colored box is still there. There is no security tab on the properties window - just General, Sharing, Web Sharing, and Customize.

Randy Fair
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-06-16 : 15:17:37
The colored box just means that some of files and/or directories are marked as read-only. Is the MDF file marked as read-only?

Are you a local administrator on your computer? What OS?

Tara
Go to Top of Page

Slovo
Starting Member

4 Posts

Posted - 2005-06-16 : 15:25:15
The mdf file is not marked as read only. That's the first thing I checked (I forgot to mention it). I am the local administrator. I am running XP pro.

Randy Fair
Go to Top of Page
   

- Advertisement -