Re: pg_dump in cycle

From: "Najib Abi Fadel" <nabifadel(at)usj(dot)edu(dot)lb>
To: "Ilia Chipitsine" <ilia(at)paramon(dot)ru>
Cc: "generalpost" <pgsql-general(at)postgresql(dot)org>
Subject: Re: pg_dump in cycle
Date: 2004-09-16 10:08:23
Message-ID: 00af01c49bd5$1d119f50$f664a8c0@najib
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Check out the "psql " command.
U can use :

psql -l

which outputs sometinhg like
List of databases
Name | Owner | Encoding
-----------------+-----------+-----------
dragon_devel | ptufenkji | UNICODE
dragon_devel_v2 | ptufenkji | UNICODE
dragon_joujou | ptufenkji | UNICODE
dragon_prod | ptufenkji | UNICODE
fgm | gnakhle | UNICODE
fgm_eval | ptufenkji | UNICODE
hotline | postgres | UNICODE
template0 | postgres | SQL_ASCII
template1 | postgres | SQL_ASCII
usj | ptufenkji | UNICODE

for the shell script and do some text filtering in order to retrieve the
databse names.

(Or may be u can do a connection to the database from the shell script i am
not sure: i don't have a big experience in shell scripting)

----- Original Message -----
From: "Ilia Chipitsine" <ilia(at)paramon(dot)ru>
To: "Najib Abi Fadel" <nabifadel(at)usj(dot)edu(dot)lb>
Cc: "generalpost" <pgsql-general(at)postgresql(dot)org>
Sent: Thursday, September 16, 2004 11:01 AM
Subject: Re: [GENERAL] pg_dump in cycle

> yes, but how can I integrate that query with shell script (which will
> perform actual dumping) ?
>
> I would even say, "select datname from pg_database where not
> datistemplate", becuase otherwise pg_dump will complain about template0
>
> Cheers,
> Ilia Chipitsine
>
>
> > U can use :
> > select datname from pg_database;
> >
> > in order to get the list of databses
> >
> > HTH
> >
> > Najib.
> >
> > ----- Original Message -----
> > From: "Ilia Chipitsine" <ilia(at)paramon(dot)ru>
> > To: "Najib Abi Fadel" <nabifadel(at)usj(dot)edu(dot)lb>
> > Sent: Thursday, September 16, 2004 10:41 AM
> > Subject: Re: [GENERAL] pg_dump in cycle
> >
> >
> >>> Use pg_dump instead of pg_dumpall
> >>>
> >>> example:
> >>> pg_dump databaseName > databaseDumpFile
> >>>
> >>> if u have many databases, you can make a script that dumps each
database
> > in
> >>
> >> sure, I have many databases.
> >> how can I write such script without explicitly specifying database
names ?
> >> I do not want to modify that script after I have added database.
> >>
> >>> it's own file ....
> >>>
> >>>
> >>>
> >>> ----- Original Message -----
> >>> From: "Ilia Chipitsine" <ilia(at)paramon(dot)ru>
> >>> To: <pgsql-general(at)postgresql(dot)org>
> >>> Sent: Thursday, September 16, 2004 8:08 AM
> >>> Subject: [GENERAL] pg_dump in cycle
> >>>
> >>>
> >>>> Dear Sirs,
> >>>>
> >>>> I want to dump all databases, but separately each database in its own
> >>>> file, not all databases in one single file as pg_dumpall does.
> >>>>
> >>>> How can I implement that ?
> >>>>
> >>>> Cheers,
> >>>> Ilia Chipitsine
> >>>>
> >>>> ---------------------------(end of
> > broadcast)---------------------------
> >>>> TIP 4: Don't 'kill -9' the postmaster
> >>>>
> >>>
> >>>
> >>
> >
> >
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Örn Hansen 2004-09-16 10:32:27 REFERENCES
Previous Message Martijn van Oosterhout 2004-09-16 10:07:30 Re: lexicographical ordering in postgres