473,386 Members | 1,698 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,386 software developers and data experts.

Exporting/moving Postgress Instance

Hi,

I'm relatively new to postgres but I've managed to get an instance up and
running and built a web site based on it. But I want to move the complete
site to another host not in the same network. If I want to set the schema up
on a new machine is it sufficient to simply copy the data folder (and sub
folders) and then start the instance by pointing to that data folder?
Otherwise is there an recognised dump file in the same way that Oracle has
and if so how do I create it?

Thanks

Nick
Nov 23 '05 #1
3 1449
Nick schrieb:
Otherwise is there an recognised dump file in the same way that Oracle has
and if so how do I create it?


Hi Nick,

you should look at

pg_dump or pg_dumpall in the docs.

(or pg_dump --help)

restore the dumped database with psql.

Daniel
Nov 23 '05 #2

Hi Nick,

you should look at

pg_dump or pg_dumpall in the docs.

(or pg_dump --help)

restore the dumped database with psql.

Daniel


Thanks, it worked to export the data. I'll have to see how it goes with the
import.

Nick
Nov 23 '05 #3
>

Thanks, it worked to export the data. I'll have to see how it goes with the
import.

Nick

Above two samples. Notice that I use commandline param1 (%1) to specify
the host and param2 (%2) to specify the database name. I also never
export with blobs because i want to have a dumpfile for each table. I
export as INSERTS WITH COLUMN NAMES because my databases could have
different version with different column orders.

sample for export :

Table - export

pg_dump -i -h %1 -a -D -U syncro -S syncro -t fieldalias -f
"E:\Setup\P32\PSql\binary\ZZ_13 fielalias.sql" %2

BLOB - export

psql -h %1 -U syncro -c "SELECT lo_export(mm_picture,
'../mainmenu.mm_id.'|| CAST(mm_id AS VARCHAR) || '.blob') FROM mainmenu
WHERE mm_picture IS NOT NULL" %2
sample for import :

Table - import

psql -h %1 -f "%P32PATH%\PSql\binary\ZZ_12 sondfunc.sql" %2 syncro

BLOB - import

psql -h %1 -c "UPDATE mainmenu SET
mm_picture=lo_import('../mainmenu.mm_id.'|| CAST(mm_id AS VARCHAR) ||
'.blob') WHERE mm_picture IS NOT NULL" %2 syncro
Daniel
Nov 23 '05 #4

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

Similar topics

1
by: Liza | last post by:
Hi, I'm a novice to postgress and need to constract a simple tree. In my table I have: regionID int parentID int name char I need to do two functions: find all the children of XXX parent...
4
by: Angel Cat | last post by:
I'm exporting a large file from a large Production database (SQL). Users are currently updating and inserting new records. Does the export take a snapshot of the data when it starts ? or will...
6
by: Hemant Shah | last post by:
Folks, I need to move HOME directory of an instance to another directory. What is the best way of doing it? Is changing password file enough? or dies DB2 store this info in it's own config? ...
3
by: premmehrotra | last post by:
I am using Access 2000 and Oracle 9.2.0.x on a Windows 2000. I have setup Oracle 9.2 ODBC Driver (I have not yet figured how to set Microsoft's Oracle ODBC driver). I am exporting a table from...
2
by: Regnab | last post by:
I've got my code working so that it'll count the number of columns in the table and move across (eg Range A-P and then range Q-W). Problem is when I get to the end of the single letters and get...
2
by: Angel | last post by:
I'm exporting a C-style function call with this syntax: int getDate(char *date); I'm trying to export to my c# app like this: public static extern int getDate(System.IntPtr ptr); public...
67
by: Bob Powell | last post by:
To whom it may concern: I find the recent articles in various trade publications a little disturbing due to the lack of PostgrSQL mention. I continue to see articles about how IBM may be...
1
by: Praveen | last post by:
Hi All, Can anybody tell from where i can download the latest Postgress Windows version? Thanks, Praveen
224
by: Jon Slaughter | last post by:
Sorry for all the cross posting but I'm interesting in getting a serious discussion about how usenet has become lately. Many people are moving away from usenet because of all the spam and cooks...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.