Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 从postgresql 9.3迁移到9.4,postgis_Linux_Postgresql_Postgis_Archlinux - Fatal编程技术网

Linux 从postgresql 9.3迁移到9.4,postgis

Linux 从postgresql 9.3迁移到9.4,postgis,linux,postgresql,postgis,archlinux,Linux,Postgresql,Postgis,Archlinux,我从postgresql 9.3升级到9.4,现在我想迁移我的数据 这就是我想做的。首先,我像这样运行旧的postgresql /opt/pgsql-9.3/bin/pg_ctl -D /var/lib/postgres/data/ start 然后,我尝试将旧数据库转储到一个文件: /opt/pgsql-9.3/bin/pg_dumpall >> old_backup.sql 它告诉我: pg_dump: [archiver (db)] query failed: ERROR:

我从postgresql 9.3升级到9.4,现在我想迁移我的数据

这就是我想做的。首先,我像这样运行旧的postgresql

/opt/pgsql-9.3/bin/pg_ctl -D /var/lib/postgres/data/ start
然后,我尝试将旧数据库转储到一个文件:

/opt/pgsql-9.3/bin/pg_dumpall >> old_backup.sql
它告诉我:

pg_dump: [archiver (db)] query failed: ERROR:  could not access file "$libdir/postgis-2.1": No such file or directory
好吧,我试着找到postgis-2.1文件并将它们复制到
libdir

find / -name "*postgis-2.1*"
/usr/lib/postgresql/rtpostgis-2.1.so
/usr/lib/postgresql/postgis-2.1.so
/usr/lib/postgresql/postgis-2.1 <-----
所以我在
/opt/pgsql-9.3/lib
中做了一个符号链接,链接到
这里/usr/lib/postgresql/postgis-2.1

 pwd
/opt/pgsql-9.3/lib
ls -l postgis-2.1
postgis-2.1 -> /usr/share/postgresql/contrib/postgis-2.1
但我仍然得到错误:查询失败:错误:无法访问文件“$libdir/postgis-2.1”:没有这样的文件或目录

我有点没主意了。也许有人能帮我

我是usnig arch linux

附言

已安装Postgis:

pacman -S postgis
warning: postgis-2.1.5-1 is up to date -- reinstalling
以下是二进制文件:

find / -name "*postgis-2.1*"
/usr/lib/postgresql/rtpostgis-2.1.so   <---- binary
/usr/lib/postgresql/postgis-2.1.so     <----- binary
/opt/pgsql-9.3/lib/postgis-2.1         <----- that's the symlink from earlier
/usr/share/postgresql/contrib/postgis-2.1
find/-name“*postgis-2.1*”

/usr/lib/postgresql/rtpostgis-2.1.so符号链接指向“共享”文件,用于创建扩展名和族。您需要的是将
.so
文件指向
pg_config--pkglibdir返回的目录中:

$ rm /opt/pgsql-9.3/lib/postgis-2.1 # it is a wrong link, so undo it
$ ln -s /usr/lib/postgresql/postgis-2.1.so /opt/pgsql-9.3/lib/
现在PostGIS
.so
文件将位于
“$libdir”
中,您将能够执行
pg\u dumpall


当然,保持这种状态对我来说并不是一种正常的设置,但在升级过程中,我假设这只是一种中间状态,之后您将完全删除PostgreSQL 9.3。您还必须验证PostGIS是否与9.3库链接,如果没有,您可能会遇到一些问题。

我也有类似的问题,但解决方法有所不同:

dbname=#\dx

  Name   | Version |   Schema   |                             Description
---------+---------+------------+---------------------------------------------------------------------
 plpgsql | 1.0     | pg_catalog | PL/pgSQL procedural language
 postgis | 2.1.5   | postgis    | PostGIS geometry, geography, and raster spatial types and functions


dbname=#ALTER EXTENSION postgis UPDATE TO '2.2.0';
dbname=#\dx

  Name   | Version |   Schema   |                             Description
---------+---------+------------+---------------------------------------------------------------------
 plpgsql | 1.0     | pg_catalog | PL/pgSQL procedural language
 postgis | 2.2.0   | postgis    | PostGIS geometry, geography, and raster spatial types and functions

我也有同样的问题。我与Docker的解决方案是:

docker exec -i $(docker-compose ps -q postgis) ln -s /usr/lib/postgresql/9.6/lib/postgis-2.3.so /usr/lib/postgresql/9.6/lib/postgis-2.1.so

升级后您尝试了pg_转储,升级是在
pg_升级
中执行的?顺便说一句:在你们和符号链接的共享库玩杂耍之后,你们运行了ldconfig吗?并没有。我用pacman-Syu升级了。我只是做了一个正常的升级。我没有运行ldconfig。我不知道是什么。我现在就去看看。好的,非常感谢ldconfig的提示。我读过,但是我;我不知道如何使用它在这种情况下,我;我害怕做实验。您能告诉我在这些特殊情况下应该如何运行它吗?[我不知道pacman]通常:(以root身份)
ldconfig
,或者
ldconfig-v
更详细。您的.so文件应该显示在输出中。(如果没有:您的配置文件有问题)刚刚在OS X(自制)上从2.1.7升级到PostGIS 2.2.0,这个解决方案对我很有效。谢谢这是升级已经安装在数据库中的postgis扩展的官方方法,因此它应该比其他答案更可取
docker exec -i $(docker-compose ps -q postgis) ln -s /usr/lib/postgresql/9.6/lib/postgis-2.3.so /usr/lib/postgresql/9.6/lib/postgis-2.1.so