C:\Documents and Settings\Administrator>db2start
INST : 服务已返回特定的服务错误码。

SQL1220N  不能分配数据库管理器共享内存集。

C:\Documents and Settings\Administrator>db2sampl

  Starting the DB2 instance...
  Creating database "SAMPLE"...
  Attempt to create the database "SAMPLE" failed.
  SQL1032N  未发出启动数据库管理器的命令。  SQLSTATE=57019


  'db2sampl' processing complete.


C:\Documents and Settings\Administrator>db2 get dbm cfg

          数据库管理器配置

     节点类型                                            = 带有本地和远程客户机
的数据库服务器

 数据库管理器配置发行版级别                              = 0x0c00

 最大打开文件数                            (MAXTOTFILOP) = 16000
 CPU 速度(毫秒/指令)                       (CPUSPEED) = 3.700030e-007

 最大并发活动数据库数                            (NUMDB) = 8
 联合数据库系统支持                          (FEDERATED) = NO
 事务处理器监视器名                        (TP_MON_NAME) =

 缺省对方付费帐户                      (DFT_ACCOUNT_STR) =

 Java Development Kit 安装路径(JDK_PATH)               = C:\DB2V95\java\jdk

 诊断错误捕获级别                            (DIAGLEVEL) = 3
 通知级别                                  (NOTIFYLEVEL) = 3
 诊断数据目录路径                             (DIAGPATH) =

 缺省数据库监视开关
   缓冲池                              (DFT_MON_BUFPOOL) = OFF
   锁定                                   (DFT_MON_LOCK) = OFF
   排序                                   (DFT_MON_SORT) = OFF
   语句                                   (DFT_MON_STMT) = OFF
   表                                    (DFT_MON_TABLE) = OFF
   时间戳记                          (DFT_MON_TIMESTAMP) = ON
   工作单元                                (DFT_MON_UOW) = OFF
 监视实例和数据库的运行状况                 (HEALTH_MON) = ON

 SYSADM 组名                              (SYSADM_GROUP) =
 SYSCTRL 组名                            (SYSCTRL_GROUP) =
 SYSMAINT 组名                          (SYSMAINT_GROUP) =
 SYSMON 组名                              (SYSMON_GROUP) =

 客户机用户标识-密码插件                (CLNT_PW_PLUGIN) =
 客户机 Kerberos 插件                  (CLNT_KRB_PLUGIN) = IBMkrb5
 组插件                                   (GROUP_PLUGIN) =
 本地授权的 GSS 插件                   (LOCAL_GSSPLUGIN) =
 服务器插件方式                        (SRV_PLUGIN_MODE) = UNFENCED
 GSS 插件的服务器列表            (SRVCON_GSSPLUGIN_LIST) =
 服务器用户标识-密码插件              (SRVCON_PW_PLUGIN) =
 服务器连接认证                            (SRVCON_AUTH) = NOT_SPECIFIED
 集群管理器                                (CLUSTER_MGR) =

 数据库管理器认证                       (AUTHENTICATION) = SERVER
 没有权限就允许编目                     (CATALOG_NOAUTH) = NO
 信赖所有客户机                         (TRUST_ALLCLNTS) = YES
 可信的客户机认证                       (TRUST_CLNTAUTH) = CLIENT
 绕过联合认证                               (FED_NOAUTH) = NO

 缺省数据库路径                              (DFTDBPATH) = C:

 数据库监视器堆大小(4KB)                 (MON_HEAP_SZ) = 66
 “Java 虚拟机”堆大小(4KB)             (JAVA_HEAP_SZ) = 512
 审计缓冲区大小(4KB)                    (AUDIT_BUF_SZ) = 0
 实例共享内存(4KB)的大小             (INSTANCE_MEMORY) = 6596
 备份缓冲区缺省大小(4KB)                   (BACKBUFSZ) = 1024
 复原缓冲区缺省大小(4KB)                   (RESTBUFSZ) = 1024

 代理程序的堆栈大小                     (AGENT_STACK_SZ) = 16
 最小已落实专用内存(4KB)                (MIN_PRIV_MEM) = 32
 专用内存阈值(4KB)                   (PRIV_MEM_THRESH) = 20000

 排序堆阈值(4KB)                          (SHEAPTHRES) = 10000

 目录高速缓存支持                            (DIR_CACHE) = YES

 应用程序支持层堆大小(4KB)                 (ASLHEAPSZ) = 15
 最大请求者 I/O 块大小(以字节计)            (RQRIOBLK) = 32767
 查询堆大小(4KB)                       (QUERY_HEAP_SZ) = 1000

 已调速实用程序对工作负载的影响        (UTIL_IMPACT_LIM) = 10

 代理程序的优先级                             (AGENTPRI) = SYSTEM
 代理程序池大小                         (NUM_POOLAGENTS) = 100
 池中的初始代理程序数                   (NUM_INITAGENTS) = 0
 最大协调代理程序数                    (MAX_COORDAGENTS) = AUTOMATIC
 最大客户机连接数                      (MAX_CONNECTIONS) = AUTOMATIC

 保留受防护的进程                           (KEEPFENCED) = YES
 合用受防护的进程的数目                    (FENCED_POOL) = MAX_COORDAGENTS
 受防护的进程的初始数目                 (NUM_INITFENCED) = 0

 索引重新创建时间和重做索引构建               (INDEXREC) = RESTART

 事务管理器数据库名称                      (TM_DATABASE) = 1ST_CONN
 事务再同步时间间隔(秒)              (RESYNC_INTERVAL) = 180

 SPM 名称                                     (SPM_NAME) = IBM_8903
 SPM 日志大小                          (SPM_LOG_FILE_SZ) = 256
 SPM 再同步代理程序限制                 (SPM_MAX_RESYNC) = 20
 SPM 日志路径                             (SPM_LOG_PATH) =

 NetBIOS 工作站名                                (NNAME) =

 TCP/IP 服务名称                              (SVCENAME) =
 发现方式                                     (DISCOVER) = SEARCH
 发现服务器实例                          (DISCOVER_INST) = ENABLE

 最大查询并行度                        (MAX_QUERYDEGREE) = ANY
 启用分区内并行性                       (INTRA_PARALLEL) = NO

 内部通信缓冲区数(4KB)               (FCM_NUM_BUFFERS) = 4096
 内部通信信道数                       (FCM_NUM_CHANNELS) = AUTOMATIC
 db2start/db2stop 超时(分钟)         (START_STOP_TIME) = 10

