![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Is this expected behavior? Why isn't the identity value stored in a table (like systable) so that it can be retrieved after an unload/reload or truncate? |
#3
| |||
| |||
|
|
Andy, Is this expected behavior? Why isn't the identity value stored in a table (like systable) so that it can be retrieved after an unload/reload or truncate? I would think that this value is saved in a system table. But system tables are not directly part of the reload process. Instead, they are rebuilt indirectly by the creation of the "standard" tables. As rebuilding is many times used to kind of clean up a database, I would imagine this is intended behaviour. You did not write why you delete all data before the reload, and for what purpose you do the reload at all. So I ma not sure what would be the best solution for your case. But the way you describe would be one possible solution: Just use something like delete from test where col1 < (select max(col1) from test) instead of a pure delete. You could then even delete this value after the reload in the new database without losing the information of the next autoincrement value. Frank |
#4
| |||
| |||
|
|
Hello, We're using ASA 9.0.2.3557. We have 2300 remote databases synchronizing to an Oracle consolidated. If a table with an autoincrement column is purged prior to doing a full rebuild of the database, the identity value resets to 0. Had we not done an unload/reload, it would have continued from where it left off. The following steps reproduce the problem. dbinit -n d:\test.db create table test(col1 integer default autoincrement, col2 integer); insert into test (col2) values (1); insert into test (col2) values (1); insert into test (col2) values (1); insert into test (col2) values (1); commit; delete from test; commit; dbunload -c uid=dba;pwd=sql;dbf=d:\test.db -r d:\reload.sql d:\ del /f d:\test.db dbinit -n d:\test.db read d:\reload.sql insert into test (col2) values (1); commit; Following these steps, you would find that the "test" table now contains one record (1,1) instead of (5,1). However, if instead of deleting all records, you do a "delete from test where col1 < 4;" The new table will continue to autoincrement at 5 as expected. It seems during reload.sql that it somehow resets the identity to the largest value in the table instead of persisting the autoincrement value through the unload. This is a problem in our environment because we synchronize using Mobilink. We have a table with updates and inserts synchronized up. There is a purge on the remote to remove anything over 90 days which, in this case, removed all records. The database had a problem requiring an unload/reload. Since the autoincrement restarted at 1, we now get a primary key violation when we try to synchronize that table. Is this expected behavior? Why isn't the identity value stored in a table (like systable) so that it can be retrieved after an unload/reload or truncate? Thanks, Andy |
![]() |
| Thread Tools | |
| Display Modes | |
| |