首页 > 学技术 > 技术网文 > DB2 > 正文

[保留] 请教db2数据库中数据导入导出的具体步骤!


来源 chinaunix.net 酷勤网整理

我现在的做法:
1.windows 下
db2look -d reportdb -e -c -o reportdb.sql
db2 connect to reportdb
db2move reportdb export

这里主要有2个文件,reportdb.sql,是reportdb的数据库结构信息(ddl),其中数据库的模式为administrator
db2move.lst文件,其中内容就是导出数据的信息 如:“!"administrator"."REPORT_MAIN"!tab1.ixf!tab1.msg!”
因为aix上的管理员为db2inst1,所以我将这2个文件中的administrator改为db2inst1

2.进入AIX系统
create db reportdb
将windows系统下导出的所以文件ftp到aix机器上。
db2 connect to reportdb
db2 -tvf reportdb.sql
(我现在在这里就发生了问题,导入文件是可以的,显示为:DB21007E  读取该命令时已到达文件末尾。
可是在reportdb数据库中却一个表也查不到)
db2 reportdb load 

以后还有一个代码页的问题。
请问大家我该怎么做阿?我做的步骤中有什么错误呢?



 mymm 回复于:2003-12-16 10:28:35

你上传的文件有DOS换行符!
上传后执行一下:
sed -e 's/^M//g' reportdb.sql >; reportdb.ddl
再执行:
db2 -stvf reportdb.ddl

也可以vi去掉!
注意^M是[color=red]ctrl v + ctrl M[/color] !!!


 g_hellohell 回复于:2003-12-16 10:37:48

呵呵,谢谢谢谢,老大真是厉害!!


 g_hellohell 回复于:2003-12-16 10:40:38

那代码页转换那里,改如何做呢?
我aix上的数据库的代码页是819,而windows的代码页为1386


 g_hellohell 回复于:2003-12-16 11:10:01

db2 reportdb load modified by codepage=1386

是这样写么?


 mymm 回复于:2003-12-16 11:41:52

在建库时就应确定!
db2 "create database NAME using codeset XXXX ...................."

回家了!


 g_hellohell 回复于:2003-12-18 18:22:27

请问具体该如何写呢?
create db reportdb using codeset 1386 territory ??
我写cn,zh,都说我无效


 Law 回复于:2003-12-22 14:44:41

你可以查看db2的帮助,里面又说各个系统的代码页的号码


 javacool 回复于:2003-12-27 13:00:39

up


 3000sunqin 回复于:2003-12-27 15:29:23

在aix上,db2set db2codepage=1386
db2set db2country=86
重起一下实例就可以创建代码页缺省为1386的数据库了
db2 create db dbname .




原文链接:http://bbs.chinaunix.net/viewthread.php?tid=223473
转载请注明作者名及原文出处



收藏本页到: