What this bloke wants is a File system level backup. So, the following is suggested:

tar -cf backup.tar /usr/local/pgsql/data

There are two restrictions, however, which make this method impractical, or at least 
inferior to the pg_dump method: 

1. The database server must be shut down in order to get a usable backup. Half-way 
measures such as disallowing all connections will not work as there is always some 
buffering going on. For this reason it is also not advisable to trust file systems 
that claim to support "consistent snapshots". 

Needless to say that you also need to shut down the server before restoring the data. 

2. If you have dug into the details of the file system layout you may be tempted to 
try to back up or restore only certain individual tables or databases from their 
respective files or directories. This will not work because the information contained 
in these files contains only half the truth. The other half is in the commit log files 
pg_clog/*, which contain the commit status of all transactions. A table file is only 
usable with this information. Of course it is also impossible to restore only a table 
and the associated pg_clog data because that will render all other tables in the 
database cluster useless. 

3. Time to hit the door!

BR,
N

----------------------------------------------
Also note that the file system backup will not necessarily be smaller than an SQL 
dump. On the contrary, it will most likely be larger. (pg_dump does not need to dump 
the contents of indexes for example, just the commands to recreate them.) 
 š


On Wed, 06 Oct 2004 Shantanu Kumar wrote :
>amitflu wrote:
>
>>I need "DATADIR"(database directory) of a
>>postgres database from a different machine. I
>>have all the information like
>>Port,DatabaseName,Host,Username,Password.
>>  
>This is not a PostgreSQL issue. You only want data from another machine. You could 
>take backup on CDs or a Flash disk and restore on the target. Or get it 
>tar+[g|b]zipped via HTTP/S, or S/FTP or NFS of even SSH. Over long distance, SSH is 
>recommended as it's fast and secure.
>
>Let's say you want contents of dir /var/lib/pgsql downloaded. Do as follows:
>
>ssh [EMAIL PROTECTED] "tar cj /var/lib/pgsql" > dump.tar.bz2
>
>Replace "user" and "host" as appropriate.
>
>Regards,
>Shantanu
>
>
>_______________________________________________
>ilugd mailinglist -- [EMAIL PROTECTED]
>http://frodo.hserus.net/mailman/listinfo/ilugd
>Archives at: http://news.gmane.org/gmane.user-groups.linux.delhi 
>http://www.mail-archive.com/[EMAIL PROTECTED]/



_______________________________________________
ilugd mailinglist -- [EMAIL PROTECTED]
http://frodo.hserus.net/mailman/listinfo/ilugd
Archives at: http://news.gmane.org/gmane.user-groups.linux.delhi 
http://www.mail-archive.com/[EMAIL PROTECTED]/

Reply via email to