Examples of the dbfhadmin Command Line Utility

Attention: This feature is in Early Adopter Program (EAP) release status. We will continue the development of additional features and provide additional interfaces via patch updates and future releases. Please contact Micro Focus SupportLine if you require further clarification.
Note: On UNIX platforms, the command is dbfhadmin32 or dbfhadmin64, depending on your working mode.

CAS processes

Use the following commands to view the enterprise server processes that may be in error after an abnormal termination, and to recover such processes.

The following command lists the CAS processes still running for the svr-mydb database server instance on svr-01:

dbfhadmin -casprocess -list -usedb:svr-mydb -host:svr-01

The following command lists the CAS processes still running for the svr-mydb database server instance, on the host MYHOST:

dbfhadmin -casprocess -list -usedb:svr-mydb -host:MYHOST

The following command recovers the CAS process for process ID 12345, for the svr-mydb database server instance on svr-01:

dbfhadmin -casprocess -recover -usedb:svr-mydb -host:svr-01 -pid:12345

The following command recovers all CAS processes for the svr-mydb database server instance on svr-01:

dbfhadmin -casprocess -recover -usedb:svr-mydb -host:svr-01

Database creation

Use the following commands to create databases from a script file. Running these commands ahead of time ensures processing is not delayed when access is required and the databases are yet to be created.

The following command creates an ANSI-encoded MSSQL datastore database by running the mydb.sql script file:

dbfhadmin -createdb -file:mydb.sql -type:datastore -provider:ss

The following command creates an EBCDIC-encoded Db2 datastore database by running the mydb.sql script file:

dbfhadmin -createdb -file:mydb.sql -type:datastore -provider:db2 -ebcdic
The following command creates a PostgreSQL datastore database, on the MYREMOTEHOST server/port, by running the mypgdb.sql script file:
dbfhadmin -createdb -file:mypgdb.sql -type:datastore -provider:pg -host:MYREMOTEHOST -port:33445
[18]

Data files

Use the following commands to view data files still open after an abnormal termination of an enterprise server, and to recover/release them. Also, there are a number of commands to administer the column types of indexed keys.

The following command lists the data files still open for the VSAM datastore hosted on svr-mydb:

dbfhadmin -openfiles -list -datastore:sql://svr-mydb/VSAM -host:svr-01

The following command recovers the data files still open for the VSAM datastore hosted on svr-mydb:

dbfhadmin -openfiles -recover -datastore:sql://svr-mydb/VSAM -host:svr-01

The following command specifies that the column type for the primary key of the MYFILE.dat file is alphanumeric, and the column type for the first alternate key is signed COMP-X:

dbfhadmin -keytypes -add -file:sql://svr-mydb/VSAM/MYFILE.dat -types:AN,SCOMPX

The following command replaces existing key types for the specified data file:

dbfhadmin -keytypes -add -replace -file:sql://svr-mydb/VSAM/MYFILE.dat -types:AN,SCOMPX

The following command deletes the key types that have been specified for MYFILE.dat, and the column types for indexed keys revert to type BINARY:

dbfhadmin -keytypes -delete -file:sql://svr-mydb/VSAM/MYFILE.dat

The following command exports the list of key types for the VSAM datastore to the MYKEYTYPES.xml file:

dbfhadmin -keytypes -export:MYKEYTYPES.xml -datastore:sql://svr-mydb/VSAM

The following command imports a list of key types to the VSAM datastore from the MYKEYTYPES.xml file:

dbfhadmin -keytypes -import:MYKEYTYPES.xml -datastore:sql://svr-mydb/VSAM

The following command imports a list of key types to the VSAM datastore from the MYKEYTYPES.xml file, replacing any existing types that correspond to the ones in the file:

dbfhadmin -keytypes -import:MYKEYTYPES.xml -datastore:sql://svr-mydb/VSAM -replace

The following command lists the key types set for each data file in the datastore:

dbfhadmin -keytypes -list -datastore:sql://svr-mydb/VSAM

Script file creation

Use the following commands to create script files that can be used to create databases.

The following command creates a script file (createdb.sql) that can be run to create a Db2 cross-region database:

dbfhadmin -script -type:crossregion -provider:db2 -file:createdb.sql

The following command creates a script file (createdb.sql) that can be run to create a Db2 cross-region database using the SYSTEM_1252_US Windows collating sequence:

dbfhadmin -script -type:crossregion -provider:db2 -file:createdb.sql -collate:SYSTEM_1252_US

The following command creates a script file (createdb.sql) that can be run to create a PostgreSQL datastore called MYFILES:

dbfhadmin -script -type:datastore -name:MYFILES -provider:pg -file:createdb.sql

The following command creates a script file (createdb.sql) that can be run to create an MSSQL region database called ESDEMO:

dbfhadmin -script -type:region -name:ESDEMO -provider:ss -file:createdb.sql

The following command creates a script file (createinmydb.sql) that can be run to create a Db2 datastore called mySEQ, which will be stored in the existing Db2 database called masterSEQDB:

dbfhadmin -script -type:datastore -name:mySEQ -provider:db2 -file:createinmydb.sql -existdb:masterSEQDB

Resource recovery

Use the following commands if you are receiving console log error messages that indicate resources are not available during startup. There is an automated recovery process that, in the event of a system failure, attempts to recover resources, but if not all were able to, you may be able to free them using these commands.

The following command lists any region resources that are locked for the DBHOST database server instance:

dbfhadmin -region -list -usedb:DBHOST

The following command lists any region resources that are locked for the ESDEMO region, on the DBHOST database server instance:

dbfhadmin -region -list -usedb:DBHOST -name:ESDEMO

The following command releases the locks on any region resources listed for the ESDEMO region, on the DBHOST database server instance:

dbfhadmin -region -recover -usedb:DBHOST -name:ESDEMO

The following command generates a diagnostic report names diags.txt, which contains details about ESDEMO region database (and associated cross-region database) in the DBHOST database:

dbfhadmin -diags -usedb:DBHOST -name:ESDEMO -file diags.txt

Upgrading datastores[18]

Use the following command to generate the script file upgradeds.sql, required to manually upgrade the VSAM datastore. If you omit the -file option, a file named upgrade_datastore_VSAM_db-type.sql is generated (db-type is determined by the settings in the database configuration file).

dbfhadmin -upgrade -datastore:sql://localhost/VSAM -file:upgradeds.sql

If the datastore does not need to be upgraded, dbfhadmin outputs ADM0073I Datastore '<datastore-url>' does not need to be upgraded, and no script file is created. When an upgrade is required, dbfhadmin outputs ADM0045I Creating SQL script file '<sql-script-name>'.

The resulting script should be run as a user with sysadmin privileges using the sqlcmd (SQL Server), psql (PostgreSQL), or db2 (Db2) command-line tool.