Backup Odoo db from within odoo

微笑、不失礼 提交于 2020-01-11 04:39:08

问题


I need to backup the current db while logged into odoo. I should be able to do it using a button, so that suppose I click on the button, it works the same way as odoo default backup in manage databases, but I should be able to do it from within while logged in.

Is there any way to achieve this? I do know that this is possible from outside odoo using bash but thats not what I want.


回答1:


By using this module you can backup your database periodically

https://www.odoo.com/apps/modules/7.0/crontab_config/ (v7)

you can also test this module

https://www.odoo.com/apps/modules/6.1/db_backup_ept/ (v6 it can be miggrated to v7)

in your case you can add button to execute the function that will be executed by the schedular.




回答2:


You can use a private browser session to access the Database menu, from the login screen, and perform the the backup form there (you need to know the master password to access that, defined in the server configuration file).




回答3:


Go to your_odoo_instance/web/database/manager where you can see all your installed databases:

Odoo's Database Manager - Backup

You will need your defined master password for this task. If you can't remember it, have a look at your odoo.conf file in your server and check the 'admin_passwd' entry.




回答4:


You can take database backup from "Database Management" in odoo..

type following link in browser,

http://localhost:8069/web/database/manager

just replace your ip and port in aboves link, you will get screen for database management, you can perform following operations related to database

  • Create
  • Duplicate
  • Drop
  • Backup
  • Password
  • Restore



回答5:


You can use the CURL to download the full backup (assets + DB), this method is comparatively faster than pg_dump.

curl -X POST \
-F "master_pwd=${ADMIN_PASSWORD}" \
-F "name=${ODOO_DATABASE}" \
-F "backup_format=zip" \
-o ${BACKUP_DIR}/${ODOO_DATABASE}.$(date +%F-%T).zip \
${HOST}/web/database/backup

You can wrap inside a custom (your own) Odoo add-on if you wish to. Hope this helps.




回答6:


Add a button somewhere and call a controller like this one.

@http.route('/backup/download', auth="user", type='http')
        def backup(self, **kw):
            ts = datetime.datetime.utcnow().strftime("%Y-%m-%d_%H-%M-%S")
            filename = "%s_%s.zip" % (request.env.cr.dbname, ts)
            headers = [
                ('Content-Type', 'application/octet-stream; charset=binary'),
                ('Content-Disposition', content_disposition(filename)),
            ]
            dump_stream = db.dump_db(request.env.cr.dbname, None)
            response = werkzeug.wrappers.Response(dump_stream, headers=headers, direct_passthrough=True)
            return response



回答7:


There are a lot of ways to dump the database of ODOO. You can download apps from the ODOO store for doing this automatically also. Here I can suggest an addon that will do this DATABASE AUTO Backup according to your settings Month, Day, Hour basis. This is a highly reliable and efficient way where this module can handle large databases without effecting odoo processes. ODOO DATABASE AUTOMATIC BACKUP




回答8:


For backup, you can go to this link http://localhost:8069/web/database/manager.

  • You can create a backup from there.
  • You can restore your pre existing backup also.

Important- Before that just set your master password for your Database to avoid consequences in future.

If you want to change particular models or fields while logged in. You can do it by export/import action provided by Odoo. After exporting data from local you can import it on your server for that you have to validate it.



来源:https://stackoverflow.com/questions/27935745/backup-odoo-db-from-within-odoo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!