db2创建nickname

参考:https://copyfuture.com/blogs-details/20201231224307473y

https://blog.csdn.net/u013914485/article/details/38265129?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_baidulandingword~default-1-38265129-blog-122701582.pc_relevant_3mothn_strategy_recovery&spm=1001.2101.3001.4242.2&utm_relevant_index=4

db:CZYTEST
ip:172.16.43.162
us:db2inst1
ps:db2inst1

db:CZYTEST
ip:172.16.43.187
us:db2inst1
ps:db2inst1

1、187服务器操作:

1、创建CZYTEST
db2 create db CZYTEST

2、162服务器操作

(1)前提开启联邦支持

db2 update dbm cfg using federated yes
重启db2
db2stop
db2start

(2)创建nickname

db2 connect to sample user db2inst1 using db2inst1

1、创建node
db2 catalog tcpip node nodedc remote 172.16.43.187 server 50000 REMOTE_INSTANCE CZYTEST
db2 terminate

#删除node
db2 uncatalog node

2、创建数据库 别名
db2 catalog database CZYTEST at node nodedc
db2 terminate

#删除db
db2 uncatalog db


db2 connect to  CZYTEST user db2inst1 using db2inst1

3、创建wrapper
db2 create wrapper DRDA

4、创建连接到对方数据库的server
db2 "create Server dbsrv type DB2/UDB version 11.5 wrapper "DRDA" authid "db2inst1" password "db2inst1" options (NODE 'nodedc',dbname 'CZYTEST')"

#删除server
db2  DROP SERVER dbsrv

5、用户mapping的创建-用户对用户
db2  "create user mapping for "db2inst1" server dbsrv options (remote_authid 'db2inst1' , remote_password 'db2inst1')"

#删除mapping
db2 drop User Mapping for db2inst1 server dbsrv

6、创建连接到对方表的nickname
db2  "create nickname CZYTEST.NEWTABLE_V for dbsrv.CZYTEST.NEWTABLE"

 

posted @ 2022-11-18 17:59  灰蓝色的白云梦想  阅读(279)  评论(0编辑  收藏  举报