Обсуждение: Data migration from version 7.2.1 to 8.1.5
Hi, I am trying to write a script which will migrate all the data from a particular database on version 7.2.1 and restore the same data along with the full schema on an 8.1.5 database. The database itself will be created and does not need to be created. I tried dumping data in tar format using the pg_dump utility (with version 7.2.1) and restoring it using pg_restore utility (with version 8.1.5). But on running this command: pg_restore -d mydb -C -u <my_dump_file> I get the following error: pg_restore: [archiver] unsupported version (1.10) in file header Any idea where I am going wrong. Thanks, Arindam
Arindam <arindam.mukerjee@gmail.com> writes: > I tried dumping data in tar format using the pg_dump utility (with > version 7.2.1) and restoring it using pg_restore utility (with version > 8.1.5). But on running this command: > pg_restore -d mydb -C -u <my_dump_file> > I get the following error: > pg_restore: [archiver] unsupported version (1.10) in file header It looks to me a whole lot like you got it backward, ie, used the 8.1 pg_dump and then tried to restore with the 7.2 pg_restore. Now you *should* be using the newer pg_dump to dump from the old database --- that's considered good practice. But you need an up-to-date pg_restore to read its output. regards, tom lane
On 2/8/07, Tom Lane <tgl@sss.pgh.pa.us> wrote: > Arindam <arindam.mukerjee@gmail.com> writes: > > I tried dumping data in tar format using the pg_dump utility (with > > version 7.2.1) and restoring it using pg_restore utility (with version > > 8.1.5). But on running this command: > > > pg_restore -d mydb -C -u <my_dump_file> > > I get the following error: > > pg_restore: [archiver] unsupported version (1.10) in file header > > It looks to me a whole lot like you got it backward, ie, used the 8.1 > pg_dump and then tried to restore with the 7.2 pg_restore. > > Now you *should* be using the newer pg_dump to dump from the old > database --- that's considered good practice. But you need an > up-to-date pg_restore to read its output. Well this time I got it dumped using 8.1.5 and tried restoring it too with 8.1.5 - however no difference in the result. > > regards, tom lane >
Arindam <arindam.mukerjee@gmail.com> writes: > On 2/8/07, Tom Lane <tgl@sss.pgh.pa.us> wrote: >> Now you *should* be using the newer pg_dump to dump from the old >> database --- that's considered good practice. But you need an >> up-to-date pg_restore to read its output. > Well this time I got it dumped using 8.1.5 and tried restoring it too > with 8.1.5 - however no difference in the result. [ experiments a bit... ] Apparently you have still a third version laying about someplace, because that message actually must be coming from a 7.3 or 7.4 pg_restore. Check your PATH. $ pg_dump -Ft -s regression >zzz.tar $ ~postgres/version82/bin/pg_restore zzz.tar | wc 6450 17782 136294 $ ~postgres/version81/bin/pg_restore zzz.tar | wc 6455 17788 136330 $ ~postgres/version80/bin/pg_restore zzz.tar | wc 6587 18184 139822 $ ~postgres/version74/bin/pg_restore zzz.tar | wc pg_restore: [archiver] unsupported version (1.10) in file header 0 0 0 $ ~postgres/version73/bin/pg_restore zzz.tar | wc pg_restore: [archiver] unsupported version (1.10) in file header 0 0 0 $ ~postgres/version72/bin/pg_restore zzz.tar | wc pg_restore: [archiver] input file does not appear to be a valid archive 0 0 0 $ ~postgres/version71/bin/pg_restore zzz.tar | wc Archiver: input file does not appear to be a valid archive 0 0 0 $ regards, tom lane
On 2/8/07, Tom Lane <tgl@sss.pgh.pa.us> wrote: > Arindam <arindam.mukerjee@gmail.com> writes: > > On 2/8/07, Tom Lane <tgl@sss.pgh.pa.us> wrote: > >> Now you *should* be using the newer pg_dump to dump from the old > >> database --- that's considered good practice. But you need an > >> up-to-date pg_restore to read its output. > > > Well this time I got it dumped using 8.1.5 and tried restoring it too > > with 8.1.5 - however no difference in the result. > > [ experiments a bit... ] Apparently you have still a third version > laying about someplace, because that message actually must be coming > from a 7.3 or 7.4 pg_restore. Check your PATH. > > $ pg_dump -Ft -s regression >zzz.tar > $ ~postgres/version82/bin/pg_restore zzz.tar | wc > 6450 17782 136294 > $ ~postgres/version81/bin/pg_restore zzz.tar | wc > 6455 17788 136330 > $ ~postgres/version80/bin/pg_restore zzz.tar | wc > 6587 18184 139822 > $ ~postgres/version74/bin/pg_restore zzz.tar | wc > pg_restore: [archiver] unsupported version (1.10) in file header > 0 0 0 > $ ~postgres/version73/bin/pg_restore zzz.tar | wc > pg_restore: [archiver] unsupported version (1.10) in file header > 0 0 0 > $ ~postgres/version72/bin/pg_restore zzz.tar | wc > pg_restore: [archiver] input file does not appear to be a valid archive > 0 0 0 > $ ~postgres/version71/bin/pg_restore zzz.tar | wc > Archiver: input file does not appear to be a valid archive > 0 0 0 > $ Lousy me. I qualified it with the full path - it worked. Earlier I was running pg_restore and it was coming from /usr/bin - version 7.3.6. Thank you. > > regards, tom lane > -- Against stupidity, the very Gods themselves contend in vain -- Friedrich Schiller