This article mainly describes the definition of DB2 database cataloguing. If you want to understand the definition of DB2 database cataloguing, we should first briefly introduce the architecture of DB2 database, we all know that the biggest concept in DB2 databases is system nodes, that is, hosts.
Below is an instance. below is the database, then the tablespace, and then the database object. Now suppose you have a database server on p570, and you have a client on windows, linux, or any platform. Now you want to establish a client-to-server connection, what are the specific steps?
Step 1:
You must identify the remote server on the client machine. How can this problem be solved? The catalog Method Used in DB2 is to write the remote server into a file on the local client through the catalog:
- db2 catalog tcpip node p570 remote 172.10.10.10 server 50000
In the above command, p570 is a node name that must be unique on a machine), remote is followed by the server IP address, and server is the port number corresponding to the instance on the remote server. DB2 records the remote server information in the local SQLNODIR file in this way. Therefore, the DB2 database cataloguing node maps the remote server to the local database, the records in SQLNODIR can be used to locate the remote server and instance, similar to the address pointer pointing to the remote server and instance.
Step 2:
After the remote server IP address and instance are catalogued, the database under the instance should be catalogued locally in step 2.
- db2 catalog db REMOTEDB at node p570
In this command, REMOTEDB is the database under the remote instance, and p570 is the name of the target node in step 1.
After this command is executed, the remote database information is recorded in the local SQLDBDIR file, which can be understood as ing the database under the remote server instance to a local alias.
The preceding example shows that the client and server are not on the same machine, and the database is catalogued through the cataloguing node to connect the client to the database on the server. If the client is connected to the same machine, at this time, do not display the cataloguing nodes. However, when we create an instance on the server, there is an implicit process of cataloging the instance locally, assume that an instance named db2inst1 is created on p570, there is an implicit
Db2 catalog local node db2inst1 instance db2inst1 system p570 ostype aix steps. Similarly, when you create a database MYDB under db2inst1, there is an implicit cataloguing catalog) database step:
Db2 catalog db mydb at node db2inst1 step.
So far, you can understand catalog). DB2 database catalog is the purpose of establishing a database connection from the client to the server locally or remotely.
PS:
Instance name: The default value is db2inst1. You can view the instance configuration parameters.
- db2 get dbm cfg|grep -i svcename
Instance port: The default value is 50000. You can view the port number by accessing the services file.
In the \ WINNT \ system32 \ drivers \ etc folder for Windows)
- db2inst1 50000/tcp
Unix System in the \ etc folder)
- db2inst1 50000/tcp
The above content is an introduction to a simple understanding of the concept of DB2 database cataloguing. I hope you will gain some benefits.