Re: shared database sequence.

  • From: Nigel Thomas <nigel_cl_thomas@xxxxxxxxx>
  • To: Andrew.Kerber@xxxxxxx, sjaffarhussain@xxxxxxxxx
  • Date: Mon, 26 Feb 2007 17:16:11 +0100 (CET)

Syed wrote:
Is it possible to share a database sequence between multiple databases? Not in 
RAC of course.
We are planning to have two databses exchanging information (replicating) using 
third party solution. But, stuck with the issues of sequences.

Syed

Another approach is to define the sequence separately on each master. If you 
have two masters, define the sequence to use odd numbers on one master, and 
even numbers on the other

on A: CREATE SEQUENCE myseq START WITH 1 INCREMENT BY 2 ;
on B: CREATE SEQUENCE myseq START WITH 2 INCREMENT BY 2 ;

If you may be adding more masters later, give yourself an INCREMENT BY that is 
bigger than the number of masters you are ever likely to have.

The advantages of this scheme include:
you can tell which master originated the object
the online transaction is entirely local (A can operate if B is unavailable, 
and vice versa); this is the clincher to me: if you could always rely on both 
being up and available, you wouldn't need replication in the first place...

Potential disadvantages are minor:
numbers are not globally ordered - latest on A could be far behind latest on B 
which could also leave many gaps in the sequence
HTH

Regards Nigel

Other related posts: