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

Postgres Import and Export tool pg_dump reference

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Postgres Import and Export tool pg_dump:

Backup:

Pg_dump-h localhost-U postgres db_name > db_name.sql

Restore:

Psql-U postgres-d db_name-f db_name.sql > out.txt

Pg_dump-Fp-a-- insert-t t_info-p 5432 data > info.dump

Backup record:

INSERT INTO t_info VALUES (1, 'name1',' name2')

Restore:

Psql-p 5432 data

< info.dump pg_dump -Fp -a --insert --column-inserts -t t_info -p 5432 data >

Info.dump

Backup record:

INSERT INTO t_info (id1, name1, name2) VALUES (1, 'name1',' name2')

Restore:

Psql-p 5432 data

< info.dump pg_dump -Fp -a -t t_info -p 5432 data >

Info.dump

Backup record:

COPY t_info (id1, name1, name2) FROM stdin

1 name1 name2

Restore:

Psql-p 5432 data

< info.dump 导出整个库: pg_dump -Fc -p 5432 data >

Data.dat

Restore:

Pg_restore-p 5432-d data data.dat

Export the entire library in parallel:

Pg_dump data-Fd-j 3-p 5432-f dump

Restore parallelism:

Pg_restore-- dbname=data-Fd-- jobs=3-- verbose-p 5432 dump/

Or:

Pg_restore-d data-j 3-- verbose-p 5432 dump/

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