Re: create database from template requires the source database to be unused

From: Alban Hertroys <haramrae(at)gmail(dot)com>
To: Tim Uckun <timuckun(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: create database from template requires the source database to be unused
Date: 2012-06-28 06:40:38
Message-ID: A3FD8AFC-15FE-4C0F-9A6D-BF94D617EB09@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 28 Jun 2012, at 5:11, Tim Uckun wrote:

> I am sure this is intended behavior but it seems odd (and inconvenient) to me.
>
> create database tim_test_copy template tim_test
>
> ERROR: source database "tim_test" is being accessed by other users
> DETAIL: There are 1 other session(s) using the database.
>
> I would presume only reads are required from tim_test but apparently I
> have to resort to pg_dump and pg_restore to clone an active database.

For how to mark a database as a template database, check the bottom section of: http://www.postgresql.org/docs/9.1/static/manage-ag-templatedbs.html

Alban Hertroys

--
If you can't see the forest for the trees,
cut the trees and you'll find there is no forest.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ben Carbery 2012-06-28 07:50:32 Customising pg directories
Previous Message Craig Ringer 2012-06-28 03:43:11 Re: create database from template requires the source database to be unused