Setting registry and environment variables
Most environment variables are set in the Db2® database profile registries by using the db2set command. The few variables that are set outside the profile registries require different commands depending on your operating system.
Before you begin
- SYSADM authority to set variables in the instance-level registry
- root authority to set variables in the global-level registry
- local Administrator authority
- SYSADM authority with the following conditions:
- If extended security is enabled, SYSADM users must belong to the DB2ADMNS group.
- If extended security is not enabled, SYSADM users can make updates if the appropriate permissions are granted to them in the Windows registry.
About this task
When you use the db2set command to set variables in the profile registries, you do not need to restart your computer for variable values to take effect. However, changes do not affect Db2 applications that are currently running or users that are active. The Db2 registry applies the updated information to Db2 server instances and Db2 applications that are started after the changes are made.
If Db2 variables are set outside the registry, you cannot administer those variables remotely. Also, you must restart the computer for the variable values to take effect.
The DB2INSTANCE and DB2NODE Db2 environment variables are not stored in the Db2 profile registries. See the topics about setting environment variables outside the profile registries for information about setting these variables.
On Linux and UNIX operating systems, the instance-level profile registry is stored in the profile.env text file. If two or more users set a registry variable with the db2set command at almost the same time, the size of this file is reduced to zero. Also, the output from the db2set -all command displays inconsistent values.
Procedure
To set a registry variable:
The following table shows some of the ways that you can set registry variables with the db2set command. See the db2set command reference topic for more information about the parameters and usage of this command.
Desired Action | Command |
---|---|
Set a registry variable for the current or default instance. | db2set registry_variable_name=new_value |
Set a registry variable for all databases in an instance. | db2set registry_variable_name=new_value -i instance_name |
Set a registry variable for a particular database partition in an instance. | db2set registry_variable_name=new_value -i instance_name database_partition_number |
Set a registry variable for all instances that pertain to a Db2 Enterprise Server Edition installation. | db2set registry_variable_name=new_value -g |
Set a registry variable at the user level in a Lightweight Directory Access Protocol (LDAP) environment. | db2set registry_variable_name=new_value -ul |
Set a registry variable at the global level in an LDAP environment. DB2LDAP_KEEP_CONNECTION and DB2LDAP_SEARCH_SCOPE are the only two registry variables that can be set at the LDAP global level. | db2set registry_variable_name=new_value -gl |