PostgreSQL 9.0.13执行pg_restore但没有证据表明正在使用磁盘空间

我正在尝试从另一台服务器恢复使用此命令获取的pg_dump.
sudo -u postgres pg_dump --verbose --format=custom --file=pg-backup.sql -U postgres salesDB

复制pg-backup.sql文件后,我试图用这个命令恢复

sudo -u postgres pg_restore --verbose --jobs=`nproc` -f pg-backup.sql

pg-backup.sql文件是13GB.
pg-restore已经运行了4个小时,一直在我的屏幕上滚动数据.没有错误.

但是当我从psql会话中执行此语句时

SELECT pg_size_pretty(pg_database_size('salesDB'));

我的大小为5377 kB.什么?它现在至少应该是1GB.
我完全迷失了.所有这些数据都在我的屏幕上滚动,我无法证明它会在任何地方.没有磁盘使用.

救命

在pg_restore命令中没有“-f”标志的情况下尝试它.此外,您可能想尝试创建空的salesdb数据库并传入“-d salesdb”.请注意,除非在双引号内创建,否则db名称将折叠为小写.

添加了示例步骤,以显示在还原运行时数据库的大小增加

-- sample pg_dump command
pg_dump -f testdb.out -Fc src_test_db

-- create the db to restore into
createdb sometestdb

-- restore with 4 parallel jobs,from the "testdb.out" file,into the db "sometestdb"
time pg_restore --dbname=sometestdb --jobs=4 testdb.out

-- In another window,every few seconds,you can see the db growing
psql -d postgres -c "select pg_size_pretty(pg_database_size('sometestdb'))"
 pg_size_pretty 
----------------
 4920 MB

psql -d postgres -c "select pg_size_pretty(pg_database_size('sometestdb'))"
 pg_size_pretty 
----------------
 4920 MB

psql -d postgres -c "select pg_size_pretty(pg_database_size('sometestdb'))"
 pg_size_pretty 
----------------
 5028 MB

psql -d postgres -c "select pg_size_pretty(pg_database_size('sometestdb'))"
 pg_size_pretty 
----------------
 5371 MB

相关文章

项目需要,有个数据需要导入,拿到手一开始以为是mysql,结果...
本文小编为大家详细介绍“怎么查看PostgreSQL数据库中所有表...
错误现象问题原因这是在远程连接时pg_hba.conf文件没有配置正...
因本地资源有限,在公共测试环境搭建了PGsql环境,从数据库本...
wamp 环境 这个提示就是说你的版本低于10了。 先打印ph...
psycopg2.OperationalError: SSL SYSCALL error: EOF detect...