Question

How to download a database from Managed Database Cluster?

How to download a database from Managed Database Cluster (PostgreSQL)?

And

How to upload existing database to Managed Database Cluster (PostgreSQL)?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Matt Cowley
Site Moderator
Site Moderator badge
July 12, 2019
Accepted Answer

Hi there @Motash,

You should be able to achieve both of these by using the pg_dump and pg_restore command-line tools.

A command similar to the following should allow you to dump all the data from your remote PostgreSQL database to a single dump file:

  1. pg_dump -h use_your_host -U use_your_username -Fc use_your_dbname > dbdump.pgsql

You can restore a dump file to the default database and user by running a command similar to this:

  1. pg_restore -d 'use_your_connnectionURI' --jobs 4 use_your_dump_file

We cover both importing and exporting databases more detail in our product documentation for our managed databases (PostgreSQL):

https://www.digitalocean.com/docs/databases/how-to/postgresql/import-databases/

Hope that helps! - Matt.

Thank you. For pg_dump I had to also add: -p my_port_number (in my case 25060).

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel