11<!--
2- $Header: /cvsroot/pgsql/doc/src/sgml/ref/Attic/initlocation.sgml,v 1.4 1999/07/22 15:09:12 thomas Exp $
2+ $Header: /cvsroot/pgsql/doc/src/sgml/ref/Attic/initlocation.sgml,v 1.5 2000/01/18 00:03:34 petere Exp $
33Postgres documentation
44-->
55
@@ -15,17 +15,15 @@ Postgres documentation
1515 <application>initlocation</application>
1616 </refname>
1717 <refpurpose>
18- Create a secondary <productname>Postgres </productname> database storage area
18+ Create a secondary <productname>PostgreSQL </productname> database storage area
1919 </refpurpose>
2020 </refnamediv>
2121 <refsynopsisdiv>
2222 <refsynopsisdivinfo>
23- <date>1999-07-20 </date>
23+ <date>2000-01-17 </date>
2424 </refsynopsisdivinfo>
2525 <synopsis>
26- initlocation [ --location=<replaceable class="parameter">er">al</replaceable>ble> | -D <replaceable class="parameter">altdir</replaceable> ]
27- [ --username=<replaceable class="parameter">name</replaceable> | -u <replaceable class="parameter">name</replaceable> ]
28- [ <replaceable class="parameter">altdir</replaceable> ]
26+ initlocation <replaceable class="parameter">directory</replaceable>
2927 </synopsis>
3028
3129 <refsect2 id="R2-APP-INITLOCATION-1">
@@ -39,45 +37,14 @@ initlocation [ --location=<replaceable class="parameter">er">al</replaceable>ble
3937
4038 <variablelist>
4139 <varlistentry>
42- <term>--location=<replaceable class="parameter">altdir</replaceable></term>
43- <term>-D <replaceable class="parameter">altdir</replaceable></term>
44- <term><replaceable class="parameter">altdir</replaceable></term>
40+ <term><replaceable class="parameter">directory</replaceable></term>
4541 <listitem>
4642 <para>
4743Where in your Unix filesystem do you want alternate databases to go?
48- The top level directory is called the <envar>PGDATA</envar> directory, so you
49- might want to point your first alternate location at
50- <envar>PGDATA2</envar>.
5144 </para>
5245 </listitem>
5346 </varlistentry>
5447
55- <varlistentry>
56- <term>--username=<replaceable class="parameter">name</replaceable></term>
57- <term>-u <replaceable class="parameter">name</replaceable></term>
58- <term><envar>PGUSER</envar></term>
59- <listitem>
60- <para>
61- Who will be the Unix filesystem owner of this database storage area?
62- The
63- <productname>Postgres</productname> superuser is a Unix user
64- who owns all files that store the database
65- system and also owns the postmaster and backend processes that access them.
66- Usually, this is the user who should run <application>initlocation</application>
67- and who will thus have ownership of the directories and files.
68- </para>
69- <note>
70- <para>
71- Only the Unix superuser can create a database system with a
72- different user as the <productname>Postgres</productname> superuser.
73- Specifying a user other than the <productname>Postgres</productname> superuser
74- may lead to database security and data integrity problems. Refer to the
75- <citetitle><productname>PostgreSQL</productname> Administrator's Guide</citetitle>
76- for more information.
77- </para>
78- </note>
79- </listitem>
80- </varlistentry>
8148 </variablelist>
8249 </para>
8350 </refsect2>
@@ -92,65 +59,6 @@ initlocation [ --location=<replaceable class="parameter">er">al</replaceable>ble
9259 <para>
9360 <application>initlocation</application> will create directories in
9461 the specified place.
95-
96- <variablelist>
97- <varlistentry>
98- <term><computeroutput>
99- We are initializing the database area with username postgres (uid=500).
100- This user will own all the files and must also own the server process.
101- Creating Postgres database system directory <replaceable class="parameter">altdir</replaceable>
102- Creating Postgres database system directory <replaceable class="parameter">altdir</replaceable>
103- </computeroutput></term>
104- <listitem>
105- <para>
106- Successful completion.
107- </para>
108- </listitem>
109- </varlistentry>
110-
111- <varlistentry>
112- <term><computeroutput>
113- We are initializing the database area with username postgres (uid=500).
114- This user will own all the files and must also own the server process.
115- Creating Postgres database system directory /usr/local/src/testlocation
116- mkdir: cannot make directory `<replaceable class="parameter">altdir</replaceable>': Permission denied
117- </computeroutput></term>
118- <listitem>
119- <para>
120- You do not have filesystem permission to write to the specified directory area.
121- </para>
122- </listitem>
123- </varlistentry>
124-
125- <varlistentry>
126- <term><computeroutput>
127- Valid username not given. You must specify the username for
128- the Postgres superuser for the database system you are
129- initializing, either with the --username option or by default
130- to the USER environment variable.
131- </computeroutput></term>
132- <listitem>
133- <para>
134- The username which you have specified is not the
135- <productname>Postgres</productname> superuser.
136- </para>
137- </listitem>
138- </varlistentry>
139-
140- <varlistentry>
141- <term><computeroutput>
142- Can't tell what username to use. You don't have the USER
143- environment variable set to your username and didn't specify the
144- --username option
145- </computeroutput></term>
146- <listitem>
147- <para>
148- Specify the <option>--username</option> command line option.
149- </para>
150- </listitem>
151- </varlistentry>
152-
153- </variablelist>
15462 </para>
15563 </refsect2>
15664 </refsynopsisdiv>
@@ -164,41 +72,16 @@ environment variable set to your username and didn't specify the
16472 </title>
16573 <para>
16674 <application>initlocation</application>
167- creates a new <productname>Postgres</productname> secondary database storage area.
168- A secondary storage area contains a required tree of directories with
169- the correct file permissions on those directories.
170- </para>
171- <para>
172- Creating a database storage area consists of creating the directories in which
173- database data might live.
75+ creates a new <productname>PostgreSQL</productname> secondary database storage area.
76+ See the discussion under <xref linkend="SQL-CREATEDATABASE" endterm="SQL-CREATEDATABASE-title">
77+ about how to manage and use secondary storage areas. If the argument does not contain
78+ a slash and is not valid as a path, it is assumed to be an environment variable,
79+ which is referenced. See the examples at the end.
17480 </para>
17581 <para>
176- There are two kinds of arguments for <application>initlocation</application>.
177-
178- First, you can specify an environment variable (e.g. <envar>PGDATA2</envar>).
179- This environment variable should be known to the backend for later use in
180- <command>CREATE DATABASE/WITH LOCATION</command>
181- or
182- <command>createdb -D <replaceable class="parameter">altdir</replaceable></command>.
183- However, <emphasis>the backend daemon must have this variable in it's
184- environment</emphasis> for this to succeed.
185-
186- Second, you may be able to specify an explicit
187- absolute path to the top directory of the storage area. However,this second
188- option is possible only if explicitly enabled during the
189- <productname>Postgres</productname> installation. It is usually disabled
190- to alleviate security and data integrity concerns.
82+ In order to use this command you must be logged in (using 'su', for example)
83+ the database superuser.
19184 </para>
192- <note>
193- <para>
194- <productname>Postgres</productname> will add <filename>/base/</filename>
195- to the specified path to create the storage area.
196- </para>
197- <para>
198- The backend requires that any argument to <option>WITH LOCATION</option> which is
199- in all uppercase and which has no path delimiters is an environment variable.
200- </para>
201- </note>
20285 </refsect1>
20386
20487 <refsect1 id="R1-APP-INITLOCATION-2">
@@ -210,12 +93,19 @@ environment variable set to your username and didn't specify the
21093 </title>
21194 <para>
21295 To create a database in an alternate location, using an environment variable:
96+ <programlisting>
97+ $ export PGDATA2=/opt/postgres/data
98+ $ initlocation PGDATA2
99+ $ createdb 'testdb' -D 'PGDATA2/testdb'
100+ </programlisting>
101+ </para>
213102
214- <programlisting>
215- % setenv PGDATA2 /opt/postgres/data
216- % initlocation PGDATA2
217- % createdb -D PGDATA2
218- </programlisting>
103+ <para>
104+ Alternatively, if you allow absolute paths you could write:
105+ <programlisting>
106+ $ initlocation /opt/postgres/data
107+ $ createdb 'testdb' -D '/opt/postgres/data/testdb'
108+ </programlisting>
219109 </para>
220110 </refsect1>
221111</refentry>