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

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

主站蜘蛛池模板: 金阳县| 封开县| 屏东县| 永康市| 南溪县| 迭部县| 沂水县| 新田县| 图木舒克市| 蛟河市| 象山县| 铜鼓县| 旌德县| 岢岚县| 南开区| 普洱| 仙桃市| 张家口市| 永寿县| 那坡县| 巴彦县| 加查县| 临澧县| 凤山市| 永修县| 洛隆县| 台州市| 剑河县| 德格县| 买车| 盖州市| 高要市| 新晃| 阜南县| 城口县| 闽侯县| 宁河县| 崇明县| 万宁市| 吴堡县| 九龙县|