Thursday, February 7, 2013

PostgreSQL - export/import schema only

Export

Use -s to specify schema only
pg_dump <src_database_name> -s > schema.sql
(Optional) Use -t to specify table. For more than 1 table just add more -t.
 pg_dump <src_database_name> -s -t <table1_name> -t <table2_name> > schema.sql

Import
psql <dest_database_name> -f schema.sql


Credit:

No comments:

Config number of file descriptors on Linux

Check file descriptor limit for a process. Vary depending on owner of the process $ cat /proc/{process-id}/limits Check current number of...