473,508 Members | 2,489 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Scripting a new db server setup

A E
Hi,

Was wondering if there are ways to completely script a new postgresql installation. I need to be able to create the db, users, and db elements from one command so that I can included it in a setup routine.

Alex

Nov 12 '05 #1
6 1426
> Was wondering if there are ways to completely script a new
postgresql installation. I need to be able to create the db,
users, and db elements from one command so that I can included
it in a setup routine.


http://savannah.gnu.org/cgi-bin/view...ver/bootstrap/

is one possibility you might consider.

Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 12 '05 #2
A E <co*******@yahoo.com> writes:
Hi,

Was wondering if there are ways to completely script a new postgresql
installation. I need to be able to create the db, users, and db
elements from one command so that I can included it in a setup
routine.


Absolutely--write SQL scripts that do the work and feed them to 'psql'
in a shell script.

-Doug

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 12 '05 #3
A E
Thanks Doug! I got some weird errors though when trying to run a command to create db, create user, create elements from the pgAdmin sql editor. I was trying to test and in a nutshell it not allow me to create the db in the same script as everything else, because I seperated the parts and it worked fine.

Thanks Karsten, but I was unsure of what I was looking at.

Alex

Doug McNaught <do**@mcnaught.org> wrote:
A E writes:
Hi,

Was wondering if there are ways to completely script a new postgresql
installation. I need to be able to create the db, users, and db
elements from one command so that I can included it in a setup
routine.


Absolutely--write SQL scripts that do the work and feed them to 'psql'
in a shell script.

-Doug
Nov 12 '05 #4
> Was wondering if there are ways to completely script a new postgresql installation. I need to be able to create the db, users, and db elements from one command so that I can included it in a setup routine.

That's rather easy.

A shell script can do roughly the following:

- initdb somewhere
- start PG
- run 'psql template1 < myload.sql'

The myload.sql would connect to template1, do a "createdb newdbname" and
start creating tables, etc.

Almost the same concept as doing a restore from a pg_dumpall.

- Brandon

----------------------------------------------------------------------------
c: 917-697-8665 h: 201-435-6226
b. palmer, bp*****@crimelabs.net pgp:crimelabs.net/bpalmer.pgp5

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #5
> Thanks Doug! I got some weird errors though when trying to run a command to
create db, create user, create elements from the pgAdmin sql editor. I was
trying to test and in a nutshell it not allow me to create the db in the same
script as everything else, because I seperated the parts and it worked fine.


I think it's likely that at some point you wound up connected to wrong db
and need a connect command somewhere in your script. For instance, you
connect to template1 to start because your db doesn't exist yet, now
creating your db doesn't connect you to it. But when you split the script,
you explicitly connect to your db for the second script.
--
Scott Ribe
sc********@killerbytes.com
http://www.killerbytes.com/
(303) 665-7007 voice
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 12 '05 #6
On Sun, 4 Jan 2004, A E wrote:
Hi,
Was wondering if there are ways to completely script a new postgresql
installation. I need to be able to create the db, users, and db
elements from one command so that I can included it in a setup
routine.


How about pgbash. Is it still being supported? The page
(http://www.psn.co.jp/PostgreSQL/pgbash/index-e.html) I looked at shows
the last version as 7.3 (Feb 2003) which coincides with Pg V 7.3.

Funny this should come up now as I am looking for a way to do the same
thing. Serendipity eh?
Rod
--
"Open Source Software - You usually get more than you pay for..."
"Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL"

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 12 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
5560
by: Rodd Snook | last post by:
I have an application which makes extensive use of the Scripting.Dictionary object. I'm not doing anything silly like putting them outside the page scope -- just creating quite a few of them and...
2
3411
by: Tim Chmielewski | last post by:
I have been trying to read values from a form into an array on a page without much success and was told to use a Scripting.Dictionary instead. There are a variable number of fields on the form as...
2
15207
by: Ken Lindner | last post by:
I have a need to become familiar with SQL Server 2000 for work. Needless to say I am new to SQL Server any version, but not IT in general. My employer has provided me with the SQL Server 2000...
0
1559
by: fiona | last post by:
Catalyst Releases Scripting Editions of SocketTools Client and server-side development for Active Server Pages and PHP. Yucca Valley, CA, May 25, 2005 - Catalyst Development Corp...
19
1744
by: Shailesh Humbad | last post by:
Has anyone ever heard of a c++ web 'scripting' engine? I think it would be fairly easy to make one. All that is needed is an intermediary that compiles the code on demand and caches the...
4
7286
by: coosa | last post by:
Hi, I was installing SQL Server on my machine and during installation my PC freezed. It happens frequently on my machine. So i tried after restarting to install it again and since then i always...
4
5237
by: Greg P | last post by:
I know this is a long post, please bear with me. I have been working on this all weekend to no avail although I have done a good amount of research (see most pertinent links that I've looked at...
7
2731
by: Greg P | last post by:
I know this is a long post, please bear with me. I have been working on this all weekend to no avail although I have done a good amount of research (see most pertinent links that I've looked at...
6
2146
by: avh | last post by:
Hi, I'have been looking for a simple scripting (interpreted) language to be run within my ASP.NET pages.Syntax is of minor importance. Although I find many options, all of these seem to first...
0
7133
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7336
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
5643
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5059
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4724
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3214
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1568
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.