How to backup a remote PostgreSQL db and restore it locally?
pg_dump and pg_restore 来备份和恢复数据库中的数据。
--------------------------------------
This article lists the commands to dump a remote PostgreSQL database in a local file and then restore it on the localhost PostgreSQL server running.
# Please note: The below commands worked for me. It may or may not work for you.
# Please use it at your own risk. # Create a database dump of the the remote DB. pg_dump -h -Fc -o -U remote-postgresql-user remote-db-name > mydatabase.dump # Example: pg_dump -h 10.20.30.40 -Fc -o -U postgres mydatabase > mydatabase.dump # Restore the db dump as a local PostgreSQL database. # Note that I have assumed that you have already installed and configured PostgreSQL
# in your local machine. sudo -u postgres pg_restore -C mydatabase.dump
For a details of the command line options supported by pg_dump
and pg_restore
, please visit http://www.postgresql.org/docs/9.0/static/app-pgdump.html and http://www.postgresql.org/docs/9.0/static/app-pgrestore.html respectively.
How to backup a remote PostgreSQL db and restore it locally?的更多相关文章
- Symantec Backup Exec Remote Agent 2010在Redhat Enterprise 6.6上启动问题
在Red Hat Enterprise Linux Server release 6.6 (Santiago)上安装了Symantec Backup Exec Remote Agent 2010后,启 ...
- Postgresql DB安装和使用问题记录
2.选择语言后提示: Error: There has been an error. Please put SELinux in permissive mode and then run instal ...
- PostgreSQL pg_dump pg_dumpall and restore
pg_dump dumps a database as a text file or to other formats. Usage: pg_dump [OPTION]... [DBNAME] Gen ...
- PostgreSQL与RPM
如何查看使用PostgreSQL的RPM包安装后的文件目录及相关路径(PostgreSQLRPM的spec文件已经帮我们创建好了postgres用户及postgres组). 查看RPM文档信息:/us ...
- [TroubleShooting] The remote copy of database xx has not been rolled forward to a point in time
Steps: 1. backup database TestMirror on Pricipal server 2. backup database log of TestMirror on Pric ...
- PostgreSQL Q&A: Building an Enterprise-Grade PostgreSQL Setup Using Open Source Tools
转自:https://www.percona.com/blog/2018/10/19/postgresql-building-enterprise-grade-setup-with-open-sour ...
- 一键备份脚本 backup.sh
做网站最重要的是什么?数据!数据,是网站之本,备份,是每一个站长都应该重视的事情.但同时,备份也是一件繁琐和重复的事情.所以,这些事情,肯定能做到自动化的.下面来介绍一下这个一键备份脚本 backup ...
- postgresql备份和恢复
备份: pg_dump -d m3vg -h localhost -p 5432 -U delta -W -f 1024.dump -F tar 恢复: pg_restore -h localhost ...
- PostgreSQL 使用PG_Rman进行物理备份
背景 在Oracle下我们可以使用rman进行物理备份,支持数据库的全量.增量.归档的备份模式而PostgreSQL作为开源数据库,近些时间来也一直向商业版数据库看齐,也推出了开源功工具pg_rman ...
随机推荐
- EF选择Mysql数据源
EF添加ADO.NET实体模型处直接选择Mysql数据源 最近想到EF是连接多数据库的orm框架,于是就想测试下.查了一堆网上资料后,测试连接mysql成功.步骤如下: 1.在你项目Model层中nu ...
- PLSQL Developer 运用Profiler 分析存储过程性能
最近应公司需要,需要编写ORACLE存储过程.本人新手,在完成存储过程的编写后,感觉需要对存储过程中各个语句的执行时间进行分析,以便 对整个存储过程进行优化. 由于用的是PLSQL Developer ...
- BZOJ 1207
1207: [HNOI2004]打鼹鼠 Time Limit: 10 Sec Memory Limit: 162 MBSubmit: 3089 Solved: 1499[Submit][Statu ...
- pytest学习(2)
可以把多个test放在一个class里, class TestClass(object): def test_one(self): x = "this" assert 'h' in ...
- Laravel5.5配置使用redis
1.安装redis linux上redis的安装与配置 2.安装redis客户端 composer require predis/predis或者安装 PhpRedis PHP 扩展brew inst ...
- 如果想从jenkins直接生成docker镜像,并推送到harbor中,最简单的脚本如何实现?
如果不考虑意外, 第一版最简单的构思如下: #!/usr/bin/env python # -*- coding: utf-8 -*- import getopt, sys import subpro ...
- (一)shell基础
(1)shell作用: 1)自动化批量系统初始化程序(软件安装,时区设置,安全策略) 2)自动化批量软件部署程序(LNMP,LAMP,LNTM) 3)管理应用程序(kvm,集群管理扩容) 4)日志分析 ...
- 浙江省第十二届省赛 B - Team Formation
Description For an upcoming programming contest, Edward, the headmaster of Marjar University, is for ...
- css “裁剪”图片(显示图片的一部分)
背景:朋友有一个需求,就是列表页显示的图片要做裁剪,不然不按比例缩小图片看起来就变形了.本来想好的解决办法是用PHP来生成缩略图,然而试了好几个开源缩略图类都没有一个满意的,突然想到为什么不直接用CS ...
- HDU 2504.又见GCD-递归
又见GCD Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submi ...