The method of cataloging native database in DB2

Source: Internet
Author: User
Tags db2 connect db2 connect to

Problem: There are two instances on the same node, and there are two ways to access a database in another instance under one of these instances:

1. using Catalog Local node , in one instance, another instance is cataloged directly, in which the communication between them is the IPC ( interprocess communication), this method can only be performed on the same physical machine.

2. using Catalog TCPIP node , one as the client and the other as the server, in this way, the communication between them is TCPIP, This method is not limited to local, but also for remote communication.

Here are two examples to illustrate the process

experiment  db2 10.1.0.0   windows operating system, using catalog local node

1. There are two instances of INST01 and INST02on the machine, with a database under instance INST01 SAMPLE1, the instance INST02 has a database SAMPLE2, after starting two instances, as shown in:


Now , using the Catalog Local node method under instance INST01 to INST02 The instance Catalog in ( Note that all of the following are done under instance INST01 )


The node01 here is equivalent to the INST02 alias, using attach to connect to the node01 After that, the create database command issued is equivalent to INST02 .



From the output above you can see that the database created SAMPLE3 is actually under INST02 , not INST01 .

In order to access the database SAMPLE2in INST02 under INST01, you can go directly to the INST01 Catalog it.




You can connect to the database using the connect to command



Experiment 2 , DB2 v10.5, Linux Use Catalog TCPIP Node the way

There are two instances of Qingsong and db2inst2on the same physical machine, with the database under instance Qingsong Qsmiao, as the server, instance db2inst2 as the client



1. View /etc/services file


2. use the root user to add a line remote_test the /etc/services 60012/tcp

3. Update the Database Manager configuration file on the server qingsong

$ DB2 Update dbm CFG using Svcename remote_test

$ db2stop

$ db2start

$ db2 get dbm CFG | grep svcename

4. set the communication protocol for the server to TCPIP

$ db2set Db2comm=tcpip

$ db2stop

$ db2start

$ db2set-all

5. Client cataloging node

$ db2start

$ DB2 List Node directory

$ DB2 Catalog TCPIP node qingnode remote localhost server 60012

$ DB2 Terminate

$ DB2 List Node directory

wherein, localhost refers to the machine, if it is remote, can be directly modified to the corresponding IP address,60012 refers to the port corresponding to the server.

6. Client cataloging database

$ DB2 Catalog db Qsmiao as remotedb at node Qingnode

$ DB2 List DB directory

$ DB2 Connect to Remotedb user Qingsong using Qingsong



The above catalogue is TCPIP node .

Resources:

Catalog TCPIP Node

http://www-01.ibm.com/support/knowledgecenter/SSEPGG_9.7.0/com.ibm.db2.luw.admin.cmd.doc/doc/r0001944.html?cp= ssepgg_9.7.0%2f3-6-2-4-17&lang=en

Catalog Local Node

http://www-01.ibm.com/support/knowledgecenter/SSEPGG_9.7.0/com.ibm.db2.luw.admin.cmd.doc/doc/r0001989.html?cp= ssepgg_9.7.0%2f3-6-2-4-14&lang=en

Catalog Database

http://www-01.ibm.com/support/knowledgecenter/SSEPGG_9.7.0/com.ibm.db2.luw.admin.cmd.doc/doc/r0001936.html?cp= ssepgg_9.7.0%2f3-6-2-4-10&lang=en


The method of cataloging native database in DB2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.