Odoo offers a unique ability to manage multiple databases within a single system instance. This is an extremely useful feature for companies managing several entities, agencies serving multiple clients, and development teams working on different projects. In this article, we explain in detail how to effectively configure and manage multiple databases in Odoo.
Why use multiple databases in Odoo?
Using multiple databases in a single Odoo instance brings a number of operational and business benefits:
- Data isolation - each database is a separate PostgreSQL database, which ensures complete separation of information between projects or clients
- Resource optimization - a single Odoo instance requires fewer server resources than several separate installations
- Easier management - system updates and configuration are performed centrally for all databases
- Test environments - the ability to create dedicated databases for testing without affecting production
- Cost savings - lower spending on infrastructure and administration
Basic requirements and preparation
Before you start creating multiple databases in a single Odoo instance, make sure you have:
- A working Odoo installation (Community or Enterprise) - version 14 or newer
- Access to the odoo.conf configuration file
- System administrator privileges
- Sufficient server resources (RAM, CPU, disk space) - at least 2GB of RAM per database for comfortable operation
- A configured PostgreSQL (version 12 or newer)
If you are just getting started with Odoo, see our guide how to install Odoo 19 Community vs Enterprise.
Configuring odoo.conf for multiple databases
The key element that makes it possible to add multiple databases in a single Odoo instance is the proper configuration of the odoo.conf file. Here are the most important parameters:
Basic settings
Open the Odoo configuration file (usually located at /etc/odoo/odoo.conf or ~/.odoorc) and configure the following parameters:
[options]
db_host = localhost
db_port = 5432
db_user = odoo
db_password = twoje_haslo
list_db = True
dbfilter = .*
You can find detailed information about all parameters in our article how to configure the odoo.conf file.
The list_db parameter
The list_db = True parameter enables displaying the list of all available databases on the login screen. This is the default Odoo behavior in a development environment. Note: In a production environment, it is recommended to set list_db = False for security reasons - this prevents potential attackers from discovering the list of all databases in the system.
Filtering databases - dbfilter
The dbfilter parameter is crucial when managing multiple databases in a single Odoo instance. It determines which databases are available depending on the domain or other criteria. It accepts regular expressions:
dbfilter = .*- shows all databases (useful in a development environment)dbfilter = ^%d$- shows the database matching the domain name (without www and the extension) - the most commonly used configuration in productiondbfilter = ^%h$- uses the full hostname (including the subdomain)dbfilter = firma1|firma2|firma3- restricts access to the listed databases only
Alternatively, for single-database scenarios, you can use the db_name parameter instead of dbfilter.
Managing the master password
You can set the master password in two ways:
admin_passwd = twoje_silne_haslo
Or through an environment variable (more secure):
export ODOO_MASTER_PASSWORD='twoje_silne_haslo'
The default password is 'admin' and must be changed before a production deployment.
Creating a new database through the web interface
The easiest way to add multiple databases in a single Odoo instance is to use the built-in web interface:
Step 1: Accessing the database manager
Go to: http://twoja-domena:8069/web/database/selector
Note: Make sure the list_db parameter is set to True in the configuration file. In newer Odoo versions you may also need the db_manager_enabled = True parameter (enabled by default in Community, it may be disabled in Enterprise).
Step 2: Creating a new database
In the database manager, click the 'Create' button and fill in the form:
- Master Password - the Odoo master password (default 'admin', it should be changed)
- Database Name - a unique name for the new database (no spaces, preferably lowercase letters and underscores)
- Email - the administrator's email address
- Password - the administrator password of the new database (not to be confused with the master password)
- Language - the interface language (Polish)
- Country - the country (Poland)
- Demo data - whether to load demo data (recommended for test databases, not recommended for production)
Step 3: Initializing the database
After you click 'Continue', the system automatically creates a new PostgreSQL database, installs the base modules, and redirects you to the newly created instance. This process can take from a few to several dozen minutes, depending on server resources and the demo data option you selected.
Creating a database from the command line
For advanced users and in automation scenarios, it is useful to create databases through the CLI:
odoo-bin -c /etc/odoo/odoo.conf -d nazwa_bazy -i base --stop-after-init --without-demo=all
Parameters:
-c /etc/odoo/odoo.conf- path to the configuration file-d nazwa_bazy- name of the new database-i base- installs the base module (required for every Odoo database)--stop-after-init- stops the process after initialization--without-demo=all- does not load demo data (optional)
For installations done through a package manager, use:
/usr/bin/odoo -c /etc/odoo/odoo.conf -d nazwa_bazy -i base --stop-after-init
Managing multiple databases
Switching between databases
After logging in to Odoo, you can switch between databases by:
- Logging out and logging in again while choosing a different database (if list_db = True)
- Going directly to
/web/database/selector - Using different domains with the appropriate dbfilter configuration (recommended in production)
- Adding the db parameter directly to the URL:
?db=nazwa_bazy(if not blocked by dbfilter)
Backups of multiple databases
Regular backups are critical when managing multiple databases. Each Odoo database (which is a separate PostgreSQL database) should be backed up separately. You can find detailed instructions in the article how to back up an Odoo database.
If you need to restore data, use our guide how to restore an Odoo database from a backup.
Disabling the database manager in production
For security reasons, in a production environment it is recommended to disable the database manager by adding the following to the configuration file:
list_db = False
db_manager_enabled = False
This will block access to the database management interface through the browser. Databases can then be managed only through the CLI or directly in PostgreSQL.
Remember to restart the Odoo service after making the change. If you have configured Odoo as a systemd service, check how to run Odoo as a systemd service.
Advanced configuration with multiple domains
When managing multiple databases in a single Odoo instance, you often need to assign each database to a separate domain or subdomain.
Nginx configuration for multiple databases
Using nginx as a reverse proxy, you can route different domains to the appropriate databases:
server {
server_name klient1.example.com;
location / {
proxy_pass http://127.0.0.1:8069;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
In the odoo.conf file, set:
dbfilter = ^%d$
proxy_mode = True
The proxy_mode = True parameter is essential for Odoo to work correctly behind a reverse proxy. This configuration automatically selects the 'klient1' database for the domain klient1.example.com. You can find more details in the article how to set up nginx as a reverse proxy for Odoo.
SSL protection for every domain
Every domain should be secured with an SSL certificate. See the guide how to configure HTTPS/SSL for Odooto properly configure encryption for all databases. You can use Let's Encrypt to automatically generate certificates for multiple domains.
Performance optimization for multiple databases
Managing multiple databases in a single Odoo instance requires proper resource optimization:
Workers configuration
The workers parameter in the odoo.conf file determines the number of worker processes handling requests. With multiple databases, it is a key performance parameter:
workers = 4
max_cron_threads = 2
General rule: number of workers = (number_of_CPU_cores × 2) + 1
However, with many active databases it is worth experimenting with the values. For a 4-core server with 2-3 active databases, a good starting point is 6-8 workers. Keep in mind that each worker consumes RAM.
Memory limits
Set memory limits for each worker to prevent server overload:
limit_memory_hard = 2684354560
imit_memory_soft = 2147483648
limit_time_cpu = 600
limit_time_real = 1200
These values (2.5GB hard, 2GB soft) are suitable for most use cases. A worker exceeding the soft limit will be restarted after it finishes the current request, and one exceeding the hard limit - immediately.
PostgreSQL optimization
Adjust the PostgreSQL settings to handle multiple databases (edit the postgresql.conf file):
shared_buffers = 512MB
effective_cache_size = 2GB
work_mem = 16MB
maintenance_work_mem = 128MB
max_connections = 200
checkpoint_completion_target = 0.9
These values are suitable for a server with 4-8GB of RAM serving several databases. For larger installations, scale them proportionally. Remember that shared_buffers should be about 25% of available RAM, and effective_cache_size about 50-75% of RAM.
Security of multiple databases
When managing multiple databases, pay particular attention to security:
- Hide the database list - set
list_db = Falsein production - Disable the database manager - add
db_manager_enabled = Falsein production - Strong master password - change the default admin_passwd to a complex one (at least 20 characters)
- Manager access - restrict access to /web/database/selector through a firewall or nginx
- Separate permissions - each database should have independent administrators with different passwords
- Regular backups - automate backups of every database (at least once a day)
- Monitoring - track the logs of each database separately and configure alerts
- Security updates - regularly update Odoo and PostgreSQL
Migrating and cloning databases
Adding multiple databases in a single Odoo instance often involves cloning or migrating existing data:
Cloning through the interface
In the database manager (if db_manager_enabled = True), the 'Duplicate Database' option is available, which creates an identical copy of the selected database. You must provide the master password and a name for the new database. Both the PostgreSQL database structure and the filestore (attachments, images) are cloned.
Cloning through PostgreSQL
You can also clone a database directly in PostgreSQL:
createdb -O odoo -T baza_zrodlowa baza_docelowa
Then copy the filestore manually:
cp -r ~/.local/share/Odoo/filestore/baza_zrodlowa ~/.local/share/Odoo/filestore/baza_docelowa
Migrating from another server
If you want to move a database from another Odoo instance to an existing multi-database instance, use the guide how to move Odoo to another server. The process includes exporting the database, transferring files, and importing into the target instance.
Differences between Community and Enterprise
When it comes to managing multiple databases, there are a few differences between the editions:
- Odoo Community - full multi-database functionality, database manager enabled by default
- Odoo Enterprise - the same capabilities, but the administrator can globally disable access to the database manager
- Odoo.sh and Odoo Online - databases are managed through a dedicated dashboard, not the standard manager
Multi-database functionality is available in both editions without restrictions.
Best practices
When deploying multiple databases in a single Odoo instance, apply the following best practices:
- Naming convention - use consistent database names (e.g. company_prod, company_test, company_dev)
- Documentation - keep a register of all databases with their purpose, administrators, and creation date
- Resource monitoring - regularly check CPU, RAM, and disk usage for each database separately
- Update policy - test updates first on a cloned test database
- Module separation - for projects that require different module versions, consider separate addons directories with the
addons_pathparameter - Backup strategy - implement automated backups with retention (e.g. 7 daily, 4 weekly, 12 monthly)
- Size limits - monitor the size of databases and the filestore, and set alerts when thresholds are exceeded
- Archiving - archive unused databases and remove them from the active instance
If you are planning a system upgrade, see the article how to upgrade Odoo to a newer version.
Troubleshooting common problems
Problem: I can't see the list of databases
Check the list_db = True setting in the odoo.conf file and restart the service. Also make sure that db_manager_enabled is not set to False. If you use dbfilter, check that the regular expression does not filter out all databases.
Problem: The wrong database loads automatically
Verify the dbfilter parameter and make sure it correctly filters databases by domain. Check the Odoo logs to see which regular expression is being applied. The most common cause is a mismatch between the database name and the domain name when using dbfilter = ^%d$.
Problem: 'database selection' error when logging in
This error appears when dbfilter does not match any existing database. Check:
- Whether the database name matches the pattern in dbfilter
- Whether the database actually exists in PostgreSQL
- Whether the HTTP headers (Host) are correctly passed through the reverse proxy
Problem: Performance issues
Increase the number of workers, optimize PostgreSQL, or consider adding server resources. Every active database consumes memory, so plan resources according to the number of concurrent users across all databases. Use monitoring tools such as htop and pg_stat_activity to identify bottlenecks. Consider splitting the databases into separate Odoo instances if a single instance is overloaded.
Problem: The filestore doesn't work correctly after cloning
Make sure you copied the entire filestore directory along with its permissions. The directory should be owned by the odoo user and have appropriate permissions (755 for directories, 644 for files).
FAQ - Frequently asked questions
How many databases can I have in one Odoo instance?
Theoretically, there is no hard limit on the number of databases in a single Odoo instance - the limit is server resources (RAM, CPU power, and disk space). In practice, most implementations handle from a few to a few dozen databases. The key is to properly match the workers parameters and PostgreSQL resources to the number of databases and the expected load.
As a reference point: a server with 8GB of RAM and 4 CPU cores can comfortably handle 5-10 moderately active databases (10-20 users each). For a very large number of databases (above 20-30), consider a server cluster or splitting them across several instances. Also keep the filestore size in mind - each database has its own attachments directory, which can quickly fill up the disk.
Can each database have different modules installed?
Yes, each database in an Odoo instance is completely independent and can have a different set of modules installed. All databases share the same pool of available modules (the addons directories defined in the addons_path parameter), but the decision to install specific modules is made separately for each database, either during creation or later through the Apps menu.
This allows you to tailor functionality to the specific needs of each project or client. For example, one database can have e-commerce modules installed, another manufacturing modules, and a third only accounting modules. Module versions are common to all databases (determined by the Odoo version), but the set of installed modules is individual. To add custom modules available to all databases, see how to install external modules in Odoo.
Can I hide the database selection from users?
Yes, there are two main methods of hiding the database selection. The first is setting list_db = False in the odoo.conf file, which hides the list of all databases on the login screen - users will have to know the exact database name to log in (or be redirected through dbfilter).
The second, more elegant and recommended method is to use the dbfilter = ^%d$ parameter together with domain configuration - each domain automatically connects to its corresponding database, with no choice left to the user. For example, for the domain firma1.example.com the 'firma1' database is selected automatically. This is the recommended approach in a production environment for security reasons (it hides the list of databases from potential attackers) and for user experience (users don't have to remember the database name). Additionally, you can completely disable the database manager with db_manager_enabled = False.
Summary
Adding multiple databases in a single Odoo instance is a powerful feature that, when properly configured, allows you to efficiently manage multiple projects, clients, or environments. The key to success is configuring the odoo.conf file correctly, especially the list_db, dbfilter, and db_manager_enabled parameters, and providing adequate server resources.
Remember the most important rules: disable list_db and db_manager_enabled in production, use dbfilter to automatically select the database based on the domain, back up each database separately and regularly, monitor resource usage, and adjust workers and the PostgreSQL configuration to the actual load. Proper access protection through a strong master password, HTTPS/SSL, and a reverse proxy are key elements of a secure multi-database configuration.
Thanks to Odoo's flexibility, you can scale your infrastructure as your business grows, adding new databases without having to install additional instances of the system. Each database is a separate PostgreSQL database with its own filestore, which ensures complete data isolation while keeping the operational efficiency of a single Odoo installation.
Need help configuring Odoo?
Managing multiple databases in Odoo can be challenging, especially in more advanced setups with multiple domains, SSL, and performance optimization. The KK Innovations team specializes in implementing and optimizing Odoo systems for companies of every size.
We offer comprehensive support, including:
- Professional installation and configuration of Odoo (Community and Enterprise)
- Data migration from other ERP systems
- Performance optimization and parameter tuning
- Configuration of advanced multi-database environments with multiple domains
- Training for administrative teams and end users
- Ongoing technical support and maintenance
- Security audits and implementation of best practices
Contact us to discuss your needs and receive a tailored offer. Our experts will help you make full use of the potential of Odoo in your organization!