If a database does not exist at the point that it is required (for example, you attempt to upload a data file to a datastore that has not yet been created in the database instance), it is created on-the-fly; this can be slow for certain RDBMS types, and so we recommended that you create any required databases ahead of time, using SQL scripts.
dbfhadmin -script -type:datastore -provider:pg -name:<datastore-name> [-db|existdb:<database-name>] [-file:<script-name.sql>]
where <database-name> is the name of a new database (-db) or existing database (-existdb) that can house multiple datastores - if you omit either option, a new database called <datastore-name> will be created for the datastore; <script-name.sql> is the name of the script file to be created.
Once you have created the script files, use the dbfhadmin utility to run them, and create the required databases. Before you run the -createdb command, ensure that the psql command is on the PATH.
dbfhadmin -createdb -provider:pg -type:datastore -file:<script-name.sql> -user:<user>where <script-name.sql> is the name of the script file that was created in an earlier step, and <user> is a valid user name for the database. It is also assumed that an entry for that user name has been created in the password file %APPDATA%\postgresql\pgpass.conf on Windows, or .pgpass in the user's home directory on Linux, in order to obtain the password; alternatively, you could set the pgpassword environment variable prior to running the -createdb command. On Linux, PostgreSQL also supports the use of the PGPASSFILE environment variable to specify the location of the password file. Refer to your PostgreSQL documentation for more details.
Now that the datastores have been created, you can configure the database configuration file to use them.