Two ways to manage DB2 Environment Variables

Source: Internet
Author: User

In Oracle databases, managing environment variables is troublesome. When you deploy an Oracle database on a Windows operating system, the database installer automatically sets Oracle-related environment variables. However, when you deploy an Oracle database on Linux and other operating systems, You have to manually set the environment variables and set them on the Linux operating system. This puts forward special requirements for the Oracle database administrator. They must understand not only the knowledge of Oracle database systems, but also the commands related to Linux operating systems.

The database administrator can use database commands to change the environment variable values in this table. Then, the database system automatically updates related content to the operating system to control environment variables. Simply put, the management of environment variables in the DB2 database is integrated with the database system. You can configure the database environment variables without having to know the Linux operating system commands.

I. Brief registry type

There are multiple brief registries in the DB2 database. Each brief Registry is responsible for environment variables at a specific level.

First, the brief registry at the instance level. This table stores a large number of DB2 database variable flags. Generally, the environment variables of a specific instance are stored in this brief registry. In addition, the environment variables in this table have a high priority. If the value of the environment variable defined at this level conflicts with the value set at the global level, the value of the environment variable at this level will be replaced. Second, the global summary registry. If no environment variable is set for the database administrator of a specific instance, this global summary registry is used. The environment variables in this table have valid environment variables within the current machine range (provided that there are no conflicting settings in the instance-level summary registry ). The third is the brief registry at the node level of the DB2 instance. In a complex environment where database applications are deployed, the distributed deployment environment is often used to improve the database performance. When a database is distributed in a system with different database partitions, the Registry resides on each node (that is, each server, the value of the environment variable of all instances that store data on this server. Note that the priority of setting at this level is higher than that of the above two levels. The value of the environment variable set at this level will replace the corresponding setting at the instance level or global level.

The author believes that the most important thing to know about these brief registries is to understand their priority. This is the same as the environment variables in the operating system. It has user-level and OS-level environment variables. In general, the closer it is to the user, the higher its priority is, that is, the proximity principle is adopted. This is also true for the priority of the DB2 registry. From the above analysis, we can see that the brief registry with the highest priority is the brief registry at the instance node level. The second is the brief instance-level registry. The last is the global summary registry. In general, some common environment variables are configured in the simple registry with a low level, such as the global level summary registry; you can also configure all environment variables in the global summary registry as the default environment variables of the database. Then, you can modify the configurations at the instance or node level and use user-defined settings. This reduces the configuration of environment variables. In short, no matter what kind of management policy is adopted, the database administrator must have a clear understanding of the priority of these brief registries. Avoid Zhang guanli Dai during management.

2. Learn to use the db2set command to modify the value of the brief registry.

In the DB2 database, the DB2 environment variables in the brief registry are managed through the db2set command. Therefore, the DB2 database administrator must master the db2set command. Specifically, you can master the following content.

First, you need to understand the meaning of each option. There are multiple levels of brief registries in the db2 database. The values in these tables are all done using the same command. The Administrator must change the environment variables at different levels through different options. To change the environment variables in the brief registry of all instances in the database system, use the-g option. To change the brief registry of this user level, when the-ul option is used. Remember that these options cannot be used incorrectly when changing environment variables. Otherwise, Zhang guanli Dai may obtain the opposite result.

Second, you need to note that sometimes the Administrator may impose some restrictions on the environment variable settings. If you cannot modify an environment variable at the global level, you can only set it at the instance or node level. In this case, you need to use the-null option. The main purpose of this command is to delete the specified environment variables and restrict the use of other levels of the brief registry to change the relevant environment variables.

Third, pay attention to the differences in environment variables. Some environment variables can be set in the summary registries mentioned above. However, some environment variables can be set only in the specific brief registry. For example, some environment variables can be set only in the brief registry at the global level. This is mainly a shared environment variable. In addition, all instances are required to use the same environment variable. In this case, you can avoid conflicts caused by different environment variables of each instance or user. For example, the db2system environment variable can be set only in the global environment variable. The purpose is to ensure that each instance uses the same db2system environment variable. If you want to modify the db2system environment variable in the instance-level registry, the database system will prompt the user related error information. Therefore, the DB2 database administrator needs to know which environment variables can be set at which specific levels. In particular, you need to understand the environment variables that can be modified only in a global environment. Once you have mastered this content, you can avoid detours in environment variable management.

Fourth, you need to pay attention to the need to change the environment variable to the relevant permissions of the operating system. Although the database administrator changes the environment variables in the brief registry in the database system. However, the most important changes need to be reflected in the operating system. Therefore, if the database administrator needs to change the environment variables, not only the database system permissions are required, but the current user should also have the corresponding permissions in the operating system, such as the operating system administrator permissions. If you do not have permissions at the operating system level, it is useless even if you have the highest permissions on the database system. For example, in Linux, if a database user wants to change the registry value at the instance level, the user must have the privileges of the system administrator. If you want to change the environment variables in the global summary registry, the database user must have the permissions of the operating system Super User. From this example, we can see that the brief registry is just a tool that helps database administrators control environment variables. Eventually, these environment variables will be updated to relevant operating system settings.

Fifth, if the DB2 database administrator is not just a database administrator, but also has some special accomplishments on the operating system (especially on Linux), you can skip this brief registry, use commands such as export directly at the operating system level to maintain the environment variables necessary for running the DB2 database system. Currently, most DB2 databases are deployed on Linux or Unix operating systems. Therefore, mastering the management skills of Linux and other operating systems is also required by DB2 database administrators. So if you have the opportunity, I think it is very necessary for the DB2 administrator to learn about the management of Linux and other operating systems. When you are familiar with Linux and other operating system management skills, I suggest you directly manage the database running environment through the operating system environment variables. In the operating system, you can easily update and back up the configuration files of these environment variables. Sometimes it is easier to change in the brief registry. Therefore, for professional DB2 database administrators, you must master the skills to maintain environment variables through the brief registry and operating system commands. Sometimes the two can be used at the same time to get twice the result with half the effort.

  1. Correctly export LOB data in DB2
  2. Analysis of DB2 external file format
  3. Three Suggestions for DB2 database design
  4. Parsing Remote replication between DB2 and non-DB2 Databases
  5. 30 Basic DB2 database operation commands

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.