Need to Extract PostgreSQL Schema for Clean Database
-
I'm not an expert on PostgreSQL but I need to do some trouble shooting with an instance of it and am stuck as to how to proceed. What I am trying to do is to take one existing database instance and create a clone of it that is empty that I can then do testing with. I want to avoid altering the original database for obvious reasons.
Here is what I have currently:
postgres=# \l List of databases Name | Owner | Encoding ------------+----------+---------- portal_old | phppg | LATIN9 portaltest | phppg | LATIN9 postgres | postgres | LATIN9 template0 | postgres | LATIN9 template1 | postgres | LATIN9 (5 rows)
The database that needs to be copied is portaltest. Unfortunately there is not enough space on the server to make a full copy of the database itself (legacy problems) which adds additional complications.
So I cannot take a full pg_dump of the database. If I try to use the -n flag of pg_dump to only get the schema it tells me that no schema can be found.
I am unclear how to pull out the framework of the database to make a copy given the scenario.
-
What is the error produced by the schema dump?
-
This is what I get...
postgres@~ 2$ pg_dump -p 5023 -n portaltest pg_dump: specified schema "portaltest" does not exist
-
No idea on that.
-
@StrongBad said in Need to Extract PostgreSQL Schema for Clean Database:
This is what I get...
postgres@~ 2$ pg_dump -p 5023 -n portaltest pg_dump: specified schema "portaltest" does not exist
http://orig01.deviantart.net/eb26/f/2011/145/e/2/portal_2___error_by_half_dude-d3h8bys.jpg