简体   繁体   中英

Insert and update 4 million records everyday

Auditing purpose, I want to insert 1 million records into one table

and again 1 million record into another table.

and update 1 million record in transaction table(production DB) and also again

update 1 million record in another transaction table(production DB).

so over all 40M records. I am getting error ORA-00060 deadlock detected while waiting for resource.

actually I cant give commit in between the transaction. after completed the task successfully I have to commit the transaction. like example if I keep commit for each insert, any error occurs i cant rollback.

I am new to oracle. Kindly advice.

Thanks in advance

Flow

insert 1M

insert 1M

update 1M

update 1M

commit;

Create or replace procedure prc_tagbalance
As
Begin
  Insert into t1 
  Select custid,mobileno,openingbal,currentvalue
  From mas_walletinfo;
Exception
  -- Error table insert using procedurr with pragma Autonomous transaction
  Return;
End;

Begin
  Insert into t2
    Select vechileid,tid,tbalance from mas_vehicleinfo;
Exception
  --error table insert
  Return;
End;

Begin
  Update mas_walletinfo set openingbal=currentvalue;
Exception
  Return;
End;
Begin
  Update mas_vechileinfo set openingbal=tbalnce:
  Commit;
Exception
  Return;
End:
End;

put commit after each operation.

Create or replace procedure prc_tagbalance
As
Begin
  Insert into t1 
  Select custid,mobileno,openingbal,currentvalue
  From mas_walletinfo;
 Commit;
Exception
  -- Error table insert using procedurr with pragma Autonomous transaction
  Return;
End;

Begin
  Insert into t2
    Select vechileid,tid,tbalance from mas_vehicleinfo;
 Commit;
Exception
  --error table insert
  Return;
End;

Begin
  Update mas_walletinfo set openingbal=currentvalue;
 Commit;
Exception
  Return;
End;
Begin
  Update mas_vechileinfo set openingbal=tbalnce:
  Commit;
Exception
  Return;
End:
End;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM