标签: postgresql

如何将 Postgres 数据转储导入到 MS SQL 中?

我有一些来自 Postgres 数据库转储的数据(不是 csv 或其他任何数据),我希望将其放入 MS SQL 中。有没有一种简单的方法可以做到这一点,或者有一个对数据导入大小等没有限制的免费工具?

Postgres 位于 Debian VM 上,我可以将其导出为 csv,但我是 Linux 新手,不知道如何将其从 VM 传输到 Win 7。

谢谢

postgresql debian sql-server

5
推荐指数
1
解决办法
1万
查看次数

postgres 上的 ssl

我正在尝试设置我的 postgres 服务器来进行 ssl 连接。我正确设置了 postgresql.conf 和 pg_hba.conf 。我在 postgres 数据目录中创建了一个密钥和自签名证书(server.crt 和 server.key),并将 server.crt 复制到 root.crt。

我还在另一台主机上使用服务器中的 root.crt 设置了证书和密钥来签署客户端证书。当我使用 openssl 测试证书时,一切都很好。但是,当我尝试连接到 postgres 服务器时,它失败了:

psql -h <HOSTNAME> -U <USER> -d <DB>
psql: SSL error: certificate verify failed
Run Code Online (Sandbox Code Playgroud)

或者:

openssl s_client -connect <HOSTNAME>:5432 -state -msg -showcerts -debug
CONNECTED(00000003)
SSL_connect:before/connect initialization
write to 080ACFE0 [080AD570] (145 bytes => 145 (0x91))
0000 - 80 8f 01 03 01 00 66 00-00 00 20 00 00 39 00 00   ......f... ..9..
...
0080 - 04 …
Run Code Online (Sandbox Code Playgroud)

postgresql ssl

5
推荐指数
1
解决办法
7284
查看次数

PostgreSQL 将不再启动

今天,我的 PostgreSQL 在我的 Windows 机器上不再启动......

我尝试在Windows服务中启动该服务,但出现以下错误:

Windows could not start the PostgreSQL Database Server 8.3 service on Local Computer.

Error 1053: The service did not respond to the start or control request in a timely fashion.
Run Code Online (Sandbox Code Playgroud)

然后我到命令行手动启动C:/Program Files (x86)/PostgreSQL/8.3/bin/psql.exe,然后得到这个错误:

psql: Could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "???" and accepting TCP/IP connections on port 5432?
Run Code Online (Sandbox Code Playgroud)

编辑:我在日志中发现了这一点:

2011-04-22 13:13:16 CEST LOG:  could not receive data from client: No connection could be made because the …
Run Code Online (Sandbox Code Playgroud)

postgresql windows sql

5
推荐指数
1
解决办法
5万
查看次数

Postgresql 表删除需要很长时间

我对 Postgresql 和服务器管理有点陌生,所以我不太确定这是否是正常行为。现在我正在尝试删除带有级联选项的表。

我使用的命令是

DROP TABLE library_genre CASCADE;
Run Code Online (Sandbox Code Playgroud)

已经过去半个小时了还是这样

NOTICE:  drop cascades to constraint radio_logs_entry_genre_id_fkey on table logs_entry
Run Code Online (Sandbox Code Playgroud)

我不太确定如何检查数据库有多大,但我无法想象太大。您认为是否可能存在某种腐败导致需要这么长时间?

任何解决这个问题的建议将不胜感激。我应该使用什么样的命令来弄清楚发生了什么?

编辑:新信息

我在尝试删除表之前在 pg_dump 上运行了这个

du -k pg_dump_file
Run Code Online (Sandbox Code Playgroud)

它给了我 27712。但我不确定它返回的数据大小是多少。如果是千字节,则只有 27 兆字节,而且看起来不需要这么长时间的修改。

编辑#2。我跑了 top,看起来 postgres 并没有真正使用太多的 CPU 或内存。

postgresql ubuntu database web-server

5
推荐指数
1
解决办法
2万
查看次数

升级psql客户端哪个包?

我已将 Postgres 安装从 8.4 更新到 9.3。

现在,当我使用初始命令登录服务器时

 sudo -u postgres psql template1
Run Code Online (Sandbox Code Playgroud)

我收到以下错误

psql (8.4.18, server 9.3.5)
WARNING: psql version 8.4, server version 9.3.
         Some psql features might not work.
Type "help" for help.
Run Code Online (Sandbox Code Playgroud)

我需要安装/升级什么软件包才能将 psql 升级到 9.4 版本?(在红帽 6 上)

