Alternate data location, again

From: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Alternate data location, again
Date: 2002-02-19 15:54:05
Message-ID: Pine.LNX.4.44.0202190753430.1380-100000@salmo.appl-ecosys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)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(at)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(at)appl-ecosys(dot)com
http://www.appl-ecosys.com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2002-02-19 15:54:35 creating tables from a disk file
Previous Message Jean-Michel POURE 2002-02-19 15:50:32 Re: libpq or ecpg?