免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 6796 | 回复: 6
打印 上一主题 下一主题

怎样Import时候不记录日志 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-11-30 09:19 |只看该作者 |倒序浏览
需要向一个表中Import几百万条记录,按照以前论坛上说得的方法,
alter table ab activate not logged initially
import from ..... insert into ....
但是依然报事务日志已满的错误,好像依然记录日志。请问各位如何解决?
不想在import时候用commitcount参数

论坛徽章:
0
2 [报告]
发表于 2007-11-30 10:58 |只看该作者
你对这个理解有误,下面的内容是从inforcenter里面节选出来的。
ACTIVATE NOT LOGGED INITIALLY

1. 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. 特别注意,in the same unit of work。

2. Any changes made to the system catalog by the ALTER statement in which the NOT LOGGED INITIALLY attribute is activated are logged.

3. Any subsequent changes made in the same unit of work to the system catalog information are logged.

4. At the completion of the current unit of work, the NOT LOGGED INITIALLY attribute is deactivated and all operations that are done on the table in subsequent units of work are logged.  特别注意这一点,结合第一点,就是你依然碰到日志满的原因了。

论坛徽章:
0
3 [报告]
发表于 2007-11-30 15:02 |只看该作者
问一下: in the same unit of work 是啥意思?

论坛徽章:
0
4 [报告]
发表于 2007-12-02 12:18 |只看该作者
下面是官方准确的解释。
http://publib.boulder.ibm.com/in ... oc/doc/c0005018.htm


Units of work

A transaction is commonly referred to in DB2 Database for Linux, UNIX, and Windows as a unit of work. A unit of work is a recoverable sequence of operations within an application process. It is used by the database manager to ensure that a database is in a consistent state. Any reading from or writing to the database is done within a unit of work.

For example, a bank transaction might involve the transfer of funds from a savings account to a checking account. After the application subtracts an amount from the savings account, the two accounts are inconsistent, and remain so until the amount is added to the checking account. When both steps are completed, a point of consistency is reached. The changes can be committed and made available to other applications.

A unit of work is started implicitly when the first SQL statement is issued against the database. All subsequent reads and writes by the same application are considered part of the same unit of work. The application must end the unit of work by issuing either a COMMIT or a ROLLBACK statement. The COMMIT statement makes permanent all changes made within a unit of work. The ROLLBACK statement removes these changes from the database. If the application ends normally without either of these statements being explicitly issued, the unit of work is automatically committed. If it ends abnormally in the middle of a unit of work, the unit of work is automatically rolled back. Once issued, a COMMIT or a ROLLBACK cannot be stopped. With some multi-threaded applications, or some operating systems (such as Windows(R)), if the application ends normally without either of these statements being explicitly issued, the unit of work is automatically rolled back. It is recommended that your applications always explicitly commit or roll back complete units of work. If part of a unit of work does not complete successfully, the updates are rolled back, leaving the participating tables as they were before the transaction began. This ensures that requests are neither lost nor duplicated.

There is no physical representation of a unit of work because it is a series of instructions (SQL statements).

[ 本帖最后由 huyuhui001 于 2007-12-2 12:19 编辑 ]

论坛徽章:
0
5 [报告]
发表于 2007-12-02 19:33 |只看该作者
LOAD 是不写日志的

论坛徽章:
0
6 [报告]
发表于 2007-12-03 15:58 |只看该作者

执行的时候使用+c

把你的那两条语句放一个脚本里面,执行时用db2 +c -tvf a.db2

论坛徽章:
0
7 [报告]
发表于 2007-12-07 14:40 |只看该作者
用load吧。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP