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

Dropping databases

Dropping a database is an easy task compared to Oracle. You select the database you want to drop, and all its objects, containers, and files will be deleted.

Getting ready

The database must not be used, so all users have to be disconnected. I recommend you take a backup at this point. For many reasons, it could have been the wrong database to drop.

How to do it...

  1. Select the database:

    Select the databases folder on the left pane of the control center; or, you can list databases:

    [db2inst1@nodedb21 ~]$ db2 list database directory System Database Directory Number of entries in the directory = 1 Database 1 entry: Database alias = NAV Database name = NAV Local database directory = /data/db2 Database release level = d.00 Comment = Aviation Geo Data Directory entry type = Indirect Catalog database partition number = 0 Alternate server hostname = Alternate server port number =
    
  2. Drop the database:

    Right-click on the NAV database, and then select Drop option. This will drop the database and remove it from the database directories, or, from the command line:

[db2inst1@nodedb21 ~]$ db2 drop database nav DB20000I The DROP DATABASE command completed successfully.

How it works...

Directory /db2inst1/NODE0000/NAV, relative to your storage path, is deleted with all files in it. In this case, /data/db2/db2inst1/NODE0000/NAV/*.* will be cleared.

There's more...

Let's review some precautions before dropping a database.

Backup history

Be aware that all logs files and backup history will be deleted. If you expect to be doing roll-forward recovery after a restore, make sure you save all necessary log files in a safe place. An added precaution would be to ensure the backup's integrity.

Keep safe

We recommend you set time aside for this type of operation and avoid any pressure. If someone asked you to drop a database, take your time to make sure it's the right one. Sometimes people refer to a database by its role or alias, so misunderstandings can occur.

The Control Center's GUI is easy to use, so a right-click can have disastrous results. I would prefer to drop a database from the command-line after making sure I'm connected to the right one.

See also

主站蜘蛛池模板: 桐梓县| 北流市| 江都市| 巴南区| 民县| 新沂市| 平远县| 德兴市| 苏州市| 南皮县| 杨浦区| 包头市| 武汉市| 赤壁市| 莆田市| 广汉市| 囊谦县| 荃湾区| 绍兴县| 秭归县| 泰来县| 建湖县| 焉耆| 卓尼县| 清苑县| 布尔津县| 浦城县| 扬州市| 寿阳县| SHOW| 安仁县| 隆林| 德江县| 平利县| 安丘市| 和龙市| 吉隆县| 天水市| 阿荣旗| 张北县| 拉萨市|