Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id EBBDDBF6A45 for ; Wed, 2 May 2012 18:01:58 -0300 (ADT) Received: from dilbert.fhcrc.org ([140.107.152.15]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SPggL-0001qN-TY for seapug@postgresql.org; Wed, 02 May 2012 21:01:57 +0000 Received: from dilbert.fhcrc.org (localhost.localdomain [127.0.0.1]) by localhost (Postfix) with SMTP id 4C1517FE82; Wed, 2 May 2012 14:01:39 -0700 (PDT) Received: from starbuck.fhcrc.org (STARBUCK.FHCRC.ORG [140.107.152.103]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by dilbert.fhcrc.org (Postfix) with ESMTPS id D4C597FF8C; Wed, 2 May 2012 14:01:38 -0700 (PDT) Received: from ISIS.fhcrc.org (140.107.132.206) by starbuck.fhcrc.org (140.107.152.103) with Microsoft SMTP Server id 14.1.355.2; Wed, 2 May 2012 14:01:38 -0700 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-Class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01CD28A6.C45C7392" Subject: Re: pg_dump: aborting because of server version mismatch Date: Wed, 2 May 2012 14:01:47 -0700 Message-ID: In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [seapug] pg_dump: aborting because of server version mismatch Thread-Index: Ac0ooZDQ1fmMHKtzQlmRDFgDuRyZSgAA7BdA References: From: "Albin, Lloyd P" To: Mitesh Shah , X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.5.2.205131 X-FHCRC-SCANNED: Wed May 2 14:01:38 2012 X-Pg-Spam-Score: -4.2 (----) X-Archive-Number: 201205/4 X-Sequence-Number: 118 ------_=_NextPart_001_01CD28A6.C45C7392 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Mitesh, =20 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.=20 =20 =20 Lloyd =20 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 =20 Hi, I am trying to create a daily backup cron script but it fails with an error as below: =20 Any pointers to resolve this will be greatly appreciated. =20 Thanks, Mitesh Shah mitesh.shah@stripes39.com =20 (1) Error: bash-3.2$ sh pg_backup_rotated_orig.sh=20 Making backup directory in /Users/miteshshah/Documents/2012-05-02-daily/ -e=20 =20 Performing full backups -e -------------------------------------------- =20 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=20 All database backups complete! =20 =20 =20 (2.1) /Users/miteshshah/Desktop/pg_backup.config file: ############################# ## POSTGRESQL BACKUP CONFIG ## ############################## # hostname to adhere to pg_hba policies. HOSTNAME=3D =20 # username to connect to database as. USERNAME=3D =20 # Database name DATABASE=3D =20 # This dir will be created if it doesn't exist. This must be writable by the user the script is # running as. BACKUP_DIR=3D =20 # SCRIPTPATH SCRIPTPATH=3D =20 # Will produce a custom-format backup if set to "yes" ENABLE_CUSTOM_BACKUPS=3Dyes =20 # Will produce a gzipped plain-format backup if set to "yes" ENABLE_PLAIN_BACKUPS=3Dyes =20 =20 #### SETTINGS FOR ROTATED BACKUPS #### =20 # Which day to take the weekly backup from (1-7 =3D Monday-Sunday) DAY_OF_WEEK_TO_KEEP=3D5 =20 # Number of days to keep daily backups DAYS_TO_KEEP=3D7 =20 # How many weeks to keep weekly backups WEEKS_TO_KEEP=3D5 =20 ###################################### =20 =20 (2.2) /Users/miteshshah/Desktop/pg_backup_rotated_orig.sh #!/bin/bash =20 ########################### ####### LOAD CONFIG ####### ########################### =20 source /Users/miteshshah/Desktop/pg_backup.config =20 =20 ########################### #### START THE BACKUPS #### ########################### =20 function perform_backups() { SUFFIX=3D$1 FINAL_BACKUP_DIR=3D$BACKUP_DIR"`date +\%Y-\%m-\%d`$SUFFIX/" =20 echo "Making backup directory in $FINAL_BACKUP_DIR" =20 if ! mkdir -p $FINAL_BACKUP_DIR; then echo "Cannot create backup directory in $FINAL_BACKUP_DIR. Go and fix it!" exit 1; fi; =20 =20 ########################### ###### FULL BACKUPS ####### ########################### =20 echo -e "\n\nPerforming full backups" echo -e "--------------------------------------------\n" =20 =20 =20 if [ $ENABLE_PLAIN_BACKUPS =3D "yes" ] then echo "Plain backup of $DATABASE" =20 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 =20 if [ $ENABLE_CUSTOM_BACKUPS =3D "yes" ] then echo "Custom backup of $DATABASE" =20 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 =20 =20 =20 echo -e "\nAll database backups complete!" } =20 # DAILY BACKUPS =20 # Delete daily backups 7 days old or more find $BACKUP_DIR -maxdepth 1 -mtime +$DAYS_TO_KEEP -name "*-daily" -exec rm -rf '{}' ';' =20 =20 ------_=_NextPart_001_01CD28A6.C45C7392 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

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

=

 

(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=3D = <host>

 

# = username to connect to database as.

USERNAME=3D<user>

 

# = Database name

DATABASE=3D<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=3D<backup_dir>

 

# SCRIPTPATH

SCRIPTPATH=3D<path>

 

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

ENABLE_CUSTOM_BACKUPS=3Dyes

<= div>

 

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

ENABLE_PLAIN_BACKUPS=3Dyes

 

 

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

 

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

DAY_OF_WEEK_TO_KEEP=3D5

 

# = Number of days to keep daily backups

DAYS_TO_KEEP=3D7

 

# = How many weeks to keep weekly backups

WEEKS_TO_KEEP=3D5

 

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

 

 

(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=3D$1

        = FINAL_BACKUP_DIR=3D$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 =3D "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 =3D "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 '{}' = ';'

 

 

------_=_NextPart_001_01CD28A6.C45C7392--