Book Image

IBM DB2 9.7 Advanced Administration Cookbook

Book Image

IBM DB2 9.7 Advanced Administration Cookbook

Overview of this book

IBM DB2 LUW is a leading relational database system developed by IBM. DB2 LUW database software offers industry leading performance, scale, and reliability on your choice of platform on various Linux distributions, leading Unix Systems like AIX, HP-UX and Solaris and MS Windows platforms. With lots of new features, DB2 9.7 delivers one the best relational database systems in the market. IBM DB2 9.7 Advanced Administration Cookbook covers all the latest features with instance creation, setup, and administration of multi-partitioned database. This practical cookbook provides step-by-step instructions to build and configure powerful databases, with scalability, safety and reliability features, using industry standard best practices. This book will walk you through all the important aspects of administration. You will learn to set up production capable environments with multi-partitioned databases and make the best use of hardware resources for maximum performance. With this guide you can master the different ways to implement strong databases with a High Availability architecture.
Table of Contents (21 chapters)
IBM DB2 9.7 Advanced Administration Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

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.