
IBM DB2 9.7 Advanced Administration Cookbook

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.
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.
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
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.
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.
Using the Control Center, right-click on db2inst1
and issue stop and start.
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.
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.
Change the font size
Change margin width
Change background colour