We enable a cron job for every Saturday morning at 02:30 am to start a db_optimize.pl script, this works fine for most of our landscapes, however on a few landscapes we see that the db_optimize.pl script causes the ddmdb event table to crash when it starts the optimize. This causes us to have to repair the database for these landscapes before we can start archive manager.
From the mysql.out file we can see that the table crashes exactly 2 seconds after the cron job starts the db_optimize.pl script.
2022-03-05T02:30:02.283753Z 275 [ERROR] /usr/Spectrum/mysql/bin//mysqld: Table './ddmdb/event' is marked as crashed and last (automatic?) repair failed
A previous temp file event.TMD existed and was not removed.
Release : 21.2
Component :Spectrum Events DDMDB
As seen in the output of the db_optimize.pl script the temp file was already existing and therefore a new temp file could not be created.
Can't create new tempfile: './ddmdb/event.TMD'
Once this file was manually removed then the db_optimize.pl script works without any issues.