java.sql.SQLSyntaxErrorException: ORA-02289:序列不存在

今天在迁oracle移数据库到另一个机子时出现这个错误,之前也迁移过一次序列都导出了,可这次没有导出,网上搜了些资料发现可以用下面的方法单独到处序列,在Oracle的sql窗口中输入以下语句:

SELECT ' CREATE SEQUENCE '||SEQUENCE_NAME|| ' INCREMENT BY '|| 

        INCREMENT_BY ||' START WITH '||LAST_NUMBER||' MAXVALUE '|| 
        MAX_VALUE  ||'   CACHE '||CACHE_SIZE||' ORDER NOCYCLE ;'

FROM user_SEQUENCES;

执行后出现以下语句:(从表格中复制出的)

   CREATE SEQUENCE SEQ_TBL_JDC INCREMENT BY 1 START WITH 21 MAXVALUE 99999999   CACHE 20 ORDER NOCYCLE ;
   CREATE SEQUENCE SEQ_TBL_JS INCREMENT BY 1 START WITH 101 MAXVALUE 10000000   CACHE 20 ORDER NOCYCLE ;
   CREATE SEQUENCE SEQ_TBL_JS_MK INCREMENT BY 1 START WITH 161 MAXVALUE 10000000   CACHE 20 ORDER NOCYCLE ;
   CREATE SEQUENCE SEQ_TBL_WXYH_QY INCREMENT BY 1 START WITH 401 MAXVALUE 99999999   CACHE 20 ORDER NOCYCLE ;
   CREATE SEQUENCE SEQ_TBL_XFXX INCREMENT BY 1 START WITH 301 MAXVALUE 99999999   CACHE 20 ORDER NOCYCLE ;
   CREATE SEQUENCE SEQ_TBL_YGZWXYH INCREMENT BY 1 START WITH 481 MAXVALUE 99999999   CACHE 20 ORDER NOCYCLE ;
   CREATE SEQUENCE SEQ_TBL_YHXX INCREMENT BY 1 START WITH 261 MAXVALUE 10000000   CACHE 20 ORDER NOCYCLE ;
   CREATE SEQUENCE SEQ_TBL_YH_JS INCREMENT BY 1 START WITH 261 MAXVALUE 10000000   CACHE 20 ORDER NOCYCLE ;
   CREATE SEQUENCE SEQ_WCTTBLPZLB INCREMENT BY 1 START WITH 15 MAXVALUE 99999999   CACHE 10 ORDER NOCYCLE ;
   CREATE SEQUENCE SEQ_WCTTBLSWSXX INCREMENT BY 1 START WITH 186 MAXVALUE 99999999   CACHE 10 ORDER NOCYCLE ;
   CREATE SEQUENCE WCTTBLGFBMXX_SEQ INCREMENT BY 1 START WITH 441 MAXVALUE 9999999999999999999999999999   CACHE 20 ORDER NOCYCLE ;
   CREATE SEQUENCE WCTTBLSPBM_SEQ INCREMENT BY 1 START WITH 981 MAXVALUE 9999999999999999999999999999   CACHE 20 ORDER NOCYCLE ;
   CREATE SEQUENCE WCTTBLZZSFPMX_SEQ INCREMENT BY 1 START WITH 1621 MAXVALUE 9999999999999999999999999999   CACHE 20 ORDER NOCYCLE ;
  CREATE SEQUENCE WCTTBLZZSFPZB_SEQ INCREMENT BY 1 START WITH 981 MAXVALUE 9999999999999999999999999999   CACHE 20 ORDER NOCYCLE ;

然后在新机子上复制运行即可。

你可能感兴趣的:(oracle)