Thursday, March 22, 2012

Error: 5123 CREATE FILE encountered operating system error 5A(Access denied.)

HI ,

This is a problem I encountered when I had to detach a database file (type .mdf):

1) I went to the MS SQL Management Server Studi and detached my database file successfully from a connection called Workhorse.

2) I needed to place the .mdf database file into a zip file in order to put it on a remote server. I did this using Shared Portal. This was also successful

3) However when I tried reattaching the database file, I got this error:

CREATE FILE encountered operating system error 5A(Access denied.) while attempting to open or create the physical file "C\Program Files\MSSQL Server\MSSQL\Data\<databasename>.mdf'

Q) The database file and log file (ldf) exist in the correct directory so I don't know what happened. Can any one help?

Thanks much

Tonante

Dear Tonate,

Please, take a look on the following link and might be it will help you :)

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=120536&SiteId=1

|||

Hi Tonate,

I got the solution for this. I proud this is my first blog to provide the answer on internet

I got the same error too:

CREATE FILE encountered operating system error 5A(Access denied.) while attempting to open or create the physical file "C\Program Files\MSSQL Server\MSSQL\Data\<databasename>.mdf'

the solution is:

set the Operating system permission on that .mdf file to full permission to 'Everyone' in new server.

this will helps me to attach the database in other server..

Have a Great Day..

vino...

|||Well that could be a security issue, its better to give permission to the SQL Server account.|||Greetings SQL Server users, I rarely post to forums but think I probably should start doing so. I know this problem was probably solved, but just in case it wasn't, this was my solution to the exact same problem when attempting to do exactly what you tried (detaching, zipping, then re-attaching the database file *.mdf) using SQL Server 2005 with Mgmt Server Studio. First, Stop all SQL services, Secondly, go to the sql folder (default: MSSQL) and right click on it and see if you can change your folder and all subfolder atrributes to NOT read only (unchecked). I noticed that on my server, the log and data files could not be changed. So I immediately went to those files *.ldf and *.mdf and took ownership of both of them (the permissions can easily get wacked). Once I did that, I was able to zip them and move them to safer ground. I then restarted all SQL Services, and was able to re-attach the *.mdf file. If you are like me, you probably log in using a few different usernames and move files around a lot. For some odd reason, our permissions get hosed up from time to time. I hope this helped.

No comments:

Post a Comment