如何升级Cygwin中的Postgres数据库?

我更新了一些Cygwin软件包,现在我无法启动Postgres:

$ /usr/sbin/postmaster FATAL: database files are incompatible with server DETAIL: The data directory was initialized by PostgreSQL version 8.2, which is not compatible with this version 9.2.4. 

我试过pg_upgrade,但是你需要指定旧的和新的二进制文件。 另外,pg_upgrade说它只能用于8.3。

我以为我可以使用setup-x86.exe来select以前的版本,这是8.2.11-1,但是当我安装,然后我无法启动Postgres:

 $ /usr/sbin/postgres.exe Bad system call (core dumped) 

  1. 卸载postgres 9
  2. 安装postgres 8.2
  3. 安装libpq
  4. /etc/rc.d/init.d/postgresql启动
  5. 为每个数据库执行此操作:
    • pg_dump -f stocks.sql.gz -Z 9-C股票
  6. /etc/rc.d/init.d/postgresql停止
  7. cd $ PGDATA / ..#/ usr / share / postgresql / ..
  8. mv postgresql postgresql-8.2
  9. 安装postgres 9,postgresql-contrib,卸载libpq。
  10. /usr/sbin/pg_ctl.exe初始化
  11. /usr/sbin/pg_ctl.exe启动
  12. createdb.exe#用你的用户名创build一个数据库
  13. gzip -dc stocks.sql.gz | psql#很多警告+错误

从9.2升级到9.3

  1. 阅读有关升级Postgres的信息: http : //www.postgresql.org/docs/current/static/upgrading.html
  2. 如果必须安装旧版本的Postgres。 有人维护一个Cygwin版本的历史档案。
    1. 浏览您需要的setup.ini文件的时间戳: ftp : //www.fruitbat.org/pub/cygwin/circa/index.html
    2. 复制文件夹的FTP地址(不是index.html)
    3. 使用-X选项运行/setup-x86.exe -X以忽略安装签名(它们不存档)。
    4. 将FTP地址粘贴到对话框中以select您的下载网站。 然后,您将看到在此期间可用的包的快照。
  3. 重新启动cygserver,如果你closures升级:以pipe理员cygrunsrv -S cygserver运行: cygrunsrv -S cygserver
  4. 启动旧版本的Postgres: /usr/sbin/postmaster &/usr/sbin/pg_ctl start
  5. 将数据库转储到pg_dumpall > /tmp/pg.sql的临时文件中
  6. closuresPostgres /usr/sbin/pg_ctl.exe stop
  7. 移动旧数据目录mv /usr/share/postgresql /usr/share/postgresql-9.2
  8. 正常运行安装程序并安装最新的Postgres。 请确保select您的正常下载网站。
  9. 初始化DB /usr/sbin/pg_ctl init
  10. 启动新版本的Postgres /usr/sbin/pg_ctl.exe start
  11. 导入旧的数据库psql -d postgres -f /tmp/pg.sql