官术网_书友最值得收藏!

Starting and stopping instances

There are several situations in which an instance must be stopped and started, for example, after you change some parameters that are not dynamic, or after applying a fixpack.

Getting ready

We have, at disposal, a couple of different ways to start or stop an instance. We can use, say, db2start for starting and db2stop for stopping; these commands are available for execution in the command line or from DB2 CLI. We can also start or stop an instance from the Control Center. In Windows, you can also start and stop an instance by starting and stopping the service associated with it.

How to do it...

  1. The current instance is set by the environment variable DB2INSTANCE or the global registry variable DB2INSTDEF, in case DB2INSTANCE is not set. This is applicable mostly for Microsoft Windows platforms where there could be more than one instance per user.
    • On Microsoft Windows:
      C:\Documents and Settings>db2ilist DB2_02 DB2WIN C:\Documents and Settings>set DB2INSTANCE DB2INSTANCE=DB2_02
      
    • Now, if we issue db2stop or db2start, only instance DB2_02 will be affected.
      • On our Linux server nodedb21:
        [db2inst1@nodedb21 ~]$ echo $DB2INSTANCE db2inst1
        
  2. As the db2inst1 instance owner, stop instance db2inst1 with the db2stop command, and start it with db2start:
    [db2inst1@nodedb21 ~]$ db2stop 06/09/2011 17:55:21 0 0 SQL1064N DB2STOP processing was successful. SQL1064N DB2STOP processing was successful. [db2inst1@nodedb21 ~]$ db2start 06/09/2011 17:55:29 0 0 SQL1063N DB2START processing was successful. SQL1063N DB2START processing was successful.
    
  3. As the multipartitioned instance owner db2instp, stop instance db2instp with the db2stop command, and start it with db2start:
    [db2instp@nodedb21 sqllib]$ db2stop 06/09/2011 19:03:47 1 0 SQL1064N DB2STOP processing was successful. 06/09/2011 19:03:48 0 0 SQL1064N DB2STOP processing was successful. 06/09/2011 19:03:49 2 0 SQL1064N DB2STOP processing was successful. SQL1064N DB2STOP processing was successful. [db2instp@nodedb21 sqllib]$ db2start 06/09/2011 19:04:02 1 0 SQL1063N DB2START processing was successful. 06/09/2011 19:04:06 2 0 SQL1063N DB2START processing was successful. 06/09/2011 19:04:06 0 0 SQL1063N DB2START processing was successful. SQL1063N DB2START processing was successful.
    
  4. Using the Control Center, right-click on db2inst1 and issue stop and start.

How it works...

In the process of starting an instance, memory structures are allocated and the instance starts listening for connections on the ports assigned by the SVCENAME database manager configuration parameter. At stop, existing connections are disconnected and memory is deallocated.

There's more...

Other options that can be used to start and stop an instance are the DB2 CLI commands, START DATABASE MANAGER and STOP DATABASE MANAGER. For Windows, we have as alternate option to start or stop the service associated with the instance. To set the instance for automatic start on Linux or Unix, at system boot, you can use the instance-level registry variable DB2AUTOSTART=YES or the db2iauto on <instance name> command.

主站蜘蛛池模板: 鹤岗市| 六盘水市| 太湖县| 兰考县| 托里县| 盱眙县| 岳池县| 墨江| 镇远县| 交城县| 洛阳市| 当涂县| 葵青区| 宜黄县| 保山市| 冀州市| 乌什县| 荃湾区| 奎屯市| 应用必备| 车致| 玉林市| 白朗县| 佛坪县| 黑山县| 墨竹工卡县| 景洪市| 寿光市| 诏安县| 繁昌县| 河津市| 康保县| 虎林市| 商丘市| 徐汇区| 五家渠市| 玛曲县| 南丰县| 金秀| 井冈山市| 方城县|