Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
2967 มุมมอง

I have backup my database using the below code. 

filename="/var/pgdump/${db}_${date}.sql"
pg_dump ${db} -U openerp -w -h localhost -f $filename

When i restore the same database through the interface, it creates a new database.

When i run psql -U postgres -d check -1 -f database_20140611_2300080974977.sql this command, it shows error.

How can i restore database, which backup using above command?

Or any other solution(backup through command and restore through command or interface)?

 

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

Backup database :- 

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

Restore database :-

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

อวตาร
ละทิ้ง