sys.dm_change_feed_errors (Transact-SQL)

Applies to: SQL Server 2022 (16.x) Azure SQL Database Azure Synapse Analytics Microsoft Fabric

Returns recent errors from the change feed, snapshot, or incremental change publish processes

This dynamic management view is used for:

Column name Data type Description
session_id int This is the session_id maintained by history cache of the log reader.
source_task tinyint Internal change feed task ID.
0 = UNDEFINED
1 = TIMER
2 = CAPTURE
3 = PUBLISH
4 = COMMIT
5 = SNAPSHOT
table_id int The object_id of the relevant table.
table_group_id uniqueidentifier The unique identifier of the table group. It will be a GUID generated by the setup flow.
capture_phase_number int Log reader scan phase, if capture job completes and the publish/commit is still in progress, the phase still remains at last scan (batch processing phase 7). For more information, see batch_processing_phase in sys.dm_change_feed_log_scan_sessions. Doesn't apply to snapshot.
entry_time datetime The date and time the error was logged. This value corresponds to the timestamp in the SQL error log. In SQL Server, this time is reporting in local time. In Azure SQL Database, the time zone is UTC.
error_number int ID of the error message.
error_severity int Severity level of the message, between 1 and 25.
error_state int State number of the error.
error_message nvarchar(1024) Message text of the error.
batch_start_lsn nvarchar(23) Starting LSN value of the rows being processed when the error occurred.

0 = the error didn't occur within a log scan session.
batch_end_lsn nvarchar(23) End LSN value of the rows being processed when the error occurred.

0 = the error didn't occur within a log scan session.
tran_begin_lsn nvarchar(23) Begin_lsn of the failed transaction. Will be NULL for snapshot errors.
tran_commit_lsn nvarchar(23) Commit LSN for the change row in the change data row set on which the failure occurred. Will be NULL for snapshot errors.
sequence_value nvarchar(23) LSN value of the rows being processed when the error occurred.

0 = the error didn't occur within a log scan session.
command_id int Command ID from the change row that failed to publish. Will be NULL for snapshot errors.

Remarks

This DMV shows errors from last 32 sessions. One session might include multiple errors, for example, retry attempts on landing zone failures. This DMV will also show errors faced during snapshot and incremental change publish process.

Permissions

Requires VIEW DATABASE STATE or VIEW DATABASE PERFORMANCE STATE permission to query the sys.dm_change_feed_errors dynamic management view. For more information about permissions on dynamic management views, see Dynamic Management Views and Functions.

Examples

Use sys.dm_change_feed_errors to check for any recent errors.

SELECT * 
FROM sys.dm_change_feed_errors 
ORDER BY entry_time DESC;

For Microsoft Fabric mirrored databases:

For Azure Synapse Link: