PostgreSQL: backup remote database with pg_dump

#let's create a backup from remote postgresql database using pg_dump: # # pg_dump -h [host address] -Fc -o -U [database user] <database name> > [dump file] # #later it could be restored at the same remote server using: # # sudo -u postgres pg_restore -C mydb_backup.dump # #Ex: pg_dump -h 67.8.78.10 -p 5432 -Fc -o -U myuser mydb > mydb_backup.dump #complete (all databases and objects) pg_dumpall -U myuser -h 67.8.78.10 -p 5432 --clean --file=mydb_backup.dump #restore from pg_dumpall --clean: psql -f mydb_backup.dump postgres #it doesn't matter which db you select here
Command I use to backup my remote postgres databases

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.