One error we often have to deal with is incorrect sequence when adding new data to Maximo. There are many situations when it might come up, such as:
- When loading data using MXLoader, or inserting data directly via SQL
- Sequence corruption due to unknown cause in Production, probably due to errors caused by cancelled/terminated job
- Restoring database from a copy, or after an upgrade.
When this happens, the user sees an error with duplicated key value such as “BMXAA4211E - Database error number 2601 has occurred…”
The solution for this is well documented and
straightforward, we just need to find the current maximum ID value used in the
table, and update the corresponding sequence to use the next value.
UPDATE maxsequence SET maxreserved = (SELECT max(workorderid) + 1 FROM workorder) WHERE tbname = 'WORKORDER' and name = 'WORKORDERID'
However, I like to avoid restarting Maximo if possible due to some obvious problems such as:
- I recently had to do a quick deployment which involves uploading some data. For some unknown reasons, loading the data via MXLoader causes random sequence corruption a few times. For this client which has a large cluster, restarting Maximo will require an additional 30-60 minutes down time.
- A location data hierarchy update requiring me to insert a few thousand new records to the LOCANCESTOR table. I needed update the sequence to a new value for subsequent data upload via MIF to work. Since it is a cloud environment, if I can avoid a restart, we won’t need to be dependent on the availability of the cloud provider.
- Create a new script with no launch point:
Whenever we update maxsequence table with a new value and need to reset the cache, just execute the script by calling it via REST API: [MAXIMO_URL]//maximo/oslc/script/runtask?_lid=maxadmin&_lpwd=maxadmin
No comments:
Post a Comment