agora inbox for austinpug@postgresql.org  
help / color / mirror / Atom feed
pg_dump: aborting because of server version mismatch
8+ messages / 6 participants
[nested] [flat]

* pg_dump: aborting because of server version mismatch
@ 2012-05-02 19:55  Mitesh Shah <mitesh.shah@stripes39.com>
  0 siblings, 4 replies; 8+ messages in thread

From: Mitesh Shah @ 2012-05-02 19:55 UTC (permalink / raw)
  To: pgsql-admin@postgresql.org; pgsql-bugs@postgresql.org; pgsql-sql@postgresql.org; adelaide-au-pug@postgresql.org; seapug@postgresql.org

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 '{}' ';'

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* pg_dump: aborting because of server version mismatch
@ 2012-05-02 19:58  Mitesh Shah <mitesh.shah@stripes39.com>
  parent: Mitesh Shah <mitesh.shah@stripes39.com>
  3 siblings, 1 reply; 8+ messages in thread

From: Mitesh Shah @ 2012-05-02 19:58 UTC (permalink / raw)
  To: sfpug@postgresql.org; atlpug@postgresql.org; austinpug; bostonpug@postgresql.org; bwpug@postgresql.org

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 '{}' ';'

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* pg_dump: aborting because of server version mismatch
@ 2012-05-02 20:23  Mitesh Shah <mitesh.shah@stripes39.com>
  parent: Mitesh Shah <mitesh.shah@stripes39.com>
  3 siblings, 1 reply; 8+ messages in thread

From: Mitesh Shah @ 2012-05-02 20:23 UTC (permalink / raw)
  To: seapug@postgresql.org

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 '{}' ';'

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: pg_dump: aborting because of server version mismatch
@ 2012-05-02 21:01  Albin, Lloyd P <lalbin@scharp.org>
  parent: Mitesh Shah <mitesh.shah@stripes39.com>
  0 siblings, 0 replies; 8+ messages in thread

From: Albin, Lloyd P @ 2012-05-02 21:01 UTC (permalink / raw)
  To: Mitesh Shah <mitesh.shah@stripes39.com>; seapug@postgresql.org

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 '{}' ';'

 

 

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [BUGS] pg_dump: aborting because of server version mismatch
@ 2012-05-02 21:53  Kevin Grittner <Kevin.Grittner@wicourts.gov>
  parent: Mitesh Shah <mitesh.shah@stripes39.com>
  3 siblings, 1 reply; 8+ messages in thread

From: Kevin Grittner @ 2012-05-02 21:53 UTC (permalink / raw)
  To: adelaide-au-pug@postgresql.org; pgsql-admin@postgresql.org; pgsql-bugs@postgresql.org; pgsql-sql@postgresql.org; seapug@postgresql.org; Mitesh Shah <mitesh.shah@stripes39.com>

Mitesh Shah <mitesh.shah@stripes39.com> wrote:
 
> *pg_dump: server version: 9.1.2; pg_dump version: 9.0.5*
> *pg_dump: aborting because of server version mismatch*
 
This is not a bug.  Use a version of pg_dump which is at least as
new as the server.  The older version of pg_dump is unlikely to be
able to recognize everything in the newer server,
 
-Kevin



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [seapug] Re: [BUGS] pg_dump: aborting because of server version mismatchT
@ 2012-05-02 22:27  Robert Bernier <rbernier@mediosystems.com>
  parent: Kevin Grittner <Kevin.Grittner@wicourts.gov>
  0 siblings, 0 replies; 8+ messages in thread

From: Robert Bernier @ 2012-05-02 22:27 UTC (permalink / raw)
  To: seapug@postgresql.org; +Cc: Kevin Grittner <Kevin.Grittner@wicourts.gov>; adelaide-au-pug@postgresql.org, pgsql-admin@postgresql.org, pgsql-bugs@postgresql.org, pgsql-sql@postgresql.org, "Mitesh Shah" <mitesh.shah@stripes39.com>

