Odoo Help


"Database is being accessed by other users" - how to use the database manager GUI?

Peter Nietz
on 10/14/14, 7:43 AM 3,826 views

I installed a fresh Odoo and created a DataBase, installed all modules I need and made the admin an admin.

Now I want to duplicate this db, but I always get "Database is being accessed by other users".

How can I duplicate a database with the database manager GUI of odoo?

If I stop odoo service the simple line of sql does the job:

CREATE DATABASE whatever_db WITH TEMPLATE base_deb OWNER db_owner;

If it isn't possible without entering a console, what use does this function have at all?

Thx Peter


Ludo - 21South

--Ludo - 21South--
| 2 2 5
Zwijndrecht, Netherlands
--Ludo - 21South--


Ludo - 21South
On 10/14/14, 10:13 AM

This is due to postgres keeping track of the connections, even if they are not closed correctly (just killing the browser for example). Probably the thing to do is restart Odoo. Right after that, the connections should be gone and you should be able to duplicate.

For some mysterious reason it sometimes works over here after pressing the button multiple times. I am clueless as to why that is.

By the way, the client-dump of the database is not always fool-proof we have found out. I still rely on the pg_dump, if only to ensure the type of dump and the other options such as the no-owner flag. Furthermore, when using legacy postgres to update to a new postgres, the client will not do the job correctly.

Nirav Jani
On 10/14/14, 8:00 AM


You Can restart postgres service.

with postgres I know what to do ... stop odoo, enter postgres, duplicate ... but that's not using the database manager of odoo! And what use of a database manager if I have to restart the underlying database?

Peter Nietz
on 10/14/14, 9:20 AM

you can use this command: ps -ax | grep server. you get list process name. then you kill process the command is : kill -9 [proces_name].

Nirav Jani
on 10/14/14, 9:28 AM

thx, I know how to do this, of you can use top or htop or whatever! but how to do it WITHOUT ENTERING THE CONSOLE? If I use the console, there is no use of the database manager gui of odoo!

Peter Nietz
on 10/14/14, 9:49 AM
Rui Andrada
On 10/14/14, 10:13 AM

That is a good question and I guess there's no answer for that, no answer like you want.

Like you want, only wait for Oddo disconnect from db and after you can do database operations.

After some time testing and using Odoo, I think the "database manager" feature needs more work.

I can only do database operations after use SQL query to postgresql disconnect any user from specific database which I'll work.
Here the query useful sometimes, to kill connections: 

SELECT pg_terminate_backend(pg_stat_activity.pid)
FROM pg_stat_activity
WHERE pg_stat_activity.datname = 'database_name'
  AND pid <> pg_backend_pid();

Change 'database_name' for your needs and all connections to db will be closed.


thx ... if I stop odoo, the simple line CREATE DATABASE whatever_db WITH TEMPLATE base_db OWNER username; works for me ...

Peter Nietz
on 10/14/14, 10:19 AM

If you are in multi user environment you'll need this query. You'll execute query CREATE DATABASE..TEMPLATE, why not execute before and kill all connections to specific db? Thanks for your comment.

Rui Andrada
on 10/20/14, 8:28 AM

I give to you the only answer as you ask for, you don't need to enter in console you only need psql or any connections to postgresql.

Rui Andrada
on 10/20/14, 8:32 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 10/14/14, 7:43 AM
Seen: 3826 times
Last updated: 3/16/15, 8:10 AM