Hi,
I have a copy of "/usr/local/pgsql/data" from old server. Is it
possible to do a dump of the sql databases in this directory, so that
I can easily migrate them to my current system?

-Håvard Wahl Kongsgård

Search Discussions

  • Bruce Momjian at Sep 23, 2010 at 9:34 pm

    kongsgar@stud.ntnu.no wrote:
    Hi,
    I have a copy of "/usr/local/pgsql/data" from old server. Is it
    possible to do a dump of the sql databases in this directory, so that
    I can easily migrate them to my current system?
    Yes, run pg_dumpall, save it, and load it into the new system. You
    really haven't given us much information on what problem you are having.

    --
    Bruce Momjian <bruce@momjian.us> http://momjian.us
    EnterpriseDB http://enterprisedb.com

    + It's impossible for everything to be true. +
  • Kongsgar at Sep 24, 2010 at 7:25 am
    To specify: I have a copy of the data in "/usr/local/pgsql/data" from
    my old, but I don't have access to the old system anymore so I cannot
    simply do a "pg_dumpall" from there.

    I believe I could copy the content of "/usr/local/pgsql/data" into
    "/usr/local/pgsql/data" on my new system. But is there an alternative?

    -Håvard Wahl Kongsgård

    kongsgar@stud.ntnu.no wrote:
    Hi,
    I have a copy of "/usr/local/pgsql/data" from old server. Is it
    possible to do a dump of the sql databases in this directory, so that
    I can easily migrate them to my current system?
    Yes, run pg_dumpall, save it, and load it into the new system. You
    really haven't given us much information on what problem you are having.

    --
    Bruce Momjian <bruce@momjian.us> http://momjian.us
    EnterpriseDB http://enterprisedb.com

    + It's impossible for everything to be true. +
  • Craig Ringer at Sep 24, 2010 at 11:31 am

    On 24/09/2010 3:24 PM, kongsgar@stud.ntnu.no wrote:
    To specify: I have a copy of the data in "/usr/local/pgsql/data" from my
    old, but I don't have access to the old system anymore so I cannot
    simply do a "pg_dumpall" from there.

    I believe I could copy the content of "/usr/local/pgsql/data" into
    "/usr/local/pgsql/data" on my new system.
    Maybe. You'd need to make sure that the target /usr/local/pgsql/data was
    *empty*, and that you were running the same major version (ie both 8.4
    or both 8.3, etc) of PostgreSQL on both the old and new servers. Both
    servers need to be the same architecture, ie both must be ix86 (32-bit
    x86) or both must be x64 (64-bit intel/amd), etc.

    Personally, I'd try to start up postgresql with the old data directory
    as a target, and get it running to the point where you can do a
    pg_dumpall. Then initdb a proper new cluster and restore to it.

    --
    Craig Ringer

    Tech-related writing at http://soapyfrogs.blogspot.com/
  • Kongsgar at Sep 24, 2010 at 12:21 pm
    What version of PG was it?
    The "PG_VERSION" file = 8.3

    -Håvard Wahl Kongsgård

    Siterer Raymond O'Donnell <rod@iol.ie>:
    On 24/09/2010 08:24, kongsgar@stud.ntnu.no wrote:
    To specify: I have a copy of the data in "/usr/local/pgsql/data" from my
    old, but I don't have access to the old system anymore so I cannot
    simply do a "pg_dumpall" from there.

    I believe I could copy the content of "/usr/local/pgsql/data" into
    "/usr/local/pgsql/data" on my new system. But is there an alternative?
    You'll still need a copy of the correct version of PostgreSQL to
    read that data, and I think it'll need to be the same architecture
    as well.
    Ray.

    --
    Raymond O'Donnell :: Galway :: Ireland
    rod@iol.ie
  • Raymond O'Donnell at Sep 24, 2010 at 12:41 pm

    On 24/09/2010 13:21, kongsgar@stud.ntnu.no wrote:
    What version of PG was it?
    The "PG_VERSION" file = 8.3
    OK, well at least it's not an ancient version that's not available any
    more. :-)

    As Craig said, the best thing is to get hold of a copy of 8.3 that
    matches the architecture of the old server machine, start it up, and do
    a pg_dumpall.

    Ray.

    --
    Raymond O'Donnell :: Galway :: Ireland
    rod@iol.ie
  • Craig Ringer at Sep 24, 2010 at 3:12 pm

    On 24/09/2010 8:40 PM, Raymond O'Donnell wrote:
    On 24/09/2010 13:21, kongsgar@stud.ntnu.no wrote:
    What version of PG was it?
    The "PG_VERSION" file = 8.3
    OK, well at least it's not an ancient version that's not available any
    more. :-)

    As Craig said, the best thing is to get hold of a copy of 8.3 that
    matches the architecture of the old server machine
    Or compile one, if necessary. You should *certainly* compile one in
    preference to trying to hack outdated packages onto your new system by
    force, as some people seem to do. *BAD* *IDEA*, do not try it. Just by
    way of warning.

    If you do compile it, specify a non-default --prefix that's a unique new
    subtree, so you can just "rm -rf" it when you're done with it. Think
    --prefix=/opt/pgsql8.3 . If you install it directly into /usr/local
    you'll have a crufty old libpq and headers hanging around later.

    Personally, if I were facing this situation I'd fire up a virtual
    machine with the right architecture and give it access to my old data
    dir instead. Much less hassle, as I can just drop the VM once I'm done
    with it, and my real host's software loadout and configuration are
    unaffected. With kvm (+virt-manager if you want) making it so trivial to
    create and destroy VMs this is a no-brainer. You can run a 32-bit VM on
    a 64-bit (Intel/AMD) host just fine, so if you're transitioning from 32-
    to 64-bit you shouldn't have any issues.

    You could always install the old Pg locally on the new host, from
    packages or by compiling it, but I wouldn't recommend it. Use a VM if
    you can, keep things clean.

    --
    Craig Ringer

    Tech-related writing at http://soapyfrogs.blogspot.com/
  • Yaroslav Tykhiy at Sep 27, 2010 at 3:35 am

    On 25/09/2010, at 1:11 AM, Craig Ringer wrote:
    On 24/09/2010 8:40 PM, Raymond O'Donnell wrote:
    On 24/09/2010 13:21, kongsgar@stud.ntnu.no wrote:
    What version of PG was it?
    The "PG_VERSION" file = 8.3
    OK, well at least it's not an ancient version that's not available
    any
    more. :-)

    As Craig said, the best thing is to get hold of a copy of 8.3 that
    matches the architecture of the old server machine
    Or compile one, if necessary. You should *certainly* compile one in
    preference to trying to hack outdated packages onto your new system
    by force, as some people seem to do. *BAD* *IDEA*, do not try it.
    Just by way of warning.

    If you do compile it, specify a non-default --prefix that's a unique
    new subtree, so you can just "rm -rf" it when you're done with it.
    Think --prefix=/opt/pgsql8.3 . If you install it directly into /usr/
    local you'll have a crufty old libpq and headers hanging around later.
    I'd like to just add a few words of encouragement here. Postgresql's
    build system is absolutely marvellous in that it can produce a totally
    self-contained installation under --prefix that can be copied across
    compatible systems etc. You even can build several variants and
    install them at different prefixes if unsure which is going to match
    the database. So your only worry is to make sure you are playing
    around with a copy of the database copy, not with the master copy
    itself. :-)

    A virtual machine can be useful for experiments, as usual, but a
    Postgresql installation to a custom prefix will not litter the base
    system so it's pretty safe to try it out on a live machine of suitable
    architecture rather than in a "sandbox", which can save some time.

    Yar
  • Alan Hodgson at Sep 23, 2010 at 9:37 pm

    On September 23, 2010 01:49:50 pm kongsgar@stud.ntnu.no wrote:
    Hi,
    I have a copy of "/usr/local/pgsql/data" from old server. Is it
    possible to do a dump of the sql databases in this directory, so that
    I can easily migrate them to my current system?
    You should be able to launch a postmaster against it to do so, yes. It will
    need to be the same (major) version as the old server was running.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-general @
categoriespostgresql
postedSep 23, '10 at 8:56p
activeSep 27, '10 at 3:35a
posts9
users6
websitepostgresql.org
irc#postgresql

People

Translate

site design / logo © 2022 Grokbase