Backup policy: Staged backup + specific event backup. Periodic automatic backup + Manual Check + automatic notification.
Official reference: https://www.odoo.com/forum/help-1/question/how-to-setup-a-regular-postgresql-database-backup-4728
1. Odoo BACKUP Database
Http://ip/web/data/manager
Select Backup, enter password admin
Tip: Database backup error:access denied
Processing: Login Odoo server, modify/etc/openerp_server.conf to change database maintenance master Password
; Administrator master password (for operations such as creating, restoring, and backing up databases)
ADMIN_PASSWD = Admin
Run after saving file: Service Odoo Restart restart Odoo configuration takes effect
Retry the BACKUP Database Http://ip/web/data/manager
Backup database, input mastrer password:admin
Hint: Database backup error:command ' pg_dump ' not found.
Try: Install Postgresql/pg_dump on the Odoo server CentOS, in the terminal: Yum-install PostgreSQL
Installation of Pg_dump to perform backup results hint: Database backup error:postgres subprocess ('/usr/bin/pg_dump ', '--no-owner ', '--file=/tmp/ Tmpgs8ryd/dump.sql ', U ' gsola ') Error 1
2, Odoo database duplicate operation: Odoo database Management Duplicate database, is the selected database on the same server to replicate a different name of the clone, for testing or contact purposes.
Http://ip/web/data/manager
Select Duplicate, enter password admin, new database name such as: Lianxi, after completion will be more than a database "Lianxi" total landing or operation room selection, indicating duplicate success.
3. The restore operation of Odoo database
Http://ip/web/data/manager
Select Restore
4, login Freebsd+postgresql server, with Pg_dump backup, with Pg_restore recovery, these two commands is the PostgreSQL system comes with. Stop the Odoo server before backing up:
# Stop OpenERP Server
/etc/init.d/openerp-server stop
# Start OpenERP Server
/etc/init.d/openerp-server start
Backup and restore using the TAR format:
Pg_dump-u username-ft Testdb1>testdb1.tar
Without testDb2 you need to create: Createdb testDb2, or use the-C--create option
Pg_restore-u Username-c-D TestDb2 Testdb1.tar
For Odoo, you need to remember the original database name and owner's user name, then delete it, then build the same name as the owner of the database, and then restore. Or-c--clean Use this option to remove the object before recovering it. (This option will cause an error, but after you have backed up, delete several items and then restore to prove that the deleted item was restored correctly)
5, in the client PGADMINIII can back up the database
6, the client pgadmin with the Pg_dump backup, psql recovery, the program in the Pgadmin installation directory.
Backup: pg_dump-h 192.168.12.40-u uhml gsola > E:\gsola.bak
Instruction Explanation:
Pg_dump is the backup database Directive,
192.168.12.40 is the IP address of the database (you must ensure that the database allows external access, if you can use localhost locally)
UHML is the user name of the database
Gsola is the database name.
> meaning is exported to the E:\gsola.bak file, if there is no write path, write Gsola.bak file name alone, then the backup file will be saved in
Current directory
Recovery: Psql-h 192.168.12.40-c-u uhml-d Gsola < E:\gsola.bak
Instruction Explanation:
Psql is the RESTORE DATABASE command
192.168.12.40 is the IP address of the database (you must ensure that the database allows external access, if you can use localhost locally)
UHML is the user name of the database
Gsola is which database to restore to
< means to import the E:\gsola.bak file into the specified database.
The-c--clean option is deleted before the object is restored.
All of the above is for Windows and still works on Linux.
7.
8. Backup strategy: Multi-level offsite heterogeneous backup
Guaranteed backup of system data with more than 3 different media in different locations
Select a local backup point offsite, automatic backup
Mobile Backup/tape backup: Regular backups
9. Pg_rman Backup
10. Barman Backup
Exception handling:
1. Delete the database with active Links:
If the database has an active connection, the drop database fails with an error message.
postgres=# DROP DATABASE TestDB;
Error:database "TestDB" is being accessed by other users
Detail:there is 3 other sessions using the database.
You can use the following statement to abort the active connection of TestDB, and then drop the database.
postgres=# SELECT pg_terminate_backend (PID)
postgres-# from Pg_stat_activity
postgres-# WHERE datname= ' TestDB ' and pid<>pg_backend_pid ();
Pg_terminate_backend
----------------------
T
T
T
(3 rows)
Pg_stat_activity is a system view in which each row of a table represents the properties and state of a service process.
A Boolean pg_terminate_backend (PID int) is a system function that terminates a back-end service process.
the int pg_backend_pid () system function is used to obtain the ID of the server process attached to the current session
Database version of PostgreSQL 9.3 used
Odoo 9.0 Database Backup Summary