Thread: Postgres restore issue

Postgres restore issue

From
"Vaidyanathaswamy, Anandsaikrishnan"
Date:

Good morning,

 

First of all thanks for helping me ,

 

We have postgres running in 8.4.22, We have back up from 8.3.7

When I try to restore, All the tables are not restored, almost 60% of the tables not exist, Failed with the following errors.

 

Any help on this much appreciated.

 

I am using the below command for pg_restore

 

nohup pg_restore -c -U postgres  -d gpl_maps ~/gcs/PostgreSQL/gpl_maps_devgm01.bkup &

 

 

pg_restore: [archiver (db)] Error from TOC entry 7580; 0 49537695 TABLE DATA bldg_footprints gpl-layer-loader

pg_restore: [archiver (db)] could not execute query: ERROR:  relation "bldg_footprints" does not exist

    Command was: COPY bldg_footprints (gid, id, inbld_fid, bld_status, simbldflag, shape_leng, shape_le_1, shape_le_2, shape_area, et_id, the...

pg_restore: [archiver (db)] Error from TOC entry 7346; 0 17254 TABLE DATA block postgres

pg_restore: [archiver (db)] could not execute query: ERROR:  relation "block" does not exist

    Command was: COPY block (gid, blockgroup, bkg_key, the_geom) FROM stdin;

 

pg_restore: [archiver (db)] Error from TOC entry 7443; 0 2897197 TABLE DATA brushfire_hazard_layer postgres

pg_restore: [archiver (db)] could not execute query: ERROR:  relation "brushfire_hazard_layer" does not exist

    Command was: COPY brushfire_hazard_layer (gid, id, risk_value, fire_risk, fipsstco, the_geom) FROM stdin;

 

pg_restore: [archiver (db)] Error from TOC entry 7347; 0 17282 TABLE DATA ca059_census_tracts gpl-layer-loader

pg_restore: [archiver (db)] could not execute query: ERROR:  relation "ca059_census_tracts" does not exist

    Command was: COPY ca059_census_tracts (gid, censustrac, sdstag, the_geom) FROM stdin;

 

pg_restore: [archiver (db)] Error from TOC entry 7348; 0 17294 TABLE DATA ca059_numbered_census_tracts gpl-layer-loader

pg_restore: [archiver (db)] could not execute query: ERROR:  relation "ca059_numbered_census_tracts" does not exist

    Command was: COPY ca059_numbered_census_tracts (gid, tractid, sdstag, the_geom) FROM stdin;

 

pg_restore: [archiver (db)] Error from TOC entry 7628; 0 90569459 TABLE DATA calgary_disclaimer_boundary gpl-layer-loader

pg_restore: [archiver (db)] could not execute query: ERROR:  relation "calgary_disclaimer_boundary" does not exist

    Command was: COPY calgary_disclaimer_boundary (gid, id, area_km, the_geom) FROM stdin;

 

pg_restore: [archiver (db)] Error from TOC entry 7576; 0 45204628 TABLE DATA congressional_dist_copy gpl-layer-loader

pg_restore: [archiver (db)] could not execute query: ERROR:  relation "congressional_dist_copy" does not exist

    Command was: COPY congressional_dist_copy (gid, statefp, cd113fp, geoid, namelsad, lsad, cdsessn, mtfcc, funcstat, aland, awater, intptla...

pg_restore: [archiver (db)] Error from TOC entry 7575; 0 45203723 TABLE DATA congressional_district gpl-layer-loader

pg_restore: [archiver (db)] could not execute query: ERROR:  relation "congressional_district" does not exist

    Command was: COPY congressional_district (gid, statefp, cd113fp, geoid, namelsad, lsad, cdsessn, mtfcc, funcstat, aland, awater, intptlat...

pg_restore: [archiver (db)] Error from TOC entry 7350; 0 17337 TABLE DATA continent postgres

pg_restore: [archiver (db)] could not execute query: ERROR:  relation "continent" does not exist

    Command was: COPY continent (gid, continent, the_geom) FROM stdin;

 

pg_restore: [archiver (db)] Error from TOC entry 7507; 0 22422078 TABLE DATA coremls_geocoverage_county gpl-layer-loader

pg_restore: [archiver (db)] could not execute query: ERROR:  relation "coremls_geocoverage_county" does not exist

    Command was: COPY coremls_geocoverage_county (county_id, pctcvginfonet, pctcvginfonetmls, pctcvginfonetmlsvm, name, the_geom) FROM stdin;

 

******************************************************************************************
This message may contain confidential or proprietary information intended only for the use of the
addressee(s) named above or may contain information that is legally privileged. If you are
not the intended addressee, or the person responsible for delivering it to the intended addressee,
you are hereby notified that reading, disseminating, distributing or copying this message is strictly
prohibited. If you have received this message by mistake, please immediately notify us by 
replying to the message and delete the original message and any copies immediately thereafter.

Thank you.
******************************************************************************************
CLLD

Re: Postgres restore issue

From
Heikki Linnakangas
Date:
On 25 October 2018 20:27:07 WEST, "Vaidyanathaswamy, Anandsaikrishnan" <avaidyanathaswamy@corelogic.com> wrote:
>We have postgres running in 8.4.22, We have back up from 8.3.7
>When I try to restore, All the tables are not restored, almost 60% of
>the tables not exist, Failed with the following errors.
>
>Any help on this much appreciated.
>
>I am using the below command for pg_restore
>
>nohup pg_restore -c -U postgres  -d gpl_maps
>~/gcs/PostgreSQL/gpl_maps_devgm01.bkup &
>
>
>pg_restore: [archiver (db)] Error from TOC entry 7580; 0 49537695 TABLE
>DATA bldg_footprints gpl-layer-loader
>pg_restore: [archiver (db)] could not execute query: ERROR:  relation
>"bldg_footprints" does not exist
>Command was: COPY bldg_footprints (gid, id, inbld_fid, bld_status,

These errors are coming from restoring the data. Were there any errors before these, from the CREATE TABLE commands?
Youcould try using the -s option, to restore just the schema first, and check if all the tables exist after that. You
couldalso run it without the username and database options, to create a human-readable SQL file. That might give a
betterclue on what's going on. 

- Heikki


Re: Postgres restore issue

From
Narayanan V
Date:
Hi Anand,

I was unsuccessful in trying to reproduce this with a database and pg_dump
from 8.3.7 and a pg_restore of 8.4.22. 

------------------------------------------------------------------------------------------------------

I do get the following error during the restore on an empty database, however,
I think we can safely ignore this.

pg_restore: dropping TABLE employees
pg_restore: [archiver (db)] Error from TOC entry 1465; 1259 16391 TABLE employees kannan
pg_restore: [archiver (db)] could not execute query: ERROR:  table "employees" does not exist
    Command was: DROP TABLE public.employees;

As evident the above error happens because the employees table does not exist in an empty database.

------------------------------------------------------------------------------------------------------

I think I would follow Heikki's comments and check for errors during the schema restore first.

------------------------------------------------------------------------------------------------------

Although I am not sure it would make much of a difference I would suggest you try the --create (-C)
option. Please note that this option tries to delete and re-create the database itself hence you will
need to supply some other database to the -d option.

Thank you,
Narayanan


On Sat, Oct 27, 2018 at 3:30 PM Heikki Linnakangas <hlinnaka@iki.fi> wrote:
On 25 October 2018 20:27:07 WEST, "Vaidyanathaswamy, Anandsaikrishnan" <avaidyanathaswamy@corelogic.com> wrote:
>We have postgres running in 8.4.22, We have back up from 8.3.7
>When I try to restore, All the tables are not restored, almost 60% of
>the tables not exist, Failed with the following errors.
>
>Any help on this much appreciated.
>
>I am using the below command for pg_restore
>
>nohup pg_restore -c -U postgres  -d gpl_maps
>~/gcs/PostgreSQL/gpl_maps_devgm01.bkup &
>
>
>pg_restore: [archiver (db)] Error from TOC entry 7580; 0 49537695 TABLE
>DATA bldg_footprints gpl-layer-loader
>pg_restore: [archiver (db)] could not execute query: ERROR:  relation
>"bldg_footprints" does not exist
>Command was: COPY bldg_footprints (gid, id, inbld_fid, bld_status,

These errors are coming from restoring the data. Were there any errors before these, from the CREATE TABLE commands? You could try using the -s option, to restore just the schema first, and check if all the tables exist after that. You could also run it without the username and database options, to create a human-readable SQL file. That might give a better clue on what's going on.

- Heikki