db2实例

来源:互联网 发布:宏景软件 编辑:程序博客网 时间:2024/04/29 18:39

实例从os角度就是一组进程和内存.db2的实例与Oracle有很大的不同.Oracle的实例是一个实例对应一个

db,rac模式是多实例对应一个db.而在db2的世界里用户可以创建多个实例,每个实例可以包含若干个db,其中一个

实例stop了.并不影响其它实例的db.

相关命令如下:

创建实例,安装完db2之后创建实例需要root权限.执行db2icrt.在linux&unix上创建实例需要对应os用户,该用户可以叫"instance user",创建完之后会在用户目录下生成一些文件和子目录

cd /opt/ibm/db2/V9.7/instance (执行实例创建需要进入db2安装目录,这是我的db2安装目录)


[db2inst1@localhost ~]$ sudo groupadd db2_test

[db2inst1@localhost ~]$ sudo useradd -g db2_test -d db2_test

[db2inst1@localhost /]$ cd /home/
[db2inst1@localhost home]$ ls
aa  db2fenc1  db2inst1  db2_test  test

[db2inst1@localhost home]$ cd /opt/ibm/db2/V9.7/instance/

[db2inst1@localhost instance]$ sudo ./db2icrt -u db2_test db2_test
DBI1070I  Program db2icrt completed successfully.

[db2inst1@localhost ~]$ sudo su - db2_test

[db2_test@localhost ~]$ ls
sqllib

[db2_test@localhost ~]$ ps -ef | grep -i db2 (查看db2进程)

db2_test 12690 12687  2 11:29 pts/0    00:00:00 db2sysc 0                                      
root     12691 12690  0 11:29 pts/0    00:00:00 db2ckpwd 0                                      
root     12692 12690  0 11:29 pts/0    00:00:00 db2ckpwd 0                                      
root     12693 12690  0 11:29 pts/0    00:00:00 db2ckpwd 0                                      
db2_test 12697 12690  1 11:29 pts/0    00:00:00 db2vend (PD Vendor Process - 1)                                                                                             
db2_test 12702 12687  4 11:29 pts/0    00:00:00 db2acd 0 ,0,0,0,1,0,0,0000,1,0,8a6740,14,1e014,2,0,1,11fc0,0x210000000,0x210000000,1600000,168015,2,1a8018


至此实例创建完毕了.如果创建很多实例如何查看呢?使用db2ilist

[db2_test@localhost ~]$ db2ilist
db2inst1
db2_test

如果需要更加详细的信息.比如需要实例的版本、实例目录可以使用db2gerg.这里就不演示了.

实例的启停,前面出现过.这里在说一下吧.

db2start,db2stop.

如果实例停止不了.使用db2stop force


设置实例,比如我这台机器有很多实例.我想使用其中一个或者查看当前使用的哪个实例怎么办呢?

db2 get instance闪亮登场啦.

set instance=db2_test设置实例


删除实例

db2idrop (删除时别忘记停止db2喔!!!)


如何查看实例参数呢?

db2 get dbm cfg

以下是我的

