将 Postgresql 8.3 数据库文件升级到 8.4

发布于 2024-09-17 05:50:16 字数 305 浏览 16 评论 0原文

我将 Ubuntu 8.04 升级到 Ubuntu 10.04。不幸的是,升级过程还将 Postgres 8.3 安装更新为 Postgres 8.4 安装。我的感觉是,虽然数据库引擎二进制文件已经更新,但数据库本身没有迁移,因此8.4无法加载它。 由于 8.3 数据格式与 8.4 格式不兼容,因此更改 postgresql.conf 是不够的,我也无法在 8.4 安装中使用 pg_dump

我需要一种方法将我以前的基础从 8.3 升级到 8.4,无法使用 8.3 引擎,只能使用 8.4。

有什么线索吗?

I upgraded my Ubuntu 8.04 To Ubuntu 10.04. Unfortunately, the upgrade process also updated the Postgres 8.3 install to a Postgres 8.4 install. My feeling is that although database engine binaries have been updated, the database itself was not migrated, hence it can not be loaded by the 8.4.
Since the 8.3 data format is not compatible with 8.4 format, altering postgresql.conf is not enough, nor can I use pg_dump with my 8.4 install.

I need a way to upgrade my previous base from 8.3 to 8.4, with no access to a 8.3 engine, only a 8.4.

Any clue?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

心的位置 2024-09-24 05:50:16

Debian 和 Ubuntu 中的 postgres 软件包有一种非常明确定义的从一个 Postgres 版本升级到另一个版本的方法。该过程记录在 /usr/share/doc/postgresql-common/README.Debian 中,如下所示:

Default clusters and upgrading
------------------------------
When installing a postgresql-X.Y package from scratch, a default
cluster 'main' will automatically be created. This operation is
equivalent to doing 'pg_createcluster X.Y main --start'.

Due to this default cluster, an immediate attempt to upgrade an
earlier 'main' cluster to a new version will fail and you need to
remove the newer default cluster first. E. g., if you have
postgresql-8.2 installed and want to upgrade to 8.3, you first install
postgresql-8.3:

  apt-get install postgresql-8.3

Then drop the default 8.3 cluster:

  pg_dropcluster 8.3 main --stop

And then upgrade the 8.2 cluster to 8.3:

  pg_upgradecluster 8.2 main

执行此操作的最佳时间是升级到 Ubuntu 版本之前您当前运行的 Postgresql 版本已被删除,即在本例中,而在可以同时安装 Postgres 8.3 和 Postgres 8.4 的 Ubuntu 版本上。就我而言,我从乐观变为业力,从 8.3 升级到 8.4,然后从业力变为清醒。

如上所述,升级过程非常顺利。 *pg_upgradecluster* 命令将停止旧版本,迁移数据,然后在与旧版本相同的端口上启动新版本,最后在新端口上启动旧版本。

如果您在迁移到缺少 postgres 8.3 的 Ubuntu 版本之前没有迁移 8.3 postgres 数据,迁移仍然很简单。首先将 karmic ubuntu 存储库添加到 /etc/apt/sources.list

deb http://archive.ubuntu.com/ubuntu/ karmic main restricted universe

安装 postgresql-8.3:

apt-get update && apt-get install postgresql-8.3

删除 8.4 集群。 警告:这将删除您的 postgresql 8.4 安装中的数据(如果有)。但如果您这样做只是因为需要将 8.3 升级到 8.4,则 8.4 集群中将没有数据。

pg_dropcluster 8.4 main --stop

然后将8.3集群升级到8.4:

  pg_upgradecluster 8.3 main

最后,删除postgresql-8.3包,并从/etc/apt/sources.list中删除jaunty-line,然后运行apt-get update 再次。

像往常一样,在执行上述任何操作之前备份您的 postgres 目录始终是一个好主意。

The postgres packages in Debian, and hence, Ubuntu, has a very clearly defined way of upgrading from one Postgres version to another. The procedure is documented in /usr/share/doc/postgresql-common/README.Debian as follows:

Default clusters and upgrading
------------------------------
When installing a postgresql-X.Y package from scratch, a default
cluster 'main' will automatically be created. This operation is
equivalent to doing 'pg_createcluster X.Y main --start'.

Due to this default cluster, an immediate attempt to upgrade an
earlier 'main' cluster to a new version will fail and you need to
remove the newer default cluster first. E. g., if you have
postgresql-8.2 installed and want to upgrade to 8.3, you first install
postgresql-8.3:

  apt-get install postgresql-8.3

Then drop the default 8.3 cluster:

  pg_dropcluster 8.3 main --stop

And then upgrade the 8.2 cluster to 8.3:

  pg_upgradecluster 8.2 main

The best time to do this is before ugrading to a version of Ubuntu where the version of Postgresql you're currently running has been removed, i.e. in this example, while on a version of Ubuntu that has the possibility to install both Postgres 8.3 and Postgres 8.4. In my case, I went from jaunty to karmic, upgraded 8.3 to 8.4 and then went from karmic to lucid.

The upgrade process as described above is very smooth. The *pg_upgradecluster* command will stop the old version, migrate data, then start the new version on the same port as the old version, finally starting the old version on a new port.

If you did not migrate your 8.3 postgres data before moving to an Ubuntu version that lacks postgres 8.3, migrating is still simple. Start by adding the karmic ubuntu repository to /etc/apt/sources.list:

deb http://archive.ubuntu.com/ubuntu/ karmic main restricted universe

Install postgresql-8.3:

apt-get update && apt-get install postgresql-8.3

Drop your 8.4 cluster. Warning: This will remove data in your postgresql 8.4 installation if you have any. But if you're only doing this because you need to upgrade your 8.3 to 8.4, you will have no data in your 8.4 cluster.

pg_dropcluster 8.4 main --stop

And then upgrade the 8.3 cluster to 8.4:

  pg_upgradecluster 8.3 main

Finally, remove the postgresql-8.3 package, and remove the jaunty-line from /etc/apt/sources.list, then run apt-get update again.

As usual, taking a backup of your postgres directories before doing any of the above is always a good idea.

不必在意 2024-09-24 05:50:16

您必须在源的临时位置安装 PostgreSQL 8.3,将旧数据复制到那里,启动 Pg,使用 pd_dumpall 转储其数据,然后将此数据导入到新的 Postgres。

不安装 Pg 8.3 是不可能的。

You'll have to install PostgreSQL 8.3 in temporary location from source, copy your old data there, start Pg, dump it's data using pd_dumpall and then import this data to new Postgres.

It's impossible without installing Pg 8.3.

送你一个梦 2024-09-24 05:50:16

在尝试任何操作之前,请确保备份所有内容。

有一个 pg_migrator 项目,我认为它可以为你做到这一点,尽管我不是确定是否需要8.3应用程序或源代码。

Make sure you backup everything before you try anything.

There is the pg_migrator project which I think will do that for you, though I'm not sure whether it needs to 8.3 applications or source code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文