The following error message has been observed while restoring the MSSQL database to an alternate location:
The operating system returned the error '5(Access is denied.)' while attempting 'RestoreContainer::ValidateTargetForCreation' on 'E:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\XXXXXX.mdf'
We can use SQL Server Configuration Manager to find which account is used to run the SQL Server instance, and then make sure that account has full control
Steps to Resolve-
Sql Server Configuration managerclick on SQL Server (MSSQLSERVER)Propertieslog On As value to LocalSystemRe-run the restore job.