On my secondary, I am seeing many messages like these in sysjobhistory from the LSCopy and LSRestore jobs for each database:
Could not log history/error message.(Microsoft.SqlServer.Management.LogShipping)
Error: Could not cleanup history.(Microsoft.SqlServer.Management.LogShipping)
Error: Only members of the sysadmin fixed server role can perform this operation.(.Net SqlClient Data Provider)
The job steps are being run by "SQL Server Agent Service Account". That service account is a domain service account which has a login with the sysadmin role.
What else should I be looking for to find the true cause of the messages?
The msdb.dbo.log_shipping_monitor_secondary table hasn't been updated in months based on the values in last_copied_file, last_copied_date, etc., yet the LSCopy and LSRestore jobs are succeeding (and show current file names in the messages). (The LSAlert job is disabled.)
One interesting thing is that the names in the log_shipping_monitor_secondary.secondary_server column is the name of the primary server. From what I can tell, the secondary server was cloned from the primary and renamed before log shipping was set up, but the SQL instance name wasn't changed.
I'd like to resolve all this without completely rebuilding this secondary server.