pg_dump and pg_restore 来备份和恢复数据库中的数据。

原文:  https://ksearch.wordpress.com/2012/09/28/how-to-backup-a-remote-postgresql-db-and-restore-it-locally/

--------------------------------------

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?的更多相关文章

  1. 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后,启 ...

  2. Postgresql DB安装和使用问题记录

    2.选择语言后提示: Error: There has been an error. Please put SELinux in permissive mode and then run instal ...

  3. 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 ...

  4. PostgreSQL与RPM

    如何查看使用PostgreSQL的RPM包安装后的文件目录及相关路径(PostgreSQLRPM的spec文件已经帮我们创建好了postgres用户及postgres组). 查看RPM文档信息:/us ...

  5. [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 ...

  6. 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 ...

  7. 一键备份脚本 backup.sh

    做网站最重要的是什么?数据!数据,是网站之本,备份,是每一个站长都应该重视的事情.但同时,备份也是一件繁琐和重复的事情.所以,这些事情,肯定能做到自动化的.下面来介绍一下这个一键备份脚本 backup ...

  8. postgresql备份和恢复

    备份: pg_dump -d m3vg -h localhost -p 5432 -U delta -W -f 1024.dump -F tar 恢复: pg_restore -h localhost ...

  9. PostgreSQL 使用PG_Rman进行物理备份

    背景 在Oracle下我们可以使用rman进行物理备份,支持数据库的全量.增量.归档的备份模式而PostgreSQL作为开源数据库,近些时间来也一直向商业版数据库看齐,也推出了开源功工具pg_rman ...

随机推荐

  1. (十二)进一步掌握STVD/COSMIC

    如何分配变量到指定的地址 举例:unsigned char temp_A@0x00; //定义无符号变量temp_A,强制其地址为0x00unsigned char temp_B@0x100; //定 ...

  2. 【 Zabbix 】— 监控nginx

    一.环境说明 OS:centos6.7 x64 nginx:nginx/1.9.9 ZABBIX:2.4.8 zabbix监控nginx是根据nginx的stub_status模块,抓取status模 ...

  3. 请求参数中的"+"号为什么会丢失,如何保证参数完整

    最近在开发中碰见一个问题,后端代码调用接口,在请求端参数没有任何问题,但是当接口接收到参数时,其中的加号全部变为了空格. 在查阅资料后发现是URLDecoder方法的问题,以下是URLDecoder的 ...

  4. SQL 建立多个字段唯一性校验

    由于在做压力测试,同一时间占用的问题. 两个用户同时下同一时间的订单,需要增加校验,第一个能保存的用户保存,第二个就不能让保存了. 问题是通过代码,怎么都做不到毫秒级校验,所以解决办法就只能是通过数据 ...

  5. 理解和上手Redux

    顾名思义本文分两个部分,理解和上手,第一部分我先讲个故事,这个故事也许不是特别形象,但对大家理解Redux一定有所帮助.第二部分我举个例子. 先讲个故事: 一个餐厅(应用),我是顾客(用户),这个餐厅 ...

  6. Python与数据结构[4] -> 散列表[0] -> 散列表与散列函数的 Python 实现

    散列表 / Hash Table 散列表与散列函数 散列表是一种将关键字映射到特定数组位置的一种数据结构,而将关键字映射到0至TableSize-1过程的函数,即为散列函数. Hash Table: ...

  7. floyed算法的一些感想

    for(int k=1;k<=n;k++) for(int i=1;i<=n;i++) for(int j=1;j<=k;j++) if(f[i][k]+f[k][j]<f[i ...

  8. hdu6121

    hdu6121 题意 给出一棵树,\(0\) 为根节点,节点 \(i\) 的父节点标号是 \(\lfloor\frac{i-1}{k}\rfloor\),求所有子树大小的异或和. 分析 找规律.在纸上 ...

  9. 加密连接工具Cryptcat

    加密连接工具Cryptcat   Cryptcat是网络工具Netcat的加密版本.Cryptcat支持TCP.UDP两种网络协议.它可以在两个计算机之间建立指定的连接,并使用特定的密钥对传输数据进行 ...

  10. 「Baltic2015」Network

    题目描述 原文 The government of Byteland has decided that it is time to connect their little country to th ...