当前位置: 代码迷 >> DB2 >> DB2导出然后导入后-数据少了-为啥解决方案
  详细解决方案

DB2导出然后导入后-数据少了-为啥解决方案

热度:7204   发布时间:2013-02-26 00:00:00.0
DB2导出然后导入后-数据少了-为啥
大家好,在这里向你们请教一个问题。

有一个A表,里面有140W的数据,现在对部分 ‘过期’ 数据要做备份,我将它分成两部分导出,一部分是过期的(old),一部分是要继续留下的(new)
因为考虑到方便,在清表后,将"一部分是要继续留下的(new)"数据重新Load进表里。
首先: 
<code>
export to td_fm_unites_20110531_olddata.txt of del select * from tbl where time<'20110531';
export to td_fm_unites_20110531_newdata.txt of del select * from tbl where time>'20110531';
</code>
Export完成后,
<code>
[db2inst1@itcc db2databak]$ wc -l td_fm_unites_20110531_newdata.txt
939817 td_fm_unites_20110531_newdata.txt
[db2inst1@itcc db2databak]$ wc -l td_fm_unites_20110531_olddata.txt
457457 td_fm_unites_20110531_olddata.txt
</code> 
然后, 我创建一个空文件 del.del
<code>
load from del.del of del 
insert into tbl;
<code>
将 tbl表里面的数据清空。

此时,将td_fm_unites_20110531_newdata的数据Load到表里

load from td_fm_unites_20110531_newdata.txt of del 
insert into tbl;

但是Load后,发现数据少了很多。


db2 => load from td_fm_unites_20110531_newdata.txt of del 
db2 (cont.) => insert into td_fm_unites;
load from td_fm_unites_20110531_newdata.txt of del insert into td_fm_unites
SQL3501W The table space(s) in which the table resides will not be placed in 
backup pending state since forward recovery is disabled for the database.

SQL3109N The utility is beginning to load data from file 
"/home/db2inst1/db2databak/td_fm_unites_20110531_newdata.txt".

SQL3500W The utility is beginning the "LOAD" phase at time "2012-05-31 
15:39:30.315169".

SQL3519W Begin Load Consistency Point. Input record count = "0".

SQL3520W Load Consistency Point was successful.

SQL3125W The character data in row "F2-25908" and column "1" was truncated 
because the data is longer than the target database column.

SQL3119W The field value in row "F2-25909" and column "4" cannot be converted 
to an INTEGER value. A null was loaded.

SQL3119W The field value in row "F2-25909" and column "5" cannot be converted 
to an INTEGER value. A null was loaded.

SQL0180N The syntax of the string representation of a datetime value is 
incorrect. SQLSTATE=22007

SQL3185W The previous error occurred while processing data from row 
"F2-25909" of the input file.

SQL3125W The character data in row "F1-26018" and column "1" was truncated 
because the data is longer than the target database column.

SQL3119W The field value in row "F1-26019" and column "4" cannot be converted 
to an INTEGER value. A null was loaded.

SQL3119W The field value in row "F1-26019" and column "5" cannot be converted 
to an INTEGER value. A null was loaded.

SQL0180N The syntax of the string representation of a datetime value is 
incorrect. SQLSTATE=22007

SQL3185W The previous error occurred while processing data from row 
"F1-26019" of the input file.

SQL3125W The character data in row "F2-26003" and column "1" was truncated 
because the data is longer than the target database column.

SQL3125W The character data in row "F1-26058" and column "1" was truncated 
because the data is longer than the target database column.

SQL3119W The field value in row "F1-26059" and column "4" cannot be converted 
to an INTEGER value. A null was loaded.

SQL3119W The field value in row "F1-26059" and column "5" cannot be converted 
to an INTEGER value. A null was loaded.

SQL0180N The syntax of the string representation of a datetime value is 
  相关解决方案