PostgreSQL 数据库从 shell 级逆向工程 [英] PostgreSQL database reverse engineering from shell level

查看:52
本文介绍了PostgreSQL 数据库从 shell 级逆向工程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我碰巧用大型数据库做了一些审核,但我在这方面经验不足,所以我想聪明的做法是在我的本地主机上创建类似的数据库,以免弄乱原始数据库.

而且这是我的问题,是否可以生成 SQL 脚本来创建我想要的精确表?
我的意思是在 MySQL GUI 工具上有这样的选项,逆向工程 生成 SQL 脚本,它将在我使用函数时创建精确的数据库,在 shell 级别的 PostgreSQL 中是否可能?

I happened to do some moderating stuff with large database but I am not so experienced in it so i guess the smart thing is to create similar database on my localhost to not mess up with original one.

And here is my question, is it possible to generete SQL script which will create exact table as i want?
I mean on MySQL GUI tool there is option like this, reverse engineering which generate SQL script which will create exact database as I used function on, is it possible in PostgreSQL in shell level?

推荐答案


pg_dump --schema-only db1 > db-schema.sql

这篇关于PostgreSQL 数据库从 shell 级逆向工程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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