How to catalog databases in the local database in DB2

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

How to catalog databases in the local database in DB2

Problem: There are two instances on the same node. If you want to access the database in another instance under one of the instances, there are two methods:

1. the catalog local node method is used to catalog another instance directly in one of the instances. In this test, the communication mode between them is IPC (inter-process communication ), this method can only be performed on the same physical machine.

2. use catalog TCPIP node to take one of them as the client and the other as the server. In this way, the communication mode between them is TCPIP, which is not limited to local, it is also applicable to remote communication.

The following are two examples to illustrate this process.

Lab1DB2 10.1.0.0, Windows operating system, using catalog local node.

1. There are two instances on the machine: INST01 and INST02. There is a database SAMPLE1 under instance 01 and a database SAMPLE2 under instance 02. After the two instances are started, as shown in:

Now, use the catalog local node Method in instance 01 to catalog instance INST02 (note that all of the following operations areIn the instanceINST01Completed)


Node01 is equivalent to an alias for INST02. After you use attach to connect to node01, the create database Command is equivalent to running in INST02.


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

To access the database SAMPLE2 in INST02 under INST01, You can catalog it directly in INST01.


You can use the connect to command to connect to the database.


Lab 2,DB2 v10.5, using catalog TCPIP node in Linux

On the same physical machine, there are two instances qingsong and db2inst2. The instance QINGSONG has the database QSMIAO as the server, and the instance db2inst2 serves as the client.

1. view the/etc/services file

2. Use the root user to add a REMOTE_TEST 60012/tcp line in/etc/services.

3. Update the configuration file of the database manager on the qingsong server.

$ Db2 update dbm cfg using svcename REMOTE_TEST

$ Db2stop

$ Db2start

$ Db2 get dbm cfg | grep svcename

4. Set the communication protocol of the server to TCPIP.

$ Db2set DB2COMM = tcpip

$ Db2stop

$ Db2start

$ Db2set-all

5. Client cataloguing Node

$ Db2start

$ Db2 list node directory

$ Db2 catalog TCPIP node qingnode remote localhost server 60012

$ Db2 terminate

$ Db2 list node directory

Specifically, localhost refers to the local machine. If it is remote, you can directly change it to the corresponding IP address, and 60012 refers to the port corresponding to the server.

6. Client cataloguing Database

$ Db2 catalog db qsmiao as remoteDB at node qingnode

$ Db2 list db directory

$ Db2 connect to REMOTEDB user qingsong using qingsong

The preceding cataloguing method is TCPIP node.

References:

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

Related Article

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.