Pivotal Knowledge Base

Follow

gptoolkit Schema 'ERROR: relation "gp_toolkit.gp_stats_missing" does not exist'

Symptom

In case of a full database restore, you can notice that gp_toolkit schema is broken and have no relations.

testdb=# select * from gp_toolkit.gp_stats_missing; 
ERROR:  relation "gp_toolkit.gp_stats_missing" does not exist
LINE 1: select * from gp_toolkit.gp_stats_missing;

Cause

This is because the new database has been created using template0 with gpdbrestore/gp_restore utility and the gp_toolkit is already broken on template0 database.

For eg.s

You can notice that from the content gp_cdatabase_1_1* on the master backup directory as below:

gpadmin:Fullrack@mdw $ cat gp_cdatabase_1_1_20140314194732
--
-- Database creation
--
CREATE DATABASE gpadmin WITH TEMPLATE = template0 ENCODING = 'UTF8' OWNER = gpadmin;

So the new database will encounter the same issue when accessing the relations from this administrative schema.

Resolution

Reload the schema after taking the dump from template1 or postgres database as discussed below:

  • Take a backup of gp_toolkit from template1 database:
pg_dump -n gp_toolkit template1 > gp_toolkit_backup
  • Reload into the new database:
psql -f gp_toolkit_backup testdb
  • If the schema has not been created when the database was initialized then use the script from $GPHOME.
psql -f  $GPHOME/share/postgresql/gp_toolkit.sql
  • The issue is resolved in Pivotal Greenplum (GPDB) 4.3.x versions

Comments

Powered by Zendesk