0

I have a server with Postgresql. I don't have access to this server, just the endpoint to connect with psql. I want to backup data from this server to another server using pg_dump. However, my second server does not have postgresql and I don't have root privilege to install it either. Is there any way to run pg_dump without install postgresql?

It is possible to install postgresql on my client and pg_dump from it but I'm afraid the database is too big for my laptop.

  • 1
    if you install on your client you can still direct the dump save to a different server as long as you have write permissions – indiri Dec 13 '17 at 16:18
1

Basically we don't need any Postgresql server to take the backup. Postgresql client is enough for this.

But you must have sudo privilege to install this client.

For Ubuntu:

echo "deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main" >>  /etc/apt/sources.list.d/pgdg.list
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
sudo apt-get install wget ca-certificates
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-client

For RedHat/CentOS/Amazon Linux:

Download the rpm here: https://yum.postgresql.org/repopackages.php#pg96

yum install postgresql 

Dump the Database

pg_dump -h remote_address -U username -D dbname -Fp > backup.sql

enter image description here

More about Pg_dump:

https://www.postgresql.org/docs/9.6/static/app-pgdump.html

1

It is possible to install postgresql on my client and pg_dump from it but I'm afraid the database is too big for my laptop.

Sure, pg_dump is just a program. You can download it or build it seperate from the others, also check out the -c option to --format=format if space is an issue

c custom Output a custom-format archive suitable for input into pg_restore. Together with the directory output format, this is the most flexible output format in that it allows manual selection and reordering of archived items during restore. This format is also compressed by default.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.