コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
2970 ビュー

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

アバター
破棄