<!--
$Header: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/ref/initlocation.sgml,v 1.9 2000/05/26 15:47:17 momjian Exp $
Postgres documentation
-->

<refentry id="APP-INITLOCATION">
 <refmeta>
  <refentrytitle id="APP-INITLOCATION-TITLE">
   <application>initlocation</application>
  </refentrytitle>
  <refmiscinfo>Application</refmiscinfo>
 </refmeta>
 <refnamediv>
  <refname>
   <application>initlocation</application>
  </refname>
  <refpurpose>
   Create a secondary <productname>Postgres</productname> database storage area
  </refpurpose>
 </refnamediv>
 <refsynopsisdiv>
  <refsynopsisdivinfo>
   <date>2000-01-17</date>
  </refsynopsisdivinfo>
  <synopsis>
initlocation <replaceable class="parameter">directory</replaceable>
  </synopsis>

  <refsect2 id="R2-APP-INITLOCATION-1">
   <refsect2info>
    <date>1998-10-02</date>
   </refsect2info>
   <title>
    Inputs
   </title>
   <para>

    <variablelist>
     <varlistentry>
      <term><replaceable class="parameter">directory</replaceable></term>
      <listitem>
       <para>
	Where in your Unix filesystem do you want alternate databases to go?
       </para>
      </listitem>
     </varlistentry>

    </variablelist>
   </para>
  </refsect2>

  <refsect2 id="R2-APP-INITLOCATION-2">
   <refsect2info>
    <date>1998-09-26</date>
   </refsect2info>
   <title>
    Outputs
   </title>
   <para>
    <application>initlocation</application> will create directories in 
    the specified place.
   </para>
  </refsect2>
 </refsynopsisdiv>

 <refsect1 id="R1-APP-INITLOCATION-1">
  <refsect1info>
   <date>1998-09-26</date>
  </refsect1info>
  <title>
   Description
  </title>
  <para>
   <application>initlocation</application> 
   creates a new <productname>Postgres</productname> secondary database storage area.
   See the discussion under <xref linkend="SQL-CREATEDATABASE" endterm="SQL-CREATEDATABASE-title">
   about how to manage and use secondary storage areas. If the argument does not contain
   a slash and is not valid as a path, it is assumed to be an environment variable,
   which is referenced. See the examples at the end.
  </para>
  <para>
   In order to use this command you must be logged in (using 'su', for example)
   the database superuser.
  </para>
 </refsect1>

 <refsect1 id="R1-APP-INITLOCATION-2">
  <refsect1info>
   <date>1998-09-26</date>
  </refsect1info>
  <title>
   Usage
  </title>
  <para>
   To create a database in an alternate location, using an environment variable:
<programlisting>
$ export PGDATA2=/opt/postgres/data
</programlisting>
Start and stop postmaster so it sees the $PGDATA2 environment variable.
The system must be configured so the postmaster sees $PGDATA2 every time it
starts.
<programlisting>
$ initlocation PGDATA2
$ createdb -D 'PGDATA2' 'testdb' 
</programlisting>
  </para>

  <para>
  Alternatively, if you allow absolute paths you could write:
<programlisting>
$ initlocation /opt/postgres/data
$ createdb -D '/opt/postgres/data/testdb' testdb 
</programlisting>
  </para>
 </refsect1>
</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->
