App Control: Execution of stored procedure dbo.PruneDeletedHosts failed because of error "String or binary data would be truncated"
search cancel

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:

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

  1. Logon into the DAS database with the app control service account using SQL management studio .
  2. 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
  3. In SQL management studio  in the object explorer navigate to databases > das > Tables 
  4. Do right click on [dbo].[hostmain_bak] table and select "Script table as > Create to > New Query Editor Window " , save the script output.
  5. 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
  6. 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,
  7. Execute the script from step 4. 
  8. Migrate back the  [dbo].[hostmain_bak] data backed up in step 2
    SELECT * 
    INTO hostmain_bak
    FROM #Temphostmain_bak
  9. Execute the PruneDeletedHosts    
    exec  dbo.PruneDeletedHosts

Additional Information

Please made sure a full database backup is taken before executing the given steps.