I'm copying data from one database to another. But, before I do this, I need to copy the sequence information. My question is: What internal system table contains this information so I can copy to the other database to avoid integrity constraint problems??
You should not mess with sys tables, just copy the hole table with the sequence and then create a sequence in the new db starting with the max(sequence_num) from the table.
DBA_SEQUENCES will give you the max value, but I agree with Highlander. Why mess with that when you have the data? Just query the column which stores the sequence values, and start with that number + whatever increment you intend to use.
I would agree with SantoshYN. Since you are copying one database to another the safest way would be to export the source database and import the target database. that way you ensure all the system tables are also copied.
But if it s specifically only data from some tables then you would need to export only those tables from the source database and recreate the sequence in the target database with the max +1 sequence value in the target database as suggested by highlander.
Bookmarks