Odoo Help

0

Backup/Restoring a Large Database using PSQL dump with Filestore?

By
inian
on 18-2-9 上午9:48 1,426 views

Hi Guys,

I am using Odoo 11 CE

I tried to backup and restore by database by PSQL dump.

Step1 : Backup my database named rck_test5

sudo pg_dump -U rck10 -h localhost -p 5432 rck_test5 > /odoo/backups/new

Step2: Created new db

createdb -O rck10 rck_test6

Step3: Restore the database

psql -U rck10 -d rck_test6 -f /odoo/backups/new

Everything works fine. But when restored, I am missing all icons and images attached.

I found that these files are stored in ./local/share/Odoo/filestore/dbname when we create or restore database from ui.

When we restore using UI, filestore is zipped and restored properly.

But when we want to restore a database that is more than 10 GB, it is adviced to use psql dump.

I tried setting data_dir path in odoo-server.conf. But it does not generate filestore.

I need to know how to backup and restore filestore using command line. (Reason : I get to see full log of what is happening when we restore a huge database)

Please guide how to

* Backup a filestore

* Restore a filestore

* Update path in ir_attachement.location

to set odoo to read the new filestore location. Please guide me

0
Gagea Alexandru
On 18-3-16 上午5:41

Hello, did you manage to find a solution for your problem ?

No, I could backup/restore completely with file store, only with User interface.

inian
on 18-3-16 上午5:47

All of a suddent i can't backup an odoo database.. with no reason and no relevant error, and if i perform backup and restore from pgadmin i dont get the filestore, can't event find the location of the filestore..

Gagea Alexandru
on 18-3-16 上午5:50

can you still connect to your database through pg admin. If so you can restore your database with below commands.

inian
on 18-3-16 上午5:54

I go in /var/lib/odoo, to find the filestore, however, i dont have .local/share/Odoo folders...

Gagea Alexandru
on 18-3-16 上午6:02

You cannot view this location in UI navigate through terminal

inian
on 18-3-16 上午6:07

i was not in root mode, im in the filestore location, basically i want to restore a database on another server.

Tell me if the bellow steps are wrong:

1. backup database from pgadmin, production server

2. restore database in pgadmin on a development server

3.copy filestore from production server to the dev server.

Gagea Alexandru
on 18-3-16 上午6:51

You are right but we cannot copy the file store from ./local/share/ folder. I already tried that.

inian
on 18-3-16 上午6:58

For your information, only images and icons are stored in file store.

inian
on 18-3-16 上午7:00

i was able to copy the db filestore from that location, into the same location on another server, however, cannot acces the database from UI..

Gagea Alexandru
on 18-3-16 上午7:23

how did you copy the file store. Share command. In order to work database name and file store name should be exactly same.

inian
on 18-3-16 上午8:13

1. sudo -su root

2. cd /var/lib/odoo.local/share/Odoo/filestore

3. cp -R dbname /opt/Downloads

( to give write/read/delete permissions on the folder Downloads :

sudo chmod -R ugo+rw /opt/downloads )

4. Copied the filestore from server1(downloads) to server2 (downloads) and on server 2, used the cp command to copy from downloads back to filestore location, and yes it had the same name.

To transfer files from linux server to my desktop i use a program called WinSCP.

Gagea Alexandru
on 18-3-16 上午8:33

I solved my backup issue. Yesterday, i created 2 tables in the database, directly from pgadmin. This was the issue because backup from UI is made based on some scripts...So.. advice, if you want to create new tables in the database, its best if you create them from Studio. Thank you for your time and answers.

Gagea Alexandru
on 18-3-16 上午8:50

Hi Gagea, in my case file store is stored in ./local/share.. you say you have copied the files form var/lib..

Files are not created for me in that folder

how did you install odoo. I followed following link.

https://www.rosehosting.com/blog/install-odoo-11-on-ubuntu-16-04/

you also say we must create table from studio. Do you mean the UI?

inian
on 18-3-19 上午1:34

Yes, the full path of my filestore is :

cd /var/lib/odoo/.local/share/Odoo/filestore , and you must be in root mode in able to see this location ( sudo -su root ).

I installed Odoo 11 from Odoo.com installation docs.

Gagea Alexandru
on 18-3-19 上午4:00

And when i say studio, yes, its from the UI, available on Odoo Enterprise.

Gagea Alexandru
on 18-3-19 上午4:02
0
Sunny Dev
On 18-2-10 上午1:00

hi,


first you go into your filestore directory, and existing directory copy and paste with new db name.

in your case,

  • now you first delete created automatically Filestore folder in directory.

    • cd  ./local/share/Odoo/filestore/

    • apply command ==>  sudo rm -R rck_test6

  • after  that copy existing filestore db and paste with new name.

    • sudo cp -R  rck_test5 rck_test6


    after restart your server and check, all icons and images are displayed same as old db.


I hope it will help you.


Thanks



Hi Sunny,

Thanks for your response, but I cannot copy or paste into ./local/share/Odoo/filestore/

Remove "rm" works but no other command works.

inian
on 18-2-12 上午2:05

can you tried with "sudo" command?

Sunny Dev
on 18-2-12 上午5:08

Tried that too, I don't get any errors.nothing can be copied from there. Some how odoo can write or copy when we take backup/restore from UI.

inian
on 18-2-12 上午5:20

not sure, but it maybe comes from "web" module for backup via UI.

Sunny Dev
on 18-2-12 上午6:09

My concern is it is ok to backup a small database using web UI. But can same be used for backing up a database that is large.

inian
on 18-2-12 上午7:16

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.

Register

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

1 follower(s)

Stats

Asked: 18-2-9 上午9:48
Seen: 1426 times
Last updated: 18-3-16 上午5:41