Re: Database Management Setup

From: Aris wendy <aris_postgre(at)telkom(dot)net>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: Database Management Setup
Date: 2003-02-03 04:55:30
Message-ID: 200302031155.30678.aris_postgre@telkom.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

> 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(at)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(at)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(at)aris pgsql]# mv /database/base/16976 /database1/base/16976
[root(at)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(at)aris pgsql]#mkdir /database/base/16976
[root(at)aris pgsql]#chown postgres.postgres /database/base/16976
[root(at)aris pgsql]#su postgres
bash-2.05b$ ln -s /database/base/16976 /database1/base/16976
[root(at)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(at)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(at)aris pgsql]# cp /database1/base/16976/PG_VERSION /database/base/16976
[root(at)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

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Alexey Dashevsky 2003-02-03 08:24:27 LWLock acquire - can't wait without a proc structure
Previous Message Marc G. Fournier 2003-02-03 04:12:53 Re: Fwd: Postfix SMTP server: errors from