Commands

Describes some commands to control PostgreSQL for different operating systems.


Global

Deletion of the database “odoo”:

psql
psql -U postgres -c "drop database odoo"
psql -l
\q

Location of the productive PostgreSQL database:

which psql

Result:

  • /usr/local/bin/psql


Location of the PostgreSQL program files:

  • /usr/local/Cellar


Location of the data dictionary:

SHOW data_directory;

Result:

  • /usr/local/var/postgres


Google Engine

  1. Delete Database

sudo su - odoo -s /bin/bash
psql -l
dropdb Logistics_DB
  1. Create Database

createdb -p 5432 -O odoo -e Logistics_DB
  1. Verification of Database

acuumdb --full --dbname Logistics_DB --analyze --verbose

Backup and Restore

  1. Basics of the Backup Scripts

1.a) Templates


  1. Google Cloud Engine

2.a) The apple script Script Odoo Backup Google executes a backup based on the Advanced Backup Script.

2.b) The apple script Script Odoo Restore Google executes a restore based on the Advanced Restore Script.


  1. macOS

3.a) The apple script Script Odoo Backup Automate executes a backup based on the Advanced Backup Script.

3.b) The apple script Script Odoo Restore Automate executes a restore based on the Advanced Restore Script.


  1. Raspberry Pi

Path to the scripts:

  • /home/pi/Documents/Script

Path to the backup directory (has to be entered in both scripts):

  • /home/pi/Documents/Backup

User with which the script has to be executed:

  • odoo

4.a) Backup

sudo su - odoo -s /bin/bash
cd /home/pi/Documents/Script
bash ./backup-dump.sh
exit

4.b) Restore

sudo su - odoo -s /bin/bash
cd /home/pi/Documents/Script
bash ./restore-dump.sh
exit