Wednesday, March 21, 2012

Error in SQL Server Management Studio Express when Attach DB

Hello

When I try to attach a Database in SSMSEE, I always receive the same error. After clicking on the "ADD"-Button in the "Attach Databases"-Window, the following error occurs:

TITLE: Locate Database Files - ORION\SQLEXPRESS


C:\Programme\Microsoft SQL Server\MSSQL.1\MSSQL\DATA
Cannot access the specified path or file on the server. Verify that you have the necessary security privileges and that the path or file exists.

If you know that the service account can access a specific file, type in the full path for the file in the File Name control in the Locate dialog box.

OK - Button

And directly after that error, when I click the OK-Button from the error above, I receive the "Locate Database Files"-Windows. But there I see only one partition G from my harddisk(but I have C, D, E, F, G).

I can not understand, why I should not have the necessary security privileges (The path exists at all events). In the Object Explorer I see all my DB's. And I can access on every DB without problems.

How can I solve this problem and attach an existing Database?

Mike50

Hi,

the service accoutn SQL Server is running on needs the appropiate priviledges to attach the database. Even if you have the rights to access the share, this doesn′t mean that SQL Server has, so make sure that the account which can be seen under the properties of the server (or in the service control panel) is priviledged.

(Make also sure that this isn′t a network drive you are using while loading something, if you want to load from the load you have to use the UNC syntac rather than the mapped drives, that much easier)

HTH, Jens Suessmeyer.

|||Hello,

Thanks for your quick answer.

It isn't a network drive, it's local. In the windows explorer, in the SQL Server folders under properties-->security, there I have acces to all folders for everybody (I changed all folders to give access to "everybody2)! But is this the right place to give the privileges? I tried a lot of things but nothing happend.

Can you please explain me, where exactly I have to look under properties of the server and change?

mike50
|||I solved the problem!

In the SQL Server properties, I had for log-in the account "NT AUTHORITY\NetworkService" and this NetworkService had no rights to access the program files folder! So I changed it to "Local Systemaccount" and now I can attach DB's.
But is this a good idea to start the SQL Server Service with this account?

mike50
|||Ok, wasn′t this what is said ?

HTH, Jens Suessmeyer.|||

Jens:

Yes, it was "close" to what you said. But I am still having this issue.

I have the SQL Server (MSSQLSERVER) account running under an account named ".\mssql".

I have the SQL Server Agent (MSSQLSERVER) account running under the same ".\mssql" account.

I have given this user account full rights on my D:\MsSql\ directory.

I have my default data and logs directory configured for D:\MsSql\Data\

I still get this error popping up when I click "add" in the Attach Database dialog window.

Any other ideas?

It is not wise to run the services under Local System account, as he asks above.

No comments:

Post a Comment