PGは、データベースのバックアップファイルを2つ、1のSQLファイル、バイナリファイル、バイナリファイルのみにpg_restoreを使用して復元することが可能であることができ、生成しました。
簡単な説明PostgreSQLのデータベース操作
PostgreSQLデータベースのバージョン
また、psql --versionの
はpsql(PostgreSQLの)9.1.3
以下は、Windowsは、su -postgresを置き換えられます、Linuxでの動作であります
CMDタイプを実行します→D:→
CDのDは:\プログラムファイル\のPostgreSQL \ 9.2 \ binには、次の表を作成し、あなたがテーブルを削除すると、postgresの中で動作する必要があるので、-u postgresの入力psqlを削除し、データベースのフロントを作成する必要があります
まず、データベースのバックアップ
1、バックアップデータベース構造
SU - postgresの
のpg_dump -Fc -s -f testdbschema.sqlます。testdb
2、データベースのデータをバックアップ
SU - postgresの
のpg_dump -Fc -a -f testdbdata.sqlます。testdb
図3に示すように、バックアップデータベース構造及びデータ
SU - postgresの
のpg_dump -Fc -f testdbschemadata.sqlます。testdb
4、データベース内の指定されたバックアップ・テーブル構造
pg_dumpは-Fc -s -t citycode -f citycode_schema.sqlます。testdb
図5に示すように、バックアップデータは、データベーステーブルで指定されています
pg_dumpは-Fc -a -t citycode -f citycode_data.sqlます。testdb
0.6、指定されたバックアップデータベーステーブル(データ構造)
pg_dumpは-Fc -t citycode -f citycode_schemadata.sqlます。testdb
第二に、データベースを削除
SU - postgresの
dropdbのTESTDB
第三に、データベースを復元
1、新しいデータベースTESTDBを作成
SU - postgresの
CREATEDBのTESTDB。
図2に示すように、リカバリデータ構造(スキーマのみ)
SU - postgresの
pg_restoreの-s -dます。testdb testdbschema.sql
3、データベースのデータ復旧(データのみ)
SU - postgresの
pg_restoreの-a -dます。testdb testdbdata.sql
4、データベース構造及びデータリカバリ(スキーマとデータ)
SU - postgresの
pg_restoreの-d TESTDB testdbschemadata.sql
5、表データの回復を指定します
1)テーブルを削除
また、psql TESTDB
表citycodeをドロップ。
2)回復のテーブル構造
pg_restoreの-s -t citycode -dます。testdb citycode_schema.sql
3)テーブルデータを復元
pg_restoreの-a -t citycode -dます。testdb citycode_data.sql
4)回復テーブル(データ構造)
pg_restoreの-t citycode -dます。testdb citycode_schemadata.sql
静的(データなしの成長)データベースのバックアップおよびリカバリ関連の操作よりも。
重要:pg_restoreのは、データファイルのpg_dumpのコマンド(FC \ FT)形式のバックアップを復元するために使用することができます。この形式のパラメータ宣言pg_dumpは何のバックアップコマンドの実行が存在しない場合にpg_restoreがリストアする際、エラーメッセージが発生する可能性があり、「pg_restoreのを:[アーカイバ]入力ファイルは有効なアーカイブではありません」。
公式文書をpg_dumpは
https://www.postgresql.org/docs/10/app-pgdump.html
pg_dumpallは
https://www.postgresql.org/docs/10/app-pg-dumpall.html
pg_restoreの