An SSA database restore job fails sporadically with this error: String data, right truncation [SQLSTATE 01004]
This job runs daily, and succeeds most of the time. When it fails it is on a Friday and it leaves the database in a restoring state. The code inside the job is the exact same code used for other database restore jobs where this is not a concern.
My solution each time this happens is to delete the database and manually restore it. After manually restoring, I run the job and it runs fine. It continues to run fine every day from that point on until it doesn't.
I checked the SQL logs and I do see this error: "spid75,Unknown,BackupDiskFile::OpenMedia: Backup device '\the_path_to_the_backups' failed to open. Operating system error 5(Access is denied.).,,,,". So, I checked to ensure the user has permission to access to the .BAK file at the folder level and the file level. It does have full access.
Any thoughts on how I can stop this job from failing randomly?
EDIT: This is the code from that job.
USE DBA_Tools;
GO
EXECUTE
DBMaintenance.restoreBackupChain
@BackupFolder = '\\servername\sqlbackups2$\instancename\Database_Backups\DSOG',
@Database = 'DSOG';
USE [DSOG]
GO
EXEC sp_change_users_login 'Auto_Fix', 'reportingServicesUser'
GO
EXEC [DSOG].dbo.sp_changedbowner @loginame = N'sa', @map = false
GO
USE [master] ;
ALTER DATABASE [DSOG] SET RECOVERY SIMPLE ;
GO