DB2 Version 9.7 for Linux, UNIX, and Windows

sqle_deactivate_db API - Deactivate database

Stops the specified database.

Scope

In a partitioned database environment, this API deactivates the specified database on all database partition servers. If one or more of these database partition servers encounters an error, a warning is returned. The database will be successfully deactivated on some database partition servers, but may remain activated on the database partition servers encountering the error.

Note: If it is the coordinator partition or the catalog partition that encounters the error, the API returns a negative sqlcode, and the database will not be reactivated on any database partition server on which it was deactivated.

Authorization

One of the following:
  • sysadm
  • sysctrl
  • sysmaint

Required connection

None. Applications invoking DEACTIVATE DATABASE cannot have any existing database connections.

API include file

sqlenv.h

API and data structure syntax

SQL_API_RC SQL_API_FN
  sqle_deactivate_db (
        char * pDbAlias,
        char * pUserName,
        char * pPassword,
        void * pReserved,
        struct sqlca * pSqlca);

SQL_API_RC SQL_API_FN
  sqlg_deactivate_db (
        unsigned short DbAliasLen,
        unsigned short UserNameLen,
        unsigned short PasswordLen,
        char * pDbAlias,
        char * pUserName,
        char * pPassword,
        void * pReserved,
        struct sqlca * pSqlca);

sqle_deactivate_db API parameters

pDbAlias
Input. Pointer to the database alias name.
pUserName
Input. Pointer to the user ID stopping the database. Can be NULL.
pPassword
Input. Pointer to the password for the user name. Can be NULL, but must be specified if a user name is specified.
pReserved
Reserved for future use.
pSqlca
Output. A pointer to the sqlca structure.

sqlg_deactivate_db API-specific parameters

DbAliasLen
Input. A 2-byte unsigned integer representing the length of the database alias name in bytes.
UserNameLen
Input. A 2-byte unsigned integer representing the length of the user name in bytes. Set to zero if no user name is supplied.
PasswordLen
Input. A 2-byte unsigned integer representing the length of the password in bytes. Set to zero if no password is supplied.

Usage notes

Databases initialized by ACTIVATE DATABASE can only be shut down by DEACTIVATE DATABASE. db2InstanceStop automatically stops all activated databases before stopping the database manager. If a database was initialized by ACTIVATE DATABASE, the last DB2 CONNECT RESET statement (counter equal 0) will not shut down the database; DEACTIVATE DATABASE must be used.

REXX API syntax

This API can be called from REXX through the SQLDB2 interface.