DB2 Version 9.7 for Linux, UNIX, and Windows

ACTIVATE DATABASE command

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 command 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 command has succeeded.

Authorization

One of the following:
  • sysadm
  • sysctrl
  • sysmaint

Required connection

None

Command syntax

Read syntax diagramSkip visual syntax diagram
>>-ACTIVATE--+-DATABASE-+--database-alias----------------------->
             '-DB-------'                   

>--+-------------------------------------+---------------------><
   '-USER--username--+-----------------+-'   
                     '-USING--password-'     

Command parameters

database-alias
Specifies the alias of the database to be started.
USER username
Specifies the user starting the database.
USING password
Specifies the password for the user name.

Usage notes

If a database has not been started, and a CONNECT TO (or an implicit connect) is issued in an application, the application must wait while the database manager starts the required database, before it can do any work with that database. However, once the database is started, other applications can simply connect and use it without spending time on its start up.

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 be shut down using the DEACTIVATE DATABASE command, or using the db2stop command.

If a database was started by a 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. If ACTIVATE DATABASE was not used to start the database, the database will shut down when the last application disconnects.

ACTIVATE DATABASE behaves in a similar manner to a 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. Restart will only be performed if the database is configured to have AUTORESTART ON.

The application issuing the ACTIVATE DATABASE command cannot have an active database connection to any database.

The database can be inaccessible if the database was not explicitly activated, a client application performs frequent reconnections, or the time interval between issuing the DEACTIVATE DATABASE and ACTIVATE DATABASE commands is very short. Activate the database by issuing the ACTIVATE DATABASE command and then attempt to connect to the database.