Re: Restoring a database

Поиск
Список
Период
Сортировка
От Jeff Frost
Тема Re: Restoring a database
Дата
Msg-id 48F660D6.7020909@frostconsultingllc.com
обсуждение исходный текст
Ответ на Re: Restoring a database  (Jeff Frost <jeff@frostconsultingllc.com>)
Ответы Re: Restoring a database  ("Chris Henderson" <henders254@gmail.com>)
Список pgsql-general


Jeff Frost wrote:
Chris Henderson wrote: 
I backup all my databases by using pg_dumpall - pg_dumpall >
/tmp/postgres.backup.`hostname`. It should backup four DBs: analyze,
postgres,  template0 and template1
I guess this backs up the schemas as well.

Now I want to restore one of the databases and schema from this backup
dump file onto a different server. The databases is call "analyze".
Does anyone know how to do that with pg_restore? Thanks.    
Chris,

pg_restore is used to restore backups that were saved in the custom
format by pg_dump (option -Fc).  You don't need pg_restore to restore a 
Whoops, that should say, in the custom or tar format (options -Fc or -Ft).    

pg_dumpall archive.  If you look at the backup file, you'll find that
it's just straight SQL.  If you want to restore a particular database
out of it and not all of them, then you will need to edit the sql file
to include only what you want to restore.  Then you simply pass it
through psql like so:

psql -f /tmp/postgres.backup.`hostname` postgres

Hint: the above will require that the CREATE DATABASE and \connect
commands for the database you want to restore are still in the file.
 

-- 
Jeff Frost, Owner 	<jeff@frostconsultingllc.com>
Frost Consulting, LLC 	http://www.frostconsultingllc.com/
Phone: 916-647-6411	FAX: 916-405-4032

В списке pgsql-general по дате отправления:

Предыдущее
От: Jeff Frost
Дата:
Сообщение: Re: Restoring a database
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: PL/pgSQL stored procedure returning multiple result sets (SELECTs)?