Network Management
Solarwinds Platform Configuration Wizard fails with an error: "TRUNCATE TABLE statement failed. Index is not partitioned, but table uses partition function”
This article addresses an issue where Configuration Wizard is failing on Database configuration failure to execute a script that involves a TRUNCATE TABLE command. When the Configuration Wizard attempts to run a TRUNCATE TABLE ... WITH (PARTITIONS (...)) command, SQL Server enforces that all indexes on that table must use the same partition scheme. The presence of a non-partitioned index causes the script to fail.
First published date
Last published date
Overview
During execution of the SolarWinds Configuration Wizard, users may encounter an error similar to the following:
ERROR DBConfigProcessor – TRUNCATE TABLE statement failed. Index 'IX_AUTO_CPULoad_CS_Daily_hist__2024_5_5_89004' is not partitioned, but table 'CPULoad_CS_Daily_hist' uses partition function 'pf_CPULoad_CS_Daily_hist'. Index and table must use an equivalent partition function.
Index name and affected table might vary.
This occurs during the Database Configuration phase, specifically when the Configuration Wizard executes the database setup scripts located in the DatabaseSetup\PreTimeSeries directory. The error indicates a mismatch between the partitioning of a table and its associated index.
The table CPULoad_CS_Daily_hist is partitioned using a specific partition function (pf_CPULoad_CS_Daily_hist), while a custom or non-standard index (in this case, IX_AUTO_CPULoad_CS_Daily_hist__2024_5_5_89004) is not partitioned.
Product section
Cause
This error typically occurs when:
- A custom index has been manually created on a partitioned table in the SolarWinds database, and
- The custom index does not use the same partition function or partition scheme as the table itself.
Resolution
- Identify all Non-Partitioned (Custom) Indexes.
- Open Microsoft SQL Server Management Studio (SSMS).
- Connect to the SQL Server Instance.
- Click New Query.
- Paste and Run the script below:
Note: In the WHERE clause (originally WHERE i.name LIKE 'IX_Auto%'), update the pattern to exactly match the custom index name prefix shown in your logs. This allows the query to identify all custom indexes starting with IX_Auto% (or the specific variant logged).
-- 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
s.name AS SchemaName,
t.name AS TableName,
i.name AS IndexName,
pf.name AS TablePartitionFunction,
ps.name AS IndexPartitionScheme,
i.type_desc AS IndexType
FROM sys.indexes i
JOIN sys.objects t ON i.object_id = t.object_id
JOIN sys.schemas s ON t.schema_id = s.schema_id
LEFT JOIN sys.indexes AS ti ON t.object_id = ti.object_id AND ti.index_id < 2 -- base table clustered index
LEFT JOIN sys.partition_schemes ps ON i.data_space_id = ps.data_space_id
LEFT JOIN sys.partition_schemes ps_table ON ti.data_space_id = ps_table.data_space_id
LEFT JOIN sys.partition_functions pf ON ps_table.function_id = pf.function_id
WHERE i.name LIKE 'IX_Auto%'
AND i.type_desc <> 'HEAP' -- exclude heaps
AND i.is_hypothetical = 0
AND ps_table.name IS NOT NULL -- table uses a partition scheme
AND (ps.name IS NULL OR ps.name <> ps_table.name) -- index is not aligned
ORDER BY SchemaName, TableName, IndexName;
-
- Click Execute
- Once identified, generate
DROP INDEXstatements for the problematic indexes and run the command below:
From this sample:
index: IX_AUTO_CPULoad_CS_Daily_hist__2024_5_5_89004
table: CPULoad_CS_Daily_hist
Note: Create a backup of the Database and consult these with your DBA.
-- 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.
DROP INDEX [IX_AUTO_CPULoad_CS_Daily_hist__2024_5_5_89004] ON [dbo].[CPULoad_CS_Daily_hist];
- Once all non-partitioned indexes are removed, re-run the Configuration Wizard.