X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 775219DCAAF for ; Tue, 6 Dec 2005 11:55:20 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 33293-07 for ; Tue, 6 Dec 2005 11:55:24 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.205]) by postgresql.org (Postfix) with ESMTP id 370AA9DCAC4 for ; Tue, 6 Dec 2005 11:55:15 -0400 (AST) Received: by nproxy.gmail.com with SMTP id x29so28665nfb for ; Tue, 06 Dec 2005 07:55:16 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=DEW2HQEYuuG9fZC5cI1lA+HRyG8Ihi11bS9notdpMhTHVWgeia/VKIG8O+M/iQjzLeb61yRvFWYo13zTM5oYSYw5pEUxevGwXgGL0Lwgo+32W4jzd72h/m62z0ywgOwL+AyHh7S2QP4s+e4bxXBZ77trJtfIA0UhLz/DbAtve5Y= Received: by 10.48.209.8 with SMTP id h8mr148337nfg; Tue, 06 Dec 2005 07:55:16 -0800 (PST) Received: by 10.48.108.10 with HTTP; Tue, 6 Dec 2005 07:55:16 -0800 (PST) Message-ID: Date: Tue, 6 Dec 2005 15:55:16 +0000 From: Guido Barosio To: "Karthik.S" Subject: Re: error while creating database Cc: pgsql-admin@postgresql.org In-Reply-To: <4395852E.5050802@midascomm.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_12689_17242640.1133884516200" References: <4395852E.5050802@midascomm.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[HTML_MESSAGE=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/35 X-Sequence-Number: 19755 ------=_Part_12689_17242640.1133884516200 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Quote: "I am having a script(uses psql) which drops and creates a database by logging into 'template1'. This will be invoked from crontab." If you are actually connecting with this script into template1 before running the create database, you will then receive that message. Ensure tha= t the script is not doing this, or create a new template2 database, to use as a template, instead of the default one. My 2 cents. g.- On 12/6/05, Karthik.S wrote: > > Dear all, > > I am using postgres version: 7.1.3 in Red hat linux : 7.2. > > I am having a script(uses psql) which drops and creates a database by > logging > into 'template1'. This will be invoked from crontab. > > Sometimes (nearly 50% of the times) the database creation fails by saying > "ERROR: CREATE DATABASE: source database "template1" is being > accessed by other users" > > But I am sure that none of my scripts access 'template1' at that time. > I have also checked the 'ps -afx' output (logged at the time of failing), > but no suspects found. > > Kindly give me a solution to overcome this problem. > Also kindly tell me a way to find, which process is accessing the > template1. > > > Thanks in advance. > > regards > KArthik.S > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend > -- "Adopting the position that you are smarter than an automatic optimization algorithm is generally a good way to achieve less performance, not more" - Tom Lane. ------=_Part_12689_17242640.1133884516200 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Quote:

"I am having a script(uses psql) which drops and creates= a database by
logging
into 'template1'. This will be invoked from cr= ontab."

If you are actually connecting with this script into te= mplate1 before running the create database, you will then receive that mess= age. Ensure that the script is not doing this, or create a new template2 da= tabase, to use as a template, instead of the default one.

My 2 cents.

g.-

On 1= 2/6/05, Karthik.S <skarthik@midascomm.com> wrote: Dear all,

        I am using= postgres version: 7.1.3 in Red hat linux : 7.2.

I am having a scrip= t(uses psql) which drops and creates a database by
logging
into 'temp= late1'. This will be invoked from crontab.

Sometimes (nearly 50% of the times) the database creation fails by = saying
"ERROR:  CREATE DATABASE: source database "te= mplate1" is being
accessed by other users"

But I am sur= e that none of my scripts access 'template1' at that time.
I have also checked the 'ps -afx' output (logged at the time of failing= ),
but no suspects found.

Kindly give me a solution to overcome t= his problem.
Also kindly tell me a way to find, which process is accessi= ng the
template1.


Thanks in advance.

regards
KArthik.S

---------------------------(end of broadcast)---------------------= ------
TIP 6: explain analyze is your friend



--
"Adopting the position that you are smart= er than an automatic
optimization algorithm is generally a good way to a= chieve less
performance, not more" - Tom Lane. ------=_Part_12689_17242640.1133884516200--