加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-13 16:14:43 所属栏目:百科 来源:网络整理
导读:我正在尝试从另一台服务器恢复使用此命令获取的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=`npr
我正在尝试从另一台服务器恢复使用此命令获取的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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读