This article explains how to run gpcheckcat
both online and in restricted mode in all versions of Tanzu Greenplum.
The procedure mentioned below will generate two log files:
/home/gpadmin/gpcheckcat_YYYMMDD_summary.log
/home/gpadmin/gpAdminLogs/gpcheckcat_YYYMMDD.log
Both the files must be provided to Support in order to investigate catalog issues.
Follow the instructions below to run gpcheckcat in restricted mode:
1. Stop the database:
gpstop -M fast
2. Start in restricted mode:
gpstart -aR
Note: This will prevent normal users from accessing the system. If there are scripts or tools which connect to the database using superuser accounts, then they should also be disabled until gpcheckcat
is completed.
3. If you on a GPDB version prior to v4.3.8.1, refer to the following Knowledge Base article to remove orphaned temp schemas: Orphaned temporary schemas in Greenplum Database
Run gpcheckcat
. For versions before v4.3.8.1, use the following step:
cd /home/gpadmin export PGDATABASE="DATABASE_NAME" nohup $GPHOME/bin/lib/gpcheckcat -v > /home/gpadmin/gpcheckcat_$(date +%Y%m%d)_summary.log 2>&1 &
For GPDB v4.3.8.1 or above, use the following step:
cd /home/gpadmin export PGDATABASE="DATABASE_NAME" nohup gpcheckcat -v > /home/gpadmin/gpcheckcat_$(date +%Y%m%d)_summary.log 2>&1 &
To run for all databases use -A
. Refer to gpcheckcat --help
for the list of all available options.
4. Review the summary log to see if a repair script was generated:
repair scripts generated in directory gpcheckcat.repair.YYYY-MM-DD.hh.mm.ss
If one was generated, enter the directory and execute the repair script:
cd gpcheckcat.repair.YYYY-MM-DD.hh.mm.ss ./runsql.sh
Once the repair script completes, re-run gpcheckcat
again to capture any remaining issues.
5. Repeat steps 4 and 5 for all other databases.
6. Create an archive containing both logs:
cd /home/gpadmin tar -zcvf gpcheckcat_$(date +%Y%m%d).tar.gz gpcheckcat_YYYMMDD_summary.log gpAdminLogs/gpcheckcat_YYYMMDD.log
7. Restart database in normal mode and release it to users.
8.Provide the log archive to Pivotal Support.
Follow the instructions below to run gpcheckcat in online mode.
Note: The online version of gpcheckcat
is safe to run catalog checks on a production cluster and does not require a maintenance window. It runs all the checks except for persistent table checks, that needs the database in maintenance mode.
1. Run online gpcheckcat
. For versions GPDB before v4.3.8.1, use the following command:
cd /home/gpadmin export PGDATABASE="DATABASE_NAME" nohup $GPHOME/bin/lib/gpcheckcat -O > /home/gpadmin/gpcheckcat_$(date +%Y%m%d)_summary.log 2>&1 &
For GPDB versions at or above v4.3.8.1, use the following command:
cd /home/gpadmin export PGDATABASE="DATABASE_NAME" nohup gpcheckcat -O > /home/gpadmin/gpcheckcat_$(date +%Y%m%d)_summary.log 2>&1 &
To run for all databases use -A
. Refer gpcheckcat --help
for list of all available options.
2. Review the summary log to see if a repair script was generated:
repair scripts generated in directory gpcheckcat.repair.YYYY-MM-DD.hh.mm.ss
If one was generated, enter the directory, and execute the repair script:
cd gpcheckcat.repair.YYYY-MM-DD.hh.mm.ss ./runsql.sh
Once the repair script completes, re-run gpcheckcat
again to capture any remaining issues.
3. Repeat steps 1 and 2 for all other databases. Create an archive containing both logs:
cd /home/gpadmin tar -zcvf gpcheckcat_$(date +%Y%m%d).tar.gz gpcheckcat_YYYMMDD_summary.log gpAdminLogs/gpcheckcat_YYYMMDD.log
4. Provide the log archive to VMware Tanzu Support.