Oracle/DB2/Postgresql/Mysql/Hadoop/Greenplum/Postgres-xl/Mongodb
分类: DB2/Informix
2014-09-28 17:17:50
1、源数据库MQS_G1查询日标数据库MQS_G2的用户为mqs_g2用户下面的表
db2 =>db2 connect to mqs user mqs_g1 using mqs_g1
db2 =>update dbm cfg using Federated YES //修改数据库,打开可以做为联合数据库的功能
db2 =>db2stop force //修改后,必须重启db2才可以
db2 =>db2start
db2 =>db2 connect to mqs user mqs_g1 using mqs_g1
db2 =>create wrapper drda //创建包装器
db2 =>create server MQS_G2 type db2/udb version'9' wrapper "DRDA" authid "mqs_g1" password "mqs_g1"
options (add dbname 'mqs_g2') //创建服务
db2=> create user mapping for "mqs_g1" server "MQS_G2" options (add remote_authid 'mqs_g1',add
remote_password 'mqs_g1') //创建用户映射 并且服务名MQS_G2必须大写
db2 =>create nickname g2 for mqs_g2.mqs_g2.GDPCAR //给某个表在本地数据库创建别名
db2=>create nickname g2t for mqs_g2.mqs_g2.DITEMMTemp1
db2 => select count(*) from g2t //查看执行结果。
注意,mqs_g2数据库必须存在msq_g1用户。