1

How to get my db structure without the data, (schema, tables, ...) as a script by command line.

1 Answer 1

4

http://www.postgresql.org/docs/current/interactive/app-pgdump.html

pg_dump -s -U username database > backup.sql

Haven't tested it though, so not sure if it works.

edit: had the german link up there ;)

Sign up to request clarification or add additional context in comments.

3 Comments

And the english version: postgresql.org/docs/current/interactive/app-pgdump.html -s only dumps the object definitions (schema), not data.
Hi, thanks for replying .. I got a permission denied could u tell me why? maybe I wrote some parameters in a wrong way, may you be specific and tell me "username" indicates to a db creator or what ? thanks again
username is the user that has permissions on the database to do the opertaions. This doesn't need to be the DB creator per se, but when this user created it, there will be also the proper permissions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.