pg-dump

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

PostgreSQL: Database backup and Recovery? [closed]

限于喜欢 提交于 2019-12-13 04:39:29
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . What is the procedure to take database backup and recovery in PostgreSQL 9.3? I am using SQL Dump for the same, but getting an error near pg_dump. --Example pg_dump testdb > backupfile --Error occurred ERROR: syntax error at or near "pg_dump" LINE 1: pg_dump testdb > backupfile 回答1: Use below command to take

PostgreSQL: VACCUM FULL vs pg_dump and restore

狂风中的少年 提交于 2019-12-12 22:29:56
问题 Does pg_dump do the same thing as VACCUM FULL? I wan to clean a database at night but VACCUM FULL takes too much time. Does pg_dump also clear database form unwanted data? 回答1: Assuming that you create a new database and restore the dump, the effect of both operations would be pretty much the same. The big question is why you think you need such extreme measures. Normally autovacuum should take care of dead tuples, and if you have a table on which you perform bulk updates or deletes, you

pg_dump setting of sequences

余生长醉 提交于 2019-12-12 02:46:39
问题 I've recently started developing apps with PostgreSQL as backend DB (imposed on me) with no previous experience of Postgres. So far it hasn't been too bad, but now I run into a problem to which I cannot find answer for. I created a batch scripts that runs a pg_dump command for a particular database on the server. This batch file is executed on schedule by the pgAgent. The pg_dump itself seems to work ok. All the database structure and data are dumped to a file. However the sequences are all

Unable to restore pg_dump backup

雨燕双飞 提交于 2019-12-10 16:12:36
问题 I'm trying to restore backup from Postgres 9.1.1, which was created by: pg_dump mydb > backup.sql restore on Postgres 9.1.9 psql -d mydb -f backup.sql I'm getting this error: psql:datasets.sql:278537: invalid command \. psql:datasets.sql:278544: ERROR: syntax error at or near "1" LINE 1: 1 4446 49 253.412262 239.618317 0 211.54303 100.482948 197.1... The \. is part of COPY command, I guess it should be compatible between Postgres 9 versions, or it's not? COPY data_136 (id, in_1, in_2, in_3,

pg_dump version mismatch in Rails

时光怂恿深爱的人放手 提交于 2019-12-10 14:53:43
问题 When running the rake db:structure:dump command, I encountered the following error: Larson-2:app larson$ rake db:structure:dump pg_dump: server version: 9.1.3; pg_dump version: 9.0.4 pg_dump: aborting because of server version mismatch rake aborted! Error dumping database How can I go about updating pg_dump? I have pg 9.1.3 installed, is there a way to update the references inside of Rails to the new version? When I try to update postgres via homebrew, I get the following output: Larson-2:app

PGAdmin 4 fails to backup database with no errors

 ̄綄美尐妖づ 提交于 2019-12-10 13:59:49
问题 I try to backup my university project database. I followed the instruction, everything seems to be inputed: 1: 2: 3: But the only pop-out I get is this one in right-bottom corner of PGAdmin 4: From the Official site, there should be another pop-up message, similiard to this one: But I don't get this one, nor I get the other one that is displayed where any error occurs. I tried to directly use pg_dump.exe , but it prompts me for a password. I tried all my passwords - user password, server