简体   繁体   English

如何在 Azure PostgreSQL 服务器上恢复 .dump 或 .sql

[英]How to restore .dump or .sql on Azure PostgreSQL Server

I already have.dump and.sql but I am unable to restore it.我已经有.dump 和.sql 但我无法恢复它。 I used pgAdmin, i can see the tables but there are no data in it.Same thing in Azure Studio and Navicat.我使用了 pgAdmin,我可以看到表格,但里面没有数据。Azure Studio 和 Navicat 中的情况相同。 I use "pg_restore" to restore the file but it doesn't throw any error.我使用“pg_restore”来恢复文件,但它不会引发任何错误。

The Right way to take a dump with data and restore is使用数据进行转储和恢复的正确方法是

./pg_dump -U postgres -p 5432 -h <remote_IP> -Ft dbname_source > dump_of_source.sql.tar 
./pg_restore -U postgres -h localhost -p 5432 -d dbname_target dump_of_source.sql.tar

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM