Network Management

Troubleshooting database CHECK constraints

CHECK constraints on historical tables are important, as incorrect constraints can cause errors in modules like database maintenance. Make sure all historical tables have CHECK constraints enabled. Sometimes the CHECK constraints can fail because of a wrong date format in the WHERE clause. For example, if the Windows locale is changed from English to Swedish, new CHECK constraints will have Swedish month names and old months will be English. In this case, constraints would not work.

First published date

10/29/2018 4:28 PM

Last published date

11/10/2022 2:39 PM

Overview

Historical tables in the database are used for partitioned views. CHECK constraints on these tables are important, as incorrect constraints can cause errors in modules like database maintenance.

Make sure that every historical table has CHECK constraints (name starts with CHK_) enabled. 
Sometimes the CHECK constraints can fail because of a wrong date format in the WHERE clause. 

For example, if the Windows locale is changed from English to Swedish, new CHECK constraints will have Swedish month names and old months will be English. In this case, constraints would not work.

Product section

Orion Platform

Cause

Incorrect CHECK constraints can cause errors in modules like database maintenance.

Resolution

Before running the script, back up your SolarWinds Orion database. If you need help, check your vendor's site for instructions.

If your Orion server is on a virtual machine, create a snapshot or copy of your VM.

If you'd like to use SolarWinds Backup, click here for information.

 

If a CHECK constraint is missing or is invalid, recreate the constraint manually or run the script from here

 

Warning: The script drops and creates CHECK constraints and assumes that daily data is one week.

Sometimes data in historical tables can overlap. To fix this, remove overlapping data manually or recreate these tables.


-- 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.