How to query the DDMdb for long event message string

Document ID : KB000094786
Last Modified Date : 05/05/2018
Show Technical Document Details
Introduction:
There are some events with long message string (in the vardata_string field) which causes a failure to insert the event into the reporting.event table.

May 02, 2018 09:38:00.784 (SRM/LandscapeManager/LandscapeThread_0) (SRM_Events) - (ERROR) - Failed to insert event into event table. SQL Exception code: 1406 SQL Exception message: Data truncation: Data too long for column 'event_msg' at row 1 Last known event time = 1524374934000 
May 02, 2018 09:38:00.784 (SRM/LandscapeManager/LandscapeThread_0) (SRM_Events) - (ERROR) - event record (mh=0x133dde, type=0x6330076, time=2018-04-22 02:28:54.0) 

This MySQL query will help you to identify the problematic event codes and delete them from the ddmdb.event table.
Question:
How to find the event code with long event message string (in the vardata_string field)
Environment:
CA Spectrum 10.x
Answer:
1. Open a bash shell (bash -login)

2. Navigate to $SPECROOT/mysql/bin directory

    cd mysql/bin

3. Launch the MySQL command prompt

    ./mysql -uroot -proot ddmdb (for Windows)

    ./mysql --defaults-file=../my-spectrum.cnf -uroot -proot ddmdb (for Linux or Solaris)

4. Run the following MySQL query:

    select HEX(model_h),HEX(type) as 'Event Type', CHAR_LENGTH(vardata_string) as 'Character length' from event where CHAR_LENGTH(vardata_string) > 65535 limit 50; 
Additional Information:
Then you can run the following MySQL command line to delete the event code in question (0x6330076):
DELETE FROM event WHERE type=0x6330076;

Failed to insert event due data too long for column 'event_msg'
Document ID    KB000094841
https://comm.support.ca.com/kb/failed-to-insert-event-due-data-too-long-for-column-event-msg/kb000094841

Or you can increase the 'event_msg' column size:
Report Manager event processing failed, with Data truncation errors: Data too long for column 'event_msg'.
Document ID    KB000008648
https://comm.support.ca.com/kb/Report-Manager-event-processing-failed-with-Data-truncation-errors-Data-too-long-for-column-eventmsg/KB000008648