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

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.

主站蜘蛛池模板: 富宁县| 福泉市| 贵溪市| 安福县| 台江县| 崇明县| 密云县| 全州县| 陆良县| 巴林右旗| 深泽县| 安溪县| 湛江市| 林州市| 内黄县| 丰都县| 安顺市| 上饶县| 四平市| 乌兰察布市| 大关县| 收藏| 黑龙江省| 永德县| 瑞金市| 曲水县| 马山县| 康乐县| 班戈县| 满城县| 修水县| 获嘉县| 五莲县| 防城港市| 海兴县| 万盛区| 长治县| 巨野县| 鄢陵县| 安阳市| 隆德县|