如何创建Postgres数据库架构的SQL脚本? [英] How to create sql script of postgres database schema?

查看:129
本文介绍了如何创建Postgres数据库架构的SQL脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要Postgres 9数据库模式的SQL脚本,该脚本不在本地服务器上。我在pgAdmin的sql编辑器上尝试了pg_dump命令,它在那儿不起作用。我不确定在哪里运行该命令。请以同样的方式帮助我。...
谢谢..

I want sql script of postgres 9 database schema which is not on local server. I tried pg_dump command on sql editor of pgAdmin and its not working there. I m not sure where to run that command. Please assist me with the same.... Thanks..

推荐答案

pg_dump 是一个命令行实用程序;它不是SQL,因此它无法在pgAdmin或其他执行SQL的地方运行。

pg_dump is a command line utility; it isn't SQL, so it won't work in pgAdmin or anywhere else that executes SQL.

pgAdmin 确实具有执行所需操作的功能:

pgAdmin however does have a facility to do what you want:


  1. 右键单击要导出的数据库

  2. 从弹出菜单中选择备份菜单

  3. 选择格式 普通

  4. 选择普通选项 仅架构

  1. Right-click on the database you want to export
  2. Select Backup from the pop-up menu
  3. Chose "format" Plain
  4. Chose "plain option" Only schema

这篇关于如何创建Postgres数据库架构的SQL脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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