[db2_test@localhost ~]$ db2 get dbm cfg


          Database Manager Configuration


     Node type = Enterprise Server Edition with local and remote clients


 Database manager configuration release level            = 0x0d00


 CPU speed (millisec/instruction)             (CPUSPEED) = 1.491821e-06
 Communications bandwidth (MB/sec)      (COMM_BANDWIDTH) = 1.000000e+02


 Max number of concurrently active databases     (NUMDB) = 8
 Federated Database System Support           (FEDERATED) = NO
 Transaction processor monitor name        (TP_MON_NAME) = 


 Default charge-back account           (DFT_ACCOUNT_STR) = 


 Java Development Kit installation path       (JDK_PATH) = /home/db2_test/sqllib/java/jdk64


 Diagnostic error capture level              (DIAGLEVEL) = 3
 Notify Level                              (NOTIFYLEVEL) = 3
 Diagnostic data directory path               (DIAGPATH) = /home/db2_test/sqllib/db2dump/
 Alternate diagnostic data directory path (ALT_DIAGPATH) = 
 Size of rotating db2diag & notify logs (MB)  (DIAGSIZE) = 0


 Default database monitor switches
   Buffer pool                         (DFT_MON_BUFPOOL) = OFF
   Lock                                   (DFT_MON_LOCK) = OFF
   Sort                                   (DFT_MON_SORT) = OFF
   Statement                              (DFT_MON_STMT) = OFF
   Table                                 (DFT_MON_TABLE) = OFF
   Timestamp                         (DFT_MON_TIMESTAMP) = ON
   Unit of work                            (DFT_MON_UOW) = OFF
 Monitor health of instance and databases   (HEALTH_MON) = ON


 SYSADM group name                        (SYSADM_GROUP) = DB2_TEST
 SYSCTRL group name                      (SYSCTRL_GROUP) = 
 SYSMAINT group name                    (SYSMAINT_GROUP) = 
 SYSMON group name                        (SYSMON_GROUP) = 


 Client Userid-Password Plugin          (CLNT_PW_PLUGIN) = 
 Client Kerberos Plugin                (CLNT_KRB_PLUGIN) = 
 Group Plugin                             (GROUP_PLUGIN) = 
 GSS Plugin for Local Authorization    (LOCAL_GSSPLUGIN) = 
 Server Plugin Mode                    (SRV_PLUGIN_MODE) = UNFENCED
 Server List of GSS Plugins      (SRVCON_GSSPLUGIN_LIST) = 
 Server Userid-Password Plugin        (SRVCON_PW_PLUGIN) = 
 Server Connection Authentication          (SRVCON_AUTH) = NOT_SPECIFIED
 Cluster manager                           (CLUSTER_MGR) = 


 Database manager authentication        (AUTHENTICATION) = SERVER
 Alternate authentication           (ALTERNATE_AUTH_ENC) = NOT_SPECIFIED
 Cataloging allowed without authority   (CATALOG_NOAUTH) = NO
 Trust all clients                      (TRUST_ALLCLNTS) = YES
 Trusted client authentication          (TRUST_CLNTAUTH) = CLIENT
 Bypass federated authentication            (FED_NOAUTH) = NO


 Default database path                       (DFTDBPATH) = /home/db2_test


 Database monitor heap size (4KB)          (MON_HEAP_SZ) = AUTOMATIC(90)
 Java Virtual Machine heap size (4KB)     (JAVA_HEAP_SZ) = 2048
 Audit buffer size (4KB)                  (AUDIT_BUF_SZ) = 0
 Size of instance shared memory (4KB)  (INSTANCE_MEMORY) = AUTOMATIC(94209)
 Agent stack size                       (AGENT_STACK_SZ) = 1024
 Sort heap threshold (4KB)                  (SHEAPTHRES) = 0


 Directory cache support                     (DIR_CACHE) = YES


 Application support layer heap size (4KB)   (ASLHEAPSZ) = 15
 Max requester I/O block size (bytes)         (RQRIOBLK) = 32767
 Workload impact by throttled utilities(UTIL_IMPACT_LIM) = 10


 Priority of agents                           (AGENTPRI) = SYSTEM
 Agent pool size                        (NUM_POOLAGENTS) = AUTOMATIC(100)
 Initial number of agents in pool       (NUM_INITAGENTS) = 0
 Max number of coordinating agents     (MAX_COORDAGENTS) = AUTOMATIC(200)
 Max number of client connections      (MAX_CONNECTIONS) = AUTOMATIC(MAX_COORDAGENTS)


 Keep fenced process                        (KEEPFENCED) = YES
 Number of pooled fenced processes         (FENCED_POOL) = AUTOMATIC(MAX_COORDAGENTS)
 Initial number of fenced processes     (NUM_INITFENCED) = 0


 Index re-creation time and redo index build  (INDEXREC) = RESTART


 Transaction manager database name         (TM_DATABASE) = 1ST_CONN
 Transaction resync interval (sec)     (RESYNC_INTERVAL) = 180


 SPM name                                     (SPM_NAME) = localho1
 SPM log size                          (SPM_LOG_FILE_SZ) = 256
 SPM resync agent limit                 (SPM_MAX_RESYNC) = 20
 SPM log path                             (SPM_LOG_PATH) = 


 TCP/IP Service name                          (SVCENAME) = 
 Discovery mode                               (DISCOVER) = SEARCH
 Discover server instance                (DISCOVER_INST) = ENABLE


 SSL server keydb file                   (SSL_SVR_KEYDB) = 
 SSL server stash file                   (SSL_SVR_STASH) = 
 SSL server certificate label            (SSL_SVR_LABEL) = 
 SSL service name                         (SSL_SVCENAME) = 
 SSL cipher specs                      (SSL_CIPHERSPECS) = 
 SSL versions                             (SSL_VERSIONS) = 
 SSL client keydb file                  (SSL_CLNT_KEYDB) = 
 SSL client stash file                  (SSL_CLNT_STASH) = 


 Maximum query degree of parallelism   (MAX_QUERYDEGREE) = ANY
 Enable intra-partition parallelism     (INTRA_PARALLEL) = NO


 Maximum Asynchronous TQs per query    (FEDERATED_ASYNC) = 0


 No. of int. communication buffers(4KB)(FCM_NUM_BUFFERS) = AUTOMATIC(4096)
 No. of int. communication channels   (FCM_NUM_CHANNELS) = AUTOMATIC(2048)
 Node connection elapse time (sec)         (CONN_ELAPSE) = 10
 Max number of node connection retries (MAX_CONNRETRIES) = 5
 Max time difference between nodes (min) (MAX_TIME_DIFF) = 60


 db2start/db2stop timeout (min)        (START_STOP_TIME) = 10


db2的实例先写到这里吧..das我也没写呢..我还饿着肚子呢..^_^






原创粉丝点击