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

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.

主站蜘蛛池模板: 太白县| 桃江县| 九龙城区| 元江| 麟游县| 昌平区| 漠河县| 福安市| 濮阳县| 沙田区| 霍林郭勒市| 东莞市| 高台县| 永胜县| 夏津县| 金山区| 枣庄市| 齐河县| 安化县| 彭泽县| 屏东市| 南皮县| 三台县| 漯河市| 昌黎县| 南宫市| 伊川县| 孟村| 淮北市| 滨海县| 开平市| 石林| 徐汇区| 延寿县| 东方市| 尼勒克县| 潍坊市| 大渡口区| 保德县| 耿马| 宜城市|