1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
|
<!-- manual page source format generated by PolyglotMan v3.0.4, -->
<!-- available via anonymous ftp from ftp.cs.berkeley.edu:/ucb/people/phelps/tcltk/rman.tar.Z -->
<HTML>
<HEAD>
<TITLE>INITDB(UNIX) manual page</TITLE>
</HEAD>
<BODY>
<A HREF="pgsql.html">PostgreSQL Contents</A>
<H2><A NAME="sect0" HREF="#toc0">NAME </A></H2>
initdb - create a new Postgres database system
<H2><A NAME="sect1" HREF="#toc1">SYNOPSIS </A></H2>
<B>initdb</B> [<B>--pglib=</B><I>directory</I>]
[<B>--pgdata=</B><I>directory</I>] [<B>--username=</B><I>username</I>] [<B>--template</B>] [<B>--noclean</B>] [<B>--debug</B>] <P>
<B>initdb</B>
[<B>-l</B> <I>directory</I>] [<B>-r</B> <I>directory</I>] [<B>-u</B> <I>username</I>] [<B>-t</B>] [<B>-n</B>] [<B>-d</B>] <P>
<P>
<H2><A NAME="sect2" HREF="#toc2">DESCRIPTION </A></H2>
<I>Initdb</I>
Creates a new Postgres database system. A database system is a collection
of databases that are all administered by the same Unix user and managed
by a single postmaster. <P>
Creating a database system consists of creating
the directories in which the database data will live, generating the shared
catalog tables (tables that don't belong to any particular database),
and creating the <I>template1</I> database. What is the <I>template1</I> database?
When you create a database, Postgres does it by copying everything from
the <I>template1</I> database. It contains catalog tables filled in for things
like the builtin types. <P>
After <I>initdb</I> creates the database, it <B>vacuum</B>'s
it. <P>
There are 3 ways to give parameters to <I>initdb</I>. First, you can use initdb
command options. Second, you can set environment variables before invoking
initdb. Third, you can have a program called <I>postconfig</I> in your Unix command
search path. <I>Initdb</I> invokes that program and the program writes <I>initdb</I>
parameters to its standard output stream. <P>
Command options always override
parameters specified any other way. The values returned by <I>postconfig</I> override
any environment variables, but your <I>postconfig</I> program may base its output
on the environment variables if you want their values to be used. <P>
The value
that <I>postconfig</I> outputs must have the format <P>
var1=value1 var2=value2
... <P>
It can output nothing if it doesn't want to supply any parameters. The
"varN" values are equal to the corresponding environment variable names.
For example, outputting "PGDATA=/tmp/postgres_test" has the same effect
as invoking <I>initdb</I> with an environment variable called "PGDATA" whose
value is "/tmp/postgres_test". <P>
There are 3 parameters you must supply to
initdb to tell it how to create the database system: <P>
1) Where are the
files that make up Postgres? Apart from files that have to go in particular
directories because of their function, the files that make up the Postgres
software were installed in a directory called the "pglib" directory. An
example of a file that will be found there that <I>initdb</I> needs is global1.bki.source,
which contains all the information that goes into the shared catalog tables.
Use the <B>--pglib</B> (<B>-l</B>) option or the <B>PGLIB</B> environment variable. <P>
2) Where
in your Unix filesystem do you want the database data to go? The top level
directory is called the "pgdata" directory. Use the <B>--pgdata</B> (<B>-d</B>) option
or the <B>PGDATA</B> environment variable. <P>
3) Who will be the Postgres superuser
for this database system? The Postgres superuser is a Unix user that
owns all files that store the database system and also owns the postmaster
and backend processes that access them. Use the <B>--username</B> (<B>-u</B>) option or
the <B>PGUSER</B> environment variable. Or just let it default to you (the Unix
user who runs <I>initdb</I>). Note that only the Unix superuser can create a database
system with a different user as Postgres superuser. <P>
<P>
<P>
<P>
<I>Initdb</I> understands
the following command-line options: <P>
<B>--pglib=</B><I>directory</I> <B>-l</B> <I>directory</I> <P>
Use the
Postgres files in the specified directory, as explained above. <P>
<B>--pgdata=</B><I>directory</I>
<B>-r</B> <I>directory</I> <P>
Put the database system in this directory, as explained above.
<P>
<B>--username=</B><I>username</I> <B>-u</B> <I>username</I> <P>
Build the database system with the specified
Unix user as the Postgres superuser for it, as explained above. <P>
<B>--template</B>
<B>-t</B> <P>
Replace the <I>template1</I> database in an existing database system, and
don't touch anything else. This is useful when you need to upgrade your
<I>template1</I> database using <I>initdb</I> from a newer release of Postgres, or
when your <I>template1</I> database has become corrupted by some system problem.
Normally the contents of <I>template1</I> remain constant throughout the life
of the database system. You can't destroy anything by running <I>initdb</I> with
the <B>--template</B> option. <P>
<B>--noclean</B> <B>-n</B> <P>
Run in `noclean' mode. By default, when
<I>initdb</I> determines that error prevent it from completely creating the
database system, it removes any files it may have created before determining
that it can't finish the job. That includes any core files left by the
programs it invokes. This option inhibits any tidying-up and is thus useful
for debugging. <P>
<B>--debug</B> <B>-d</B> <P>
Print debugging output from the bootstrap backend.
The bootstrap backend is the program <I>initdb</I> uses to create the catalog
tables. This option generates a tremendous amount of output. It also turns
off the final vacuuming step. <P>
<P>
<H2><A NAME="sect3" HREF="#toc3">FILES </A></H2>
<DL>
<DT>postconfig </DT>
<DD>(Somewhere in the Unix
command search path (defined by the PATH environment variable)). This
is a program that specifies defaults for some of the command options.
See above. </DD>
<DT>PGLIB/global1.bki.source </DT>
<DD>Contents for the shared catalog tables
in the new database system. This file is part of the Postgres software.
</DD>
<DT>PGLIB/local1_template1.bki.source </DT>
<DD>Contents for the template1 tables in
the new database system. This file is part of the Postgres software. </DD>
</DL>
<P>
<H2><A NAME="sect4" HREF="#toc4">SEE ALSO </A></H2>
<A HREF="vacuum.l.html">vacuum(l)</A>
, <A HREF="bki.5.html">bki(5)</A>
, <A HREF="create_database.l.html">create_database(l)</A>
, <A HREF="createuser.1.html">createuser(1)</A>
, <A HREF="psql.1.html">psql(1)</A>
<P>
<P>
<P>
<HR><P>
<A NAME="toc"><B>Table of Contents</B></A><P>
<UL>
<LI><A NAME="toc0" HREF="#sect0">NAME</A></LI>
<LI><A NAME="toc1" HREF="#sect1">SYNOPSIS</A></LI>
<LI><A NAME="toc2" HREF="#sect2">DESCRIPTION</A></LI>
<LI><A NAME="toc3" HREF="#sect3">FILES</A></LI>
<LI><A NAME="toc4" HREF="#sect4">SEE ALSO</A></LI>
</UL>
</BODY></HTML>
|