pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Aris wendy <aris_postgre@telkom.net>
To: pgsql-admin@postgresql.org
Subject: Re: Database Management Setup
Date: Mon, 3 Feb 2003 11:55:30 +0700
Message-ID: <200302031155.30678.aris_postgre@telkom.net> (raw)
In-Reply-To: <1043929923.1112.194.camel@linda.lfix.co.uk>
References: <200301301111.03637.aris_postgre@telkom.net>
	<1043929923.1112.194.camel@linda.lfix.co.uk>

> You can use symbolic links, if your operating system allows them.
>
>
> 1. For safety, make a full backup with pg_dumpall.
>
> 2. Identify the database directories -- they are named by the oid of the
> database in pg_databases:
>
>         template1=# select datname, oid from pg_database;
>             datname     |   oid
>         ----------------+---------
>          accounts       |   16983
>          comanagers     | 1063179
>          template1      |       1
>         ...
>
>         $ sudo ls $PGDATA/base
>         1  1063179  16983   ...
>
> 3. Shut down the postmaster.
>
> 4. Move the relevant directories from $PGDATA/base to the desired
> locations on the other disks -- their parent directories should have the
> same ownership and permissions as $PGDATA.
>
> 5. In $PGDATA/base, make symbolic links to the moved directories.
> PostgreSQL should notice no difference in the structure.
>
> 6. Restart the postmaster.
>
>
> If you destroy the database structure and recreate it by restoring from
> a full dump, the symbolic link structure will not be restored, since
> PostgreSQL knows nothing about it.  It will have to be maintained
> manually.

OK thx.....but I still got a problem
[root@aris pgsql]# su postgres 
bash-2.05b$ /usr/local/pgsql/bin/initdb -D /database
bash-2.05b$ /usr/local/pgsql/bin/initdb -D /database1
bash-2.05b$ /usr/local/pgsql/bin/postmaster -D /database
bash-2.05b$ /usr/local/pgsql/bin/createdb -D arisdb
[root@aris pgsql]# ls -al /database/base
drwx------    7 postgres postgres     4096 Feb  3 10:59 .
drwx------    6 postgres postgres     4096 Feb  3 11:00 ..
drwx------    2 postgres postgres     4096 Jan 31 18:09 1
drwx------    2 postgres postgres     4096 Jan 31 17:59 16975
drwx------    2 postgres postgres     4096 Feb  3 11:01 16976

[root@aris pgsql]# mv /database/base/16976 /database1/base/16976
[root@aris pgsql]# /usr/local/pgsql/bin/psql -Upostgres arisdb
psql: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
[root@aris pgsql]#mkdir /database/base/16976
[root@aris pgsql]#chown postgres.postgres /database/base/16976
[root@aris pgsql]#su postgres
bash-2.05b$ ln -s /database/base/16976 /database1/base/16976
[root@aris pgsql]# ls -al /database/base/16976
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
-rw-------    1 postgres postgres     8192 Jan 31 18:09 16680
lrwxrwxrwx    1 postgres postgres       20 Feb  3 11:35 16976 -> 
/database/base/16976
-rw-------    1 postgres postgres    65776 Jan 31 18:09 pg_internal.init
-rw-------    1 postgres postgres        4 Jan 31 18:09 PG_VERSION
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[root@aris pgsql]# /usr/local/pgsql/bin/psql -Upostgres arisdb
psql: FATAL:  File /database/base/16976/PG_VERSION is missing. This is not a 
valid data directory.
[root@aris pgsql]# cp /database1/base/16976/PG_VERSION /database/base/16976
[root@aris 16976]# /usr/local/pgsql/bin/psql -Upostgres arisdb
psql: FATAL:  _mdfd_getrelnfd: cannot open relation pg_class: No such file or 
directory


Sorry if my e-mail is to long to read.........
Best regards 
Aris

FYI : I use RH 8.0 and postgresql 7.3



view thread (4+ messages)  latest in thread

Message-ID: <200302031155.30678.aris_postgre@telkom.net>
Permalink:  ../200302031155.30678.aris_postgre@telkom.net/
Also on:    postgresql.org/message-id/200302031155.30678.aris_postgre@telkom.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: aris_postgre@telkom.net
  Subject: Re: Database Management Setup
  In-Reply-To: <200302031155.30678.aris_postgre@telkom.net>
  References: <200301301111.03637.aris_postgre@telkom.net> <1043929923.1112.194.camel@linda.lfix.co.uk> <200302031155.30678.aris_postgre@telkom.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox