sql - 每天插入和更新 400 万条记录
问题描述
审计目的,我想在一张表中插入100万条记录
并再次将 100 万条记录放入另一个表中。
并更新事务表(生产数据库)中的 100 万条记录,并再次更新
更新另一个事务表(生产数据库)中的 100 万条记录。
所以超过所有40M记录。等待资源时检测到错误 ORA-00060 死锁。
实际上我不能在交易之间做出承诺。成功完成任务后,我必须提交事务。例如,如果我为每个插入保持提交,任何错误都会发生我无法回滚。
我是甲骨文的新手。好心劝告。
提前致谢
流动
插入 1M
插入 1M
更新 1M
更新 1M
犯罪;
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;
解决方案
在每次操作后提交。
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;
推荐阅读
- discord - 如何使不仅一个用户能够使用包含@tasks.loop discord.py 的命令
- android - Oculus SDK / Android NDK 链接错误 1 - “您的意思是”与使用的符号相同
- python - Plotly express - 使用下拉菜单绘制直方图不同列的代码
- html - 将 CSV 文件显示为表格 - Angular/TS
- php - 将 WordPress 从本地 docker 迁移到托管服务提供商
- python - 主列表也使用复制的列表进行更新
- amazon-web-services - 如何在 Spark Scala Shell 中获取 S3 存储桶的子目录列表?
- reactjs - 升级到 react router v5.2.0 时出现问题:props.history.listen 不是函数
- publish-subscribe - 气流 pubsubpull 运算符未按预期工作
- python - 将小部件添加到标签会使其他所有小部件消失