.. _postgresql_commands: Commands ======== Describes some commands to control PostgreSQL for different operating systems. | Global ------ Deletion of the database "odoo": .. code-block:: shell psql psql -U postgres -c "drop database odoo" psql -l \q | Location of the productive PostgreSQL database: .. code-block:: shell which psql Result: - /usr/local/bin/psql | Location of the PostgreSQL program files: - /usr/local/Cellar | Location of the data dictionary: .. code-block:: shell SHOW data_directory; Result: - /usr/local/var/postgres | Google Engine ------------- 1. Delete Database .. code-block:: shell sudo su - odoo -s /bin/bash psql -l dropdb Logistics_DB 2. Create Database .. code-block:: shell createdb -p 5432 -O odoo -e Logistics_DB 3. Verification of Database .. code-block:: shell acuumdb --full --dbname Logistics_DB --analyze --verbose | Backup and Restore ------------------ 1. Basics of the Backup Scripts 1.a) Templates - `Simple Backup Script `_ - `Simple Restore Script `_ - `Advanced Backup Script `_: script is based on `Automate Odoo backups with this script `_. - `Advanced Restore Script `_: script is based on `Restore Odoo database with this script `_. | 2. 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``. | 3. 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``. | 4. 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 .. code-block:: shell sudo su - odoo -s /bin/bash cd /home/pi/Documents/Script bash ./backup-dump.sh exit 4.b) Restore .. code-block:: shell sudo su - odoo -s /bin/bash cd /home/pi/Documents/Script bash ./restore-dump.sh exit