pg-restore

Why is pg_restore returning successfully but not actually restoring my database?

馋奶兔 提交于 2019-12-29 10:53:14
问题 I have a Postgres 8.4 database on a linux server that I have dumped using the following command: pg_dump --format=c --exclude-table=log --file=/path/to/output my_db I then ftp the created file to my local Windows 7 machine and attempt to restore the file to my local Postgres 8.4 instance using the following command: pg_restore --create --exit-on-error --verbose c:\path\to\file The restore command generates plenty of output claiming it created my database, connected to it, and then created all

pg_dump ignoring table sequence?

核能气质少年 提交于 2019-12-21 03:43:09
问题 I have been playing around with PostgreSQL lately, and am having trouble understanding how to backup and restore a single table. I used pgadmin3 to backup a single table in my database, in order to copy it to a different server. When I try to do a pg_restore on the file, I get error messages saying that the sequence does not exist: pg_restore: [archiver (db)] could not execute query: ERROR: relation "businesses_id_seq" does not exist Command was: CREATE TABLE businesses ( id integer DEFAULT

How do I convert a binary pgdump (compressed) to a plain SQL file?

ぃ、小莉子 提交于 2019-12-20 10:17:24
问题 I do want to search for some data inside a database dump but these dumps are using the binary-compressed format ( PGDMP header). How can I convert these to SQL without restoring them? 回答1: pg_restore , when run without a database name, outputs a text dump to stdout; you can send that elsewhere with -f or with I/O redirection. pg_restore -f mydatabase.sql mydatabase.dump 回答2: The fastest method that I've used was: pg_restore mybinaryfile.backup > mysqlfile.sql No special flags, since pg

Using pg_dump and pg_restore correctly

一个人想着一个人 提交于 2019-12-20 03:06:19
问题 So I regularly backup and restore databases and schema's using pgadmin4. I would like to do it with a batch file using commands as pg_dump and pg_restore. I however always fail to succeed in this and could use some help. The way I try to dump one schema (with data) is the following: pg_dump -U postgres -F c -d database -n schema > mw2 Then I try to restore it with pg_restore: pg_restore -U postgres -d otherdatabase -n schema mw2 First I tried to use .dump in stead of tar but the result stays

Which pgdump format is best for small storage size and fast restore?

微笑、不失礼 提交于 2019-12-18 08:50:55
问题 This a first time foray in PostgreSQL backups (db dumps) and I've been researching the different pgdump formats, other pgdump options, and pgdumpall. For a Postgres beginner looking at taking an hourly dump (will overwrite previous dump) of two databases that contain table triggers and two different schemas in each db, what would be the backup format and options to easily achieve the following: Small file size (single file per db or ability to choose which db to restore) Easy to restore as

Postgres Tutorial: pg_restore: [archiver] input file does not appear to be a valid archive

一笑奈何 提交于 2019-12-10 03:11:15
问题 I'm working through the Postgres DVD tutorial and am running into issues importing their sample database. Running pg_restore -U postgres -d dvdrental ~[filepath]/dvd-database.tar.gz gives me pg_restore: [archiver] input file does not appear to be a valid archive . My process so far has been the following: Download the dvdrental.zip file Extract it to a .tar using tar czf dvd-database.tar.gz dvdrental.zip (I've also tried extracting the zip to a folder first with the same result, as well as

pg_dump & pg_restore password using python module subprocess

你离开我真会死。 提交于 2019-12-07 20:30:10
问题 Problem: Use the PSQL pg_dump and pg_restore in a Python script and using the subprocess module. Background: I am using the following python 2.7 script from the localhost (i.e. Ubuntu 14.04.5 LTS ) to create a backup of a table in a PSQL server (i.e. PostgreSQL 9.4.11 ) and restore it into the remote host (i.e. Ubuntu 16.04.2 LTS ) in a newer version of PSQL server (i.e. PostgreSQL 9.6.2 ). #!/usr/bin/python from subprocess import PIPE,Popen def dump_table(host_name,database_name,user_name

will pg_restore overwrite the existing tables?

↘锁芯ラ 提交于 2019-12-06 19:01:11
问题 Say I have two host servers s1 and s2. In both the servers i have a schema named n1, now i have made some changes to some of the tables present in schema n1 of s1. I want the same change to be done to schema n1 of server s2. what i am planning to do is to take a backup of the schema n1 of server s1 using pg_dump and restore in the server s2 using pg_restore. Now my question is ,since there is already the same schema n1 in the server s2 with the same set of tables. what the restore process

pg_dump & pg_restore password using python module subprocess

元气小坏坏 提交于 2019-12-06 10:00:19
Problem: Use the PSQL pg_dump and pg_restore in a Python script and using the subprocess module. Background: I am using the following python 2.7 script from the localhost (i.e. Ubuntu 14.04.5 LTS ) to create a backup of a table in a PSQL server (i.e. PostgreSQL 9.4.11 ) and restore it into the remote host (i.e. Ubuntu 16.04.2 LTS ) in a newer version of PSQL server (i.e. PostgreSQL 9.6.2 ). #!/usr/bin/python from subprocess import PIPE,Popen def dump_table(host_name,database_name,user_name,database_password,table_name): command = 'pg_dump -h {0} -d {1} -U {2} -p 5432 -t public.{3} -Fc -f /tmp

Postgres Tutorial: pg_restore: [archiver] input file does not appear to be a valid archive

有些话、适合烂在心里 提交于 2019-12-05 05:18:42
I'm working through the Postgres DVD tutorial and am running into issues importing their sample database. Running pg_restore -U postgres -d dvdrental ~[filepath]/dvd-database.tar.gz gives me pg_restore: [archiver] input file does not appear to be a valid archive . My process so far has been the following: Download the dvdrental.zip file Extract it to a .tar using tar czf dvd-database.tar.gz dvdrental.zip (I've also tried extracting the zip to a folder first with the same result, as well as dropping the .gz) Running pg_restore -U postgres -d dvdrental ~[filepath]/dvd-database.tar as stated