Re: Database Management Setup - Mailing list pgsql-admin
From | Aris wendy |
---|---|
Subject | Re: Database Management Setup |
Date | |
Msg-id | 200302031155.30678.aris_postgre@telkom.net Whole thread Raw |
In response to | Re: Database Management Setup (Oliver Elphick <olly@lfix.co.uk>) |
Responses |
Re: Database Management Setup
|
List | 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@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
pgsql-admin by date: