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.
dbfhadmin -createdb -file:mydb.sql -type:datastore -provider:ss
dbfhadmin -createdb -file:mydb.sql -type:datastore -provider:db2 -ebcdic
dbfhadmin -createdb -file:mypgdb.sql -type:datastore -provider:pg -host:MYREMOTEHOST -port:33445
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. For each file, there could be associated outstanding record locks:
dbfhadmin -openfiles -list -datastore:sql://svr-mydb/VSAM -host:svr-01
The command will return a table, similar to that below, containing the status, host name, file and folder name, and process ID:
Status Host Name Folder PID ------ ---- ---- ------ --- Inactive svr-mydb catalog.dat /ESDEMO 27180 Inactive svr-mydb SPLDSN.dat /ESDEMO 27180 Inactive svr-mydb SPLJOB.dat /ESDEMO 34132 Inactive svr-mydb SPLMSG.dat /ESDEMO 27180 In doubt svr-brs catalog.dat /ESDEMO 20300 In doubt svr-brs SPLDSN.dat /ESDEMO 20300 In doubt svr-brs SPLJOB.dat /ESDEMO 20300 In doubt svr-brs SPLMSG.dat /ESDEMO 20300 Ok svr-sdn catalog.dat /ESDEMO 34144 Ok svr-sdn SPLDSN.dat /ESDEMO 34144
dbfhadmin -openfiles -recover -datastore:sql://svr-mydb/VSAM -host:svr-01
Files with an Ok status are left untouched - to also close files with an Ok status, include the -force option.
dbfhadmin -openfiles -recover -datastore:sql://svr-mydb/VSAM -host:svr-01 -pid 27180
dbfhadmin -keytypes -add -file:sql://svr-mydb/VSAM/MYFILE.dat -types:AN,SCOMPX
dbfhadmin -keytypes -add -replace -file:sql://svr-mydb/VSAM/MYFILE.dat -types:AN,SCOMPX
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
dbfhadmin -keytypes -import:MYKEYTYPES.xml -datastore:sql://svr-mydb/VSAM
dbfhadmin -keytypes -import:MYKEYTYPES.xml -datastore:sql://svr-mydb/VSAM -replace
dbfhadmin -keytypes -list -datastore:sql://svr-mydb/VSAM
Use the following commands to create script files that can be used to create databases.
dbfhadmin -script -type:datastore -name:MYFILES -provider:pg -file:createdb.sql
dbfhadmin -script -type:datastore -name:mySEQ -provider:db2 -file:createinmydb.sql -existdb:masterSEQDB
dbfhadmin -script -type:datastore -name:MYFILES -provider:ora
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), db2 (Db2), or sqlplus (Oracle) command-line tool.
Use the following commands to verify the integrity of a datastore, and if required, recover it from any integrity issues.
dbfhadmin -verify -list -datastore:sql://localhost/VSAM
Currently this check only detects orphaned record locks (that is, those record locks that exist without an associated file handle). Record locks would typically be orphaned if the associated file handle had been manually deleted from the database. When orphaned record locks are detected, dbfhadmin lists the associated file name for non-sequential files, or lists <Sequential files> for sequential files (the actual file name cannot be determined as a global record lock table is used for these files), with a count of the orphaned locks; for example:
Orphaned record locks: Name Folder Count ---- ------ ----- SPLJOB.dat /MyDir 3 <Sequential files> 1
dbfhadmin -verify -recover -datastore:sql://localhost/VSAM
dbfhadmin -diags -usedb:DBHOST -name:ESDEMO -file diags.txt
dbfhadmin -diags -usedb:DBHOST -name:ESDEMO -datastore:sql://localhost/VSAM[14]
See dbfhadmin Return Codes for a list of possible return codes used by the command: