The operating system returned the error ‘5(Access is denied.)

The operating system returned the error ‘5(Access is denied.): When we restore any database or report server database for SSRS/PBIRS we get this kind of error. In this article we will see how to resolve this issue with certain steps.

I am trying to restore my database and I will get this below error whenever I try to restore it. For more check this doc

Error Details

Microsoft.Data.SqlClient.SqlError: The operating system returned the error '5(Access is denied.)' while attempting 'RestoreContainer::ValidateTargetForCreation' on 'C:\Program Files\Microsoft SQL Server\MSSQL13.SQL16\MSSQL\DATA\ReportServer.mdf'. (Microsoft.SqlServer.SmoExtended)
The operating system returned the error '5(Access is denied.)

Resolution 1:

Go to the file location where it specifically says the mdf location ‘C:\Program Files\Microsoft SQL Server\MSSQL13.SQL16\MSSQL\DATA\ReportServer16.mdf’ and give permission to the user. The user can be windows user, domain user, SQL Server service account and any other account if you are using is to login to SQL Server.

In my case I am using my windows credentials to login to SQL Server, so I will go to this location and give permission to the user. In my case the user is SQLRepro and if you see in the below image, the user is not present in the security tab so I added him manually and in the next step you can see that.

The operating system returned the error '5(Access is denied.)

Now I have added the user SQLRepro as you can see in the below image.

The operating system returned the error '5(Access is denied.)

Resolution 2:

I did the first step resolution and try to restore but it did not work out, now I will implement this action plan.

The operating system returned the error '5(Access is denied.)

If you see in the Restore page, we can find the second option as “FILES”, click on that and check the option.

Restore of database 'ReportServer' failed.

Once you do and try to restore the database, probably this will fix the issue. If not? please go with other steps or resolution mentioned below.

TSG Links:

  1. Kerberos Issue: NT AuthorityAnonymous Login Failed -Resolve (kingfishertechtips.in)
  2. Port Number For Analysis Services – Find Ports For SSAS? (kingfishertechtips.in)
  3. RS.exe Utility: Migrate RDL Reports To Another SSRS/PBIRS (kingfishertechtips.in)
  4. Direct Query Mode ON In Tabular Model Issue – Visual Studio (kingfishertechtips.in)
  5. SMTP Server In SSRS/PBIRS |Subscribe To Email Problem/Issue (kingfishertechtips.in)
  6. SQL Server 2022 Download, Install, Connect Using SSMS Tool (kingfishertechtips.in)
  7. Creating Tabular Project & Deploy Model To Analysis Service (kingfishertechtips.in)
  8. Deploy Tabular Project To Azure Analysis Service – SSDT Tool (kingfishertechtips.in)
  9. SSRS/PBIRS – Install And Configure The Report Server On-Prem (kingfishertechtips.in)
  10. Could Not Load Folder Contents In Portal URLs – SSRSPBIRS (kingfishertechtips.in)
  11. SSRS/PBIRS – Install And Configure The Report Server On-Prem (kingfishertechtips.in)
  12. SQL Server 2022 Download, Install, Connect Using SSMS Tool (kingfishertechtips.in)
  13. Capture Fiddler Trace for Debugging the Network Traffic (kingfishertechtips.in)
  14. On-Premises Gateway: Configure/Map SQL DB To Power Bi (kingfishertechtips.in)
  15. Fixed Column/Row Header Make Visible In Any Report (kingfishertechtips.in)
  16. Self-Signed Certificate: Configure SSRS/PBIRS With SSL (kingfishertechtips.in)
  17. Create Local User Account/Local Admin User In Windows 10/11 (kingfishertechtips.in)
  18. Login With AAD/Domain/Microsoft Account To Azure VM’s/RDP (kingfishertechtips.in)
Vickey Rajpoot
Vickey Rajpoot

Hello there! I'm dedicated Microsoft Data & AI Engineer at LTIMindtree, where I thrive technology into actionable insights. Dive into my world by visiting my YouTube channel & Webiste, "Kingfisher Tech Tips".

Articles: 109

Leave a Reply

Your email address will not be published. Required fields are marked *