Sequence PK generation is messed up after table import
474742Aug 31 2006 — edited Aug 31 2006Thought I'd post this here where the possibility of direct object manipulation is what it needed.
Recently created new 10.2.0.1.0 database on new machine as a copy of one running on another machine. Installed Apex 2.2 and used the data import feature within to transport tables from the one machine to the new one. All tables were imported exactly as they were in the original DB. Primary Keys and column types are set exactly the same as the orig along with exact same AUTOID_PK column definition. New sequence was created and associated with correct PK column as in orig. Data import was all successful.
Then imported the associated Apex Application from orig DB, exported as 2.2 into new 2.2 Apex.
Problem occurs now when attempting to add new records, getting a PK violation apparently due to duplicate keys being created at insertion time from the PK's associated sequence.
I've done this same procedure in the past and not had this problem.
Using SQL Developer to look at the associated PK index I see that the index sees 205 distinct keys, 205 rows, and a sample size of 205.
++++ Does the problem stem from the next sequence value being generated is 206 ???? +++
I'm not a pro with the functionality of Oracle as you may be able to tell.
The duplicate AUTOID value may come from the fact that although there are only 205 records and 205 distinct different AUTOID values, the values themselves do not run from 1 to 205 since there have been many deletions and additions. The highest value in the AUTOID field is 376, and I would assume the sequence needs to start generating the next value from 377 forward so as not to cause this PK violation.
That is just a deduction rather than possible fact, can anyone help with identifying the problem if I'm wrong, and can I get some help correcting this so I can continue on from where I left off?
This is a problem in 2 tables at the moment, shouldn't be any more.
Thanks to anyone who can help.
Jacob