Use window 1 to work with the test instance and window 2 to work with he prod instance Note: Enter the which db2 command to ensure that your search path has been set up correctly. This command returns the absolute path of the DB2 CLP executable. Verify that it is located under the squib directory Related tasks Setting the DB2 environment automatically on UNIX on page 20 Multiple instances on a UNIX operating system It is possible to have more than one instance on a UNIXO operating system However, you may only work within one instance of DB2 at a time ote: To prevent environmental conflicts between two or more instances, you should ensure that each instance has its own home filesystem. Errors will be returned when the home filesystem is shared The instance owner and the group that is the System Administration One user id or username can be used for only one instance That user o (SYSADM) group are associated with every instance. The instance owner ar the SYsadM group are assigned during the process of creating the instar Each instance owner must have a unique home directory. All of the files necessary to run the instance are created in the home directory of the instance wner's user Id or username If it becomes necessary to remove the instance owners user ID or username from the system, you could potentially lose files associated with the instance and lose access to data stored in this instance. For this reason it is recommended that you dedicate an instance owner user ID or username to be used exclusively to run DB2 The primary group of the instance owner is also important. This primary group automatically becomes the system administration group for the instance and gains SYSADM authority over the instance. Other user IDs or usernames that are members of the primary group of the instance owner also gain this level of authority. For this reason, you may want to assign the instance owners user ID or username to a primary group that is reserved for the administration of instances(Also, ensure that you assign a primary group to the instance owner user ID or username; otherwise, the system-default primary group is used. 22 Administration Guide: Implementation
Use window 1 to work with the test instance and window 2 to work with the prod instance. Note: Enter the which db2 command to ensure that your search path has been set up correctly. This command returns the absolute path of the DB2 CLP executable. Verify that it is located under the instance’s sqllib directory. Related tasks: v “Setting the DB2 environment automatically on UNIX” on page 20 Multiple instances on a UNIX operating system It is possible to have more than one instance on a UNIX® operating system. However, you may only work within one instance of DB2® at a time. Note: To prevent environmental conflicts between two or more instances, you should ensure that each instance has its own home filesystem. Errors will be returned when the home filesystem is shared. The instance owner and the group that is the System Administration (SYSADM) group are associated with every instance. The instance owner and the SYSADM group are assigned during the process of creating the instance. One user ID or username can be used for only one instance. That user ID or username is also referred to as the instance owner. Each instance owner must have a unique home directory. All of the files necessary to run the instance are created in the home directory of the instance owner’s user ID or username. If it becomes necessary to remove the instance owner’s user ID or username from the system, you could potentially lose files associated with the instance and lose access to data stored in this instance. For this reason, it is recommended that you dedicate an instance owner user ID or username to be used exclusively to run DB2. The primary group of the instance owner is also important. This primary group automatically becomes the system administration group for the instance and gains SYSADM authority over the instance. Other user IDs or usernames that are members of the primary group of the instance owner also gain this level of authority. For this reason, you may want to assign the instance owner’s user ID or username to a primary group that is reserved for the administration of instances. (Also, ensure that you assign a primary group to the instance owner user ID or username; otherwise, the system-default primary group is used.) 22 Administration Guide: Implementation
If you already have a group that you want to make the system administration administration authority on the instance, add them to the group that is uselgo group for the instance, you can simply assign this group as the primary grou when you create the instance owner user ID or username To give other assigned as the system administration group To separate SYSADM authority between instances, ensure that each instance owner user ID or username uses a different primary group. However, if you choose to have a common SYSADM authority over multiple instances, you can use the same primary group for multiple instances Related tasks: UNIX Details When Creating Instances"on page Multiple instances on a Windows operating system It is possible to run multiple instances of DB2 on the same machine. Each instance of Db2 maintains its own databases and has its own database manager configuration parameters An instance of DB2 consists of the following: A Windows service that represents the instance. The name of the service is same as the instance name. The display name of the service(from the Services panel)is the instance name, prefixed with the"DB2 -"string For example, for an instance named DB2, there exists a Windows service called DB2"with a display name of "DB2-DB2 Note: A Windows service is not created for Windows 98. for Windows me or for client instances An instance directory. This directory contains the database manager configuration files, the system database directory, the node directory, the DCS database directory, all the diagnostic log and dump files that are associated with the instance. The instance directory is by default a sub-directory inside the SQLLiB directory and has the same name as th instance name. For example, the instance directory for instance"DB2"is C: \ SQLLIB\DB2, where C: \ SQLLIB is where DB2 is installed. You can use the registry variable DB2INSTPROF to change the default location of the instance directory. If the DB2INSTPROF registry variable is set to another location, then the instance directory is created under the directory pointed to by DB2INSTPROF. For example, if DB2INSTPROF-D: \DB2PROFS, then the instance directory will be D: \DB2PROFS \DB2 a registry key under HKEY_LOCAL_ MACHINE \SOFTWARE\ BM\DB2\PROFILES\<instance_name>. All the instance level registry variables are created here Chapter 1.Before Creating a Database 23
If you already have a group that you want to make the system administration group for the instance, you can simply assign this group as the primary group when you create the instance owner user ID or username. To give other users administration authority on the instance, add them to the group that is assigned as the system administration group. To separate SYSADM authority between instances, ensure that each instance owner user ID or username uses a different primary group. However, if you choose to have a common SYSADM authority over multiple instances, you can use the same primary group for multiple instances. Related tasks: v “UNIX Details When Creating Instances” on page 25 Multiple instances on a Windows operating system It is possible to run multiple instances of DB2® on the same machine. Each instance of DB2 maintains its own databases and has its own database manager configuration parameters. An instance of DB2 consists of the following: v A Windows® service that represents the instance. The name of the service is same as the instance name. The display name of the service (from the Services panel) is the instance name, prefixed with the “DB2 - ” string. For example, for an instance named DB2, there exists a Windows service called “DB2” with a display name of “DB2 - DB2”. Note: A Windows service is not created for Windows 98, for Windows ME, or for client instances. v An instance directory. This directory contains the database manager configuration files, the system database directory, the node directory, the DCS database directory, all the diagnostic log and dump files that are associated with the instance. The instance directory is by default a sub-directory inside the SQLLIB directory and has the same name as the instance name. For example, the instance directory for instance “DB2” is C:\SQLLIB\DB2, where C:\SQLLIB is where DB2 is installed. You can use the registry variable DB2INSTPROF to change the default location of the instance directory. If the DB2INSTPROF registry variable is set to another location, then the instance directory is created under the directory pointed to by DB2INSTPROF. For example, if DB2INSTPROF=D:\DB2PROFS, then the instance directory will be D:\DB2PROFS\DB2. v A registry key under HKEY_LOCAL_MACHINE\SOFTWARE\ IBM\DB2\PROFILES\<instance_name>. All the instance level registry variables are created here. Chapter 1. Before Creating a Database 23
You can run multiple DB2 instances concurrently. To work with an instance, rou need to set the db2INSTANCe environment variable to the name of the instance before issuing commands against that instance To prevent one instance from accessing the database of another instance, the database files for an instance are created under a directory that has the same name as the instance name. For exam DIe, when creating a database on drive C: for instance DB2, the database files are created inside a directory called C: \DB2. Similarly, when creating a database on drive C: for instance TEST, the database files are created inside a directory called C: \TEST Related concepts High Availability"in the Data Recovery and High Availability guide and Reference Related tasks "Windows Details When Creating Instances"on page 26 Creating additional instances Although an instance is created as part of the installation of DB2 UDB, your business needs may require you to create additional instances Prerequisites: If you belong to the Administrative group on Windows, or you have root authority on UNIX Platforms, you can add additional DB2 instances. The machine where you add the instance becomes the instance-owning machine (node zero). Ensure that you add instances on a machine where a DB2 administration server resides Procedure: To add an instance using the command line, enter db2icrt <instance name> provide the login name of the instance owner and optionally specify he hould When using the db2icrt command to add another instance of DB2, you authentication type of the instance. The authentication type applies to all databases created under that instance. The authentication type is a statement of where the authenticating of users will take place You can change the location of the instance directory from DB2PATH using the db2INSTPROF environment variable. You require write-access for the 24 Administration Guide: Implementation
You can run multiple DB2 instances concurrently. To work with an instance, you need to set the DB2INSTANCE environment variable to the name of the instance before issuing commands against that instance. To prevent one instance from accessing the database of another instance, the database files for an instance are created under a directory that has the same name as the instance name. For example, when creating a database on drive C: for instance DB2, the database files are created inside a directory called C:\DB2. Similarly, when creating a database on drive C: for instance TEST, the database files are created inside a directory called C:\TEST. Related concepts: v “High Availability” in the Data Recovery and High Availability Guide and Reference Related tasks: v “Windows Details When Creating Instances” on page 26 Creating additional instances Although an instance is created as part of the installation of DB2 UDB, your business needs may require you to create additional instances. Prerequisites: If you belong to the Administrative group on Windows, or you have root authority on UNIX platforms, you can add additional DB2 instances. The machine where you add the instance becomes the instance-owning machine (node zero). Ensure that you add instances on a machine where a DB2 administration server resides. Procedure: To add an instance using the command line, enter: db2icrt<instance_name> When using the db2icrt command to add another instance of DB2, you should provide the login name of the instance owner and optionally specify the authentication type of the instance. The authentication type applies to all databases created under that instance. The authentication type is a statement of where the authenticating of users will take place. You can change the location of the instance directory from DB2PATH using the DB2INSTPROF environment variable. You require write-access for the 24 Administration Guide: Implementation
DB2PATH, you have to set DB2INSTPROF before entering the dbzior than instance directory. If you want the directories created in a path other command For DB2 Universal Database Enterprise Server Edition, you also need to declare that you are adding a new instance that is a partitioned database system. Related concepts: Authentication methods for your server"on page 227 Authentication considerations for remote clients"on page 232 Related reference db2icrt-Create Instance"in the Command Reference UNIX Details When Creating Instances When working with UNIX operating systems, the db2icrt command has the following optional parameters This parameter is used to display a help menu for the command This parameter sets the debug mode for use during problem determination -a AuthType This parameter specifies the authentication type for the instance. Valid authentication types are SERVER, SERVER_ENCRYPT, or CLIENT. If not pecified, the default is SERVER, if a DB2 server is installed. Otherwise, it is set to CLIEnT Notes: 1. The authentication type of the instance applies to all databases owned by the instance 2. On UNIX operating systems, the authentication type DCE is not a valid -u FencedID This parameter is the user under which the fenced user-defined functions (UDFS)and stored procedures will execute. This is not required if you install the DB2 client or the DB2 Application Development Client. For other DB2 products, this is a required parameter Note: FencedID may not be"root"or"bin PortIa Chapter 1. Before Creating a Database 25
instance directory. If you want the directories created in a path other than DB2PATH, you have to set DB2INSTPROF before entering the db2icrt command. For DB2 Universal Database Enterprise – Server Edition, you also need to declare that you are adding a new instance that is a partitioned database system. Related concepts: v “Authentication methods for your server” on page 227 v “Authentication considerations for remote clients” on page 232 Related reference: v “db2icrt - Create Instance” in the Command Reference UNIX Details When Creating Instances When working with UNIX operating systems, the db2icrt command has the following optional parameters: v –h or –? This parameter is used to display a help menu for the command. v –d This parameter sets the debug mode for use during problem determination. v –a AuthType This parameter specifies the authentication type for the instance. Valid authentication types are SERVER, SERVER_ENCRYPT, or CLIENT. If not specified, the default is SERVER, if a DB2 server is installed. Otherwise, it is set to CLIENT. Notes: 1. The authentication type of the instance applies to all databases owned by the instance. 2. On UNIX operating systems, the authentication type DCE is not a valid choice. v –u FencedID This parameter is the user under which the fenced user-defined functions (UDFs) and stored procedures will execute. This is not required if you install the DB2 client or the DB2 Application Development Client. For other DB2 products, this is a required parameter. Note: FencedID may not be “root” or “bin”. v –p PortName Chapter 1. Before Creating a Database 25
This parameter specifies the TCP/IP service name or port number to be used. This value will then be set in the instance's database configuration file for every database in the instance -s InstType Allows different types of instances to be created. Valid instance types are ese, wse, client, and standalone. To add an instance for a dB2 server, you can use the following command db2icrt -u db2fencl db2inst1 If you installed the DB2 Connect Enterprise Edition only, you can use the instance name as the Fenced Id also: db2icrt -u db2inst1 db2inst1 To add an instance for a DB2 client, you can use the following command db2icrt db2inst1 -s client -u fencedID DB2 client instances are created when you want a workstation to connect to other database servers and you have no need for a local database on that workstation Related reference: db2icrt-Create Instance"in the Command reference Windows Details When Creating Instances When working with the Windows operating systems, the db2icrt command has the following optional parameters -s InstType Allows different types of instances to be created. Valid instance types are: ese, wse, cli and standalone p: InstProf_ Path This is an optional parameter to specify a different instance profile path. If you do not specify the path, the instance directory is created under the SQLLIB directory, and given the shared name DB2 concatenated to the instance name. Read and write permissions are automatically granted to everyone in the domain. Permissions can be changed to restrict access to the directory If you do specify a different instance profile path, you must create a shared drive or directory. This will allow the opportunity for everyone in the domain to access the instance directory unless permissions have bee changed -u:username, password 26 Administration Guide: Implementation
This parameter specifies the TCP/IP service name or port number to be used. This value will then be set in the instance’s database configuration file for every database in the instance. v –s InstType Allows different types of instances to be created. Valid instance types are: ese, wse, client, and standalone. Examples: v To add an instance for a DB2 server, you can use the following command: db2icrt-u db2fenc1 db2inst1 v If you installed the DB2 Connect Enterprise Edition only, you can use the instance name as the Fenced ID also: db2icrt -u db2inst1 db2inst1 v To add an instance for a DB2 client, you can use the following command: db2icrtdb2inst1 –s client–u fencedID DB2 client instances are created when you want a workstation to connect to other database servers and you have no need for a local database on that workstation. Related reference: v “db2icrt - Create Instance” in the Command Reference Windows Details When Creating Instances When working with the Windows operating systems, the db2icrt command has the following optional parameters: v –s InstType Allows different types of instances to be created. Valid instance types are: ese, wse, client, and standalone. v –p:InstProf_Path This is an optional parameter to specify a different instance profile path. If you do not specify the path, the instance directory is created under the SQLLIB directory, and given the shared name DB2 concatenated to the instance name. Read and write permissions are automatically granted to everyone in the domain. Permissions can be changed to restrict access to the directory. If you do specify a different instance profile path, you must create a shared drive or directory. This will allow the opportunity for everyone in the domain to access the instance directory unless permissions have been changed. v –u:username,password 26 Administration Guide: Implementation