IBM Books

Administrative API Reference

sqledrpd - 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 API affects all nodes that are listed in the $HOME/sqllib/db2nodes.cfg file.

Authorization

One of the following:

Required Connection

Instance. It is not necessary to call ATTACH before dropping a remote database. If the database is cataloged as remote, an instance attachment to the remote node is established for the duration of the call.

Version

sqlenv.h

C API Syntax



/* File: sqlenv.h */
/* API: Drop Database */
/* ... */
SQL_API_RC SQL_API_FN
  sqledrpd (
    _SQLOLDCHAR * pDbAlias,
    struct sqlca * pSqlca);
/* ... */
 

Generic API Syntax



/* File: sqlenv.h */
/* API: Drop Database */
/* ... */
SQL_API_RC SQL_API_FN
  sqlgdrpd (
    unsigned short Reserved1,
    unsigned short DbAliasLen,
    struct sqlca * pSqlca,
    _SQLOLDCHAR * pReserved2,
    _SQLOLDCHAR * pDbAlias);
/* ... */
 

API Parameters

Reserved1
Reserved for future use.

DbAliasLen
Input. A 2-byte unsigned integer representing the length in bytes of the database alias.

pSqlca
Output. A pointer to the sqlca structure. For more information about this structure, see SQLCA.

pReserved2
A spare pointer that is set to null or points to zero. Reserved for future use.

pDbAlias
Input. A string containing the alias of the database to be dropped. This name is used to reference the actual database name in the system database directory.

REXX API Syntax



DROP DATABASE dbalias

REXX API Parameters

dbalias
The alias of the database to be dropped.

Sample Programs

C
\sqllib\samples\c\dbconf.sqc

COBOL
\sqllib\samples\cobol\dbconf.sqb

FORTRAN
\sqllib\samples\fortran\dbconf.sqf

REXX
\sqllib\samples\rexx\dbconf.cmd

Usage Notes

sqledrpd 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 calling this API.

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 this API is called 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 API 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 API is called, all the DB2 Data Links Managers configured to that database must be available; otherwise, the drop database operation will fail.

See Also

sqlecadb - Catalog Database

sqlecrea - Create Database

sqlecran - Create Database at Node

sqledpan - Drop Database at Node

sqleuncd - Uncatalog Database.


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

[ DB2 List of Books | Search the DB2 Books ]