Backup Schema w/ SQL Text File

Поиск
Список
Период
Сортировка
Искать

Backup Schema w/ SQL Text File

От:
<operationsengineer1@yahoo.com>
Дата:
i backed up a db with sql text.  no problems.

however, i can't restore sql text using pgadmin3.  so
i go to the commandline and type in...

psql depot_development < create.sql.

ni dice b/c depot development is a schema of rails,
not a db intself.

what is the synatx to restore, using sql text, a
schema within a db?

i suspect it is something along the lines of:

psql rails[insert correct symbol
here]depot_development < create.sql

i didn't see this addressed in the manual (at least
the main page).

tia...

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: Backup Schema w/ SQL Text File

От:
Alan Hodgson <ahodgson@simkin.ca>
Дата:
On May 7, 2006 06:59 pm, operationsengineer1@yahoo.com wrote:
> what is the synatx to restore, using sql text, a
> schema within a db?
>
> i suspect it is something along the lines of:
>
> psql rails[insert correct symbol
> here]depot_development < create.sql
>
> i didn't see this addressed in the manual (at least
> the main page).

I don't think you can, unless you only dumped that schema.  Consult the 
pg_dump and pg_restore manual pages for the more advanced backup formats 
which allow you to selectively backup and restore select sets of tables, 
including just those in particular schemas.

-- 
"Thank God we don't get all the government we pay for." -- Will Rogers

Re: Backup Schema w/ SQL Text File

От:
Sean Davis <sdavis2@mail.nih.gov>
Дата:



On 5/7/06 9:59 PM, "operationsengineer1@yahoo.com"
 wrote:

> i backed up a db with sql text.  no problems.
> 
> however, i can't restore sql text using pgadmin3.  so
> i go to the commandline and type in...
> 
> psql depot_development < create.sql.

Besides the pg_restore functionality to access specific schemas, etc., you
could add tp the beginning of create.sql:

 -- Next line assumes no depot_development exists....
 create schema depot_development;
 set search_path to depot_development, public;

See the documentation for search_path details, but it basically says "unless
I tell you otherwise, use depot_development as the default schema."

Sean

FAQ