Odoo Help

Welcome!

This community 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.

0

How to duplicate DB data only?

By
Jeff Beidler
on 2/13/15, 4:53 PM 652 views

I have a database that apparently has some corruption somewhere inside it.  In this database, I'm unable to view stock picking reports.  If I create a new, clean database, this function works just fine, so it must be a problem with the first DB.  However, if you do a simple DB copy from the database manager, restoring to a new database, the problem is migrated along with all the data.  I have tried doing data-only dumps using psql and pg_dump from the command line, but restoring always errors out or leaves me with a database that can be seen from the Odoo DB selection screen, but doesn't show any of the modules/apps as installed.  How do others solve issues like this?  I'm really hoping to avoid having to do table by table export/import via the Odoo interface.  What a pain in the butt that would be!  Any suggestions?

1
Jordan Vrtanoski
On 2/13/15, 11:11 PM

It sounds to mie like you have issue with inconsistent data in the DB. Best approach is to figure out which table is causing the problems.

Try analysing the log file if there are exceptions. If required, you can increase the log-level to log the SQL statements (--log-sql). Once you had identified the table, you can try to fixing the data in that table. Here the tables from a clean database can be handy.

Hope this will help you find the problem.

How would you go about "fixing" the data? Everything should be changed via the front end, to keep the ORM happy, right?

Jeff Beidler
on 2/17/15, 5:10 PM

Not necessary, you can change the data from the back-end as well, but you need basic understanding of the relational databases, mainly about the foreign keys. ORM will convert the python object to SQL statements in order to insert/update/delete the data in the database. If you perform same modifications, ORM will not be aware that the data was modified from the database side. I have done changes of the data many times with SQL statement, however, I don't recommend this for beginners. Before you do any change, make sure you test on duplicate database and make sure you have fresh backup.

Jordan Vrtanoski
on 2/18/15, 2:58 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 2/13/15, 4:53 PM
Seen: 652 times
Last updated: 3/16/15, 8:10 AM