The dbfhadmin Command Line Utility

Use the dbfhadmin command-line tool to recover resources from region, cross-region, and datastore databases in the event of a system failure. You can also use it to ensure that the database column used for primary and alternate indexed keys are set to the correct SQL type.

Note: You must run the command from an environment where the MFDBFH_CONFIG variable points to a configuration file that contains data source entries for the databases to be administered.

Syntax:

dbfhadmin [action][options] 
Note: On UNIX platforms, the command is dbfhadmin32 or dbfhadmin64, depending on your working mode.
Actions
Refer to the running of the command as a whole:
  • -casprocess - list or recover resources in CAS processes.
  • -createdb - create a database.
    Warning: This option is not supported for the creation of Oracle databases.
  • -diags - generate a diagnostics file containing details of the region and cross-region databases, the database configuration file contents, and the table contents of the cross-region database and region databases.[7]
  • -keytypes - list, add, delete, import, or export key type metadata.
  • -openfiles - list files or close open files in a datastore.
  • -region - list or recover region resources. You may be required to free locked resources using this method if the automated recovery process has been unable to - console log error messages may indicate when this has been the case.
  • -script - generate an SQL script for creating databases.
  • -upgrade - generate an SQL script for upgrading datastores. Datastores are automatically updated from time to time (for example, when structural changes are required). Sometimes, these automatic updates fail (usually as the result of insufficient database permissions), and therefore must be rerun manually. This option generates the script file required to run the manual update. Once you have the required file, you should run it with sysadmin privileges, using the command-line tool appropriate for your database type.
  • -verify - list or recover the integrity of a datastore/region and cross-region database.
Options
Defines the options for the specified action. Valid values are:
-add
Specifies that keytype metadata is added or updated for a particular datastore. Use with the -keytypes action.
-collation:<id>
The collation type used when creating a Db2 database. The default is SYSTEM_1252_US for Windows, and SYSTEM_923_US for UNIX/Linux. Use with the -script -provider:db2 action/option.
-configfile:<name>
The path and file name of the database configuration file. This is optional if the MFDBFH_CONFIG environment variable is already in effect, but if set, will override the value of the MFDBFH_CONFIG. [10]
-datastore:<url>
The URL of the datastore from which you want to list or recover files from. Use with the -openfiles, -upgrade, and the -keytypes -import/-export action/options.
-db:<dbname>
Name of database to be created or used. Use with the -script -provider:db2|pg|ss action/option.
-delete
Specifies that keytype metadata is deleted for a particular datastore. Use with the -keytypes action.
-ebcdic
Creates a database with EBCDIC support. Use with the -createdb -provider:db2 action/option.
-existdb:<db-name>
Name of an existing physical database into which a datastore, region, or cross-region database is to be created. Use with the -script -provider:db2|pg|ss and the -createdb -provider:ora -script action/options.
Note: For Oracle databases, this option is mandatory, as MFDBFH will not create the specified database if its underlying physical database does not already exist.
-export:<file-name>
Specifies a file with which to export the keytype metadata for a particular datastore. Use with the -keytypes -datastore action/option.
-file:<url>
Specifies the datastore data file that you want to add keytype metadata to, or remove keytype metadata from. Use with the -keytypes -add/-delete action/options.
-file:<file-name>
Specifies the input file name for database creation, or the output file name for generated scripts or region diagnostics. Use with the -createdb action for input files, the -script or -upgrade actions for generated script files, or -diags -usedb:<instance> -name:<object-name> action/options for diagnostics files[7] .
-force
Forces closed an open file reguardless of its status. Use with the -openfiles -recover -pid action/options.[9]
-hex
Displays the name of the specified region in hexadecimal. Use with the -region -list -usedb:<dbname> -name:<region-name> action/options. [6]
-host:<name>
The host name targeted for process recovery, for forced file closure, or for PostgreSQL database creation. Use with the -casprocess -list/-recover, -openfiles -list/-recover, or -createdb -provider:pg actions/options.
-import:<file-name>
Specifies the file containing keytype metadata that is to be imported. Use with the -keytypes -datastore action/option.
The following example shows the required format for the import file, where file1.dat, located at the root of the datastore, has an alphanumeric primary key and a signed COMP-X first alternate key; file2.dat, located in the PAY1 sub-folder, has an alphanumeric primary key and first alternate key, and an unsigned COM-X second alternate key:
<?xml version="1.0" encoding="us-ascii" standalone="no"?>
<keytypes_definitions>
    <keytypes_definition filename="file1.dat" folder="/" types="AN,SCOMPX"/>
    <keytypes_definition filename="file2.dat" folder="/PAY1" types="AN,AN,UCOMPX"/>
