Restarts a database that has been abnormally terminated and left in an inconsistent state. At the successful completion of this API, the application remains connected to the database if the user has CONNECT privilege.
Scope
This API affects only the node on which it is executed.
Authorization
None
Required Connection
This API establishes a database connection.
Version
db2ApiDf.h
C API Syntax
/* File: db2ApiDf.h */ /* API: Restart Database */ /* ... */ SQL_API_RC SQL_API_FN db2DatabaseRestart ( db2Uint32 versionNumber; void * pParamStruct; struct sqlca * pSqlca); typedef struct { char * piDatabaseName; char * piUserId; char * piPassword; char * piTablespaceNames; } db2RestartDbStruct; /* ... */ |
Generic API Syntax
/* File: db2ApiDf.h */ /* API: Restart Database */ /* ... */ SQL_API_RC SQL_API_FN db2DatabaseRestart ( db2Uint32 versionNumber; void * pParamStruct; struct sqlca * pSqlca); typedef struct { char * piDatabaseName; char * piUserId; char * piPassword; char * piTablespaceNames; } db2RestartDbStruct; /* ... */ |
API Parameters
REXX API Syntax
RESTART DATABASE database_alias [USER username USING password] |
REXX API Parameters
Usage Notes
Call this API if an attempt to connect to a database returns an error message, indicating that the database must be restarted. This action occurs only if the previous session with this database terminated abnormally (due to power failure, for example).
At the completion of this API, a shared connection to the database is maintained if the user has CONNECT privilege, and an SQL warning is issued if any indoubt transactions exist. In this case, the database is still usable, but if the indoubt transactions are not resolved before the last connection to the database is dropped, another call to the API must be completed before the database can be used again. Use the transaction APIs (see Appendix B, Transaction APIs) to generate a list of indoubt transactions. For more information about indoubt transactions, see the Administration Guide.
In the case of circular logging, a database restart operation will fail if there is any problem with the table spaces, such as an I/O error, an unmounted file system, and so on. If losing such table spaces is not an issue, their names can be explicitly specified; this will put them into drop pending state, and the restart operation can complete successfully.
See Also
CONNECT TO statement in the SQL Reference.