1.创建新实例
[root@xifenfei ~]# cd /opt/db2/V9.5/instance/
[root@xifenfei instance]# ./db2icrt -h
DBI1001I  Usage:
 db2icrt [-h|-?]
         [-d]
         [-a AuthType]
         [-p PortName]
         [-s InstType]
         -u FencedID InstName
[root@xifenfei instance]# useradd Fence2
[root@xifenfei instance]# passwd Fence2
Changing password for user Fence2.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@xifenfei instance]# useradd db2inst2
[root@xifenfei instance]# passwd db2inst2
Changing password for user db2inst2.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@xifenfei instance]# ./db2icrt -a server -p 55555 -s ese -u Fence2 db2inst2
DBI1070I  Program db2icrt completed successfully.
[root@xifenfei instance]# su - db2inst2
[db2inst2@xifenfei ~]$ db2 get instance
 The current database manager instance is:  db2inst2
[db2inst2@xifenfei ~]$ db2ilist
db2inst1
db2inst2
[db2inst2@xifenfei ~]$ db2greg -dump
S,DB2,9.5.0.0,/opt/db2/V9.5,,,0,0,,1332659153,0
S,DAS,9.5.0.0,/opt/db2/V9.5/das,lib/libdb2dasgcf.so,,,, ,,
I,DAS,9.5.0.0,dasusr1,/home/dasusr1/das,,1,,/opt/db2/V9.5/das,,
I,DB2,9.5.0.0,db2inst1,/home/db2inst1/sqllib,,1,0,/opt/db2/V9.5,,
I,DB2,9.5.0.0,db2inst2,/home/db2inst2/sqllib,,1,0,/opt/db2/V9.5,,
2.启动关闭实例
[db2inst2@xifenfei ~]$ db2stop 03/31/2012 11:57:48 0 0 SQL1064N DB2STOP processing was successful. SQL1064N DB2STOP processing was successful. [db2inst2@xifenfei ~]$ db2start 03/31/2012 11:57:52 0 0 SQL1063N DB2START processing was successful. SQL1063N DB2START processing was successful.
3.删除实例
--先需要关闭实例 [root@xifenfei instance]# ./db2idrop db2inst2 DBI1070I Program db2idrop completed successfully.
[root@xifenfei instance]# ./db2icrt -h DBI1001I Usage: db2icrt [-h|-?] [-d] [-a AuthType] [-p PortName] [-s InstType] -u FencedID InstName Explanation: An invalid argument was entered for the db2icrt command. Valid arguments for this command are: -h|-? display the usage information. -d turn debug mode on. -a AuthType is the authentication type (SERVER, CLIENT, or SERVER_ENCRYPT) for the instance. -p PortName is the port name or port number to be used by this instance. -s InstType is the type of instance to be created (ese,wse, standalone, or client). ese used to create an instance for a DB2 database server with local and remote clients with DPF support. This type is the default instance type for DB2 Enterprise Server Edition. wse used to create an instance for a DB2 database server with local and remote clients. This type is the default instance type for DB2 Workgroup Edition, DB2 Express or Express-C Edition, and DB2 Connect Enterprise Edition. standalone used to create an instance for a DB2 database server with local clients. This type is the default instance type for DB2 Personal Edition. client used to create an instance for a IBM Data Server Client. This type is the default instance type for IBM Data Server Client products and DB2 Connect Personal Edition. DB2 products support their default instance types and the instance types lower than their default ones. For instance, DB2 Enterprise Edition supports the instance types of 'ese', 'wse', 'standalone' and 'client'. -u FencedID is the name of the user under which fenced UDFs and fenced stored procedures will be run. This flag is not required if only a IBM Data Server Client is installed. InstName is the name of the instance. User response: Confirm that user IDs and group names used to create the DB2 instance are valid. For information about naming rules, see the topic called "User, user ID and group naming rules" in the DB2 Information Center. Refer to the DB2 Information Center for a detailed description of the command. Correct the syntax and reissue the command.