标签:flush 写日志 with bec point param rop file mit
2018.11.19
客户遇到一个问题,在import数据的时候,产生了大量的日志,客户的数据库是HADR模式,通过评估,这几张表是可以允许在备库上不查询的,表中的数据时临时的。
方案一:修改脚本,将import修改为load |
方案二:修改脚本,不修改导入数据的方式,临时激活表的not logged initially特性,事务级别 |
方案三:将相关的表重建,创建表,并激活not logged initially,该方案表将永久修改为not logged initially |
三种方案结果都是一样的,由于不写日志,均会导致备库表无法查询,报错SQL1477N
现在存在一个疑问,假如使用方案二,同时 import 时使用 commitcount,会不会存在问题呢 ? 针对该问题,得到下面结论
alter table t activate not logged initially; import from t.del of del commitcount 10 insert into t;
通过验证 commitcount 10 会导致 activate not logged initially 失效。
所以将 commitcount 10 取消掉,这个参数对于该场景,意义不大,由于表不写日志,一旦事务失败均会导致表不可访问。
编辑m.sql文件 connect to sample; alter table t activate not logged initially; import from t.del of del insert into t; commit; db2 +c -tvf m.sql
中英文
https://www.ibm.com/support/knowledgecenter/zh/SSEPGG_11.1.0/com.ibm.db2.luw.admin.ha.doc/doc/c0006079.html
https://www.ibm.com/support/knowledgecenter/da/SSEPGG_11.1.0/com.ibm.db2.luw.admin.ha.doc/doc/c0006079.html
附录1:
https://www-01.ibm.com/support/docview.wss?uid=swg21215818
How to temporarily turn logging off for heavy change operations, such as insert, delete, update, and changes in indexes?
Tables being modified can be altered to activate the ‘NOT LOGGED INITIALLY‘ attribute, which deactivates logging for the current unit of work. Any changes made to the table by an INSERT, DELETE, UPDATE, CREATE INDEX, DROP INDEX, or ALTER TABLE in the same unit of work after the table is altered by this statement are not logged.
At the completion of the current unit of work, the NOT LOGGED INITIALLY attribute is deactivated for the table and all operations that are done on the table in subsequent units of work are logged.
To use this option properly, the application doing the changes should NOT have AUTOCOMMIT enabled. Having AUTOCOMMIT OFF also helps define the scope of the transactions:
- For CLP, you can turn AUTOCOMMIT OFF using the registry variable DB2OPTIONS:
标签:flush 写日志 with bec point param rop file mit
原文地址:https://www.cnblogs.com/DBA-Ivan/p/9987476.html