从 DB2 客户机编目 TCP/IP 节点

在已经安装DB2客户端的机器上添加server编目:
语法
db2 => catalog tcpip node node_name remote hostname|ip_address
  server service_name|port_number [remote_instance instance_name]
  [system system_name] [ostype  os_type]


然后添加上面的database:
CATALOG DATABASE database-name [AS alias] [ON path | AT NODE node-name]
[AUTHENTICATION {SERVER | CLIENT | DCS | DCE SERVER PRINCIPAL principalname
| KERBEROS TARGET PRINCIPAL principalname | SERVER_ENCRYPT | DCS_ENCRYPT
| DATA_ENCRYPT | GSSPLUGIN}] [WITH "comment-string"]


测试:
--catalog node
[db2inst@rhel5 sqllib]$ db2 "catalog tcpip node tower06 remote 172.21.21.21 server 50000"

--catalog database,后来补充
[db2inst2@server1 ~]$ db2 catalog db sample at node LOCAL1
DB20000I  The CATALOG DATABASE command completed successfully.
DB21056W  Directory changes may not be effective until the directory cache is 
refreshed.


注意使用username:
[db2inst@rhel5 sqllib]$ db2 connect to bitest user etl 
Enter current password for etl: 
   Database Connection Information

 Database server        = DB2/AIX64 8.2.3
 SQL authorization ID   = ETL  ----------已经变更
 Local database alias   = BITEST


其实在服务器端还需要做如下设置:
--检查/etc/services
[root@server1 ~]# cat /etc/services |grep -i db2
ibm-db2         523/tcp                         # IBM-DB2
ibm-db2         523/udp                         # IBM-DB2
questdb2-lnchr  5677/tcp                        # Quest Central DB2 Launchr
questdb2-lnchr  5677/udp                        # Quest Central DB2 Launchr
db2inst1        50000/tcp
db2c_db2inst2   50001/tcp #DB2 connection service port 
db2inst3        50003/tcp

--检查DB2COMM
[db2inst1@server1 ~]$ db2set -all
[i] DB2PROCESSORS=0,1
[i] DB2COMM=TCPIP,NETBIOS
[i] DB2AUTOSTART=YES
[g] DB2SYSTEM=localhost.localdomain
[g] DB2INSTDEF=db2inst1
[g] DB2ADMINSERVER=db2das1

--检查SVCENAME
[db2inst1@server1 ~]$ db2 get dbm cfg |grep -i svc
 TCP/IP Service name                          (SVCENAME) = 50000

这样,客户端才可以连上

你可能感兴趣的:(sql,SQL Server,IBM,OS,db2)