0

I am trying to create a log shipping setup. The log shipping process restores the full backup to secondary, but the restore step is failing for transactional data. When I check the job history I see the following error message:

2023-12-12 18:12:01.96  *** Error: Failed to convert parameter value from a SqlGuid to a String.(System.Data) ***
2023-12-12 18:12:01.96  *** Error: Object must implement IConvertible.(mscorlib) ***
2023-12-12 18:12:01.98  Found first log backup file to restore. Secondary DB: 'BusDatabase', File: 'C:\copy\BusDatabase_20231212165000.trn'
2023-12-12 18:12:01.98  *** Error: Could not log history/error message.(Microsoft.SqlServer.Management.LogShipping) ***
2023-12-12 18:12:01.98  *** Error: Failed to convert parameter value from a SqlGuid to a String.(System.Data) ***
2023-12-12 18:12:01.98  *** Error: Object must implement IConvertible.(mscorlib) ***

-----------------------------------------------------------------------------------------

Message
2023-12-12 19:00:05.42  The restore operation was successful. Secondary Database: 'BusDatabase', Number of log backup files restored: 1
2023-12-12 19:00:05.42  *** Error: Could not log history/error message.(Microsoft.SqlServer.Management.LogShipping) ***
2023-12-12 19:00:05.42  *** Error: Failed to convert parameter value from a SqlGuid to a String.(System.Data) ***
2023-12-12 19:00:05.42  *** Error: Object must implement IConvertible.(mscorlib) ***
2023-12-12 19:00:05.42  Deleting old log backup files. Primary Database: 'BusDatabase'
2023-12-12 19:00:05.42  *** Error: Could not log history/error message.(Microsoft.SqlServer.Management.LogShipping) ***
2023-12-12 19:00:05.42  *** Error: Failed to convert parameter value from a SqlGuid to a String.(System.Data) ***
2023-12-12 19:00:05.42  *** Error: Object must implement IConvertible.(mscorlib) ***
2023-12-12 19:00:05.42  Deleting log backup file. File: 'C:\copy\BusDatabase_20231209184000.trn', Last Write Time (UTC): '12/9/2023 6:40:00 PM'
2023-12-12 19:00:05.42  *** Error: Could not log history/error message.(Microsoft.SqlServer.Management.LogShipping) ***
2023-12-12 19:00:05.42  *** Error: Failed to convert parameter value from a SqlGuid to a String.(System.Data) ***
2023-12-12 19:00:05.42  *** Error: Object must implement IConvertible.(mscorlib) ***
2023-12-12 19:00:05.43  Deleting log backup file. File: 'C:\copy\BusDatabase_20231209185000.trn', Last Write Time (UTC): '12/9/2023 6:50:00 PM'
2023-12-12 19:00:05.43  *** Error: Could not log history/error message.(Microsoft.SqlServer.Management.LogShipping) ***
2023-12-12 19:00:05.43  *** Error: Failed to convert parameter value from a SqlGuid to a String.(System.Data) ***
2023-12-12 19:00:05.43  *** Error: Object must implement IConvertible.(mscorlib) ***
2023-12-12 19:00:05.43  The restore operation was successful. Secondary ID: 'eb60caf8-e53f-49a4-823d-e98d18c3120a'
2023-12-12 19:00:05.43  *** Error: Could not log history/error message.(Microsoft.SqlServer.Management.LogShipping) ***
2023-12-12 19:00:05.43  *** Error: Failed to convert parameter value from a SqlGuid to a String.(System.Data) ***
2023-12-12 19:00:05.43  *** Error: Object must implement IConvertible.(mscorlib) ***
2023-12-12 19:00:05.43  ----- END OF TRANSACTION LOG RESTORE     -----

If I restart me secondary server the latest data will get restored, but fails again if I add an new records.

Below is my configuration for log shipping

  • backup job occurs every 10 mins
  • copy job occurs every 11 mins
  • restore job occurs every 12 mins

Can anyone please tell me how to resolve this issue?

1
  • To investigate the problem, try doing log shipping manually. That is. Make a FULL backup, then make a Transaction Log backup, then restore a FULL and Transaction Log backup. Will there be an error?
    – Ivan
    Dec 23, 2023 at 23:44

1 Answer 1

0

Any chance this is on an unpatched SQL Server 2019? I ran into the same issue yesterday with the same errors.

Log shipping looks fine, you can also see it in the restore history. However, there seems to be an issue logging the history.

You can use this query to see if your databases have an accurate restore_data

WITH LastRestores AS
(
SELECT
    DatabaseName = [d].[name] ,
    [d].[create_date] ,
    [d].[compatibility_level] ,
    [d].[collation_name] ,
    r.*,
    RowNum = ROW_NUMBER() OVER (PARTITION BY d.Name ORDER BY r.[restore_date] DESC)
FROM master.sys.databases d
LEFT OUTER JOIN msdb.dbo.[restorehistory] r ON r.[destination_database_name] = d.Name
)
SELECT *
FROM [LastRestores]
WHERE [RowNum] = 1

I found the fix below online, but I've not had the opportunity to patch it myself, so can't fully confirm it fixes it. You might have to reinitialize the log shipping afterwards as well.

KB4537869 - CU2 of SQL Server 2019

I do suggest to installing a newer SQL Server 2019 patch, CU24 is the newest one and can be found here.

More information about patches can be found on sqlserverupdates.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.