PostgreSQL pg_dump [英] PostgreSQL pg_dump

查看:114
本文介绍了PostgreSQL pg_dump的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用命令创建数据库备份

I am trying to create a database backup using the command

pg_dump -U vdc(old db) | psql vdc_bak.sql(backup db);

这里的语法有什么问题?

What's wrong with the syntax here?

它告诉 pg_dump附近的语法错误

It tells "syntax error near pg_dump"

推荐答案

您仍然没有向我们展示全局,但是语法错误似乎表明您是在SQL客户端工具(psql,pgAdmin等)中运行的。

You still don't show us the big picture, but the "syntax error" seems to indicate that you run that from within a SQL client tool (psql, pgAdmin, ...)

pg_dump psql 命令行程序,不是SQL语句。

pg_dump and psql are commandline programs, not SQL statements.

您需要在命令提示符(aka shell)中运行它们

You need to run them from the command prompt (aka shell)

另外,(旧db)参数是完全错误的。数据库未放在pg_dump的方括号中,例如:

Additionally the (old db) parameter is completely wrong. The database is not put into brackets for pg_dump, e.g:

pg_dump -U user1 dbname_old_db | psql -U user2 dbname_new_db

再次:您必须在命令提示符下运行此命令,而不是在SQL工具

Again: you have to run this from the command prompt, not from within a SQL tool

这篇关于PostgreSQL pg_dump的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