473,326 Members | 2,168 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Schema backup

Hello all

I need to transfer a database installation from one host to another. I need
to dump all users, databases, schemas, stored procedures, triggers, etc. but
no actual data at all. What I try to achieve is a fresh clone ready to run.
I tried pg_dump -s and pg_dumpall, but somewhere I'm missing something, so:
what is the procedure to dump all database structure alone, and what is the
proper reload procedure?

TIA
cl.

__________________________________________________ _______________
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 12 '05 #1
7 3775
On Friday 26 September 2003 14:37, Claudio Lapidus wrote:
pg_dump -s -Fp -c -f <file> <databse>
is what i use
Hello all

I need to transfer a database installation from one host to another. I need
to dump all users, databases, schemas, stored procedures, triggers, etc.
but no actual data at all. What I try to achieve is a fresh clone ready to
run. I tried pg_dump -s and pg_dumpall, but somewhere I'm missing
something, so: what is the procedure to dump all database structure alone,
and what is the proper reload procedure?

TIA
cl.

__________________________________________________ _______________
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

---------------------------(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
Claudio Lapidus writes:
I tried pg_dump -s and pg_dumpall, but somewhere I'm missing something, so:


Define "something".

--
Peter Eisentraut pe*****@gmx.net
---------------------------(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 #3
"Claudio Lapidus" <cl******@hotmail.com> writes:
I need to transfer a database installation from one host to another. I need
to dump all users, databases, schemas, stored procedures, triggers, etc. but
no actual data at all. What I try to achieve is a fresh clone ready to run.
I tried pg_dump -s and pg_dumpall, but somewhere I'm missing something, so:
what is the procedure to dump all database structure alone, and what is the
proper reload procedure?


The proper procedure IMHO would be
pg_dumpall -s >dumpfile
psql template1 <dumpfile

There is a small problem with this in 7.3.* (but not before or after):
due to an oversight, that version of pgdump_all doesn't support the -s
switch. So if you are using 7.3 you have to do something like

pg_dumpall -g >dumpfile
for each database:
pg_dump -C -s database >>dumpfile
regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 12 '05 #4
Tom Lane wrote:
The proper procedure IMHO would be
pg_dumpall -s >dumpfile
psql template1 <dumpfile

There is a small problem with this in 7.3.* (but not before or after):
due to an oversight, that version of pgdump_all doesn't support the -s
switch. So if you are using 7.3 you have to do something like
Ah, ah. That's why it didn't work as I was expecting. This is 7.3.2, yes.
(Peter, this is the 'something' you were asking me to define in your
response. Sorry for not having been more specific the first time.)

pg_dumpall -g >dumpfile
for each database:
pg_dump -C -s database >>dumpfile


That was what we ended up doing. It worked very well.

Thanks to all
cl.

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

Nov 12 '05 #5
"Claudio Lapidus" <cl******@hotmail.com> writes:
Tom Lane wrote:
pg_dumpall -g >dumpfile
for each database:
pg_dump -C -s database >>dumpfile
That was what we ended up doing. It worked very well.


BTW, if you find yourself wanting to do this a lot, it might be worth
your time to instead fix the oversight in pg_dumpall. You'd have to
backpatch this fix:

http://developer.postgresql.org/cvsw...1=1.19&r2=1.20

which probably wouldn't be very hard...

regards, tom lane

---------------------------(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 #6
I also have troubles with pg_dump. I have a database called 'shipping' and
it has many tables(I populated them via a script). To dump the database I
did these steps:

su greg and then pg_dump > /tmp/greg.dmp. A file greg.dmp gets created but
it has nothing in it(0 bytes). Could you advise what was wrong, please?

Thanks in advance, Greg
""Claudio Lapidus"" <cl******@hotmail.com> wrote in message
news:BA*************************@hotmail.com...
Hello all

I need to transfer a database installation from one host to another. I need to dump all users, databases, schemas, stored procedures, triggers, etc. but no actual data at all. What I try to achieve is a fresh clone ready to run. I tried pg_dump -s and pg_dumpall, but somewhere I'm missing something, so: what is the procedure to dump all database structure alone, and what is the proper reload procedure?

TIA
cl.

__________________________________________________ _______________
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 12 '05 #7
On Tuesday 30 September 2003 09:15 pm, Greg wrote:
I also have troubles with pg_dump. I have a database called 'shipping' and
it has many tables(I populated them via a script). To dump the database I
did these steps:

su greg and then pg_dump > /tmp/greg.dmp. A file greg.dmp gets created but
it has nothing in it(0 bytes). Could you advise what was wrong, please?

Thanks in advance, Greg


You forgot to tell pg_dump the name of the database. Try:
pg_dump shipping > /tmp/greg.dmp

Or, for a gzipped backup:
pg_dump shipping | gzip -c > /tmp/greg.dmp.gz

Best of luck,

Andrew Gould
---------------------------(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 #8

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

Similar topics

5
by: Shock | last post by:
Hello all, I am doing some research on database conversions. Currently, I am interested in any information that would help me convert a database from one schema to another. This could be...
6
by: Patrick Hatcher | last post by:
I have a development server where I, well, do my development. Occasionally, I will create a new schema within an existing database that I would like to use on my production machine. I know that...
6
by: clvrmnky | last post by:
I've got a database backup from another system which I'd like to restore to a test system. Both the backup and restore systems are Solaris 8. I don't recall the DB2 version, but I do know that...
0
by: Glenn Davy | last post by:
Hi all Is there a command like backup ( or an option to backup) I can execute from osql to simply dump out a schema (a bit like pg_dump --schema-only in postgres). I'm sure there must be...
3
by: Kiran | last post by:
Hi, I want to back up my data in some table in SQL server and import it back using Bulk Load of SQL server 2K. I can use the following code to backup the data in XML ...
6
by: Rory Campbell-Lange | last post by:
I think this is a suggestion/comment! pg_dump man page: --schema-only Dump only the schema (data definitions), no data I think this use of the word schema is confusing, meaning data...
2
by: Anony Mous | last post by:
Hi, I've seen in previous posts that recommended practice for database backup is to run the dump utility twice. Once for schema only and a second time for data only (I think). Up to know,...
0
by: eduardasm | last post by:
Hello, I have a problem with XML schema update for one XML column (problem exists in both SP1 and SP2 for SQL Server 2005). 1. I have a table that looks like this: CREATE TABLE .( NOT NULL...
1
by: Tomas | last post by:
Hello all, I have migrated a database from 8.2 to 9 FP3 by restoring a backup into a DB2 9 instance. Operating system is Solaris. The migration during the restore claims to have been...
5
by: Dmitriy Lapko | last post by:
Hallo all Is it possible to change schema of table in DB2 v.8.2 without recreating and coping a table into a new schema? I need it for several purposes, one of them - refactoring of existing...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.