怎样同步Oracle sequences 不同服务器,高手给个解决方案。

解决方案 »

  1.   

    在服务器A 建立SEQUENCE, 服务器B的通过 DB LINK方式访问服务器A的SEQUENCE,自然就是同步的.
      

  2.   

    不想用DBLink去访问,就是因为怕源服务器坏掉,才定期同步的。
      

  3.   


    alter sequence SEQ_ASEQ increment by 53127 nocache;
    select SEQ_ASEQ.nextval from dual;
    alter sequence SEQ_ASEQ increment by 1 nocache;
    declare
      LastValue integer;
    begin
      loop
        select SEQ_ASEQ.currval into LastValue from dual;
        exit when LastValue >= 59030 - 1;
        select SEQ_ASEQ.nextval into LastValue from dual;
      end loop;
    end;
    /
    alter sequence SEQ_ASEQ increment by 1 cache 20;
      

  4.   

    如果可以的话,控制两个服务器上的sequences一个为单数,一个为双数
    即sequences的步长为2
      

  5.   

    alter sequence SEQ_ASEQ increment by 53127 nocache;
    select SEQ_ASEQ.nextval from dual;
    alter sequence SEQ_ASEQ increment by 1 nocache;
    declare
      LastValue integer;
    begin
      loop
        select SEQ_ASEQ.currval into LastValue from dual;
        exit when LastValue >= 59030 - 1;
        select SEQ_ASEQ.nextval into LastValue from dual;
      end loop;
    end;
    /
    alter sequence SEQ_ASEQ increment by 1 cache 20;
      请问怎么修改SEUQUENCES 下一个值.
      

  6.   

    我想用存储过程里改变某个SEQUENCES 的值,怎问怎么写:
    我运行上面朋友给写的
    begin 
      loop 
        select SEQ_ASEQ.currval into LastValue from dual; 
        exit when LastValue >= 59030 - 1; 
        select SEQ_ASEQ.nextval into LastValue from dual; 
      end loop; 
    end; 
    出错了,提示未SEQ_ASEQ.currval 尚未在此会议中定义.
      

  7.   

    在一个会话中,要获取seq的currval值的话,必须先执行nextval
    这就是为什么8楼在alter之前执行了
    select SEQ_ASEQ.nextval from dual;