postgresql redhat psql

5
推荐指数
1
解决办法
1万
查看次数

Postgresql:如何确定数据库 docker 容器是否正在运行?

在 docker 映像的入口点 shell 脚本上,我想确定 postgresql 容器是否可以侦听连接。对于 mysql,我使用了以下代码段:

while ! mysqladmin ping -h"$MOODLE_DB_HOST" -P $MOODLE_DB_PORT --silent; do
  echo "Connecting to ${MOODLE_DB_HOST} Failed"
  sleep 1
done
Run Code Online (Sandbox Code Playgroud)

如何使用 postgresql 实现类似的功能?

postgresql bash docker

5
推荐指数
1
解决办法
1万
查看次数

postgresql 轨道计数和 autovacuum 不起作用

在启动日志条目中表明 autovacuum 不工作。我查询 pg_stat_user_tables 表并且 last_vacuum 和 last_autovacuum 列是空的,尽管我之前运行过真空查询。将 pgadmin 连接到数据库表明真空不工作。

我在两个 Ubuntu Azure VM 上使用 postgresql。一个VM设置为主,第二个是通过流式传输的复制数据库。在https://www.digitalocean.com/community/tutorials/how-to-set-up-master-slave-replication-on-postgresql-on-an-ubuntu-12-04-vps 中大致描述。

除了 autovacuum 之外,一切似乎都很有效。在启动过程中记录以下错误:

LOG:  test message did not get through on socket for statistics collector
LOG:  disabling statistics collector for lack of working socket
WARNING:  autovacuum not started because of misconfiguration
HINT:  Enable the "track_counts" option.
LOG:  database system was shut down at 2017-01-19 14:07:13 UTC
DEBUG:  checkpoint record is at 38/F6000028
Run Code Online (Sandbox Code Playgroud)

在 postgresql.config 我使用以下设置:

track_counts = on  
autovacuum = …
Run Code Online (Sandbox Code Playgroud)

postgresql ubuntu vacuum azure

5
推荐指数
1
解决办法
1599
查看次数

使用 PostGIS 将 PostgreSQL 9.5 升级到 9.6 - pg_upgrade

我正在尝试将 9.5 服务器升级到 9.6,并且 pg_upgrade 给了我以下错误:

Performing Consistency Checks
-----------------------------
Checking cluster versions                                   ok
Checking database user is the install user                  ok
Checking database connection settings                       ok
Checking for prepared transactions                          ok
Checking for reg* system OID user data types                ok
Checking for contrib/isn with bigint-passing mismatch       ok
Checking for roles starting with 'pg_'                      ok
Creating dump of global objects                             ok
Creating dump of database schemas
                                                        ok
Checking for presence of required libraries                 fatal

Your installation references loadable libraries that …
Run Code Online (Sandbox Code Playgroud)

postgresql postgis

5
推荐指数
1
解决办法
3998
查看次数

是否存在 Postgres 的 Galera 等价物?

我已经与 Galera 合作了几个月,喜欢故障转移和冗余。我有一个正在测试中的 Postgres 数据库,可能会转移到生产中。Postgres 是否有 Galera 等价物?我读过 Postrgres 的“备用”数据库,但不确定它们在自动故障转移/VIP 方面是否与 Galera 相同。

postgresql database galera

5
推荐指数
1
解决办法
2997
查看次数

如何从 WSL2 内部连接到 Windows 主机上运行的 Postgres?

我的 Windows 机器上运行着 Postgres,我需要从 WSL2 内部连接到它。

  • postgres windows 服务正在运行
  • 我可以使用 Windows 命令行连接到它 psql
  • WSL2 虚拟机的 IP 是172.31.210.120,网络掩码255.255.240.0(使用 确定ipfconfig)。
  • vm 内部的 windows 主机的 IP 是172.31.208.1(使用 确定cat /etc/resolv.conf
  • 我可以使用curl http://172.31.208.1:8080. 如果我记录传入请求的 IP,我会得到172.31.210.120这验证两个 IP 是否正确。
  • 我将以下行添加到pg_hba.confhost all all 172.31.210.120/20 scram-sha-256
  • 我重新启动了 postgres windows 服务

如果我尝试使用以下命令从 WSL 连接到它:

$ psql --host=172.31.208.1 --port=5432 --user=postgres
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

psql: error: could not connect to server: could not connect to server: Connection …
Run Code Online (Sandbox Code Playgroud)

postgresql linux windows windows-subsystem-for-linux

5
推荐指数
1
解决办法
3865
查看次数