Skip to main content

CREATE FILE encountered operating system error 5 (Access is denied)

I was trying to move some content dbs in our MOSS farm to another drive in the same Server. I stopped all website from IIS and stopped all the related services, then ran stsadm deletecontentdb command with all the required parameters.

Then I detached the db and it threw an error and I just closed it by clicking Ok. Now I went to the drive to copy and paste the .mdf and .ldf file to the new drive. I tried to copy the .mdf file and I got access denied error but the db was already detached, I was screwed! The downtime was only for a couple of hours and I had many dbs to move to this new drive.

I googled for some time and did not get many solutions, some people had encountered this error but none of them posted an answer. I tried to attach the file again from the old location, atleast site will not go down. But when I tried to attach I got this wierd error from SQL Server 2005 Management Studio:

TITLE: Microsoft SQL Server Management Studio
------------------------------

Failed to retrieve data for this request. (Microsoft.SqlServer.SmoEnum)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&LinkId=20476

------------------------------
ADDITIONAL INFORMATION:

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

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

CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file 'M:\SQLDataFiles\Kubera_Portal_CU_Sempra.mdf'. (Microsoft SQL Server, Error: 5123)

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

The help links provided my Microsoft did not take me anywhere, it did not help!

Now I could not copy the file to new location or attach the file again! Finally somebody wrote in a blog that such files can be copied by taking ownership of the file. I changed the owner and took ownership and then I was able to copy the file to new location. Then there was something else, the .ldf file was missing and I have no clue why that happened. Since there was nothing else to be done, I attached the .mdf file alone and gave a location for the .ldf file and it got attached. Those were some hear pulling moments because I was dealing with a production server!

Comments

Alex said…
For working out problems connected with problem .mdf you can use mdf repair. It doesn't modify source data during restoration, uses modern ways of repairing .mdf files, works under all available Windows OS.

Popular posts from this blog

"Cannot impersonate user for data source" - SSRS reports

We were getting this strange error while viewing our reports in SharePoint that was deployed using BIDS 2005: An error has occurred during report processing. Cannot impersonate user for data source 'datasource' Logon failed I tried many things but nothing worked. I did some research and found many blog posts which suggested me to reapply the password on the datasource file specified in the error message and save it again. That didn't work for me. I saw some check boxes in the data source file that read "Use as Windows Credentials" and "Set Execution Context to this report" and I didn't know what they meant. I unchecked those in my data source and then when the refreshed the page the report started displaying.

Users do not show up in SharePoint People Search or People Picker

I had this issue with people picker in a classic mode web application in SharePoint 2013 and this site is in 2010 mode - users in certain sub-domains would not show up in People Picker. I was aware of stsadm commands to fix this and we ran the stsadm command to hook up people picker with another domain some time back. The latest issue was that people picker was not returning users from the root domain and few sub domains. After researching on the internet I found (contrary to my thoughts) that we could use PowerShell and not just stsadm to map People Picker to domains. It is a good idea to first check what domains are added/mapped to the web application using the following commands: $wa = Get-SPWebApplication -Identity http://mywebapp.com #List the Domains $wa.PeoplePickerSettings.SearchActiveDirectoryDomains This will list the domains currently People Picker is looking up for that web application. I used the following script to map our AD forest to People Picker:

Report Server has encountered a SharePoint error. ( rsSharePointError)

I was receiving this error on the "Report Server Web Service URL" on our SharePoint farm: Report Server has encountered a SharePoint error. ( rsSharePointError) Access to this Web Site has been blocked. Please contact the administrator to resolve this problem. This site URL is configured via Central Administration > Configure Reporting Services Integration > Reporting Services Integration if Reporting Server feature/Add-in is installed on the farm. After doing some research I found out that this page somehow enumerates through entire site collections before it throws this error. As part of troubleshooting step I checked if the domain user configured for reporting service is has sufficient privileges in the farm and also as local admin of the sql box, but this did not solve the issue. We raised this issue with the vendor and they made us update our SQL Server 2005 to latest SP and CU; still we had the error. The reason was nobody was sure if this er