我有一个表,,数据量为500万数据。现在运行下面四个命令,需要半个小时,,大概有什么办法,帮我优化一下不?因为整个更新脚本还有很多,时间加起来太长了。
alter table ACCT_BILL add MN_AMOUNT NUMBER(10,2) default 0 not null;
alter table ACCT_BILL add GIVEN_AMOUNT NUMBER(10,2) default 0 not null;
alter table ACCT_BILL add BALANCE NUMBER(10,2) default 0 not null;
alter table ACCT_BILL add CASH NUMBER(10,2) default 0 not null;求教!!求教!!!!在线等!

解决方案 »

  1.   

    -- 如果当前表没有什么联线的操作的话,分步走试试:alter table ACCT_BILL add MN_AMOUNT NUMBER(10,2);
    alter table ACCT_BILL add GIVEN_AMOUNT NUMBER(10,2);
    alter table ACCT_BILL add BALANCE NUMBER(10,2);
    alter table ACCT_BILL add CASH NUMBER(10,2);update  ACCT_BILL set MN_AMOUNT=0, GIVEN_AMOUNT=0, BALANCE=0, CASH=0;
    commit;alter table ACCT_BILL modify MN_AMOUNT default 0 not null;
    alter table ACCT_BILL modify GIVEN_AMOUNT default 0 not null;
    alter table ACCT_BILL modify BALANCE default 0 not null;
    alter table ACCT_BILLmodify  CASH default 0 not null;