Create PostgreSQL Region and a Cross-Region Database Using Script Files

If a database does not exist at the point that it is required, 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.

  1. To create a script file for a region database, on the command line, enter the following command:
    dbfhadmin -script -type:region -provider:pg -name:<ES-name> -file:<script-name.sql> 

    where <ES-name> is the name of the enterprise server region that will use the region database, and <script-name.sql> is the name of the script file to be created.

    Note: If you omit the -file option, the default name is create_region_<ES-name>_pg.sql.
  2. To create a script file for a cross-region database, on the command line, enter the following command:
    dbfhadmin -script -type:crossregion -provider:pg -file:<script-name.sql> 
    Note: If you omit the -file option, the default name is create_crossregion_pg.sql.

    Before you run the -createdb command, ensure that the psql command is on the PATH.

  3. To create the region database, on the command line, enter the following command:
    dbfhadmin -createdb -provider:pg -type:region -name:<ES-name> -file:<script-name.sql> -user:<user> 
    where <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. 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.
  4. To create the cross-region database, on the command line, enter the following command:
    dbfhadmin -createdb -provider:pg -type:crossregion -file:<script-name.sql> -user:<user> 
    where <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. 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.

Next, you must configure your enterprise server region to use the database(s).