X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6C63F533AF for ; Fri, 22 Apr 2005 16:08:29 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31875-09 for ; Fri, 22 Apr 2005 19:08:25 +0000 (GMT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 4756053390 for ; Fri, 22 Apr 2005 16:08:25 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.13.1/8.13.1) with ESMTP id j3MJ8Oea034200 for ; Fri, 22 Apr 2005 19:08:25 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.13.1/8.13.1/Submit) id j3MJ43FK033330 for pgsql-admin@postgresql.org; Fri, 22 Apr 2005 19:04:03 GMT (envelope-from news) From: Chris Browne X-Newsgroups: pgsql.admin Subject: Re: Another Data directory for second database - feasible? Date: Fri, 22 Apr 2005 14:44:00 -0400 Organization: cbbrowne Computing Inc Lines: 47 Message-ID: <60hdhy1wjz.fsf@dba2.int.libertyrms.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux) Cancel-Lock: sha1:D/sbum00VGLfPlTPniWZxf/2TyU= To: pgsql-admin@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200504/322 X-Sequence-Number: 17335 htomeh@firstam.com ("Tomeh, Husam") writes: > I have a postgres installation with one database on a server. I'd need > to create another database; however, I'm curious if there's a way to > create the second database in a different directory than the existing > one. Is that feasible and how? Or does postgres only point to one data > directory? Thanks in advance. We have plenty of servers with multiple databases, handled in just this fashion. At the simplest level, it involves running initdb three times, on three directories: $ initdb -D /opt/DB1 $ initdb -D /opt/DB2 $ initdb -D /opt/DB3 $ vi /opt/DB?/postgresql.conf [change port numbers for each] $ for db in 1 2 3; do pg_ctl -D /opt/DB$db start done You probably want to set up some set of "init" scripts that manage telling the instances where to stow log files and such, and which can be auto-started upon system bootup. One of my coworkers has built a really nice init script that's good at building the directory structure where the DBs will be stowed, hence... $ vi init_db3.sh [modify config] $ ./init_db3.sh mkdir [builds directory structure] $ ./init_db3.sh initdb [runs initdb for you] $ ./init_db3.sh start At one point, he was trying to come up with a way of releasing it to the community; hopefully poking Drew can lead to that coming available, someday... -- (format nil "~S@~S" "cbbrowne" "acm.org") http://www.ntlug.org/~cbbrowne/sap.html Rules of the Evil Overlord #78. "I will not tell my Legions of Terror "And he must be taken alive!" The command will be: ``And try to take him alive if it is reasonably practical.''"