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

Dropping instances


There could be situations when it is necessary to drop an instance. An instance might be dropped by using the db2idrop command.

Getting ready

In this recipe, we will drop the instance db2inst2, created previously.

How to do it...

  1. The command for dropping an instance is db2idrop. You have to be user root to drop an instance. First, we need to ensure that the instance is not active. If the instance has active connections and it is active, the db2idrop command fails.

  2. Stop the instance by force:

    	[db2inst2@nodedb21 ~]$ db2stop force
    	07/12/2011 16:38:27     0   0   SQL1064N  DB2STOP processing was successful.
    	SQL1064N  DB2STOP processing was successful.
    	[db2inst2@nodedb21 ~]$
    

    Note

    If the instance hangs for some reason, the db2_kill command might be used. It will bring down the instance abruptly. However, be careful running this, because your databases running under this instance remain in an inconsistent mode.

  3. As the user root, issue the following command to drop db2inst2:

    	[root@nodedb21 ~]# /opt/ibm/db2/V9.7/instance/db2idrop db2inst2
    	DBI1070I  Program db2idrop completed successfully.
    

How it works...

On Linux and Unix, db2idrop actually deletes the sqllib directory from the instance owner home. Therefore, it is recommended to save anything you have placed in this directory such as UDFs or external programs.

On Windows, db2idrop removes the service associated with the instance.

There's more…

As a best practice, before the instance is dropped, it is recommended to save the information related to that instance in a server profile file. In case you plan to recreate the instance and configure it as before, you can simply import the server profile after the instance is created again.

To export the instance profile, use Control Center | Tools | Configuration assistant | Export profile | Customize.

In the Export tab, you have plenty of options to export; choose anything you consider worth being saved.