Tape backup, 2 versions, same database name, which is pg_dump backing up

Started by Nonameover 19 years ago9 messagesgeneral
Jump to latest
#1Noname
MargaretGillon@chromalloy.com

Yesterday a consultant upgraded me from 7.3.4 to 8.1.4 on a RedHat 9
server. To make sure everything was okay we left the server so that both
versions of Postgresql load. 7.3.4 loads on the default port of 5432 and
8.1.4 loads on port 55432 . My database was moved into the new version so
both the old and new databases have the same name.

I have a little .sh file that runs a tape backup using pg_dump and I am
wondering if both versions are running how do I know which version of the
pg_dump is running and which version of the database is being backed up?

The backup command I use is

pg_dump -U postgres -C -D -f /tmp/$(date+%F)owl.sql owl

then I use tar to copy the file to tape.

Please answer to me as well as the list, I am on digest.

Thanks,
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
*** ***
Margaret Gillon, IS Dept., Chromalloy Los Angeles, ext. 297

This e-mail message and any attachment(s) are for the sole use of the
intended recipient(s) and may contain proprietary and/or confidential
information which may be privileged or otherwise protected from
disclosure. Any unauthorized review, use, disclosure or distribution is
prohibited. If you are not the intended recipient(s), please contact the
sender by reply email and destroy the original message and any copies of
the message as well as any attachment(s) to the original message.

