当前位置:网站首页>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
边栏推荐
- Thymeleaf
- Process finished with exit code 1
- Swiper系列之轮播图
- 30行代码实现无服务器实时健康码识别--操作手册
- np.nan, np.isnan, None, pd.isnull, pd.isna 整理与小结
- Set proxy server (Google+IE) "Recommended Collection"
- php - the first of three solid foundations
- Speed up your programs with bitwise operations
- 看我如何用多线程,帮助运营小姐姐解决数据校对系统变慢!
- According to the field classification Golang map array
猜你喜欢
SQL Server 2014 installation tutorial (nanny-level graphic tutorial)
Distributed current limiting, hand & redisson implementation
#夏日挑战赛#【FFH】OpenHarmony设备开发基础(三)编译依赖
消除气泡解救蘑菇h5小游戏源码
The use of QListView
分布式限流利器,手撕&redisson实现
FreeRTOS--栈实验
js semi-circle loading progress animation js special effects
js真3d柱状图插件
Swiper系列之轮播图
随机推荐
Import and export data of SQL Server database
Set proxy server (Google+IE) "Recommended Collection"
PHP伪协议详解
js炫酷仪表盘插件
自定义mvc框架复习
MyCat2 introduction and installation and basic use
商业流程服务BPass你真的了解吗?
如何搭建威纶通触摸屏与S7-200smart之间无线PPI通信?
Drools(8): WorkBench uses
Software component analysis: 5 major capabilities to protect software supply chain security
Drools(8):WorkBench使用
Solve the problem of Chinese garbled characters in exporting excel file names
Speed up your programs with bitwise operations
#夏日挑战赛#【FFH】OpenHarmony设备开发基础(三)编译依赖
pytorch模型转tensorflow模型
js九宫格样式抽奖插件
np.nan, np.isnan, None, pd.isnull, pd.isna 整理与小结
MFC入门教程(深入浅出MFC)
How to set up wireless PPI communication between Weiluntong touch screen and S7-200smart?
1.3 Rapid Spanning Tree Protocol RSTP