How to import Odoo database and browse locally


If you use Odoo CRM solution, you can login into your account and under it you will find My Databases.

When you click on it, you will be able to export existing database (to make a dump of it). This will be used for import on your local machine. Download this dump archive to your PC.

Now, you need to install PostgreSql Database Server on your machine. I am using Windows and I choose to install version 14. You need to have 64-bit Windows OS and you can download PostgreSql Database Server installation here:

Install PostgreSql Database Server and you can also choose to install useful utilities:

  • Some language packs
  • PgAdmin4 – SQL browser client (must have for work and previewing DB)
  • .NET driver
  • ODBC driver
  • JDBC driver, etc…

It will be installed in this directory by default: c:\Program Files\PostgreSQL\14\

I needed to modify Windows Service in order not to have database folder on disk C because I have working disk D, so I modified Windows Service by using this command sequences (start Command prompt – CMD as Administrator):

  • Stop the PostgreSql Windows Service postgresql-x64-14, by going to Start > Run > services.msc and find it by Postgre and click on Stop.
  • Create first DB directory on disk D where you will keep your databases, i.e.: d:\Databases\PostgreSql
  • Use right mouse button on this directory and choose Properties > Security and grant all privileges (check also to all subfolders) to this user: NETWORK SERVICE, so Windows Service will be able to access it.
  • Use this command to change Windows Service execution sequence:
    sc config postgresql-x64-14 binPath=”\”c:\Program Files\PostgreSQL\14\bin\pg_ctl.exe\” runservice -N \”postgresql-x64-14\” -D \”d:\Databases\PostgreSql\” -w”
  • Start the Windows Service postgresql-x64-14 – same method as in step one but choose Start

When you have finish that, unpack the migration data to some folder and then run this command to import data into your database (create the empty database first – I named it MyDatabase)

“C:\Program Files\PostgreSQL\14\bin\psql.exe” “host=localhost port=5432 dbname=MyDatabase user=MyUser password=MyUserPassword” < d:\Temp\my-migration-folder\dump.sql

When import is finished, open your PgAdmin 4 SQL browser, login, choose and browse your database.

If this helps you, donate me a beer by clicking it here 🙂