Skip to main content

DB Dump Create

Windows

  1. Open PG Admin
  2. Right click on the orsanco database and select backup.
  3. Give the dump file a path and name such as: C:\Path\to\orsanco\dumps\orsanco_dump_mmddyyyy.backup
  4. Leave all other values as default and click the Backup button.

Linux

This walkthrough assumes you are already connected to the VM CLI.

  1. Check how many cores your computer has available with the command lscpu; make note of the "CPU(s)" value.
  2. Create a directory-based dump with the command: pg_dump --dbname=orsanco -U postgres -j <number_of_cpus> --verbose --format=d ./orsanco_vm_dump_mmddyyyy.backup/
  3. You can use SC Pto move the backup file from VM to another Linux machine with the command: scp -i ~/.ssh/orsanco_vm.pem -r gqc@20.14.140.39:/dbdrive/orsanco/orsanco_vm_dump_mmddyyyy.backup/ /local/path/to/dumps/
  4. Alternatively, you can perform the dump (or restore) command over TCP/IP, though the process is a bit more complicated:
    1. Allow the remote machine access to the host's database by configuring ports (UFW) and pg_hba.conf.
    2. When running the pg_dump command, add the argument -h 20.14.140.39

Old Method (Potentially Slower)

  1. Create a dump with the command: pg_dump --file /dbdrive/orsanco/orsanco_vm_dump_mmddyyyy.backup -U postgres --verbose --format=c orsanco
  2. You can use SCP to move the backup file from VM to your local WSL instance with the command: scp -i ~/.ssh/orsanco_vm.pem gqc@20.14.140.39:/dbdrive/orsanco/orsanco_vm_dump_mmddyyyy.backup /mnt/c/local/path/to/dumps/ making sure to specify the proper pem file, backup file name, and local path.