pg-dump

Populate MySQL database from postgresql dump file

为君一笑 提交于 2020-05-10 03:48:18
问题 Actually I need to populate MySQL database from a SQL file which was generated by postgresql as pg_dump dbname > myfile.sql So, if I try to do like mysql> source myfile.sql This obviously does not work. Although it did populate 70% tables but I want to know is there a way to achieve it ? From the source file of postgresql, can I source and populate my database of MySql. 回答1: If you want to migrate the data and structure from postgres table to mysql equivalent, the easiest way is using a

Easy way to view postgresql dump files?

老子叫甜甜 提交于 2020-05-09 18:58:26
问题 I have a ton of postgresql dump files I need to peruse through for data. Do I have to install Postgresql and "recover" each one of them into new databases one by one? Or I'm hoping there's a postgresql client that can simply open them up and I can peek at the data, maybe even run a simple SQL query? The dump files are all from a Postgresql v9.1.9 server. Or maybe there's a tool that can easily make a database "connection" to the dump files? UPDATE : These are not text files . They are binary

Easy way to view postgresql dump files?

守給你的承諾、 提交于 2020-05-09 18:58:09
问题 I have a ton of postgresql dump files I need to peruse through for data. Do I have to install Postgresql and "recover" each one of them into new databases one by one? Or I'm hoping there's a postgresql client that can simply open them up and I can peek at the data, maybe even run a simple SQL query? The dump files are all from a Postgresql v9.1.9 server. Or maybe there's a tool that can easily make a database "connection" to the dump files? UPDATE : These are not text files . They are binary

PostgreSql , extract schema objects DDL to separate SQL file

别说谁变了你拦得住时间么 提交于 2020-04-18 08:40:31
问题 I want to export all objects DDL to separate file example ( table_a_create.sql , view_b_create.sql , trigger_c_create.sql , table_contraints.sql ...) I was trying with pg_dump but it only exports to one file for the whole schema. I read some questions about this on stackoverflow but still not enough for my requirement Ex: How to dump PostgreSQL database structure (each object in separate file) Is there any way to do it? I'm using Windows 回答1: If you are on the client machine, you can put this

“permission denied” for pg_dump output file

被刻印的时光 ゝ 提交于 2020-01-22 14:00:08
问题 i used below command to backup my database sudo -u user_name pg_dump dbName -f /home ..../someWhere/db.sql but it gives me this : pg_dump: [archiver] could not open output file "/home ..../someWhere/db.sql": Permission denied after googling this issue i find that i must backup my data under the /tmp path , but doesn't work how can i resolve this issue ? thanks in advance, i am using Ubuntu 12.04 lts 回答1: try pg_dump from psql command-line as below: postgres=# \! pg_dump dbName -f /home ....

Unable to restore psql database from pg_dump with a different username

廉价感情. 提交于 2020-01-21 11:49:10
问题 I need to dump a postgres database from computer1 with postgres username1 and then restore it on computer2 with postgres username2. I keep running into the error that looks like the backup file wants to use username1: When I run this on computer2: psql dbname < backupname.pgsql I get this error: ERROR: role "username1" does not exist I have tried: // Dumping from computer1: pg_dump dbname > backupname.sql pg_dump dbname > backupname.pgsql pg_dump -U username1 dbname -N topology -T spacial_ref

Unable to restore psql database from pg_dump with a different username

橙三吉。 提交于 2020-01-21 11:49:09
问题 I need to dump a postgres database from computer1 with postgres username1 and then restore it on computer2 with postgres username2. I keep running into the error that looks like the backup file wants to use username1: When I run this on computer2: psql dbname < backupname.pgsql I get this error: ERROR: role "username1" does not exist I have tried: // Dumping from computer1: pg_dump dbname > backupname.sql pg_dump dbname > backupname.pgsql pg_dump -U username1 dbname -N topology -T spacial_ref