Author |
Topic |
DeepSeed
Yak Posting Veteran
52 Posts |
Posted - 2010-12-09 : 18:54:12
|
Ever since I shared my mssql folder I get an access denied error when trying to attach a .mdf file. I have tried adding Network Service with full control to the mssql folder, the files, and the share permissions. It still does not have access to its own data directory under mssql, since this is where it keeps all the database files this is a problem. |
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2010-12-09 : 19:22:33
|
Why are you sharing it?Are you using Network Service for the service account? If so, why?What is the exact error message you get when trying to attach? |
 |
|
DeepSeed
Yak Posting Veteran
52 Posts |
Posted - 2010-12-09 : 19:37:54
|
We share it so that someone can access the file system by \\sqlserver\mssql instead of \\sqlserver\c$\mssqlWe are using Network Service, it is the same account we use for our IIS Application Pools and was one of the two options when installing, seems logical for maintenance purposes.The error is:Unable to open the physical file C:\mssql\data\database_data.mdf Operating system error 5: 5(Access is denied) Error 5120It is a .mdf file from a SQL 2000 server, it is trying to upgrade it to SQL 2008, I have done this with 30 others .mdf files without a problem then all of a sudden every one I try gives me this error, and they are all detached from the same sql 2000 server. |
 |
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2010-12-09 : 20:49:28
|
No one should be accessing the data directory, except admins on occassion.The error you're getting indicates the service account doesn't have permission on the file or the folder.If you copied the file from the other server, it gets copied with the permissions it had at the old location. Check the permissions on the file itself. |
 |
|
DeepSeed
Yak Posting Veteran
52 Posts |
Posted - 2010-12-10 : 11:14:38
|
I made sure that Network Service has full rights to the files and that they are not read only. |
 |
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2010-12-10 : 11:25:48
|
Sounds like the file is still in use then. You may need to kill whatever process has a handle to the file. You can use Process Explorer to see what is locking the file.Also, are you sure you didn't already attach this one, maybe by accident?If the original still exists (you did coipy/past and not cut/paste right?) try deleting the mdf on the 2008 server. If it doesn't let you delete it, then it's in use. If it does, copy it over again.Access Denied is always either permissions or file in use. |
 |
|
DeepSeed
Yak Posting Veteran
52 Posts |
Posted - 2010-12-10 : 12:02:37
|
I tried renaming the file, no problem which you can't do if its in use. I tried restarting the server, removed parent permissions. I did cut and paste, just like I did with all the other files, I tried removing the share I made, it is not making much sense. |
 |
|
DeepSeed
Yak Posting Veteran
52 Posts |
Posted - 2010-12-10 : 16:32:55
|
Well the only way to do it was to add the Everyone account with full control. Thanksfully this is an internal server. I tried every other possibility first. |
 |
|
Sommerville
Starting Member
4 Posts |
Posted - 2010-12-11 : 09:59:45
|
I have faced similar problem and granted permission to specific Windows-Accounts to the file and directory both and it worked. Include your id and sql server service account both. If you are unable to attach. Look for any other instance on same host using this file - or the same instance has any db which is using this file. select * from sysaltfiles might help you detect this easily.regards,Sommerville |
 |
|
|