Skip to Content
Odoo मेन्यू
  • Sign in
  • मुफ़्त में आज़माएं
  • ऐप्लिकेशन
    फ़ाइनेंस
    • अकाउंटिंग
    • इनवॉइसिंग
    • एक्सपेंस
    • स्प्रेडशीट (बीआई)
    • डॉक्यूमेंट्स
    • साइन
    सेल्स
    • सीआरएम
    • सेल्स
    • पीओएस शॉप
    • पीओएस रेस्टोरेंट
    • सब्सक्रिप्शन
    • रेंटल
    वेबसाइट
    • वेबसाइट बिल्डर
    • ई-कॉमर्स
    • ब्लॉग
    • फ़ोरम
    • लाइव चैट
    • ई-लर्निंग
    सप्लाई चेन
    • इन्वेंट्री
    • मैन्युफ़ैक्चरिंग
    • पीएलएम
    • परचेज़
    • मेंटेनेंस
    • क्वालिटी
    मानव संसाधन
    • कर्मचारी
    • रिक्रूटमेंट
    • टाइम ऑफ़
    • अप्रेज़ल
    • रेफ़रल
    • फ़्लीट
    मार्केटिंग
    • सोशल मार्केटिंग
    • ईमेल मार्केटिंग
    • एसएमएस मार्केटिंग
    • इवेंट
    • मार्केटिंग ऑटोमेशन
    • सर्वे
    सेवाएं
    • प्रोजेक्ट
    • टाइमशीट
    • फ़ील्ड सर्विस
    • हेल्पडेस्क
    • प्लानिंग
    • अपॉइंटमेंट
    प्रॉडक्टिविटी
    • डिस्कस
    • अप्रूवल
    • आईओटी
    • वीओआईपी
    • नॉलेज
    • WhatsApp
    तीसरे पक्ष के ऐप्लिकेशन Odoo स्टूडियो Odoo क्लाउड प्लेटफ़ॉर्म
  • इंडस्ट्री
    रीटेल
    • बुक स्टोर
    • क्लोदिंग स्टोर
    • फ़र्नीचर स्टोर
    • ग्रॉसरी स्टोर
    • हार्डवेयर स्टोर
    • टॉय स्टोर
    Food & Hospitality
    • बार और पब
    • रेस्टोरेंट
    • फ़ास्ट फ़ूड
    • Guest House
    • बेवरिज डिस्ट्रीब्यूटर
    • होटल
    रियल एस्टेट
    • Real Estate Agency
    • आर्किटेक्चर फ़र्म
    • कंसट्रक्शन
    • एस्टेट मैनेजमेंट
    • गार्ड्निंग
    • प्रॉपर्टी ओनर असोसिएशन
    कंसल्टिंग
    • अकाउंटिंग फ़र्म
    • Odoo पार्टनर
    • मार्केटिंग एजेंसी
    • लॉ फ़र्म
    • टैलेंट ऐक्विज़िशन
    • ऑडिट & सर्टिफ़िकेशन
    मैन्युफ़ैक्चरिंग
    • टेक्सटाइल
    • Metal
    • फ़र्नीचर
    • फ़ूड
    • Brewery
    • कॉर्पोरेट गिफ़्ट
    हेल्थ & फिटनेस
    • स्पोर्ट्स क्लब
    • आईवियर स्टोर
    • फिटनेस सेंटर
    • वेलनेस प्रैक्टिशनर
    • फॉर्मेसी
    • हेयर सैलून
    Trades
    • Handyman
    • आईटी हॉर्डवेयर और सपोर्ट
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    अन्य
    • Nonprofit Organization
    • एन्वायरमेंटल एजेंसी
    • बिलबोर्ड रेंटल
    • फ़ोटोग्राफी
    • बाइक लीजिंग
    • सॉफ़्टवेयर रीसेलर
    Browse all Industries
  • कम्यूनिटी
    सीखें
    • ट्यूटोरियल्स
    • दस्तावेज़
    • सर्टिफ़िकेशन
    • ट्रेनिंग
    • ब्लॉग
    • पॉडकास्ट
    शिक्षा को बढ़ावा दें
    • एजुकेशन प्रोग्राम
    • स्केल अप! बिजनेस गेम
    • Odoo के ऑफ़िस में आएं
    सॉफ़्टवेयर पाएं
    • डाउनलोड
    • वर्शन की तुलना करें
    • रिलीज़
    साथ मिलकर काम करें
    • Github
    • फ़ोरम
    • इवेंट
    • अनुवाद
    • पार्टनर बनें
    • Services for Partners
    • अपना अकाउंटिंग फ़र्म रजिस्टर करें
    सेवाएं पाएं
    • पार्टनर ढूंढें
    • अकाउंटेंट खोजें
    • सलाहकार की मदद लें
    • इम्प्लिमेंटेशन सेवाएं
    • कस्टमर रेफ़रेंस
    • सहायता
    • अपग्रेड
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    डेमो देखें
  • कीमत
  • सहायता

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • सीआरएम
  • e-Commerce
  • लेखांकन
  • इन्वेंटरी
  • PoS
  • प्रोजेक्ट
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
टैग (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
टैग (View all)
odoo accounting v14 pos v15
About this forum
Help

How do I automate database backups?

Subscribe

Get notified when there's activity on this post

This question has been flagged
databaseadministrationbackup
12 Replies
43649 Views
Avatar
Koffi KPONOUGLO

I would like to set up an automated action to make a backup of the database every 30 minutes. I think that I must define an server action with python code. I need help with python code. thank you in advance.

1
Avatar
Discard
Andreas Brueckl

Do you mean the OpenERP database?

Daniel Reis

Duplicate of How to setup a regular PostgreSQL database backup

Avatar
Mohamed arif
Best Answer

Alternatively, you can create a crontab to invoke a python script which does backup. refere following script

import os
import time
import subprocess

dump_dir = '/home/openerp/db_backup'
db_username = 'openerp'
#db_password = ''
db_names = ['DB_NAME']

for db_name in db_names:
    try:
        file_path = ''
        dumper = " -U %s --password -Z 9 -f %s -F c %s  "
#        os.putenv('PGPASSWORD', db_password)
        bkp_file = '%s_%s.sql' % (db_name, time.strftime('%Y%m%d_%H_%M_%S'))
#        glob_list = glob.glob(dump_dir + db_name + '*' + '.pgdump')
        file_path = os.path.join(dump_dir, bkp_file)
        command = 'pg_dump' + dumper % (db_username, file_path, db_name)
        subprocess.call(command, shell=True)
        subprocess.call('gzip ' + file_path, shell=True)
    except:
        print "Couldn't backup database" % (db_name)
3
Avatar
Discard
klacus

It's a cool stuff!

Koffi KPONOUGLO
Author

Thanks Arif!

Koffi KPONOUGLO
Author

Yes it works for version 7.0.

Avatar
Koffi KPONOUGLO
Author Best Answer

Thank you. Francesco I did bash sript and I run with crontab. I still have a little detail to be adjusted. I would like the file generated by crontab has a dynamic name for example: "namedatabase-date-hour-minute-seconde.dump". Is it possible?

On LINUX :

  • you have to deposit the script in the directory etc and give the access by doing this command in shell:

sudo mv path_to_the_script /etc/cron.hourly/

sudo chmod +x name_of_the_script.py

  • The crontab execute your script.py file for example every 5min after these commands in shell:

    crontab -e

    /5 * * * * /etc/cron.hourly/script.py

    Press button F2 and Enter

1
Avatar
Discard
Lorenzo Cabrini

use someting like namedatabase-$(date %H-%M-%S).dump. Look at man date for more options

Avatar
klacus
Best Answer

Hi.

I working around this problem, and I waste a couple of time to find the solution. I use this module with a small problem, but this is works as well, the issue what is coming from the server time zone. (UTC) So if you want to test it under 6.1 (may 7.0 same) please setting the next schedule time according UTC, and it will be works. This time issue, is true not just this module, all of that what is use Openerp server as cron controller. I do not have a karma to share a link. (module name is : "db_backup_ept - Database Auto-Backup & Backup Auto-Transfer to FTP server")

Other case the backup is a bit painful under Linux, with cron. The automation of backup you need to store the database data in .pgpass according by this: www.postgresql.org/message-id/490F6EDE.70502@nrc-cnrc.gc.ca you can find a good scripts at here: blog.ufsoft.org/2011/07/03/postgres-cron-backupsI want to avoid to store the db pass in cron script, because this is security hole.

Otherwise you can find some solution about Pgagent also, but I can't try it, because I didn't have a time for the trials.

Finally please never forget to test the restore. (I have a lot of problem with restore, under 9.1 from zip, now I can restore from plain text by psql command).

How to restore: psql NEW_DB_NAME -f SQL_FILE_NAME

1
Avatar
Discard
sridhar

Hi klacus, I used db_backup_ept to auto and manual backup it created successfully. But I can't restore the database. The backup format is db_name.sql, how to restore this. help me...

klacus

I edit my answer. pls. check it.

sridhar

Yes it is working Thanks...

Avatar
Md. Sajib Ali
Best Answer

here is the video example 


0
Avatar
Discard
Avatar
Hilar Andikkadavath
Best Answer

You can use this addon for backup.

https://apps.odoo.com/apps/modules/13.0/auto_backup_odoo/

https://automaticbackup.odoo.com/

How to backup odoo database automatically

Available Backup DB/Filestore Modes:

  • Local
  • Remote Server
  • Google Drive
  • Dropbox

Module For backup ODOO databases and automating the backup process of ODOO.

  • Multiple Backup Modes
  • Filestore Backup
  • Backup ODOO Databases in specified path
  • Detailed Message Log
  • Backup Status Information and History
  • User can select the format to dump, either custom archive, plain text SQL or tar archive
  • Archive Backup Process
  • Repeat Missed Backup Process

Features

  • Dump ODOO Database in specified format
  • Output a custom archive suitable for input into pg_restore. This is the most flexible format in that it allows the reordering of loading data as well as to object definitions. This format is also compressed by default. Here we user gzip ie, test.gz, We also recommend you to select Custom, because Using the custom format you can restore single objects from a backup.
  • Output a plain-text SQL script file (the default). The plain text format is useful for very small databases with a minimal number of objects but other than that, it should be avoided.
  • Output a tar archive suitable for input into pg_restore. Using this archive format allows reordering and/or exclusion of database objects at the time the database is restored. It is also possible to limit which data is reloaded at restore time. we use tar with gzip
  • Backup Filestore
  • Multiple backup modes at sametime

Get Module From Here


Video Demonstration

0
Avatar
Discard
Avatar
Joseph Andrade
Best Answer

Hi,

Does anyone has a python script for a Webpage in order to duplicate the DB and store it wherever instructed? I need to enable this functionality for one of my clients on their website and I don't have much clue of how to get this done.

Any help will be appreciated.

Many thanks.

0
Avatar
Discard
Avatar
Bart Criel
Best Answer

I am using the information on the PostgreSQL Wiki ( look for Automated_Backup_on_Linux ) to schedule backups with cron. Works fine; set and forget.

Bart

0
Avatar
Discard
Avatar
Jairo Llopis
Best Answer

I use this cron script:

#!/bin/bash

DIR=/var/backups/odoo
DB=database_name

rm $DIR/$DB*.tar
sudo -u openerp pg_dump --format t --file "$DIR/$DB $(date --rfc-3339 seconds).tar" $DB

Put it into /etc/cron.daily/ and give it execution permissions.

If you want to have more than one version of the database, you may put you own logic in the line rm $DIR/$DB*.tar.

0
Avatar
Discard
Avatar
E.R. Spada
Best Answer

You can use the module written by Tiny: auto_backup, works great! "name" : "Database Auto-Backup", "version" : "1.0", "author" : "Tiny", "website" : " "category" : "Generic Modules", "description": """The generic Open ERP Database Auto-Backup system enables the user to make configurations for the automatic backup of the database. User simply requires to specify host & port under IP Configuration & database(on specified host running at specified port) and backup directory(in which all the backups of the specified database will be stored) under Database Configuration.

Automatic backup for all such configured databases under this can then be scheduled as follows:

1) Go to Administration / Configuration / Scheduler / Scheduled Actions 2) Schedule new action(create a new record) 3) Set 'Object' to 'db.backup' and 'Function' to 'schedule_backup' under page 'Technical Data' 4) Set other values as per your preference""",

0
Avatar
Discard
Avatar
Francesco OpenCode
Best Answer

If you're using a GNU/Linux system, the best way is to use cron + script bash to do postgres backup. If you want use python, you will use bash however.

P.S. 30 minutes is a time too short. 2 or 3 times at day are good.

0
Avatar
Discard
Avatar
Ram S
Best Answer

In OpenERP V6.x there was an option to automatically back thorough scheduler with in OpenERP. Which automatically does the backup. I am not sure it still exist in V7. '

0
Avatar
Discard
Avatar
Shimon
Best Answer

su openerp -s /bin/bash -c 'pg_dump $YOUR-DB' > $YOUR-DB.sql

0
Avatar
Discard
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Related Posts Replies Views Activity
Database size change
database backup
Avatar
1
नव॰ 23
4959
Transfer odoo14 database to odoo13
database backup
Avatar
Avatar
Avatar
2
अप्रैल 22
3404
No images after restore backup in Odoo 12 Solved
database backup
Avatar
Avatar
1
अग॰ 19
9631
Restore Database V9 community Proxy error 502
database backup
Avatar
Avatar
2
अक्तू॰ 16
7405
Database backup
database backup
Avatar
Avatar
Avatar
2
मार्च 15
9134
कम्यूनिटी
  • ट्यूटोरियल्स
  • दस्तावेज़
  • फ़ोरम
ओपन सोर्स
  • डाउनलोड
  • Github
  • रनबॉट
  • अनुवाद
सेवाएं
  • Odoo.sh Hosting
  • सहायता
  • अपग्रेड
  • कस्टम डेवलपमेंट्स
  • शिक्षा
  • अकाउंटेंट खोजें
  • पार्टनर ढूंढें
  • पार्टनर बनें
हमारे बारे में
  • हमारी कंपनी
  • ब्रांड ऐसेट
  • संपर्क करें
  • नौकरियां
  • इवेंट
  • पॉडकास्ट
  • ब्लॉग
  • ग्राहक
  • लीगल • गोपनीयता
  • सुरक्षा
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo, बिज़नेस से जुड़े ऐप्लिकेशन का एक कलेक्शन है जो ओपन सोर्स पर आधारित है. इसमें आपकी कंपनी की हर ज़रूरत के लिए ऐप्लिकेशन हैं. जैसे, सीआरएम, ई-कॉमर्स, अकाउंटिंग, इन्वेंट्री, पॉइंट ऑफ़ सेल, प्रोजेक्ट मैनेजमेंट वगैरह.

Odoo की सबसे बड़ी खासियत है कि यह इस्तेमाल करने में बहुत आसान है और यह पूरी तरह से इंटिग्रेट किया हुआ है.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now