473,402 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

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

Nov 23 '05 #1
6 2241
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
it's own file ....

----- Original Message -----
From: "Ilia Chipitsine" <il**@paramon.ru>
To: <pg***********@postgresql.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

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #2
U can use :
select datname from pg_database;

in order to get the list of databses

HTH

Najib.

----- Original Message -----
From: "Ilia Chipitsine" <il**@paramon.ru>
To: "Najib Abi Fadel" <na*******@usj.edu.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" <il**@paramon.ru>
To: <pg***********@postgresql.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



---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #3
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" <il**@paramon.ru>
To: "Najib Abi Fadel" <na*******@usj.edu.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" <il**@paramon.ru>
To: <pg***********@postgresql.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



---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 23 '05 #4

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" <il**@paramon.ru>
To: "Najib Abi Fadel" <na*******@usj.edu.lb>
Cc: "generalpost" <pg***********@postgresql.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" <il**@paramon.ru>
To: "Najib Abi Fadel" <na*******@usj.edu.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" <il**@paramon.ru>
To: <pg***********@postgresql.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
>



---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #5
This seems to be more interesting for shell scripting:

psql -d DatabaseName -c 'select datname from pg_database where not
datistemplate' ;

datname
-----------------
fgm_eval
hotline
usj
dragon_devel
dragon_joujou
dragon_devel_v2
dragon_prod
fgm
(8 rows)

Cheers.
Najib.

----- Original Message -----
From: "Najib Abi Fadel" <na*******@usj.edu.lb>
To: "Ilia Chipitsine" <il**@paramon.ru>
Cc: "generalpost" <pg***********@postgresql.org>
Sent: Thursday, September 16, 2004 12:08 PM
Subject: Re: [GENERAL] pg_dump in cycle


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" <il**@paramon.ru>
To: "Najib Abi Fadel" <na*******@usj.edu.lb>
Cc: "generalpost" <pg***********@postgresql.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" <il**@paramon.ru>
To: "Najib Abi Fadel" <na*******@usj.edu.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" <il**@paramon.ru>
>> To: <pg***********@postgresql.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
>>>
>>
>>
>


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #6
* Najib Abi Fadel:
| This seems to be more interesting for shell scripting:
|
| psql -d DatabaseName -c 'select datname from pg_database where not
| datistemplate' ;
|
| datname
| -----------------
| fgm_eval
| hotline
| usj
| dragon_devel
| dragon_joujou
| dragon_devel_v2
| dragon_prod
| fgm
| (8 rows)

$ psql -ltA | cut -d'|' -f1 | grep -v '^template' | xargs -i pg_dump -f {}.pg_dump {}
--
-- PostgreSQL database dump complete
--

--
-- PostgreSQL database dump complete
--

$ ls -l *.pg_dump
-rw-r--r-- 1 postgres users 493 2004-09-17 14:00 foo.pg_dump
-rw-r--r-- 1 postgres users 3326 2004-09-17 14:00 test.pg_dump

--
Lars Haugseth

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 23 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Sam | last post by:
I'm having trouble restoring databases that have to lo type installed in /contrib/lo. The dump seems to work just fine, I get no errors when I execute the following command #pg_dump -Fc -o -b...
4
by: Mark Mikulec | last post by:
Hi there, I wonder if anyone can shed some light on a very frustrating problem. I'm running a debian linux 3.0 "woody" server, nothing special, with the latest version of postres that apt-get...
7
by: Ed L. | last post by:
We are seeing what looks like pgsql data file corruption across multiple clusters on a RAID5 partition on a single redhat linux 2.4 server running 7.3.4. System has ~20 clusters installed with a...
0
by: Aienthiwan | last post by:
Hello all, I'm running a debian server and recently updated my version of PostgreSQL to "unstable", that being v7.4.1. I had no trouble at all getting everything up to date and going. But my...
4
by: jack turer | last post by:
I have a database in pgsql (7.3.2) on redhat 9. When I try a 'pg_dump mydb' to back up the database, I get: pg_dump: could not find namespace with OID 2200 Verbose version is: -bash-2.05b$...
9
by: Alexander Cohen | last post by:
(sorry for the double post if there is one - i sent the mail to the lisyt from the wrong address) Hi, Im passing this in the commmand line to start up the PostgreSQL server: ../pg_ctl start...
4
by: Philip | last post by:
I'm rather new to database stuff. I've been using postgresql for a couple years, but that doesn't mean I understand what I'm doing. I have simply followed the "HOW-TOs". But now I think I'm about...
1
by: Ben-Nes Michael | last post by:
Hello Im getting strange errors when restoring data from pg_dump files: ERROR: duplicate key violates unique constraint "products_pkey" CONTEXT: COPY products, line 1: "98 Super Pak Ruby...
0
by: David Suela Fernández | last post by:
Hi! I have a debian woody with postgresql 7.4.2. When i try to use pg_dump i get the next error: pg_dump: saving encoding pg_dump: saving database definition pg_dump: SQL command failed...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.