コマンドラインからデータベース「mydatabase」をテキストファイル「mydatabase.sql」にダンプしています。
"C:/Program Files (x86)/PostgreSQL/9.1/bin/pg_dump.exe " --host localhost --port 5432 --username "postgres" --no-password --verbose --file "C:\Users\User 1\Desktop\mydatabase.sql" "mydatabase"
うまくいっています。しかし、何度も試した後、それらのファイルをデータとともにデータベースにpg_restoreすることはできません。
しかし、このデータベース内のすべてのテーブルを削除すると、次のように実行できます。
psql -f "C:\Users\User 1\Desktop\mydatabase.sql" "mydatabase" "postgres"
これにより、すべてのデータが回復されます。問題は、VBNET / shellを介してpgslを実行できないため、pg_restore.exeが必要になることです。これが私の試みです。
"C:/Program Files (x86)/PostgreSQL/9.1/bin/pg_restore.exe " -i -h localhost -p 5432 -U postgres -d "mydatabase" -v "C:\Users\User 1\Desktop\mydatabase.sql"
...メッセージが表示される場所:
C:\ Users \ User 1> "C:/ Program Files(x86)/PostgreSQL/9.1/bin/pg_restore.exe" -i -h localhost -p 5432 -U postgres -d "mydatabase" -v "C:\ Users \ User 1 \ Desktop \ mydatabase.sql"無効なバイナリ"C:/ Program Files(x86)/PostgreSQL/9.1/bin/pg_restore.exe "pg_restore.exe:[archiver]入力ファイルが有効なアーカイブではないようです
復元を試みる前に、サーバー上に空のデータベース「mydatabase」があります(テーブルなし)。pg_dumpでダンプされ、明らかに適切なデータが含まれている「mydatabase.sql」でpg_restoreを機能させるために、助けを借りてください。純粋なコマンドラインまたはVBNET/シェルで使用できます。