Applications Systems

Database Maintenance Finishes with Errors Due to Arithmetic Overflow in SRM Storage Controller Baseline Tables

Database maintenance jobs fail with an arithmetic overflow error when the row count in SRM Storage Controller baseline tables exceeds 999. This is caused by the IOPSDistributionCount and BytesPSDistributionCount columns being incorrectly defined as decimal(5,2) instead of int, preventing SQL Server from storing row counts larger than 999.

First published date

7/15/2026 5:13 PM

Last published date

7/15/2026 5:43 PM

Overview

In environments with high-volume SRM (Storage Resource Monitor) polling, the SolarWinds database maintenance job fails with the error:

Arithmetic overflow error converting int to data type numeric

This occurs during the baseline recalculation stored procedures for SRM Storage Controller statistics. The maintenance job's own TRY/CATCH error handler re-raises the failure as Error 50000, State 8, which surfaces in the Orion logs and database maintenance results page.

The issue is triggered in any environment where the number of rows per StorageControllerID + TimeFrameID group in the _CS_Detail history table exceeds 999 — a threshold that is easily surpassed in long-running or high-polling-frequency SRM environments.

 

Product section

Storage Resource Monitor

Cause

The following columns in two SRM baseline tables are defined as decimal(5,2) NOT NULL, which can store a maximum integer value of 999:

Table: SRM_StorageControllerStatistics_Baseline

  • [IOPSDistributionCount] [decimal](5,2) NOT NULL

  • [BytesPSDistributionCount] [decimal](5,2) NOT NULL

Table: SRM_StorageControllerPortStatistics_Baseline

  • [IOPSDistributionCount] [decimal](5,2) NOT NULL

  • [BytesPSDistributionCount] [decimal](5,2) NOT NULL

The baseline recalculation stored procedures populate these columns using a SUM() row count expression:

SUM(CASE WHEN data.[IOPSDistribution] IS NULL OR data.[IOPSDistribution] < 0
         THEN 0 ELSE 1 END) AS [IOPSDistributionCount]

This effectively counts rows per StorageControllerID + TimeFrameID group. In high-volume environments, this count can far exceed 999 (e.g., 5,465 rows per controller). When SQL Server attempts to implicitly convert the SUM() result (e.g., 5465) into decimal(5,2), it throws the arithmetic overflow error. The stored procedure's TRY/CATCH wrapper then re-raises this as Error 50000 / State 8.

Resolution

Workaround — Manual Column Type Fix (use with caution, take a DB backup first):

⚠️ Warning: Always take a full database backup before making schema changes. Confirm the maintenance window with the customer before proceeding.

Run the following SQL against the SolarWindsOrion database to alter the affected columns to the correct data type:

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

-- Fix SRM_StorageControllerStatistics_Baseline ALTER TABLE [dbo].[SRM_StorageControllerStatistics_Baseline] ALTER COLUMN [IOPSDistributionCount] [int] NOT NULL; ALTER TABLE [dbo].[SRM_StorageControllerStatistics_Baseline] ALTER COLUMN [BytesPSDistributionCount] [int] NOT NULL; -- Fix SRM_StorageControllerPortStatistics_Baseline ALTER TABLE [dbo].[SRM_StorageControllerPortStatistics_Baseline] ALTER COLUMN [IOPSDistributionCount] [int] NOT NULL; ALTER TABLE [dbo].[SRM_StorageControllerPortStatistics_Baseline] ALTER COLUMN [BytesPSDistributionCount] [int] NOT NULL;

After running the above, re-trigger the database maintenance job and confirm it completes without errors.

Steps to verify the issue:

  1. Log in to the SolarWinds Web Console and navigate to Settings > All Settings > Database Details / Database Maintenance.

  2. Check the maintenance job history for errors — look for entries reporting "Database maintenance finished with errors."

  3. On the SQL Server hosting the SolarWinds Orion database, open SQL Server Management Studio (SSMS).

  4. Run the following query to confirm the column type mismatch:

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

    SELECT TABLE_NAME, COLUMN_NAME, DATA_TYPE, NUMERIC_PRECISION, NUMERIC_SCALE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME IN ( 'SRM_StorageControllerStatistics_Baseline', 'SRM_StorageControllerPortStatistics_Baseline' ) AND COLUMN_NAME IN ('IOPSDistributionCount', 'BytesPSDistributionCount') ORDER BY TABLE_NAME, COLUMN_NAME;

    Confirm DATA_TYPE shows decimal with NUMERIC_PRECISION = 5 and NUMERIC_SCALE = 2 — this confirms the bug is present.

  5. Run the following query to check the actual row counts that are triggering the overflow:

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

    SELECT StorageControllerID, COUNT(*) AS RowCount FROM [SolarWindsOrion].[dbo].[SRM_StorageControllerStatistics_CS_Detail] GROUP BY StorageControllerID ORDER BY RowCount DESC;

    If any StorageControllerID has a RowCount exceeding 999, this confirms the overflow condition.