There used to be a switch in pg_dump that would disable the version, you can 
even see that's in the man page. However, it is not reccommended and the most 
recent versions have fully deprecated the switch. Technically speaking that 
means that you can even use an older version of pg_dump and it wouldn't 
generate any errors although I wouldn't want to test it out on important stuff.

Robert Bernier



On Wednesday, May 02, 2012 02:53:53 pm Kevin Grittner wrote:
> Mitesh Shah <mitesh.shah@stripes39.com> wrote:
> > *pg_dump: server version: 9.1.2; pg_dump version: 9.0.5*
> > *pg_dump: aborting because of server version mismatch*
> 
> This is not a bug.  Use a version of pg_dump which is at least as
> new as the server.  The older version of pg_dump is unlikely to be
> able to recognize everything in the newer server,
> 
> -Kevin



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [sfpug] pg_dump: aborting because of server version mismatch
@ 2012-05-03 03:27  Christophe Pettus <xof@thebuild.com>
  parent: Mitesh Shah <mitesh.shah@stripes39.com>
  0 siblings, 0 replies; 8+ messages in thread

From: Christophe Pettus @ 2012-05-03 03:27 UTC (permalink / raw)
  To: Mitesh Shah <mitesh.shah@stripes39.com>; +Cc: sfpug@postgresql.org; atlpug@postgresql.org; austinpug; bostonpug@postgresql.org; bwpug@postgresql.org

Hi, Mitesh,

The error means exactly what it says: You're trying to use the 9.0.5 version of pg_dump to dump a server running 9.1.2; you need a version of pg_dump that is no older than the server you are trying to do the dump from.

On May 2, 2012, at 12:58 PM, Mitesh Shah wrote:

> 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 '{}' ';'
> 
> 

--
-- Christophe Pettus
   xof@thebuild.com




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [SQL] pg_dump: aborting because of server version mismatch
@ 2012-05-11 19:39  Adrian Klaver <adrian.klaver@gmail.com>
  parent: Mitesh Shah <mitesh.shah@stripes39.com>
  3 siblings, 0 replies; 8+ messages in thread

From: Adrian Klaver @ 2012-05-11 19:39 UTC (permalink / raw)
  To: Mitesh Shah <mitesh.shah@stripes39.com>; +Cc: pgsql-admin@postgresql.org; pgsql-bugs@postgresql.org; pgsql-sql@postgresql.org; adelaide-au-pug@postgresql.org; seapug@postgresql.org

On 05/02/2012 12:55 PM, Mitesh Shah wrote:
> 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 <mailto: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*

The problem is you are using an older version of pg_dump to dump a newer 
database. That will not work.
Possible solution:
You are running via cron. Cron has its own environment. Unless you are 
explicit in your pathing you can get surprising results, see above.
Find the path to the 9.1.2 version of pg_dump and use that absolute path 
in your script.

> *pg_dump: aborting because of server version mismatch*
> -e
> All database backups complete!
>

-- 
Adrian Klaver
adrian.klaver@gmail.com



^ permalink  raw  reply  [nested|flat] 8+ messages in thread


end of thread, other threads:[~2012-05-11 19:39 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-05-02 19:55 pg_dump: aborting because of server version mismatch Mitesh Shah <mitesh.shah@stripes39.com>
2012-05-02 19:58 ` Mitesh Shah <mitesh.shah@stripes39.com>
2012-05-03 03:27   ` Christophe Pettus <xof@thebuild.com>
2012-05-02 20:23 ` Mitesh Shah <mitesh.shah@stripes39.com>
2012-05-02 21:01   ` Albin, Lloyd P <lalbin@scharp.org>
2012-05-02 21:53 ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
2012-05-02 22:27   ` Re: [seapug] Re: [BUGS] pg_dump: aborting because of server version mismatchT Robert Bernier <rbernier@mediosystems.com>
2012-05-11 19:39 ` Adrian Klaver <adrian.klaver@gmail.com>

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