- IBM DB2 9.7 Advanced Administration Cookbook
- Adrian Neagu Robert Pelletier
- 368字
- 2021-08-20 15:33:21
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...
- 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 =
- 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.
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.
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
- Chapter 7,DB2 Backup and Recovery
- 大學計算機基礎(第二版)
- Modular Programming with Python
- OpenCV實例精解
- C#程序設計(慕課版)
- 基于差分進化的優化方法及應用
- Java:Data Science Made Easy
- Mastering Yii
- Quarkus實踐指南:構建新一代的Kubernetes原生Java微服務
- Getting Started with Greenplum for Big Data Analytics
- JavaScript應用開發實踐指南
- Java Web開發實例大全(基礎卷) (軟件工程師開發大系)
- WCF技術剖析(卷1)
- 零基礎C語言學習筆記
- Mastering Machine Learning with scikit-learn
- LabVIEW數據采集(第2版)