---
title: "db2数据导入导出时用到的一些命令 清空表命令"
author: "黑色幽默"
date: "2009-12-03T10:57:19Z"
tags: []
slug: "db2"
draft: false
lastmod: "2009-12-03T10:57:19Z"
id: 539867
url: "https://yplsoft.iteye.com/blog/539867"
---

1。快速清空表
db2 alter table tabname activate not logged initially with empty table ；
db2 import from /dev/null of del replace into tabname
 
2。在用IMPORT命令向数据库插入大量数据时,如何避免日志空间满错误
在执行IMPORT命令时, 如果使用循环日志, 有时会出现日志满错误, 这时可用COMMITCOUNT参数来解决. 因为日志空间满往往是因为所有的日志均处于活动状态导致的.而COMMIT执行后, 会释放所占据的资源, 其中包括日志 .这样, 被当前事务使用的日志在COMMIT命令执行后, 即变成非活动状态了.

3。export
db2 export to staff.ixf of ixf select * from userid.staff 
 
4。import
db2 import from stafftab.ixf of ixf insert into userid.staff