INITDB(UNIX)

NAME
initdb — initalize the database templates and primary directories

SYNOPSIS
initdb [-d ] [-n ] [-r directory ] [-t ] [-u username ] [-v ]

DESCRIPTION
Initdb sets up the initial template databases and is normally executed as part of the installation process. The template database is created under the directory specified by the the environment variable PGDATA, or to a default specified at compile-time. The template database is then vacuumed.

Initdb is a shell script that invokes the backend server directly. Hence, it must be executed by the Postgres super-user.

Initdb understands the following command-line options:

-d  Print debugging output from the backend server. This option generates a tremendous amount of information. This option also turns off the final vacuuming step.

-n  Run in “noclean” mode. By default, initdb cleans up (recursively unlinks) the data directory if any error occurs, which also removes any core files left by the backend server. This option inhibits any tidying-up.

-r directory
    Use the specified data directory.

-t  Update template database only.

-u username
    Run as the specified username.

-v  Produce verbose output, printing messages stating where the directories are being created, etc.

FILES

$PGDATA/base
    The location of global (shared) classes.

$PGDATA/base/template1
    The location of the template database.

$PGDATA/files/{global1,local1_template1}.bki
    Command files used to generate the global and template databases, generated and installed by the initial compilation process.

SEE ALSO
createdb(1), vacuum(l), bki(files), template(files).