db2匯入匯出表

2021-09-02 12:18:01 字數 1073 閱讀 1107

一、db2匯入匯出方法很多,在此列舉個比較常用的方法

匯入匯出分兩種一種是帶表結構的,一種為資料的,我們用的基本上是只有資料的

1、在db2中匯入匯出表 

(1) 匯出表結構並且資料是二進位制格式:export to filename.ixf of ixf select * from tablename where condition;

(2) 只匯出表中的資料,而不匯出表結構的語句;

export to filename.del of del select * from taablename where conditon;此語句不匯出表的格式,並且能用

記事本等asc碼編輯工具進行直接編輯。

2、在db2中想表中匯入資料:

(1) 向表中插入帶結構的資料,匯入表結構之前應該刪除該錶,在進行匯入操作:

import from filename.ixf of ixf create into tablename;

import from filename.ixf of ixf insert into tablename;

(2) 向表中匯入不帶結構的資料:

import from filename.del of del insert into tablename;

二、db2匯入匯出blob和clob檔案與上面的語法略有不同:

1.匯入:export to c:\tablename.del of del lobs to c:\ lobfile lobs modified by lobsinfile messages c:\tablename.msg select * from tablename;

2.匯出:import from c:\tablename.del of del lobs from c:\ modified by lobsinfile messages c:\tablename.msg insert into tablename

三、注意事項

在匯入前,為了確保資料正確,先刪除匯入表中的內容,然後再進行匯入操作。簡短幾行**希望對你有所幫助。(以上**在toad執行,在db2cmd下執行需要加db2 或者進入db2=>下執行)

db2 匯入匯出表

一 db2匯入匯出方法很多,在此列舉個比較常用的方法 匯入匯出分兩種一種是帶表結構的,一種為資料的,我們用的基本上是只有資料的 1 在db2中匯入匯出表 1 匯出表結構並且資料是二進位制格式 export to filename.ixf of ixf select from tablename wh...

DB2 匯入匯出

1 匯出資料 開始 執行 db2cmd 進入命令列 執行如下命令 db2look d bxfund2 e c o e data bxfund2.sql 此命令將bxfund2中的表的結構寫入到e盤data檔案下的bxfund2.sql檔案中,即匯出表結構,接著,我們來匯出資料 接著執行連線資料庫命令...

db2表及資料匯出匯入

db2匯出某使用者下資料庫所有表結構 db2look d dbname e z schema name i username w password o db2 create.sql 建立db2表 db2 tvf db2 create.sql export匯出資料 del檔案 1.做檔案export ...