#2Thomas F.O'Connell
tfo@sitening.com
In reply to: Noname (#1)
Re: Tape backup, 2 versions, same database name, which is pg_dump backing up

You'll need to specify the non-default port explicitly in your
pg_dump command in order to back up the postmaster running on 55432.

E.g., pg_dump -p 55432 -U postgres -C -D -f /tmp/$(date+%F)owl.sql owl

By default, the postgres command-line utilities attempt to connect to
5432 (or $PGPORT or whatever is configured as the default port).

In the meantime, you're still backing up the 7.3.4 postmaster with
that script.

--
Thomas F. O'Connell
Sitening, LLC

http://www.sitening.com/
3004B Poston Avenue
Nashville, TN 37203-1314
615-469-5150 x802
615-469-5151 (fax)

On Aug 2, 2006, at 3:47 PM, MargaretGillon@chromalloy.com wrote:

Show quoted text

Yesterday a consultant upgraded me from 7.3.4 to 8.1.4 on a RedHat
9 server. To make sure everything was okay we left the server so
that both versions of Postgresql load. 7.3.4 loads on the default
port of 5432 and 8.1.4 loads on port 55432 . My database was moved
into the new version so both the old and new databases have the
same name.

I have a little .sh file that runs a tape backup using pg_dump and
I am wondering if both versions are running how do I know which
version of the pg_dump is running and which version of the database
is being backed up?

The backup command I use is

pg_dump -U postgres -C -D -f /tmp/$(date+%F)owl.sql owl

then I use tar to copy the file to tape.

Please answer to me as well as the list, I am on digest.

Thanks,
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
*** *** ***
Margaret Gillon, IS Dept., Chromalloy Los Angeles, ext. 297

This e-mail message and any attachment(s) are for the sole use of
the intended recipient(s) and may contain proprietary and/or
confidential information which may be privileged or otherwise
protected from disclosure. Any unauthorized review, use,
disclosure or distribution is prohibited. If you are not the
intended recipient(s), please contact the sender by reply email and
destroy the original message and any copies of the message as well
as any attachment(s) to the original message.

#3Noname
MargaretGillon@chromalloy.com
In reply to: Thomas F.O'Connell (#2)
Re: Tape backup, 2 versions, same database name, which is pg_dump

"Thomas F. O'Connell" <tfo@sitening.com> wrote on 08/02/2006 02:04:35 PM:

You'll need to specify the non-default port explicitly in your
pg_dump command in order to back up the postmaster running on 55432.

E.g., pg_dump -p 55432 -U postgres -C -D -f /tmp/$(date+%F)owl.sql owl

By default, the postgres command-line utilities attempt to connect
to 5432 (or $PGPORT or whatever is configured as the default port).

In the meantime, you're still backing up the 7.3.4 postmaster with
that script.

--
Thomas F. O'Connell
Sitening, LLC

To confirm: what you're saying it that by specifying the port in my
command the system knows which database to backup and which version of
Postgresql to use.

Thank you for the assistance.

Margaret Gillon

#4Thomas F.O'Connell
tfo@sitening.com
In reply to: Noname (#3)
Re: Tape backup, 2 versions, same database name, which is pg_dump backing up

Your confirmation is correct with one slight technical exception:
specifying the port doesn't technically cause the system to know
which version of postgres to use.

In my previous post, I forgot to mention a related note: the version
of pg_dump that you're using matters slightly. pg_dump can typically
be used with older postgres installations, but not newer ones. So you
should prefer using the 8.1.4 version of pg_dump to dump at least
your 8.1.4 postmaster, but probably also your 7.3.4 postmaster.

A 7.3.4 pg_dump client will probably not be able to run against an
8.1.4 postmaster.

Otherwise, pg_dump doesn't really care about the version as much as
it cares about being able to connect to a postmaster. That's what
specifying the port helps it do. When you don't specify the port, it
just tries port 5432. If it finds a postmaster listening there,
great, it will try to dump it; otherwise, it will fail with a
complaint that it couldn't connect to anything on 5432.

--
Thomas F. O'Connell
Sitening, LLC

http://www.sitening.com/
3004B Poston Avenue
Nashville, TN 37203-1314
615-469-5150 x802
615-469-5151 (fax)

On Aug 2, 2006, at 4:10 PM, MargaretGillon@chromalloy.com wrote:

Show quoted text

"Thomas F. O'Connell" <tfo@sitening.com> wrote on 08/02/2006
02:04:35 PM:

You'll need to specify the non-default port explicitly in your
pg_dump command in order to back up the postmaster running on 55432.

E.g., pg_dump -p 55432 -U postgres -C -D -f /tmp/$(date+%F)

owl.sql owl

By default, the postgres command-line utilities attempt to connect
to 5432 (or $PGPORT or whatever is configured as the default port).

In the meantime, you're still backing up the 7.3.4 postmaster with
that script.

--
Thomas F. O'Connell
Sitening, LLC

To confirm: what you're saying it that by specifying the port in my
command the system knows which database to backup and which version
of Postgresql to use.

Thank you for the assistance.

Margaret Gillon

#5Noname
MargaretGillon@chromalloy.com
In reply to: Thomas F.O'Connell (#4)
Re: Tape backup, 2 versions, same database name, which is pg_dump

Your confirmation is correct with one slight technical exception:
specifying the port doesn't technically cause the system to know
which version of postgres to use.

In my previous post, I forgot to mention a related note: the version
of pg_dump that you're using matters slightly. pg_dump can typically
be used with older postgres installations, but not newer ones. So
you should prefer using the 8.1.4 version of pg_dump to dump at
least your 8.1.4 postmaster, but probably also your 7.3.4 postmaster.

A 7.3.4 pg_dump client will probably not be able to run against an
8.1.4 postmaster.

Otherwise, pg_dump doesn't really care about the version as much as
it cares about being able to connect to a postmaster. That's what
specifying the port helps it do. When you don't specify the port, it
just tries port 5432. If it finds a postmaster listening there,
great, it will try to dump it; otherwise, it will fail with a
complaint that it couldn't connect to anything on 5432.

--
Thomas F. O'Connell
Sitening, LLC

http://www.sitening.com/
3004B Poston Avenue
Nashville, TN 37203-1314
615-469-5150 x802
615-469-5151 (fax)

You're correct, I cannot use the pg_dump. I get a error message that the
pg_dump is aborting because of a version mismatch, then it says to use the
i opt. How do I call the pg_dump from the 8.1.4 version?

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
*** ***
Margaret Gillon, IS Dept., Chromalloy Los Angeles, ext. 297

This e-mail message and any attachment(s) are for the sole use of the
intended recipient(s) and may contain proprietary and/or confidential
information which may be privileged or otherwise protected from
disclosure. Any unauthorized review, use, disclosure or distribution is
prohibited. If you are not the intended recipient(s), please contact the
sender by reply email and destroy the original message and any copies of
the message as well as any attachment(s) to the original message.

#6Thomas F.O'Connell
tfo@sitening.com
In reply to: Noname (#5)
Re: Tape backup, 2 versions, same database name, which is pg_dump backing up

On Aug 2, 2006, at 4:27 PM, MargaretGillon@chromalloy.com wrote:

You're correct, I cannot use the pg_dump. I get a error message
that the pg_dump is aborting because of a version mismatch, then it
says to use the i opt. How do I call the pg_dump from the 8.1.4
version?

You'll probably need to specify an absolute path. Are both the client
and server applications running on the same server? If so, you might
need to get your consultant to tell you where the client applications
for the 8.1.4 installation were actually installed. By default,
postgres installs both client and server applications into /usr/local/
pgsql, but at least one of your installations must be in a different
location; otherwise, you probably couldn't have two versions of the
postmaster running concurrently.

--
Thomas F. O'Connell
Sitening, LLC

http://www.sitening.com/
3004B Poston Avenue
Nashville, TN 37203-1314
615-469-5150 x802
615-469-5151 (fax)

#7Noname
MargaretGillon@chromalloy.com
In reply to: Noname (#5)
Re: Tape backup, 2 versions, same database name, which is pg_dump

It needed /bin in the path. Works fine this way.

/usr/local/pgsql/bin/pg_dump -p 55432 -U postgres -C -D -f
/tmp/$(date+%F)owl.sql owl

Thank you again for your help.

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
*** ***
Margaret Gillon, IS Dept., Chromalloy Los Angeles, ext. 297

This e-mail message and any attachment(s) are for the sole use of the
intended recipient(s) and may contain proprietary and/or confidential
information which may be privileged or otherwise protected from
disclosure. Any unauthorized review, use, disclosure or distribution is
prohibited. If you are not the intended recipient(s), please contact the
sender by reply email and destroy the original message and any copies of
the message as well as any attachment(s) to the original message.

#8Richard Huxton
dev@archonet.com
In reply to: Thomas F.O'Connell (#6)
Re: Tape backup, 2 versions, same database name, which

Thomas F. O'Connell wrote:

On Aug 2, 2006, at 4:27 PM, MargaretGillon@chromalloy.com wrote:

You're correct, I cannot use the pg_dump. I get a error message that
the pg_dump is aborting because of a version mismatch, then it says to
use the i opt. How do I call the pg_dump from the 8.1.4 version?

You'll probably need to specify an absolute path. Are both the client
and server applications running on the same server? If so, you might
need to get your consultant to tell you where the client applications
for the 8.1.4 installation were actually installed. By default, postgres
installs both client and server applications into /usr/local/pgsql, but
at least one of your installations must be in a different location;
otherwise, you probably couldn't have two versions of the postmaster
running concurrently.

Oh, and two other commands you might find useful:
which pg_dump
Will show you which version of pg_dump is being run by default
alias
Will let you set up pg_dump81 as an alias for the correct binary you want.

Man pages cover the details.

--
Richard Huxton
Archonet Ltd

#9Noname
MargaretGillon@chromalloy.com
In reply to: Richard Huxton (#8)
Re: Tape backup, 2 versions, same database name, which is pg_dump

Great, Thanks!
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
*** ***
Margaret Gillon, IS Dept., Chromalloy Los Angeles, ext. 297

This e-mail message and any attachment(s) are for the sole use of the
intended recipient(s) and may contain proprietary and/or confidential
information which may be privileged or otherwise protected from
disclosure. Any unauthorized review, use, disclosure or distribution is
prohibited. If you are not the intended recipient(s), please contact the
sender by reply email and destroy the original message and any copies of
the message as well as any attachment(s) to the original message.

Richard Huxton <dev@archonet.com> wrote on 08/03/2006 01:45:41 AM:

Thomas F. O'Connell wrote:

On Aug 2, 2006, at 4:27 PM, MargaretGillon@chromalloy.com wrote:

You're correct, I cannot use the pg_dump. I get a error message that
the pg_dump is aborting because of a version mismatch, then it says

to

use the i opt. How do I call the pg_dump from the 8.1.4 version?

You'll probably need to specify an absolute path. Are both the client
and server applications running on the same server? If so, you might
need to get your consultant to tell you where the client applications
for the 8.1.4 installation were actually installed. By default,

postgres

installs both client and server applications into /usr/local/pgsql,

but

at least one of your installations must be in a different location;
otherwise, you probably couldn't have two versions of the postmaster
running concurrently.

Oh, and two other commands you might find useful:
which pg_dump
Will show you which version of pg_dump is being run by default
alias
Will let you set up pg_dump81 as an alias for the correct binary you

want.

Show quoted text

Man pages cover the details.

--
Richard Huxton
Archonet Ltd