Backup and Restore OpenERP Database


This article describe you how to backup and restore OpenERP database.There is two way to make backup and restore database.It means You can do by web-Interface or by commend prompt

web-Interface (GUI) :-

Simple steps for backup and restore OpenERP database:

1] Open Login screen click on manage database 





 















2] click backup menu and select your database and set password and click backup button and just save that database dump file on your system






 


3] For Restore database, Browse your database dump file set password and make name to database and click restore 




 














commend prompt :-

create database

 createdb database_name
 

Backup database :-

pg_dump --cluster 9.1/main --format=c old_database_name > new_database_name




 





Restore database :-

1 : Check file type by following command

          file <name of restore db which you want> [EX: file database_name ]



         
 








2 : If file type is simple PostgreSQL dump at that time you can you following command(dump db)

            DB=new_database_name && createdb --cluster 9.1/main $DB && pg_restore --cluster 9.1/main --no-acl -O -d $DB <  backup_database_name.dump
           
3 : If file type is ASCII C program text, with very long lines at that time you can use following command (sql db)

            DB=new_database_name && createdb $DB && psql -d $DB < backup_database.dump

[Note: When you can you step2 instead of steps3 you can get error : pg_restore: [archiver] input file does not appear to be a valid archive]





 



how to Restore zip file Database :-

First Create database using cretedb database_name then type following commend in terminal

    gunzip -c filename | psql database_name



How to  restore PostgreSQL database from .tar file

First Create database using cretedb database_name then type following commend in terminal

pg_restore -c -i -U systemusername -d dbname -v "/home/mayur/workspace/db_backup.tar" -W



Thanks,

Mayur Maheshwari