KeyMgtGetNextValue returning duplicate surrogate keys
Moderators: chulett, rschirm, roy
KeyMgtGetNextValue returning duplicate surrogate keys
This is a strange one.
We are using KeyMgtGetNextValue routine to assign surrogate keys when inserting records to the warehouse tables. Load runs fine for days and months and out of the blue, the load aborts with 'cannot insert duplicate key' errors.
So, for example, if a table that is loaded everyday with a few rows, has the last ID used as 180 and today if the load starts pushing out id's of 130, 131 instead of values > 180, what are all the possible reasons and where should I be looking for some traceability on why these sequences got reset back to 130.
I can think of two possibilities:
1) The SDKSequences file has been compromised or corrupted or messed with
2) Someone or some process ran the UDATE SDKSequences on this one surrogate key to set it back to 130
Any other possibilities that you guys can think of? thanks in advance..
We are using KeyMgtGetNextValue routine to assign surrogate keys when inserting records to the warehouse tables. Load runs fine for days and months and out of the blue, the load aborts with 'cannot insert duplicate key' errors.
So, for example, if a table that is loaded everyday with a few rows, has the last ID used as 180 and today if the load starts pushing out id's of 130, 131 instead of values > 180, what are all the possible reasons and where should I be looking for some traceability on why these sequences got reset back to 130.
I can think of two possibilities:
1) The SDKSequences file has been compromised or corrupted or messed with
2) Someone or some process ran the UDATE SDKSequences on this one surrogate key to set it back to 130
Any other possibilities that you guys can think of? thanks in advance..
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
I'd be guessing option (2). If SDKSequences were corrupt it wouldn't be returning anything at all.
As for tracing, search for any job that has an input link on which the hashed file name is SDKSequences.
As for tracing, search for any job that has an input link on which the hashed file name is SDKSequences.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Thank you Ray and Craig
There is no job in the project that writes to the SDKSequence file directly and our admins have assured us that there was no restore to the project directory at all.
That leaves us with the only possible explanation to be - that someone had run the Update SKDSequences in the command prompt of Administrator (or any other *malicious* process that does the equivalent). If that is the case, how can we see the list of commands that were ever executed against that project from administrator? Command History shows me nothing ...
There is no job in the project that writes to the SDKSequence file directly and our admins have assured us that there was no restore to the project directory at all.
That leaves us with the only possible explanation to be - that someone had run the Update SKDSequences in the command prompt of Administrator (or any other *malicious* process that does the equivalent). If that is the case, how can we see the list of commands that were ever executed against that project from administrator? Command History shows me nothing ...
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
so, if out of the 30 odd sequences maintained by the SDKSequences, if only one starts having this problem occasionally, it has to be a malicious process/task updating it correct?How can we monitor and identify the root cause if something like this happens.
I wanted to make sure that there is no Datastage issue here when sequences seem to be off once in a while (and every time it is a different key)
I wanted to make sure that there is no Datastage issue here when sequences seem to be off once in a while (and every time it is a different key)
-
- Participant
- Posts: 30
- Joined: Tue Jan 30, 2007 5:21 am
- Location: bangalore
Clear SDK sequence
clear SDK sequence using data stage administrator using CLEAR SDK.SEQUENCE
prasad
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Re: Clear SDK sequence
1. This is never a good idea.prasad.bodduluri wrote:clear SDK sequence using data stage administrator using CLEAR SDK.SEQUENCE
2. The command you gave is not valid anyway.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
If you really do want to monitor changes to SDKSequences, you have the option of converting it to a UniVerse table and creating triggers that can audit these changes (including writing who and when information, and even the operation and before- and after-images, to a file).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You'll need the UniVerse SQL Reference manual (downloadable from Rocket Software or from ADBK in Sweden).
There's a utility for converting a hashed file to a UniVerse table - called CONVERT.SQL - it ends up executing a CREATE EXISTING TABLE statement, which basically builds all the requisite system table entries. See also this post.
To create triggers the command is CREATE TRIGGER. And before you can use that you will need to create a DataStage/UniVerse BASIC trigger routine. All of the required information is in the UniVerse/SQL Reference Guide.
There's a utility for converting a hashed file to a UniVerse table - called CONVERT.SQL - it ends up executing a CREATE EXISTING TABLE statement, which basically builds all the requisite system table entries. See also this post.
To create triggers the command is CREATE TRIGGER. And before you can use that you will need to create a DataStage/UniVerse BASIC trigger routine. All of the required information is in the UniVerse/SQL Reference Guide.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.