Few days back, I had seen some magical behavior of oracle sequences.
We got a complaint from users about missing on some data. When we check database and SQLs, logically it must have traveled in data files. After analyzing the data download plug-ins, file status screen we found that, 17 files have the same name around time frame of 1658Hrs to 1735Hrs.
We are using the Oracle Sequence Number to allocate the file name uniquely, and then also why file names are duplicate?? What's wrong there??
-- After 1636hrs oracle started allocating the sequence number with lesser value than the current one and continued till 1740Hrs.
-- The file allocation logic was looking for max file ID value.
-- Which coming out to be same for this entire time frame; as new file ID has lesser value than the old file ID.
How this happened ??
In an Oracle RAC cluster, the sequence numbers returned were not in order...
The reason is that by default sequences in 10g\11g RAC are created without ordering. This is to reduce performance bottleneck as there would be synchronization required across all nodes of the cluster. Each node creates a cache of the sequence as specified in the SQL.
If we need to maintain the order then we need to add the ORDER argument to the sequence.
Example of Sequence Syntax in Oracle RAC:
If we need to maintain the order then we need to add the ORDER argument to the sequence.
Example of Sequence Syntax in Oracle RAC:
CREATE SEQUENCE TRNXECTRLMSTSEQ
MINVALUE 1
MAXVALUE 999999999999999999999999999
INCREMENT BY 1
START WITH 1
CACHE 20
ORDER NOCYCLE;
Comments
Post a Comment