简体   繁体   English

在Linux中备份postgreSQL数据库并在Windows中还原

[英]Backup postgreSQL database in Linux and restore in Windows

I am trying to dump a postgres database in Linux and then restore it in Windows. 我试图在Linux中转储postgres数据库,然后在Windows中还原它。 However, when I use the following command: 但是,当我使用以下命令时:

pg_dump -F p tempDB > tempDB.dump.out

The created file will not be usable in Windows. 创建的文件将无法在Windows中使用。 In fact, when I log into Windows I cannot see the file there! 实际上,当我登录Windows时,看不到该文件! Then when I log in in Linux I notice the tempDB.dump.out file does not exist there either anymore. 然后,当我在Linux中登录时,我注意到tempDB.dump.out文件不再存在。 This is however, when I use the above command, tempDB.dump.out has a size about 400MB. 但是,这是当我使用上述命令时,tempDB.dump.out的大小约为400MB。

Am I doing something wrong? 难道我做错了什么?

Thank you in advance 先感谢您

When you execute this command pg_dump -F p tempDB > tempDB.dump.out the output file will be created in the same directory where you are. 当您执行此命令pg_dump -F p tempDB> tempDB.dump.out时 ,将在您所在的目录中创建输出文件。 When you copy to some place (other directory) that can be acces for windows, you cant use pg_restore or with the pgadmin programm. 当您复制到Windows可以访问的某个位置(其他目录)时,不能使用pg_restore或pgadmin程序。

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

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