C:\Documents and Settings\Administrator>db2 update dbm cfg using INSTANCE_MEMORY AUTOMATIC
DB20000I  UPDATE DATABASE MANAGER CONFIGURATION命令成功完成。

C:\Documents and Settings\Administrator>db2start
SQL5043N  对一个或多个通信协议的支持未能成功启动。但是,成功启动了核心数据库管理
器功能。


C:\Documents and Settings\Administrator>db2stop
SQL1064N  DB2STOP 处理成功。

C:\Documents and Settings\Administrator>db2start
SQL5043N  对一个或多个通信协议的支持未能成功启动。但是,成功启动了核心数据库管理
器功能。

新的问题又出现了:SQL5043N  对一个或多个通信协议的支持未能成功启动。
但是可以正常本地使用,比如建sample数据库,连接都没有问题。
C:\Documents and Settings\Administrator>db2sampl

  Creating database "SAMPLE"...
  Connecting to database "SAMPLE"...
  Creating tables and data in schema "AUGUST"...
  Creating tables with XML columns and XML data in schema "AUGUST"...

  'db2sampl' processing complete.
 
C:\Documents and Settings\Administrator>db2 connect to sample

   数据库连接信息

 数据库服务器         = DB2/NT 9.5.0
 SQL 授权标识         = AUGUST
 本地数据库别名       = SAMPLE

C:\Documents and Settings\Administrator>db2set -all
[e] DB2PATH=C:\DB2V95
[i] DB2ACCOUNTNAME=IBM-89038EED479\db2admin
[i] DB2INSTOWNER=IBM-89038EED479
[i] DB2PORTRANGE=60000:60003
[i] DB2INSTPROF=C:\Documents and Settings\All Users\Application Data\IBM\DB2\DB2COPY1
[i] DB2COMM=TCPIP
[g] DB2_EXTSECURITY=NO
[g] DB2SYSTEM=YFZHANG
[g] DB2PATH=C:\DB2V95
[g] DB2ADMINSERVER=DB2DAS00


怎么解决 SQL5043N 呢?要确保两点,即文中蓝色的部分要注意:
1)DB2COMM要设置TCPIP
2)SVCENAME要设置正确。
通过 db2 get dbm cfg我们可以看到 SEVCNAME是空的,所以进行设置。它的值应该是db2c_DB2,可以在 services 文件中找到。Windows中该文件位于: WINDOWS\system32\drivers\etc,the UNIX services file is located at /etc/services

下面是设置方法,可以看到db2start执行后没有任何错误了。

C:\Documents and Settings\Administrator>db2 update dbm cfg using SVCENAME db2c_D
B2
DB20000I  UPDATE DATABASE MANAGER CONFIGURATION命令成功完成。

C:\Documents and Settings\Administrator>db2stop
SQL1064N  DB2STOP 处理成功。

C:\Documents and Settings\Administrator>db2start
SQL1063N  DB2START 处理成功。

C:\Documents and Settings\Administrator>