pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Albin, Lloyd P <lalbin@scharp.org>
To: Mitesh Shah <mitesh.shah@stripes39.com>
To: seapug@postgresql.org
Subject: Re: pg_dump: aborting because of server version mismatch
Date: Wed, 2 May 2012 14:01:47 -0700
Message-ID: <D780EAC3ADA31F488BCA74ECCD5B717E0A78CDE6@ISIS.fhcrc.org> (raw)
In-Reply-To: <CAHofYQRT-WXgD-+nojF_UNqjnT+Oubf+uY542dS_-m+2ib7g+w@mail.gmail.com>
References: <CAHofYQQ6yvHGCiHPBqTAL5fU=3haWXdE7oX-3=q=pcGYPajFxg@mail.gmail.com>
	<CAHofYQRT-WXgD-+nojF_UNqjnT+Oubf+uY542dS_-m+2ib7g+w@mail.gmail.com>

Mitesh,

 

Your server is newer than your pg_dump program. pg_dump must be the same
version as server version. You need to upgrade your pg_dump to be
version 9.1.2. It should have installed that version when you
installed/upgraded your Postgres version but may have been installed in
a different location or the one you are using for your script is not the
one that came with your server (separate install). So all you need to do
in your script is to point to the one that comes with the server and it
will work or update the one that you are currently using in the script
to version 9.1.2. 

 

 

Lloyd

 

From: seapug-owner@postgresql.org [mailto:seapug-owner@postgresql.org]
On Behalf Of Mitesh Shah
Sent: Wednesday, May 02, 2012 1:24 PM
To: seapug@postgresql.org
Subject: [seapug] pg_dump: aborting because of server version mismatch

 

Hi,

I am trying to create a daily backup cron script but it fails with an
error as below:

 

Any pointers to resolve this will be greatly appreciated.

 

Thanks,

Mitesh Shah

mitesh.shah@stripes39.com

 

(1) Error:

bash-3.2$ sh pg_backup_rotated_orig.sh 

Making backup directory in /Users/miteshshah/Documents/2012-05-02-daily/

-e 

 

Performing full backups

-e --------------------------------------------

 

Plain backup of mitesh

pg_dump: server version: 9.1.2; pg_dump version: 9.0.5

pg_dump: aborting because of server version mismatch

-e 

All database backups complete!

 

 

 

(2.1)    /Users/miteshshah/Desktop/pg_backup.config file:

#############################

## POSTGRESQL BACKUP CONFIG ##

##############################

# hostname to adhere to pg_hba policies.

HOSTNAME= <host>

 

# username to connect to database as.

USERNAME=<user>

 

# Database name

DATABASE=<database>

 

# This dir will be created if it doesn't exist.  This must be writable
by the user the script is

# running as.

BACKUP_DIR=<backup_dir>

 

# SCRIPTPATH

SCRIPTPATH=<path>

 

# Will produce a custom-format backup if set to "yes"

ENABLE_CUSTOM_BACKUPS=yes

 

# Will produce a gzipped plain-format backup if set to "yes"

ENABLE_PLAIN_BACKUPS=yes

 

 

#### SETTINGS FOR ROTATED BACKUPS ####

 

# Which day to take the weekly backup from (1-7 = Monday-Sunday)

DAY_OF_WEEK_TO_KEEP=5

 

# Number of days to keep daily backups

DAYS_TO_KEEP=7

 

# How many weeks to keep weekly backups

WEEKS_TO_KEEP=5

 

######################################

 

 

(2.2)  /Users/miteshshah/Desktop/pg_backup_rotated_orig.sh

#!/bin/bash

 

###########################

####### LOAD CONFIG #######

###########################

 

source /Users/miteshshah/Desktop/pg_backup.config

 

 

###########################

#### START THE BACKUPS ####

###########################

 

function perform_backups()

{

        SUFFIX=$1

        FINAL_BACKUP_DIR=$BACKUP_DIR"`date +\%Y-\%m-\%d`$SUFFIX/"

 

        echo "Making backup directory in $FINAL_BACKUP_DIR"

 

        if ! mkdir -p $FINAL_BACKUP_DIR; then

                echo "Cannot create backup directory in
$FINAL_BACKUP_DIR. Go and fix it!"

                exit 1;

        fi;

 

 

        ###########################

        ###### FULL BACKUPS #######

        ###########################

 

        echo -e "\n\nPerforming full backups"

        echo -e "--------------------------------------------\n"

 

 

 

                if [ $ENABLE_PLAIN_BACKUPS = "yes" ]

                then

                        echo "Plain backup of $DATABASE"

 

                        if ! pg_dump -Fp -h "$HOSTNAME" -U "$USERNAME"
"$DATABASE" | gzip > $FINAL_BACKUP_DIR"$DATABASE".sql.gz.in_progress;
then

                                echo "[!!ERROR!!] Failed to produce
plain backup database $DATABASE"

                        else

                                mv
$FINAL_BACKUP_DIR"$DATABASE".sql.gz.in_progress
$FINAL_BACKUP_DIR"$DATABASE".sql.gz

                        fi

                fi

 

                if [ $ENABLE_CUSTOM_BACKUPS = "yes" ]

                then

                        echo "Custom backup of $DATABASE"

 

                        if ! pg_dump -Fc -h "$HOSTNAME" -U "$USERNAME"
"$DATABASE" -f $FINAL_BACKUP_DIR"$DATABASE".custom.in_progress; then

                                echo "[!!ERROR!!] Failed to produce
custom backup database $DATABASE"

                        else

                                mv
$FINAL_BACKUP_DIR"$DATABASE".custom.in_progress
$FINAL_BACKUP_DIR"$DATABASE".custom

                        fi

                fi

 

 

 

        echo -e "\nAll database backups complete!"

}

 

# DAILY BACKUPS

 

# Delete daily backups 7 days old or more

find $BACKUP_DIR -maxdepth 1 -mtime +$DAYS_TO_KEEP -name "*-daily" -exec
rm -rf '{}' ';'

 

 

view thread (8+ messages)  latest in thread

Message-ID: <D780EAC3ADA31F488BCA74ECCD5B717E0A78CDE6@ISIS.fhcrc.org>
Permalink:  ../D780EAC3ADA31F488BCA74ECCD5B717E0A78CDE6@ISIS.fhcrc.org/
Also on:    postgresql.org/message-id/D780EAC3ADA31F488BCA74ECCD5B717E0A78CDE6@ISIS.fhcrc.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: lalbin@scharp.org, mitesh.shah@stripes39.com, seapug@postgresql.org
  Subject: Re: pg_dump: aborting because of server version mismatch
  In-Reply-To: <D780EAC3ADA31F488BCA74ECCD5B717E0A78CDE6@ISIS.fhcrc.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox