DROP DB2 Database

DROP DATABASE deletes all user data and log files, as well as any back/restore history for the database.

If the log files are needed for a roll-forward recovery after a restore operation, or the backup history

required to restore the database, these files should be saved prior to issuing this command.

$ db2 list db directory
System Database Directory
Number of entries in the directory =1
Database 1 entry:
Database alias                       = MYDB
Database name                        = MYDB
Local database directory             = /home/db2inst1/MYDB
Database release level               = d.00
Comment                              =
Directory entry type                 = Indirect
Catalog database partition number    = 0
Alternate server hostname            =
Alternate server port number         =

De careful and confirm before you drop the DB

Ensure that not applications are connected to the DB
Use $db2 list applications

To drop the Database “MYDB” Execute the db2 drop database command

[db2inst1@mercury adm]$ db2 drop database MYDB

To verify execute $ db2 list db directory

Leave a Reply

Your email address will not be published. Required fields are marked *