以前看过一篇文章,文章内容是说我们为应对日常工作中的种种情况需要学习掌握的技术,利用技术可以让我们具有快速搞定事情的能力。
场景
由生产库导出N万左右表数据,数据存储格式为标准SQL语句,我们需要将这些数据插入到测试库。为防止事务回滚段过大对数据库这边造成太大压力,所以需要每5000~10000加个COMMIT。
操作脚本
var tmpRow = 5000;
var stepRow = 5000;
while (!UltraEdit.activeDocument.isEof()) {
UltraEdit.activeDocument.gotoLine(tmpRow,0);
UltraEdit.activeDocument.findReplace.replace(";^p",";COMMIT;^p");
tmpRow += stepRow;
}
UltraEdit.activeDocument.findReplace.replace(";",";COMMIT;");
具体UltraEdit脚本配置可参见自带的操作手册。