Routine maintenance jobs from Greenplum database

Post date: Sep 15, 2014 8:46:18 PM

1. Execute following CRON JOB to do Vacuum FULL and analyze on a database - To be run on weekly basis

#!/bin/bash

## nohup /home/gpadmin/scripts/vacuum.sh > /var/tmp/vacuum_$(date +\%Y\%m\%d_\%H:\%M).log 2>&1 &

export GPHOME=/usr/local/greenplum-db

export MASTER_DATA_DIRECTORY=/data/master/gpseg-1

source $GPHOME/greenplum_path.sh

echo

cat << EOTEXT

************************************************************************

$(date) BEGIN Vacuum of all databases

************************************************************************

EOTEXT

vacuumdb -afx

echo

cat << EOTEXT

************************************************************************

$(date) END Vacuum of all databases

************************************************************************

EOTEXT

echo

2. Execute following CRON JOB to do Vacuum and analyze on a database - To be run on daily basis or after the ETL job..

#!/bin/bash

## nohup /home/gpadmin/scripts/vacuum.sh > /var/tmp/vacuum_$(date +\%Y\%m\%d_\%H:\%M).log 2>&1 &

export GPHOME=/usr/local/greenplum-db

export MASTER_DATA_DIRECTORY=/data/master/gpseg-1

source $GPHOME/greenplum_path.sh

echo

cat << EOTEXT

************************************************************************

$(date) BEGIN Vacuum of all databases

************************************************************************

EOTEXT

vacuumdb -ax

echo

cat << EOTEXT

************************************************************************

$(date) END Vacuum of all databases

************************************************************************

EOTEXT

echo

3. Execute following CRON JOB to do Vacuum on all database tables - To be run on daily basis or after the ETL job..

#!/bin/bash

## nohup /home/gpadmin/scripts/vacuum.sh > /var/tmp/vacuum_$(date +\%Y\%m\%d_\%H:\%M).log 2>&1 &

export GPHOME=/usr/local/greenplum-db

export MASTER_DATA_DIRECTORY=/data/master/gpseg-1

source $GPHOME/greenplum_path.sh

echo

cat << EOTEXT

************************************************************************

$(date) BEGIN Vacuum of all databases

************************************************************************

EOTEXT

vacuumdb -a

echo

cat << EOTEXT

************************************************************************

$(date) END Vacuum of all databases

************************************************************************

EOTEXT

echo