博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
PostgreSQL 备份与恢复
阅读量:7188 次
发布时间:2019-06-29

本文共 953 字,大约阅读时间需要 3 分钟。

  hot3.png

使用PostgreSQL内建格式(custom格式)

/Library/PostgreSQL/9.6/bin/pg_dump --host localhost --port 5432 --username "postgres" --password  --format custom --blobs --encoding UTF8 --no-privileges --verbose --file "/home/my/dbname.backup" --schema "app" --schema "sys" "dbname"

 

使用sql格式(plain格式)

/Library/PostgreSQL/9.6/bin/pg_dump --host localhost --port 5432 --username "postgres" --no-password  --format plain --no-owner --encoding UTF8 --inserts --column-inserts --no-privileges --verbose --file "/home/my/dbname.sql" --schema "app" --schema "sys" "dbname"

 

恢复数据库(custom格式)

#覆盖已有的数据,pg_restore --host localhost --port 5432 --username "db_user" --dbname "db_name" --password  --no-owner --no-privileges --clean --verbose "/home/my/dbname.backup"#新建数据库pg_restore --host localhost --port 5432 --username "db_user" --dbname "db_name" --password  --no-owner --no-privileges  --verbose "/home/my/dbname.backup"#差别在于是否有 --clean

 

转载于:https://my.oschina.net/myaniu/blog/758958

你可能感兴趣的文章
Go 生成图片
查看>>
命令-df/du
查看>>
整合 Tachyon 运行 Apache Flink(译)
查看>>
写给走在IT路上的我。。
查看>>
新手初识webservice-理论篇
查看>>
成功者的共同特点
查看>>
iOS中的多线程
查看>>
Oracle客户端配置说明 centos
查看>>
鸟哥学习笔记---NIS
查看>>
spring framework最新发布压缩包的下载问题
查看>>
hadoop-1.2.1集群安装
查看>>
c++类中的const
查看>>
markdown使用*
查看>>
13年下半年信息系统项目管理师考试总结
查看>>
为什么受伤的总是技术大牛
查看>>
我的友情链接
查看>>
Composer 笔记(PHPconf 台湾)
查看>>
linux双网卡绑定
查看>>
Python 三元运算符与lambda
查看>>
ethtool 的使用方法
查看>>