◆1、Win下打开DB2 CLP,连接到AIX上数据库(ZJGL)db2 connect to zjgl user zjgl using zjgl
◆2、用db2look导出建库表的SQL脚本。
db2 db2look -d 数据库 -i 用户 -w 密码 -e -c -o c:zjgllook.sql;不指定路径,默认保存在..SQLLIBin下
更改zjgllook.sql脚本,更改连接数据库名,去掉IN "DMS_DATA" INDEX IN "DMS_IDX" 和IN "DMS_DATA" 内容,把脚本中数据库名两边双引号去掉。
◆3、在Win下DB2建立数据库ZJDEP,采用AIX上ZJGL的脚本保存未zjdep.sql
CREATE DATABASE zjdep
ON 'd:'
ALIAS zjdep
USING CODESET ISO8859-1
TERRITORY US
COLLATE USING Compatibility
NUMSEGS 1
DFT_EXTENT_SZ 32
CATALOG TABLESPACE MANAGED BY SYSTEM
USING
('d:db2NODE0000SQL00001SQLT0000.0'
)
EXTENTSIZE 32
PREFETCHSIZE 32
OVERHEAD 24.10
TRANSFERRATE 0.90
USER TABLESPACE MANAGED BY SYSTEM
USING
('d:db2NODE0000SQL00001SQLT0002.0'
)
EXTENTSIZE 32
PREFETCHSIZE 32
OVERHEAD 24.10
TRANSFERRATE 0.90
TEMPORARY TABLESPACE MANAGED BY SYSTEM
USING
('d:db2NODE0000SQL00001SQLT0001.0'
)
EXTENTSIZE 32
PREFETCHSIZE 32
OVERHEAD 24.10
TRANSFERRATE 0.90;
◆4、在DB2 CLP下
执行:db2 connect to zjdep
而后执行:db2 -tvf d:zjgllook.sql (在批处理中执行DB2的SQL脚本文件)