Network Management

The DELETE statement conflicted with the REFERENCE constraint error in Default Database and Archive Maintenance Job in NCM

The article discusses how to resolve the issue when encountering an error when running the Default Database and Archive Maintenance Job for NCM

First published date

11/9/2021 5:05 PM

Last published date

2/10/2026 11:25 PM

Overview

Upon checking the NCM Businesslayer log:
ERROR SolarWinds.Cirrus.BusinessLayer.Jobs.BlJobRunner - 
BlJobRunner:Default Database and Archive Maintenance Job RunSubJob error: System.Data.SqlClient.SqlException (0x80131904): 
The DELETE statement conflicted with the REFERENCE constraint "FK_NCM_JobLogsNodes_NCM_JobStatistics". 
The conflict occurred in database "SolarWindsOrion", table "dbo.NCM_JobLogsNodes", column 'JobStatisticsId'.

Product section

Network Configuration Manager

Resolution

This issue is addressed in NCM 2026.1. Consider upgrading your environment. If you cannot upgrade, use the workaround below.

 

  1. Disable Job Logging in Advanced - Go to Settings  > All Settings > NCM Settings > Advanced Settings > Uncheck boxes for Job logging
     

image.png

  1. Clear the Job History Log in the NCM Jobs page (that's the small paper with a magnifier icon) Click then clear logs then save.
     

image.png

 


image.png


 

  1. Edit the Default Database Maintenance job, set the number of days for the job logs to 7 days.
  • Go to the NCM job page, search "Default Database and Archive Maintenance", select and click Edit.

  • Go to the "Add Job Specific Details" tab, set the Purge job log older than 7 days.

 

  1. Clear NCM Jobs logs using Database Manager or SQL Server Management studio
  • Remote to Main SolarWinds Platform Server

  • Stop all SolarWinds services

  • Open Database Manager

  • Execute below SQL query:

    • -- Scripts are not supported under any SolarWinds support program or service. -- Scripts are provided AS IS without warranty of any kind. SolarWinds further -- disclaims all warranties including, without limitation, any implied warranties -- of merchantability or of fitness for a particular purpose. The risk arising -- out of the use or performance of the scripts and documentation stays with you. -- In no event shall SolarWinds or anyone else involved in the creation, -- production, or delivery of the scripts be liable for any damages whatsoever -- (including, without limitation, damages for loss of business profits, business -- interruption, loss of business information, or other pecuniary loss) arising -- out of the use of or inability to use the scripts or documentation. UPDATE NCM_JobLogsNodes SET JobLog = ''

  • Start all SolarWinds services and check the status. If it doesn't help, proceed with next step

  • Stop all SolarWinds services and execute below SQL query

    • -- Scripts are not supported under any SolarWinds support program or service. -- Scripts are provided AS IS without warranty of any kind. SolarWinds further -- disclaims all warranties including, without limitation, any implied warranties -- of merchantability or of fitness for a particular purpose. The risk arising -- out of the use or performance of the scripts and documentation stays with you. -- In no event shall SolarWinds or anyone else involved in the creation, -- production, or delivery of the scripts be liable for any damages whatsoever -- (including, without limitation, damages for loss of business profits, business -- interruption, loss of business information, or other pecuniary loss) arising -- out of the use of or inability to use the scripts or documentation. DELETE FROM NCM_JobLogsNodes

  • Start all SolarWinds services