views:

56

answers:

1

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

+4  A: 

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 ;)

DrColossos
And the english version: http://www.postgresql.org/docs/current/interactive/app-pgdump.html-s only dumps the object definitions (schema), not data.
Frank Heikens
just noticed the wrong language myself, edited it
DrColossos
What's with the links to the beta docs?
Milen A. Radev
Argh, thank you again for noticing
DrColossos
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
Figo
`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.
DrColossos