本文介绍了如何从psql内备份Postgresql数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在psql中,想知道是否有一种方法可以从此命令Shell备份/还原数据库。我已经读过pg_dump,但是失败了,在pg_dump附近或附近出现语法错误。

I am within psql and am wondering if there is a way to backup/restore databases from this command shell. I have read of pg_dump, but that fails with "syntax error at or near pg_dump".

谢谢!

推荐答案

您始终可以直接从会话使用 \! [命令] 语法,例如:

You can always run shell command directly from psql session using \! [ command ] syntax, for example:

\! pg_dump -Fc -f D:\postgres.dump -U postgres postgres

当然不是这样执行或,但有可能。

Of course it's not so common to execute pg_dump or pg_restore in such way, but it's possible.

第包含所有SQL命令和应用程序(客户端和服务器)的列表。

Chapter VI. Reference contains list of all SQL commands and applications (both client and server).

这篇关于如何从psql内备份Postgresql数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 04:44