SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


"Sql server error 5120" while attaching database


"Sql server error 5120" while attaching database

Author
Message
lays.babyblush
lays.babyblush
SSC Rookie
SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)

Group: General Forum Members
Points: 33 Visits: 21
HI,

I am trying to attach few databases to sql server 2005.I have my .mdf files in "D:\MSSQL\Data" and my .ldf files in "E:\SQLLogs".
when i try to attach it gives me below mentioned error

------------------------------

Unable to open the physical file "D:\MSSQL\Data\dbAcquisitionStaging_Data1.mdf". Operating system error 5: "5(Access is denied.)". (Microsoft SQL Server, Error: 5120)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.3042&EvtSrc=MSSQLServer&EvtID=5120&LinkId=20476

---------------------------

I am added as administrator to this server. I checked for permissions on the .mdf and .ldf files It says full control.

Could anybody please advise on how to fix this issue.This is hindering my progress. Any kind of help will be greatly appreciated.

Thanks in advance
lays
RRIOS42
RRIOS42
SSC Rookie
SSC Rookie (38 reputation)SSC Rookie (38 reputation)SSC Rookie (38 reputation)SSC Rookie (38 reputation)SSC Rookie (38 reputation)SSC Rookie (38 reputation)SSC Rookie (38 reputation)SSC Rookie (38 reputation)

Group: General Forum Members
Points: 38 Visits: 268
need to check permissions to the actual file directories if all good then have your admin reset them, this has more to do with permissions with the directory you are trying to read and write.
David Webb-CDS
David Webb-CDS
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1612 Visits: 8586
Check the account under which SQL Server is running. That's the account that needs to have permissions to the files.



And then again, I might be wrong ...
David Webb
lays.babyblush
lays.babyblush
SSC Rookie
SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)

Group: General Forum Members
Points: 33 Visits: 21
Thanks for the response.
The problem is fixed. as the .mdf and .ldf files where on different drives
it was giving some wierd error so i attached only mdf files and the server created .ldf files on the same drive as mdf. this way i could attach it but then i took the db offline copied the log from D:\ to E:\ and then brought the db online. it worked.

thanks a ton for the responses.
dotnet-786228
dotnet-786228
Grasshopper
Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)

Group: General Forum Members
Points: 15 Visits: 1
Hello !!!

try login with Windows Authentication.

GalaWink
anjan.ashok
anjan.ashok
SSC Veteran
SSC Veteran (281 reputation)SSC Veteran (281 reputation)SSC Veteran (281 reputation)SSC Veteran (281 reputation)SSC Veteran (281 reputation)SSC Veteran (281 reputation)SSC Veteran (281 reputation)SSC Veteran (281 reputation)

Group: General Forum Members
Points: 281 Visits: 282
Hi Lays,

How did u copy the log from D:\ to E:\ as mentioned.

this way i could attach it but then i took the db offline copied the log from D:\ to E:\ and then brought the db online. it worked.

Pls tell me how did u do this.

Thanks in advance.
bijvoets
bijvoets
Grasshopper
Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)

Group: General Forum Members
Points: 24 Visits: 0
Although it's an old post, this problem is still actual. As this post wasn't closed with a working solution, I write it here:

Start SQL Server manager as Administrator (right-click on the program, choose "Start as administrator"): problem solved!

I wrote this solution on Developer's Challenges, SQL Server Error 5120 .
kyongaya
kyongaya
Grasshopper
Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)

Group: General Forum Members
Points: 21 Visits: 0
You are some amazing!
Yes, it works perfectly.
Thanks a lot :-D
rasool7
rasool7
Grasshopper
Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)

Group: General Forum Members
Points: 21 Visits: 2
If you are using windows 7. Open the studio management by Right click and
Run as Administrator. then log on in windows mode and try to attach the database . It will work for sure w00t
viet.anh
viet.anh
Grasshopper
Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)

Group: General Forum Members
Points: 17 Visits: 0
dotnet-786228 (6/18/2008)
Hello !!!

try login with Windows Authentication.

GalaWink


Yaaaaaaaaaaa, this solution work fine :-D

Viet Anh,
cheers
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search