Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the pg_dump command in PG

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "how to use the pg_dump command in PG". In the daily operation, I believe that many people have doubts about how to use the pg_dump command in PG. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to use the pg_dump command in PG". Next, please follow the editor to study!

-- logical backup. Pg_dump/pg_dumpall--pg_dumpall dumps all the database cluster logically into a script file. The pg_dump command can select a database or part of a table to back up. -- the backup file generated by pg_dump can be an SQL script or archive. The archive file format must be used with pg_restore-backup database pg_dump-h 192.168.19-U mydbuser mydb > / pgbackup/mydb_bak201901.sql-- custom format pg_dump-Fc-h 192.168.19-U mydbuser mydb > / pgbackup/mydb_bak201901.dump-- backup table pg_dump-t test_1 mydb > / pgbackup/test_1201901.sql-- backup all tables of a schema pg_dump-t 'mysch.*' mydb > / pgbackup/myschbak2019.sql-- back up a schema emp header table Exclude a table pg_dump-t 'mysch.t*'-T mysch.t1 mydb > / pgbackup/sche1_t_2019.sql-- migration, build a database pg_dump-h 192.168.8.19-U mydbser mydb-Fc > / pgbackup/mydb_back2019.dumppg_restore-h 192.168.9.20-U postgres-C-d postgres / pgbackup/mydb_back2019.dump-- migration Do not build a library createdb-T template0 mydb2pg_restore-d mydb2 / pgbackup/mydb_back2019.dump-- snapshot backup lvcreate-s-n snap20190113 / dev/mapper/vgpg-lvpgdata-L 240M mydb2-check snapshot lvs so far, the study on "how to use the pg_dump command in PG" is over, hoping to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report