db2dart,/DDEL导出某个schema下的表数据.


db2dart sample /ddel


Table object data formatting start.
Please enter
Table ID or name, tablespace ID, first page, num of pages:
SYSTABLES,0,0,999999

The output data file is TS0T5.DEL.


DBNAME=sample
SCHEMA=E97Q7A
RPTDIR=/tmp/db2dart

sed ‘s/"//g‘ TS0T5.DEL|while read line
do
echo $line|awk -F"," ‘{
objtype=substr($3,1,1)
gsub(" ","",$2)
dbschema=$2
if(objtype=="T" && dbschema=="‘$SCHEMA‘" )
{
tablename=$1
tableid=$7
tbspaceid=$8
printf("%s,%s,0,9999999\ny\n%s\n",tableid,tbspaceid,tablename)
}
}‘>inputfile
if [ -s inputfile ]
then
db2dart $DBNAME /DDEL /RPT $RPTDIR < inputfile
fi
done


The /DDEL parameter supports only the following column data types. If a table contains columns with any other data type, the column is skipped and not included in the delimited ASCII file.

    SMALLINT
    FLOAT
    REAL
    INTEGER
    TIME
    DECIMAL
    CHAR()
    VARCHAR()
    DATE
    TIMESTAMP
    BIGINT

If a column of type CHAR and VARCHAR contains any binary data, or is defined with FOR BIT DATA, the /DDEL parameter generates the DEL file which contains the binary data. When you load data from the DEL file to the table using the LOAD command, ensure that you always specify the modified by delprioritychar option. When you insert data into the table from the DEL file using the IMPORT command, make sure that you always specify the modified by delprioritychar codepage=x option where x is the code page of the data in the input data set.

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。