App Control: Execution of stored procedure dbo.PruneDeletedHosts failed because of error "String or binary data would be truncated"
searchcancel
App Control: Execution of stored procedure dbo.PruneDeletedHosts failed because of error "String or binary data would be truncated"
book
Article ID: 286239
calendar_today
Updated On: 02-01-2022
Products
Carbon Black App Control (formerly Cb Protection)
Issue/Introduction
Not able to manually prune the deleted end point, the execution of dbo.PruneDeletedHosts fails with the following error
Msg 8152, Level 16, State 30, Procedure dbo.PruneDeletedHosts, Line 25 [Batch Start Line 2]
String or binary data would be truncated.
The statement has been terminated.
Environment
App Control Server: All Versions
Cause
Size of column users in table [dbo].[hostmain_bak] since it does not match with the size of the users colum in [dbo].[hostmain]
Resolution
Logon into the DAS database with the app control service account using SQL management studio .
Create a backup of the existing data in the table [dbo].[hostmain_bak] by executing the below query:
SELECT *
INTO #Temphostmain_bak
FROM hostmain_bak
In SQL management studio in the object explorer navigate to databases > das > Tables
Do right click on [dbo].[hostmain_bak] table and select "Script table as > Create to > New Query Editor Window " , save the script output.
Execute the folowing query drop table [dbo].[hostmain_bak]
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[hostmain]') AND type in (N'U'))
DROP TABLE [dbo].[hostmain]
GO
From the script collected in step 4 replace the line with the user column information ([users] [nvarchar]...) with the folowing entry and save the change
[users] [nvarchar](max) NULL,
Execute the script from step 4.
Migrate back the [dbo].[hostmain_bak] data backed up in step 2
SELECT *
INTO hostmain_bak
FROM #Temphostmain_bak
Execute the PruneDeletedHosts
exec dbo.PruneDeletedHosts
Additional Information
Please made sure a full database backup is taken before executing the given steps.