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.
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
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With