Connection Error during Pg_restore

Started by Rebecca Clarkeover 14 years ago3 messagesgeneral
Jump to latest
#1Rebecca Clarke
rebecca@clarke.net.nz

Hi there

I'm doing a restore of a large table. The backup file is 18gb. When I run
the restore after sometime it comes up with this error while it is restoring
the data.

pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 3022; 0 4287406059 TABLE
DATA tbl_exampletable postgres
pg_restore: [archiver (db)] COPY failed: server closed the connection
unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
WARNING: errors ignored on restore: 1

It will work if I use COPY but the table is so big I need to use pg_dump to
compress it.

Any help would be great.

Thanks

Rebecca

#2Craig Ringer
craig@2ndquadrant.com
In reply to: Rebecca Clarke (#1)
Re: Connection Error during Pg_restore

On 17/08/2011 7:02 PM, Rebecca Clarke wrote:

Hi there

I'm doing a restore of a large table. The backup file is 18gb. When I
run the restore after sometime it comes up with this error while it is
restoring the data.

pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 3022; 0 4287406059
TABLE DATA tbl_exampletable postgres
pg_restore: [archiver (db)] COPY failed: server closed the connection
unexpectedly
This probably means the server terminated abnormally
before or while processing the request.

You'll need to look at the server logs to see why the server terminated
the connection. I expect you'll see a backend crash, but it's hard to be
sure.

Please also supply your version and the other basic information listed here:

http://wiki.postgresql.org/wiki/Guide_to_reporting_problems#Things_you_need_to_mention_in_problem_reports

--
Craig Ringer

#3Rebecca Clarke
rebecca@clarke.net.nz
In reply to: Rebecca Clarke (#1)
Re: Connection Error during Pg_restore

That worked thank you

On Wed, Aug 17, 2011 at 1:01 PM, raghu ram <raghuchennuru@gmail.com> wrote:

Show quoted text

On Wed, Aug 17, 2011 at 4:32 PM, Rebecca Clarke <rebecca@clarke.net.nz>wrote:

Hi there

I'm doing a restore of a large table. The backup file is 18gb. When I run
the restore after sometime it comes up with this error while it is restoring
the data.

pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 3022; 0 4287406059 TABLE
DATA tbl_exampletable postgres
pg_restore: [archiver (db)] COPY failed: server closed the connection
unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
WARNING: errors ignored on restore: 1

It will work if I use COPY but the table is so big I need to use pg_dump
to compress it.

Try below steps to restore data for larger table:

1. Create a table structure

2. copy data into .csv file

copy item_trans to '/opt/item_trans.csv' WITH csv;

3. restore data with below command

nohup psql -d postgres -p 5432 -U postgres -c "copy item_trans from
'/opt/item_trans.csv' WITH csv;" >>/tmp/restore.log 2>>/tmp/restore.log &

--Raghu Ram