Invoking Database Maintenance Using the Services API
Go Up to Invoking Service Tasks with isc_service_start( )
Contents
This section describes how to use isc_service_start()
to perform database validation, sweep garbage collection, and resolve limbo transactions. These tasks correspond to several of the options of the gfix
command-line utility.
Invoking a Database Validation Using the Services API
You can request a database validation with the cluster identifier isc_action_svc_repair
. Database validation scans internal data structures for specific types of corruption. In some cases, the validation operation can repair corruption.
The validation operation cannot guarantee to repair all cases of corruption. Do not rely on database validation as a disaster recovery policy in lieu of making regular backups of your database.
The following table lists arguments to isc_action_svc_repair
to validate a database:
Argument | Purpose | Argument length | Argument value |
---|---|---|---|
|
Path of the primary file of the database, from the server’s point of view |
2 bytes + string |
String |
|
The following value is a bitmask of |
4 bytes |
Bitmask |
|
Request read-only validation of the database, without correcting any problems; corresponds to |
— |
Bit |
|
Ignore all checksum errors; corresponds to |
— |
Bit |
|
Remove references to unavailable shadow files; corresponds to |
— |
Bit |
|
Mark corrupted records as unavailable, so subsequent operations skip them; corresponds to |
— |
Bit |
|
Locate and release pages that are allocated but unassigned to any data structures; corresponds to |
— |
Bit |
|
Check record and page structures, releasing unassigned record fragments; use with |
— |
Bit |
Invoking a Database Sweep Using the Services API
You can invoke a database sweep with the cluster identifier isc_action_svc_repair
. Sweeping attempts to scan the database for outdated record versions and mark them as free space. The following table lists arguments to isc_action_svc_repair
to sweep a database:
Argument | Purpose | Argument length | Argument value |
---|---|---|---|
|
Path of the primary file of the database, from the server’s point of view |
2 bytes + string |
String |
|
The following value is a bitmask of |
4 bytes |
Bitmask |
|
Request database sweep to mark outdated records as free space; corresponds to |
— |
Bit |
Resolving Limbo Transactions Using the Services API
You can list and correct transactions in a limbo state using the cluster identifier isc_action_svc_repair
.
Limbo transactions are the result of interruptions in the two-phase commit process of InterBase. Most client interfaces, including BDE and ODBC, do not exercise the two-phase commit or distributed transaction capabilities of InterBase, therefore applications using such client interfaces never create limbo transactions.
The following table lists arguments to isc_action_svc_repair
to resolve limbo transactions in a database:
Argument | Purpose | Argument length | Argument value |
---|---|---|---|
|
Path of the primary file of the database, from the point of view of the server. |
2 bytes + string |
String |
|
Request that the Services Manager commit the transactions that follow. |
— |
— |
|
Request that the Services Manager roll back the transactions that follow. |
— |
— |
|
Request that the Services Manager use automatic two-phase commit recovery on the specified transactions. |
— |
— |
|
Precedes a transaction ID number. |
4 bytes |
Unsigned long |