- 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
- 企業(yè)級(jí)Java EE架構(gòu)設(shè)計(jì)精深實(shí)踐
- Web交互界面設(shè)計(jì)與制作(微課版)
- Mastering Spring MVC 4
- Unity Virtual Reality Projects
- VMware虛擬化技術(shù)
- RISC-V體系結(jié)構(gòu)編程與實(shí)踐(第2版)
- RubyMotion iOS Develoment Essentials
- Neo4j 3.x入門(mén)經(jīng)典
- HTML5與CSS3權(quán)威指南
- 啊哈C語(yǔ)言!:邏輯的挑戰(zhàn)(修訂版)
- Java Web動(dòng)態(tài)網(wǎng)站開(kāi)發(fā)(第2版·微課版)
- 數(shù)據(jù)庫(kù)技術(shù)及應(yīng)用教程上機(jī)指導(dǎo)與習(xí)題(第2版)
- Responsive Web Design with HTML5 and CSS3(Second Edition)
- ASP.NET開(kāi)發(fā)技巧精講
- Visual C++ 2017網(wǎng)絡(luò)編程實(shí)戰(zhàn)