How to get my db structure without the data, (schema, tables, ...) as a script by command line.
1 Answer
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 ;)
3 Comments
Frank Heikens
And the english version: postgresql.org/docs/current/interactive/app-pgdump.html -s only dumps the object definitions (schema), not data.
Figo
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
DrColossos
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.