</keytypes_definitions>
-list
Lists the results of the specified actions, for the specified database: -casprocess -list shows the active processes, -region -list -usedb:<dbname> shows region resource locks for a particular database, -openfiles -list -usedb:<dbname> shows the files currently open, or -verify -list -usedb:<dbname> shows the integrity of a datastore\region and cross-region database.
-name:<object-name>
The name of the datastore or region database script to be created, or region resource to be recovered. Use with the -script -type:datastore and -script -type:region actions/options, and the -region -list/recover action/options.
-nobanner
Synonym for -quiet
-password:<pwd>
The password used to connect to a database. Use with the -createdb -provider:az|pg|ss action/options.
-pid:<process-id>
The process ID applicable to the specified action. Use with the -casprocess -recover or -openfiles -recover actions/options.
-port:<number>
The port number required for PostgreSQL database creation. You are required to specify this when the database is using a non-default port number or is on a remote server. Use with the -createdb -provider:pg action/option.
-provider:<db-type>
The name of database provider for which the script is to be generated (-script), or database creation (-createdb). <db-type> can be one of:
db-type Description
az Azure SQL database
azuresqldb Azure SQL database
db2 Db2
ora Oracle
oracle Oracle
postgresql PostgreSQL
pg PostgreSQL
sqlserver Microsoft SQL Server
ss Microsoft SQL Server
-recover
Recovers the resources owned by a CAS process, closes open datastore files with a status of Inactive or In doubt (as indicated by -openfiles -list)[9], or repairs datastores\region and cross-region databases containing integrity issues. Use with the -casprocess, -region, -openfiles or -verify actions/options.
-regionid:<id>
Specifies a particular region within a PAC to recover - <id> is a PAC UUID, which you can locate by running dbfhadmin -casprocess -list. Use with the -casprocess -recover action/option. [10]
-replace
Replaces keytype metadata that already exists for files. Use with the -keytypes, -add, or -import actions/options.
-reset
Reset the status of a region database. Use with the -region -status action/option.
-status
List or reset the status of a region database. Use with the -region action.
-type:<script-type>
Specifies the type of database creation script, which can be one of: crossregion, datastore, datastore_funcs, or region. Use with the -script and (with the exception of datastore_funcs) the -createdb actions.
datastore_funcs is used for the creation of script files used to install external functions into a database; see Installing Database Server Functions.
-types:<key-types>
Defines the column types for a file's primary and alternate keys. Specify the key types as a comma-delimited list, using the following types:
Type Description
AN Alphanumeric
BIN Binary
SCOMPX Signed COMP-X
UCOMPX Unsigned COMP-X
Use with the -keytypes -add/-replace/-import/-export/-list action/options.
-usedb:<instance>
Use the specified database server instance. Use with the -casprocess -list/-recover, -createdb -provider:az|ss, -openfiles -list/-recover, or the -openfiles -list/-recover actions/options.
-user:<user-name>
The user name used to connect to a database. Use with the -createdb -provider:az|pg|ss action/options.
-verbose
Displays additional information, such as the database configuration file and script folder locations in effect, for the current operation.