![](/img/trans.png)
[英]How to connect to postgresql google cloud sql instance? Need to import postgresql dump using pg_restore command
[英]How to restore .bak file using pg_restore command through cmd in PostgreSQL?
我有一個用 pg_dump 命令創建的 test.bak 文件,它有一個超表,我在 postgreSQL 中創建了一個新的數據庫 Performance_Test。
使用以下命令轉儲數據庫:
pg_dump -h localhost -U postgres -p 5432 -Fc -f "D:\Database Backup\temp.bak" Performace_Test
我想在 Performance_Test 中恢復那個 test.bak 文件。
我怎樣才能做到這一點?
您可以恢復執行以下操作(注意事項進一步說明):
pg_restore -h localhost -d Performace_Test -U postgres -p 5432 "D:\Database Backup\temp.bak"
注意事項是:
如果通過引用將 Performace_Test 創建為大小寫混合,則需要引用上面的名稱,例如“Performace_Test”
如果 Performace_Test 不為空,那么您將收到一堆錯誤。
還假定 Performace_Test 與您在pg_dump
命令中指定的集群相同。
psql Performance_Test < test.bak
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.