Activates the specified database and starts up all necessary database services, so that the database is available for connection and use by any application.
Scope
This API activates the specified database on all nodes within the system. If one or more of these nodes encounters an error during activation of the database, a warning is returned. The database remains activated on all nodes on which the API has succeeded.
Note: | If it is the coordinator node or the catalog node that encounters the error, the API returns a negative sqlcode, and the database will not be activated on any node. |
Authorization
One of the following:
Required Connection
None. Applications invoking ACTIVATE DATABASE cannot have any existing database connections.
Version
sqlenv.h
C API Syntax
/* File: sqlenv.h */ /* API: Activate Database */ /* ... */ SQL_API_RC SQL_API_FN sqle_activate_db ( char * pDbAlias, char * pUserName, char * pPassword, void * pReserved, struct sqlca * pSqlca); /* ... */ |
Generic API Syntax
/* File: sqlenv.h */ /* API: Activate Database */ /* ... */ SQL_API_RC SQL_API_FN sqlg_activate_db ( unsigned short DbAliasLen, unsigned short UserNameLen, unsigned short PasswordLen, char * pDbAlias, char * pUserName, char * pPassword, void * pReserved, struct sqlca * pSqlca); /* ... */ |
API Parameters
REXX API Syntax
This API can be called from REXX through the SQLDB2 interface. See How the API Descriptions are Organized, or the Application Development Guide. For a description of the syntax, see the Command Reference.
Usage Notes
If a database has not been started, and a DB2 CONNECT TO (or an implicit connect) is encountered in an application, the application must wait while the database manager starts up the required database. In such cases, this first application spends time on database initialization before it can do any work. However, once the first application has started a database, other applications can simply connect and use it.
Database administrators can use ACTIVATE DATABASE to start up selected databases. This eliminates any application time spent on database initialization.
Databases initialized by ACTIVATE DATABASE can only be shut down by sqle_deactivate_db - Deactivate Database, or by sqlepstp - Stop Database Manager. To obtain a list of activated databases, call db2GetSnapshot - Get Snapshot.
If a database was started by a DB2 CONNECT TO (or an implicit connect) and subsequently an ACTIVATE DATABASE is issued for that same database, then DEACTIVATE DATABASE must be used to shut down that database.
ACTIVATE DATABASE behaves in a similar manner to a DB2 CONNECT TO (or an implicit connect) when working with a database requiring a restart (for example, database in an inconsistent state). The database will be restarted before it can be initialized by ACTIVATE DATABASE.
See Also
sqle_deactivate_db - Deactivate Database.