简体   繁体   English

如何在没有psql和pg_restore的情况下还原PostgreSQL数据库备份?

[英]How to restore PostgreSQL database backup without psql and pg_restore?

I am using postgresql on an embedded device running yocto (customized linux). 我在运行yocto(定制linux)的嵌入式设备上使用了postgresql。 The package containing postgresql does not provide psql or pg_restore. 包含postgresql的软件包不提供psql或pg_restore。 /usr/bin provides the following tools: / usr / bin提供以下工具:

在此处输入图片说明

pg_basebackup indicates that I am able to create backups. pg_basebackup表示我能够创建备份。 But how am I supposed to restore a backup within a terminal? 但是我应该如何在终端中还原备份? With pg_restore or psql this would not be a problem for me. 使用pg_restore或psql对我来说这不是问题。

Please note: I want to use a backup created on my windows/linux computer to create the initial database on the embedded device. 请注意:我要使用在Windows / Linux计算机上创建的备份在嵌入式设备上创建初始数据库。

Create backup of the db using command: 使用以下命令创建数据库的备份:

pg_basebackup -h {host_ip} -D pg_backup  -U {USER}

for restoring just change the data folder to pg_backup. 要恢复,只需将数据文件夹更改为pg_backup。 Now start the psql server. 现在启动psql服务器。

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

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