Understanding of DB2 database catalog (catalog) concept

Catalog is the process of establishing a database connection from a client to a server locally or remotely. Its purpose is to obtain cataloging information, that is, to generate a catalog for accessing the database. The system database directory contains a list and pointers through which  DB2  can find known databases, whether they are on the local system or on a remote system. Without cataloging information, the application cannot connect to the database, so cataloging must be done before using  DB2  .

Personal understanding is to load the relevant information about the database on the server side to the local. Why do you want to do this? The reason is that the deployed database must be installed on the server side. This database may be in another city. Now to operate this remote database, you need to connect to the remote database. And it is necessary to "take" the remote database information to the local in a certain way. This process is called catalog .

You can use the CA tool and follow the wizard step by step. Two other methods are described below, the command line method and using the CC tool:

 

Cataloging includes the following two processes:

1. Map the server to the client, that is, the catalog node .

Through the catalog node, DB2 records the information of the remote server in the local SQLNODIR file, so the catalog node actually maps the remote server to the local, and the remote server and instance can be found through the records in SQLNODIR , similar to the one pointing to the remote server and instance. address pointer.

2. Map the database under the server instance to the client, that is, the catalog database .

After cataloging the database, record the information of the remote database in the local SQLDBDIR file. Cataloging the database here can be understood as mapping the database under the remote server instance to the local one as an alias.

 

 

1. Node cataloging

 

Method 1: command execution method

Using the CLP , CW , or command line editor, enter the node catalog command:

db2 catalog tcpip node node_name remote server_ip server server_port

l      node_name: The name of the node to be cataloged, which can be started arbitrarily. The node name must be unique on a machine and cannot be duplicated with an existing node name. (You can view it through db2 list node directory ) You can enter pure letters or a combination of letters and numbers, and letters are not case-sensitive. Note that it cannot be named " DB2 " and special characters are not supported. The node directory is used to store all connectivity information for the remote database.

l      server_ip: The IP address of the server to be cataloged .

l      server_port: The port number of the server to be cataloged, the default is 50000 .

 

 

Method 2: CC execution method

Catalog DB2 nodes through the Control Center . Two processes are required: server node cataloging and node cataloging of instances under the server.

1、服务器节点编目

右键单击控制中心左侧目录树中的“所有系统”,选择“添加”项。在弹出的“添加系统”对话框内,对所要连接服务器的系统类型、系统名称、主机名、节点名、操作系统、连接协议及注释进行设置。在对服务器系统名称和主机名进行设置时,可以通过单击系统名称右侧的“发现”按钮进行搜索,选择需要连接的服务器系统。“确定”后完成服务器在客户端的映射。

2、服务器下实例的编目

右键点击所添加的服务器下的“实例”节点,选择“添加”项,在弹出的“添加实例”对话框中对目标数据库所在的实例名称、实例节点名、操作系统、连接协议、主机名及端口号进行设置。“确定”后完成服务器下实例在客户端的映射。

 

 

二、数据库编目

 

方法一:命令执行方法

使用CLPCW或命令行编辑器,输入数据库编目命令:

db2 catalog db db_name as db_alias at node node_name

l     db_name:所要编目的数据库名称。

l     db_alias:数据库编目到客户端所用的别名。

l     node_name:所要编目的数据库所在的节点名。

 

方法二:CC执行方法

通过“控制中心”对DB2进行数据库编目。右键点击服务器实例下的“数据库”,选择“添加”选项,在弹出的“添加数据库”对话框中设置数据库名称、别名等。点击“确定”完成数据库在客户端的映射。

 

出自:http://blog.itpub.net/25744374/viewspace-750069/

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326443565&siteId=291194637