Activates the specified database and starts up all associated database services, so that the database is available for connection and use by any application.
None. Applications invoking ACTIVATE DATABASE cannot have any existing database connections.
sqlenv.h
SQL_API_RC SQL_API_FN
db2ActivateDb (
db2Uint32 versionNumber,
void * pDB2ActivateDbStruct,
struct sqlca * pSqlca);
typedef SQL_STRUCTURE db2ActivateDbStruct
{
char * piDbAlias;
char * piUserName;
char * piPassword;
db2Uint32 iOptions;
} db2ActivateDbStruct;
This section provides an example of a database activation scenario. The following code block is a common body program that will be used for the database activation scenarios.
struct sqlca sqlca; // sqlca to carry the sqlcode
struct db2ActivateDbStruct activateDbStruct;
struct db2ActDeactMemberStruct memberList;
strcpy(activateDbStruct->piUserName, "USER1"); //local instance
The following activate API is shown common to the scenarios listed in the following examples:
db2ActivateDb( db2Version, &activateDbStruct, &sqlca );
activateDbStruct.iOptions = DB2_ACTDEACT_DB_GLOBAL;
activateDbStruct->piMemberList = NULL;
activateDbStruct.iOptions = DB2_ACTDEACT_DB_MEMBER;
activateDbStruct->piMemberList->numMembers = 1;
activateDbStruct->piMemberList->pMember[0] = 20;
Database administrators can use ACTIVATE DATABASE to start 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, or by db2InstanceStop. To obtain a list of activated databases, you may invoke the db2GetSnapshot. API
If a database was started by a DB2 CONNECT TO command (or by an implicit connect), and subsequently an ACTIVATE DATABASE is issued for that same database, then DEACTIVATE DATABASE must also be used to shut down that database.
See the autorestart configuration parameter for database connection behavior when the target database is in an inconsistent state.
This API can be called from REXX through the SQLDB2 interface.