Error: "Could not retrieve backup settings for primary" in Log shipping Backup job

This one is simple but interesting...

Log shipping which was running for an year, suddenly stopped working. Log shipping monitor says that there are no backups restored for last 14849 minutes... Why?

We started figuring this out, the copy and restore jobs were running fine but only the backup job was failing.

What was the error generated by the Log shipping backup job?

*** Error: Could not retrieve backup settings for primary ID 'abfb9a42-207e-451b-968c-3ac29edc16f9'.(Microsoft.SqlServer.Management.LogShipping) ***
*** Error: Failed to connect to server SQLSERVER2001.(Microsoft.SqlServer.ConnectionInfo) ***
*** Error: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)(.Net SqlClient Data Provider) ***
----- END OF TRANSACTION LOG BACKUP -----

But the name of the SQL Server name is SQLSERVER2012, so why is it looking for SQLSERVER2001? This is because the server was renamed from SQLSERVER2001 to SQLSERVER2012 recently but the sys.servers was not updated with this change.

As a result, SELECT @@SERVERNAME still points to old name so we ran commands given below to update sys.server entry and then RESTARTED SQL Server:

EXEC sp_dropserver 'Your_OLD_Computer_Name'

GO

EXEC sp_addserver 'Your_NEW_Computer_Name', 'local'

GO

Now we reconfigured log shipping to make it work. You can either do this or update the Log shipping backup with correct SQL Server instance name or create a SQL Server alias pointing back to new server name to make it work. Still not working? Leave the error message in the comments here....

Reference:

Rename a Computer that Hosts a Stand-Alone Instance of SQL Server - https://msdn.microsoft.com/en-us/library/ms143799.aspx