当前位置:网站首页>PGSQL database to realize the import and export
PGSQL database to realize the import and export
2022-08-02 12:33:00 【m0_67400972】
pgsql database import and export
1. Export table
pg_dump -h database ip -U username database name -t table name >path, for example:
pg_dump -h 127.0.0.1 -U sysdba data_center -t book >/data/book.sql
2. Import table
psql -U username -d database name pg_dump -h database ip -U username database name>Path, for example: psql -U username database name When the exported data is very large, you should use the xz compression command, which generates a file with a suffix of .xz, for example: The data_center.sql.xz file will be generated at this time xzcat compressed file path | psql -h database ip -U username database name, for example: pg_restore -h ip -U username -d database name -v file path, for example: Let me introduce myself first. The editor graduated from Shanghai Jiaotong University in 2013. I worked in a small company and went to big factories such as Huawei and OPPO. I joined Alibaba in 2018, until now.I know that most junior and intermediate java engineers want to upgrade their skills, they often need to explore their own growth or sign up to study, but for training institutions, the tuition fee is nearly 10,000 yuan, which is really stressful.Self-learning that is not systematic is very inefficient and lengthy, and it is easy to hit the ceiling and the technology stops.Therefore, I collected a "full set of learning materials for java development" for everyone. The original intention is also very simple. I hope to help friends who want to learn by themselves but don't know where to start, and at the same time reduce everyone's burden.Add the business card below to get a full set of learning materialspsql -U sysdba -d data_center
3. Export database
pg_dump -h 127.0.0.1 -U sysdba data_center >/data/data_center.sql
4. Import database
psql -U sysdba data_center
5. Compression
xz data_center.sql
6. Import the compressed file into the database
xzcat /data/data_center.sql.xz | psql -h 127.0.0.1 -U sysdba data_center
7. pgsql restores files in the database (import dmp files)
pg_restore -h 127.0.0.1 -U sysdba -d sjls -v /usr/postgres.dmp
边栏推荐
猜你喜欢
随机推荐
zabbix自动化监控脚本
Do you really understand the business process service BPass?
SQL Server 数据库之生成与执行 SQL 脚本
js源码跳转的几种方式,在当前页面跳转,在空白页跳转
数据湖(三):Hudi概念术语
消除气泡解救蘑菇h5小游戏源码
How to use the database like tap water?|Tencent Cloud Database TDSQL-C
np.nan, np.isnan, None, pd.isnull, pd.isna finishing and summary
FreeRTOS--stack experiment
Distributed current limiting, hand & redisson implementation
干测试这些年,去过阿里也去过小公司,给年轻测试员们一个忠告...
网络流详解(流网图一般能够反映什么信息)
SQL Server 2019 installation error 0 x80004005 service there is no timely response to the start or control request a detailed solution
SQL Server 2014安装教程(保姆级图解教程)
Solve the problem of Chinese garbled characters in exporting excel file names
定了!2022世界VR产业大会将继续在南昌召开
ssm access database data error
The 7 most commonly used data analysis thinking, solve 95% of the analysis problems
LeetCode_377_组合总和Ⅳ
Process finished with exit code 1