IBM Books

Command Reference

DROP DATABASE

Deletes the database contents and all log files for the database, uncatalogs the database, and deletes the database subdirectory.

Scope

By default, this command affects all nodes that are listed in the db2nodes.cfg file.

Authorization

One of the following:

Required Connection

Instance. An explicit attachment is not required. If the database is listed as remote, an instance attachment to the remote node is established for the duration of the command.

Command Syntax

>>-DROP----+-DATABASE-+--database-alias----+----------+--------><
           '-DB-------'                    '-AT NODE--'
 

Command Parameters

DATABASE database-alias
Specifies the alias of the database to be dropped. The database must be cataloged in the system database directory.

AT NODE
Specifies that the database is to be deleted only on the node that issued the DROP DATABASE command. This parameter is used by utilities supplied with DB2 Universal Database Enterprise - Extended Edition, and is not intended for general use. Improper use of this parameter can cause inconsistencies in the system, so it should only be used with caution.

Examples

The following example deletes the database referenced by the database alias SAMPLE:

   db2 drop database sample

Usage Notes

DROP DATABASE deletes all user data and log files. If the log files are needed for a roll-forward recovery after a restore operation, the files should be saved prior to issuing this command.

The database must not be in use; all users must be disconnected from the database before the database can be dropped.

To be dropped, a database must be cataloged in the system database directory. Only the specified database alias is removed from the system database directory. If other aliases with the same database name exist, their entries remain. If the database being dropped is the last entry in the local database directory, the local database directory is deleted automatically.

If DROP DATABASE is issued from a remote client (or from a different instance on the same machine), the specified alias is removed from the client's system database directory. The corresponding database name is removed from the server's system database directory.

This command unlinks all files that are linked through any DATALINK columns. Since the unlink operation is performed asynchronously on the DB2 Data Links Manager, its effects may not be seen immediately on the DB2 Data Links Manager, and the unlinked files may not be immediately available for other operations. When the command is issued, all the DB2 Data Links Managers configured to that database must be available; otherwise, the drop database operation will fail.

See Also

CATALOG DATABASE

CREATE DATABASE

UNCATALOG DATABASE.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]