Which pgdump format is best for small storage size and fast restore?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-29 14:26:16
Mani Deep

This command will create a small dmp file which includes only structure of the dattabase - tabels, columns, triggers, views etc.. (This command will just take few minutes)

pg_dump -U "dbuser" -h "host" -p "port" -F c -b -v -f ob_`date +%Y%m%d`.dmp dbname

**ex:** pg_dump -U thames -h localhost -p 5432 -F c -b -v -f ob_`date +%Y%m%d`.dmp dbname

This command will take the backup of complete database

pg_dump -h localhost -U "dbuser" "dbname" -Fc > "pathfilename.backup"

**ex:** pg_dump -h localhost -U thames thamesdb - Fc > "thamesdb.backup"

and for restore you can use:

pg_restore -i -h localhost -U "user" -d "dbname" -v "dbname.backup"

**ex:** pg_restore -i -h localhost -U thames -d thamesdb -v "thamesdb.backup"

to take backup of selected tabels(uses regular expressions) here

pg_dump -t '(A|B|C)'

for full details you can visit pgdump help page there are many options out there

If you want to take your backups hourly, I would think you should be using log archiving instead of pg_dump.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!