Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PostgreSQL: pg_dump does nothing in command prompt

I opened an SQL Shell (psql) and entered my information: username, port, host, database and password.

Then the name of the database popped up like so

Testing_Database-#

Then I attempted to dump a table into a file like so

pg_dump -h BigSever -p 5432 -t customer_order > plzwork.sql 

Nothing showed up on my machine. I quickly got back

Testing_Database-#

I searched my entire computer for it then I read online to try

pg_dump -h BigSever -p 5432 -t customer_order > C:\plzwork.sql 

It didn't work either. It threw an error, so I tried another example

pg_dump -h BigSever -p 5432 -t customer_order > "C:\\plzwork.sql"

and got

Testing_Database-#

But still, it wasn't in the C drive as expected. So, I am now wondering am I supposed to get a notification of completion? If it is working, why isn't it sending it where I can find it.

Also, I tried my own personal localhost to do a dump and got the same results.

like image 379
user1778743 Avatar asked Jul 20 '26 22:07

user1778743


2 Answers

If you are looking to use pg_dump, the command is meant for normal command prompt not for psql command prompt.

Go to your command line and run the pg_dump tablename dbname > filename.sql You can pwd just to make sure where you are.

Winscp the file to destination server. In the destination server,log into the psql command.

Run psql dbname < filename.sql

like image 196
MrKarma4u Avatar answered Jul 26 '26 03:07

MrKarma4u


If you are a Mac user:

/Applications/Postgres.app/Contents/Versions/9.6/bin/pg_dump -h BigSever -p 5432 -t customer_order > plzwork.sql

As @MrKarma4u mentioned, this has to be run from the regular command prompt (not from psql)

like image 31
Anupam Avatar answered Jul 26 '26 02:07

Anupam



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!