java學習

          java學習

           

          oracle interval分區

          create table SAP_E_DSOQQZT_TMP
          (
            id          NUMBER not null,
            request     NUMBER,
          )
          tablespace USERS
            pctfree 10
            initrans 1
            maxtrans 255
            storage
            (
              initial 16K
              next 8K
              minextents 1
              maxextents unlimited
            )
            partition by range(request) interval(1000000) 
          (
          partition SAP_E_DSOQQZT_part values less than(700000000)
          );
          -- Add comments to the columns 
          comment on column SAP_E_DSOQQZT_TMP.id
            is 'ID';
          comment on column SAP_E_DSOQQZT_TMP.request
            is '請求號';
          -- Create/Recreate indexes 
          create index FCREATETIMEA on SAP_E_DSOQQZT_TMP ( REQUEST)
            tablespace ZHFXBEMS
            pctfree 10
            initrans 2
            maxtrans 255
            storage
            (
              initial 1847M
              next 1M
              minextents 1
              maxextents unlimited
            );
          -- Create/Recreate primary, unique and foreign key constraints 
          alter table SAP_E_DSOQQZT_TMP
            add constraint PK_SAP_E_DSOQQZTA primary key (ID)
            using index 
            tablespace USERS
            pctfree 10
            initrans 2
            maxtrans 255
            storage
            (
              initial 112M
              next 1M
              minextents 1
              maxextents unlimited
            );
          第二步:判斷表是否可以在線從新定義
          begin
           dbms_redefinition.can_redef_table('ERPSU','SAP_E_DSOQQZT',DBMS_REDEFINITION.CONS_USE_PK);
           end;
          第三步:開始執行數據的遷移(30分鐘)
          begin
           DBMS_REDEFINITION.START_REDEF_TABLE('ERPSU','SAP_E_DSOQQZT', 'SAP_E_DSOQQZT_TMP');
          end;
          第四步:進行權限對象的遷移
           DECLARE
          num_errors PLS_INTEGER;
          BEGIN
          DBMS_REDEFINITION.COPY_TABLE_DEPENDENTS('ERPSU','SAP_E_DSOQQZT', 'SAP_E_DSOQQZT_TMP',
          DBMS_REDEFINITION.CONS_ORIG_PARAMS, TRUE, TRUE, TRUE, TRUE, num_errors);
          END;
          第五步:結束整個重定義
          BEGIN
          DBMS_REDEFINITION.FINISH_REDEF_TABLE('ERPSU','SAP_E_DSOQQZT', 'SAP_E_DSOQQZT_TMP');
          END;
          第六步,刪除臨時表  SAP_E_DSOQQZT_TMP
          萬一哪一步出錯,執行:
          BEGIN
          DBMS_REDEFINITION.ABORT_REDEF_TABLE(uname => 'ERPSU',
          orig_table => 'SAP_E_DSOQQZT',
          int_table => 'SAP_E_DSOQQZT_TMP'
          );
          END;
          -----------------------------------------------------------------------------

          posted on 2020-04-16 17:11 楊軍威 閱讀(138) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           

          導航

          統計

          常用鏈接

          留言簿

          隨筆檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 开封市| 威远县| 溆浦县| 徐水县| 乃东县| 珲春市| 门源| 莒南县| 沧源| 鹤岗市| 沐川县| 岗巴县| 时尚| 绩溪县| 临海市| 远安县| 准格尔旗| 昌图县| 铜山县| 吉安市| 新宁县| 木兰县| 内丘县| 金昌市| 巴青县| 乐昌市| 庆元县| 深水埗区| 长顺县| 隆子县| 铁岭县| 甘谷县| 奉化市| 麟游县| 和平区| 栖霞市| 荔波县| 道真| 出国| 丰镇市| 林甸县|