Managing databases
Every Odoo database of every instance lives in the one shared odoo-postgres container. An
instance owns its databases; one of them is the active database that the instance serves.
Creating and initialising
prod-1# odoocli instance database create --instance acmeprod-1# odoocli instance database init --instance acmecreate makes an empty PostgreSQL database. init runs Odoo's own initialisation into it, which is
what turns it into an Odoo database.
| Databases per instance | Unregistered | Community | Developer | Professional | Provider |
|---|---|---|---|---|---|
| Limit | 1 | Unlimited | Unlimited | Unlimited | Unlimited |
Listing
prod-1# odoocli instance database list --instance acmeprod-1# odoocli instance database size --instance acmeCloning
prod-1# odoocli instance database clone --instance acmeCloning is the normal way to make a test copy of production: it copies the database within the same PostgreSQL server, which is far faster than dumping and loading.
Dumping and loading
prod-1# odoocli instance database dump --instance acmeprod-1# odoocli instance database load --instance acmedump and load move a database as a file. That is what you want when the destination is a
different server, or when the file is going somewhere Antelao does not manage.
Note that load counts as a restore for licensing purposes:
Renaming and removing
prod-1# odoocli instance database rename --instance acmeprod-1# odoocli instance database remove --instance acmeActivating
prod-1# odoocli instance database activate --instance acmeThe active database is the one the instance serves. Switching it is how you promote a restored or cloned database into production.
Maintenance
prod-1# odoocli instance database vacuum --instance acmeprod-1# odoocli instance database reindex --instance acmeBoth can also be scheduled. See Maintenance.
Odoo users inside a database
Antelao can manage the Odoo-side accounts in a database, separately from the management UI's own users:
prod-1# odoocli instance database user list --instance acmeprod-1# odoocli instance database user password-reset --instance acmeprod-1# odoocli instance database user totp-disable --instance acmeThese are break-glass tools for when someone has locked themselves out of Odoo itself. They are not a substitute for managing users inside Odoo.
Other operations
| Command | What it does |
|---|---|
instance database shell | A psql session against the database |
instance database cloc | Counts lines of code in the database's custom modules |
instance database comment get / set | Reads and writes the database's PostgreSQL comment |
instance database migrate-filestore | Moves the Odoo filestore |
instance database reset-permissions | Repairs ownership and grants |
instance database sysadmin create / remove | Manages the database superuser account |
instance database recaptcha | Configures reCAPTCHA keys in the database |