Alternate data location, again - Mailing list pgsql-general

From Rich Shepard
Subject Alternate data location, again
Date
Msg-id Pine.LNX.4.44.0202190753430.1380-100000@salmo.appl-ecosys.com
Whole thread Raw
Responses Re: Alternate data location, again
List pgsql-general
  I had forgotten about the 'initlocation' command (page 265 of the
Reference Manual). So following the directions, I ensured that PGDATA2 was
exported in my environment (using the echo command), restarted the
postmaster (to ensure it had the opportunity to pick up that variable), then
ran initlocation with this result:

[rshepard@salmo ~/development/accounting]$ initlocation PGDATA2
The location will be initialized with username "rshepard".
This user will own all the files and must also own the server process.

Creating directory /opt/paisley/acctdata/
Creating directory /opt/paisley/acctdata//base

initlocation is complete.
You can now create a database using
  CREATE DATABASE <name> WITH LOCATION = 'PGDATA2'
in SQL, or
  createdb <name> -D 'PGDATA2'
from the shell.

  I see two slashes between acctdata and base; did I define the variable
improperly by terminating it with a slash? ... I just fixed this problem and
it makes no difference. Here's what I see when I try to create a database
there:

[rshepard@salmo ~/development/accounting]$ createdb paisley -D 'PGDATA2'
ERROR:  Postmaster environment variable 'PGDATA2' not set
createdb: database creation failed

  Since I followed the procedure in the description of the 'initlocation'
command and 'createdb' command, I am puzzled why it's not working here. The
only thing that occurs to me is this: the postmaster is started by root, not
by user postgres or user rshepard. Only root has permission to run
'/etc/rc.d/init.d/postgresql restart'. Could this have any bearing on the
results?

  When the postmaster tries to create a database, does it pick up the
environment variables of the user ordering the creation? Do I need to put
the PGDATA2 environment variable in root's .bash_profile?

  I have been trying to figure out by myself why this isn't working, but I
believe I've done all the docs tell me to do. If it's helpful, all this is
on a RH 6.2 system running the 2.2.19 kernel.

TIA,

Rich

Dr. Richard B. Shepard, President

                       Applied Ecosystem Services, Inc. (TM)
            2404 SW 22nd Street | Troutdale, OR 97060-1247 | U.S.A.
 + 1 503-667-4517 (voice) | + 1 503-667-8863 (fax) | rshepard@appl-ecosys.com
                         http://www.appl-ecosys.com



pgsql-general by date:

Previous
From: Rich Shepard
Date:
Subject: creating tables from a disk file
Next
From: Francisco Reyes
Date:
Subject: directory initialized 7.2 not compatible 7.1.3