7

I have a Database which has multiple schema, I need to export one of those schema structure to an sql file without the data. Is this possible, if so What command should I use?

When I use this command, I get the data as well, but I have a lot of data which makes the server run out of space for this.

--host xx --port xx --username "xx" --password  --format plain --verbose --file "sample.sql" --schema "sample" "main"

I need the structure to restore it in another location. Where I do not need the data but only the structure

I'm quite new to this area, thanks for the help

1

1 Answer 1

12

Use can use pg_dump with the option -s. Follow the link pg_dump help

To extract the schema for a single database, use

pg_dump -s <schema_name> 
Sign up to request clarification or add additional context in comments.

Comments

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.