DMS
DMS

Reputation: 818

How to create sql script of postgres database schema?

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..

Upvotes: 28

Views: 61620

Answers (2)

Anvesh
Anvesh

Reputation: 7683

You can also use pgAdmin tool to generate or take plain text Database Backup. You can generate plain text backup for data or schema only.

I have shared few screen shots, please visit this blog for more details.

Upvotes: 2

Bohemian
Bohemian

Reputation: 424973

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 however does have a facility to do what you want:

  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

Upvotes: 54

Related Questions