• Tek Siong, Hock

Extract the database via sql

There are occasions where you want to backup and restore database from an Odoo instance to another, such as the following:


1) Testing of a Production database data

If you project implementation has change request or bugs, you may want to copy the Production database to another instance for the Testing with the production data.

2) Development in the local PC

Your development of change request or bugs fixing with the production database will ensure the accurate result.


Sometimes, due to the large file size, download of the backup database may be incomplete or time out error can occurred.


Login to your odoo user in the linux server.

su - odoo_dev

Display all the databases in the postgresql

psql -l 

Make a copy of your database "odoo_dev" in the sql script

pg_dump -d odoo_dev -f  odoo_dev.sql

Copy the odoo_dev.sql to your desired server and create the new database odoo_dev_dup

and copy the data from odoo_dev.sql to the odoo_dev_dup database.

createdb odoo_dev_dup 
psql -d odoo_dev_dup -f odoo_dev.sql





27 views0 comments