Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 1D520A6FC4F; Thu, 3 May 2012 00:27:46 -0300 (ADT) Received: from smtp148.dfw.emailsrvr.com ([67.192.241.148]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SPmhl-000258-QW; Thu, 03 May 2012 03:27:46 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp24.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id B08DB18014D; Wed, 2 May 2012 23:27:31 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp24.relay.dfw1a.emailsrvr.com (Authenticated sender: xof-AT-thebuild.com) with ESMTPSA id 8486B18007C; Wed, 2 May 2012 23:27:29 -0400 (EDT) Subject: Re: [sfpug] pg_dump: aborting because of server version mismatch Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Christophe Pettus In-Reply-To: Date: Wed, 2 May 2012 20:27:28 -0700 Cc: sfpug@postgresql.org, atlpug@postgresql.org, austinpug@postgresql.org, bostonpug@postgresql.org, bwpug@postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <7DDB8E70-7E48-4EA5-8D54-A4E754971830@thebuild.com> References: To: Mitesh Shah X-Mailer: Apple Mail (2.1084) X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201205/2 X-Sequence-Number: 41 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: >=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 -- -- Christophe Pettus xof@thebuild.com