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
 General SQL Server Forums
 New to SQL Server Administration
 Problem with Attaching DB

Author  Topic 

viperbyte
Posting Yak Master

132 Posts

Posted - 2012-02-16 : 10:42:16
Hi everyone. For the longest time I've had a problem with attaching databases so I've always found a different way of dealing with my needs. But this time I really need to be able to attach a database. When attempting to do it by Management studio i can't drill down to the file name for some reason. The drilling stops prematurely. So I've tried it with a stored procedure, but that method gives me an error.

use master
go
sp_attach_db 'rsVolonteerRides',

'C:\Users\matos\Documents\Projects\SQLServerDatabases\rsVolunteerRides.mdf',
'C:\Users\matos\Documents\Projects\SQLServerDatabases\rsVolunteerRides.ldf'

go

gives me:Msg 5133, Level 16, State 1, Line 1
Directory lookup for the file "C:\Users\matos\Documents\Projects\SQLServerDatabases\rsVolunteerRides.mdf" failed with the operating system error 5(Access is denied.).

So if it's a file persmission problem I don't know what's wrong. Looking at the properties of the file I see all the persmissons available for the file checked. Can someone please help me with this?

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2012-02-16 : 11:15:38
The SQL Server service account doesn't have permission on the files/directories.

Check the services applet to see what account is running SQL Server, and grant it control permissions on those directories.
Go to Top of Page

viperbyte
Posting Yak Master

132 Posts

Posted - 2012-02-16 : 11:45:15
When i right clicked mssql service it says logon is "this logon" Network Service. So to i grant control permissions to who or what?
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2012-02-16 : 13:59:56
Have a look at this.

I'd change it to a domain account, then grant permissions.

link is bad. try copy/pasting this:

http://technet.microsoft.com/en-us/library/cc782435(v=ws.10).aspx
Go to Top of Page
   

- Advertisement -