Transaction log restore fails with error "Operating system error 5(Access is denied.)."
First Error

Msg 3201, Level 16, State 2, Line 1 Cannot open backup device '\\serverX1\d$\trlogs' Operating system error 5(Access is denied.). Msg 3013, Level 16, State 1, Line 1 RESTORE LOG is terminating abnormally1

Solution:
It means the service account of SQL Server (which used to start SQL Server service) does not have access to the source.


START > RUN > type SERVICES.MSC.
Find SQL Server Service > Right click and go to PROPERTIES.
Go to LogOn/Security tab


If it's system account (NETWORK SERVICE, LOCAL SYSTEM etc.) then change it to any specific account (domain account like ex. dba\sqlserviceact) and grant the account (ex. dba\sqlserviceact) read &amp; write privilege on the shared folder (network path).

Second Error

Msg 3117, Level 16, State 1, Line 1 The log or differential backup cannot be restored because no files are ready to rollforward. Msg 3013, Level 16, State 1, Line 1 RESTORE LOG is terminating abnormally

**Solution: **

Verify your differential has Differential Base LSN same as FirstLSN of Full Backup, using below query.

RESTORE HEADERONLY FROM DISK='\\PATH\Full_Backup.BAK'

RESTORE HEADERONLY FROM DISK='\\PATH\Diff_Backup.BAK'




If it's same, then First Restore Full backup with NORECOVERY.

    RESTORE DATABASE DatabaseName
    FROM DISK = '\\PATH\Backup_File_Full.bak'
    WITH NORECOVERY;


Then Restore Differential correspond to the full backup you restored with NORECOVERY

    RESTORE DATABASE DatabaseName
    FROM DISK = '\\PATH\Backup_File_Diff.bak'
    WITH NORECOVERY; --Use WITH RECOVERY if you need to recover data for the point of time


Now if you have Transaction Log backup to restore. Restore all the transaction log backup with NORECOVERY. Only Last T-Log backup (To the point of time you want to recover) will be restored with RECOVERY

To Restore Transaction Log Backup

RESTORE LOG DatabaseName FROM DISK = '\\Path\Backup_File_TLog.bak' WITH NORECOVERY; --If it's the last backup you need to restore use `WITH RECOVERY`


And your problem will be resolved.

Thanks