By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,710 Members | 1,887 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,710 IT Pros & Developers. It's quick & easy.

restoring database

P: n/a
Hi everybody ... i need to restore only one database from a pg_dumpall backup
file... how can i do it?

Thanks a lot !

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

http://archives.postgresql.org

Nov 12 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
On Mon, 2003-12-22 at 14:51, Lucas Lain wrote:
Hi everybody ... i need to restore only one database from a pg_dumpall backup
file... how can i do it?


If it's a plain text dump, make a copy of the backup file. Edit the
copy and delete everything that doesn't relate to the database to be
restored.

If you dumped in tar or special format, I believe you can use
pg_restore -d dbname
but I haven't done that myself and am not sure if I'm interpreting the
manpage correctly.

--
Oliver Elphick Ol************@lfix.co.uk
Isle of Wight, UK http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"And there were in the same country shepherds abiding
in the field, keeping watch over their flock by night.
And, lo, the angel of the Lord came upon them, and the
glory of the Lord shone around them; and they were
sore afraid. And the angel said unto them, " Fear not;
for behold I bring you good tidings of great joy which
shall be to all people. For unto you is born this day
in the city of David a Saviour, which is Christ the
Lord." Luke 2:8-11
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 12 '05 #2

P: n/a
>
If it's a plain text dump, make a copy of the backup file. Edit the
copy and delete everything that doesn't relate to the database to be
restored.
it's quite large to do this ...

If you dumped in tar or special format, I believe you can use
pg_restore -d dbname
but I haven't done that myself and am not sure if I'm interpreting the
manpage correctly.


this database is only for connection ..
i like the split solution ... i will try

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 12 '05 #3

P: n/a
On Mon, Dec 22, 2003 at 08:14:51PM -0300, Lucas Lain wrote:
If it's a plain text dump, make a copy of the backup file. Edit the
copy and delete everything that doesn't relate to the database to be
restored.


it's quite large to do this ...


Maybe you could try getting the line numbers for the data you want using
grep (be sure to anchor the patterns with ^ to make the search faster),
and then extract the data using either awk (see NR) or perl (see $.).
This way you don't have to open the dump with an editor, which would
load the whole file in memory.

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"La fuerza no está en los medios físicos
sino que reside en una voluntad indomable" (Gandhi)

---------------------------(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 12 '05 #4

P: n/a
On Mon, 2003-12-22 at 14:51, Lucas Lain wrote:
Hi everybody ... i need to restore only one database from a pg_dumpall backup
file... how can i do it?


If it's a plain text dump, make a copy of the backup file. Edit the
copy and delete everything that doesn't relate to the database to be
restored.

If you dumped in tar or special format, I believe you can use
pg_restore -d dbname
but I haven't done that myself and am not sure if I'm interpreting the
manpage correctly.

--
Oliver Elphick Ol************@lfix.co.uk
Isle of Wight, UK http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"And there were in the same country shepherds abiding
in the field, keeping watch over their flock by night.
And, lo, the angel of the Lord came upon them, and the
glory of the Lord shone around them; and they were
sore afraid. And the angel said unto them, " Fear not;
for behold I bring you good tidings of great joy which
shall be to all people. For unto you is born this day
in the city of David a Saviour, which is Christ the
Lord." Luke 2:8-11
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 12 '05 #5

P: n/a
>
If it's a plain text dump, make a copy of the backup file. Edit the
copy and delete everything that doesn't relate to the database to be
restored.
it's quite large to do this ...

If you dumped in tar or special format, I believe you can use
pg_restore -d dbname
but I haven't done that myself and am not sure if I'm interpreting the
manpage correctly.


this database is only for connection ..
i like the split solution ... i will try

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 12 '05 #6

P: n/a
On Mon, Dec 22, 2003 at 08:14:51PM -0300, Lucas Lain wrote:
If it's a plain text dump, make a copy of the backup file. Edit the
copy and delete everything that doesn't relate to the database to be
restored.


it's quite large to do this ...


Maybe you could try getting the line numbers for the data you want using
grep (be sure to anchor the patterns with ^ to make the search faster),
and then extract the data using either awk (see NR) or perl (see $.).
This way you don't have to open the dump with an editor, which would
load the whole file in memory.

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"La fuerza no está en los medios físicos
sino que reside en una voluntad indomable" (Gandhi)

---------------------------(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 12 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.