当前位置:网站首页>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.sql2. 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.sql4. Import database
psql -U sysdba data_center 5. Compression
xz data_center.sql6. Import the compressed file into the database
xzcat /data/data_center.sql.xz | psql -h 127.0.0.1 -U sysdba data_center7. pgsql restores files in the database (import dmp files)
pg_restore -h 127.0.0.1 -U sysdba -d sjls -v /usr/postgres.dmp
边栏推荐
- MyCat2的介绍与安装以及基本使用
- Basic operations of openGauss database (super detailed)
- sql concat()函数
- 技术分享| 融合调度系统中的电子围栏功能说明
- 机器人碰撞检测方法形式化
- 软件成分分析:手握5大能力守护软件供应链安全
- Intouch Historian历史曲线配置导入导出
- Technology sharing | Description of the electronic fence function in the integrated dispatching system
- How to better assess credit risk?Just watch this scorecard model live
- js炫酷仪表盘插件
猜你喜欢
随机推荐
1.3 Rapid Spanning Tree Protocol RSTP
Js scratchable latex style draw plug-in
Import and export data of SQL Server database
A powerful js pop-up alert plugin
LeetCode_377_Combination Sum IV
php字符串的截取方式
自己如何做小程序呢?
FreeRTOS中名称规范
simulink PID auto-tuning
Object.entries()
FreeRTOS experiment -- delete task
js stopwatch countdown plugin
SQL Server修改数据
numpy&pands 中的unique
DTG-SSOD: The latest semi-supervised detection framework, Dense Teacher (with paper download)
SuperSlide系列之轮播图
Solve the problem of Chinese garbled characters in exporting excel file names
新特性解读 | MySQL 8.0 GIPK 不可见主键
Data Lake (3): Hudi Concept Terminology
kvm部署









