Create multiple DB2 database instances
Create multiple DB2 database instances using the DB2 Command Line Processor. If have only one database instance, we can skip this task.
When you create multiple database instances, install the databases on each instance. If we use the database wizard to install the databases, prepare and run the database wizard once for each instance. If we use the scripts to install the databases, run the scripts once for each instance.
Complete steps for the operating system:
- Create multiple DB2 database instances on AIX
- Create multiple DB2 database instances on Linux
- Create multiple DB2 database instances on Windows
Create multiple DB2 database instances on AIX
Attention:
- For each instance to create, log in as the instance owner before creating the instance.
- Use the DB2 Command Line Processor to enter commands.
- After creating the instance, add the instance to the user environment variable. The instance is then visible in the DB2 Control Center.
- An instance called db2inst1 is created during DB2 installation.
To create DB2 database instances on AIX, follow these steps:
- Create a group for DB2:mkgroup db2iadm1
- Create a user for DB2:mkuser groups=db2iadm1 db2instN, where db2instN is the name of a user. DB2 prompts you to enter a password for the user. Repeat this step to create enough users to match the number of database instances.
- To create DB2 instances, log in with root user and go to /opt/IBM/db2/V9.5/instance.
./db2icrt -u db2instN db2instN
where db2instN is the name of a user and also the name of an instance. Repeat this step to create enough instances to match the number of databases.
- To set the port number of the instance, edit the/etc/services file and add the following line: db2c_instance_name instance_port/tcpwhere instance_name is the name of the instance and instance_port is the port number of that instance. Repeat this step for each instance.
- Communication protocols for the instance:
db2 update database manager configuration using svcename db2c_instance_name db2set DB2COMM=tcpip db2stop db2startRepeat this step for each instance.
- Edit the firewall configuration to allow the new instances to communicate through their listening ports.
Create multiple DB2 database instances on Linux
Attention:
- For each instance to create, log in as the instance owner before creating the instance.
- Use the DB2 Command Line Processor to enter commands.
- After creating the instance, add the instance to the user environment variable. The instance is then visible in the DB2 Control Center.
- An instance called db2inst1 is created during DB2 installation, along with three users: db2inst1, db2fenc1, and dasusr1.
To create DB2 database instances on Linux, follow these steps:
- Create groups for DB2:
groupadd -g 999 db2iadm1 groupadd -g 998 db2fadm1 groupadd -g 997 dasadm1
- Create users for DB2:
useradd -u 1100 -g db2iadm1 -m -d /home/db2instN db2instN -p db2instX
where db2instN is the name of a user and db2instX is the password for that user. Create enough users to match the number of database instances.
- Create the db2fenc1 user for DB2 in the db2fadm1 group:
useradd -u 1101 -g db2fadm1 -m -d /home/db2fenc1 db2fenc1 -p db2instX
- Create the db2fenc1 user for DB2 in the db2fadm1 group:
useradd -u 1101 -g db2fadm1 -m -d /home/db2fenc1 db2fenc1 -p db2instX
- Create the dasusr1 user for DB2 in the dasadm1 group:
useradd -u 1102 -g dasadm1 -m -d /home/dasadm1 dasusr1 -p db2instX
- To create new DB2 instances, log in with root user and go to /opt/ibm/db2/V9.5/instance.
./db2icrt -u db2fenc1 db2instN
Create enough instances to match the number of databases.
- To set the port number of the instance, edit the /etc/services file and add the following line:
db2c_<instance_name> <instance_port>/tcp where instance_name is the name of the instance and instance_port is the port number of that instance. Repeat this step for each instance.
- Log in as the database instance and set the communication protocols for the instance:
su - db2instN db2 update database manager configuration using svcename db2c_instance_name db2set DB2COMM=tcpip db2stop db2startRepeat this step for each instance.
- Edit the firewall configuration to allow the new instances to communicate through their listening ports.
Create multiple DB2 database instances on Windows
Complete these steps for each instance to create:
- Create a new user and add it to the Administrators group.
For DB2, also add the new user to the DB2ADMNS group.
- Remove the user account from the Users group.
- Grant rights to the new user:
- Click Start > Run and enter secpol.msc.
- Expand Local Policies and click User Rights Assignment.
- Open each of the following rights, click Add User or Groupand add the new user:
- Act as part of the operating system
- Adjust memory quotas|Increase quotas for a process
- Create a token object
- Debug programs
- Lock pages in memory
- Log on as a service
- Replace a process level token
The new account uses the local system as the domain.
Attention:
- For each instance to create, log in as the instance owner before creating the instance.
- Use the DB2 Command Line Processor to enter commands.
- After creating the instance, add the instance to the user environment variable. The instance is then visible in the DB2 Control Center.
To create DB2 database instances on Windows, follow these steps:
- Create an instance: db2icrt instance_name -s ese -u db2_admin_user where instance_name is the name of the instance and db2_admin_user is the user account for that instance.
- To set the port number of the instance, edit the C:\WINDOWS\system32\drivers\etc\services file and add the following line: db2c_instance_name instance_port/tcp
- Current instance parameter:set DB2INSTANCE=instance_name
- Communication protocols for the instance:
db2 update database manager configuration using svcename db2c_instance_name db2set DB2COMM=npipe,tcpip db2stop db2start
- Edit the firewall configuration to allow the new instances to communicate through their listening ports.
Parent topic:
Create multiple database instancesRelated reference: