Re: pg_dumpall - Need advice

Поиск
Список
Период
Сортировка
От Kris Deugau
Тема Re: pg_dumpall - Need advice
Дата
Msg-id 432B18F3.16195FFD@vianet.ca
обсуждение исходный текст
Ответ на pg_dumpall - Need advice  (J French <hikenboots@gmail.com>)
Список pgsql-admin
Please, don't post in HTML.

J French wrote:
> I need to write a database dump/backup shell script to cron but I
> can't seem to get pg_dumpall working.  Could someone who has this
> working take a look at my configuration below and give me some
> pointers?  It would appear that "/usr/lib/postgresql/bin/readpgenv:
> line 2: /etc/postgresql/postgresql.env: No such file or directory "
> would be a big tip off except I can't find that file on my system and
> have no idea what it is/does.  I'm new to postgresql (obviously).
> Thanks for your time. -John

Apparently a Debian-specific file, since I don't recognize it offhand
and none of the RedHat(-derived) boxen I run have it.

> debian:~# dpkg -l | grep postgresql
> ii  postgresql     7.4.7-6sarge1  object-relational SQL database
> management sy
> ii  postgresql-cli 7.4.7-6sarge1  front-end programs for PostgreSQL
> debian:~#

Aside from my grumpiness about all things Debian...

> debian:~# su postgres
> postgres@debian:/root$ cd
> postgres@debian:~$ pwd
> /var/lib/postgres
> postgres@debian:~$ pg_dumpall > testdump
> /usr/lib/postgresql/bin/readpgenv: line 2:
> /etc/postgresql/postgresql.env: No such file or directory
> postgres@debian:~$

... this works Just Fine for me on a fairly-bare Sarge box, with
Postgres installed just to see what happens.

Since you seem to be missing a semi-critical file (Debian-specific,
unfortunately - and why it's in any way necessary is beyond me), try
creating /etc/postgresql/postgresql.env with this content:  (Watch for
linewraps)

======BEGIN
# postgresql debian package
#
# This section is supplied as part of the Debian package for PostgreSQL.
# It sets the environment for an ordinary user of PostgreSQL and should
# be executed by the .profile or equivalent for the postgres
administrator
#
# It is automatically read by all six frontend programs (in the
# postgresql-client package).

[ -r /etc/postgresql/postmaster.conf ] &&
        . /etc/postgresql/postmaster.conf

PGDATA=${POSTGRES_DATA:-/var/lib/postgres/data}
PGLIB=/usr/lib/postgresql/lib
PGACCESS_HOME=/usr/lib/postgresql/share/pgaccess
PGHOST=

export PGLIB PGDATA PGACCESS_HOME PGHOST
======END

If that doesn't help, try uninstalling the postgresql package, and
reinstalling it.  You may have to purge it and manually hunt down
leftover files before reinstalling.

> Contents of /etc/postgresql:

Er, if this is truly PostgreSQL as installed from the standard Debian
package, I sincerely hope that you meant /etc/postgresql/pg_hba.conf.
FWIW, it looks identical to the fresh one I found just after installing.

I see 5 files in /etc/postgresql:

postgres@test2:/etc/postgresql$ ls -l
total 32
-rw-r-----  1 root postgres 4885 2005-05-18 04:33 pg_hba.conf
-rw-r-----  1 root postgres 1441 2005-05-18 04:33 pg_ident.conf
-rw-r--r--  1 root root     9058 2005-09-16 14:50 postgresql.conf
-rw-r--r--  1 root root      602 2005-05-18 04:33 postgresql.env
-rw-r--r--  1 root root     3458 2005-09-16 14:49 postmaster.conf

-kgd
(Debian just rubs me the wrong way.  I always end up fighting some
component instead of quickly and easily bending it to my usage.)
--
Get your mouse off of there!  You don't know where that email has been!

В списке pgsql-admin по дате отправления:

Предыдущее
От: Jeff Frost
Дата:
Сообщение: Re: pg_dumpall - Need advice
Следующее
От: Marcin Giedz
Дата:
Сообщение: Backup issue