I'm trying to pg_dump a SQL database on a remote server in our DMZ. There are 2 problems.
there is not a lot of space left on the remote server so the normal command run to locally backup the database
pg_dump -C database > sqldatabase.sql.bak
won't work due to space issues.I also can't run the other version of pg_dump command to dump database from remote server to local server using:
pg_dump -C -h remotehost -U remoteuser db_name | psql localhost -U localuser db_name
as the server is in our DMZ and port 5432 is blocked. What I'm looking to see is if it is possible to pg_dump the database and immediatly save it (ssh or some other form) as a file to a remote server.
What I was trying was: pg_dump -C testdb | ssh [email protected] | > /home/admin/testdb.sql.bak
Does anyone know if what i am trying to achieve is possible?
netcat -l -p 1234 > thefile &
. (2) from the remote machine , do:pg_dump ... | netcat your.local.ip 1234
– Surrealism