Thursday 10 May 2012


Remote Copy:
---------------

Connect  remote system using psql -h option and perform below operation, the input/out files will reside local system only.

In normal copy command      COPY    end with semicolon  ';'

Where as Remote copy command    \COPY  end without semicolon ';'


Copying data from remote system to local system:
---------------------------------------------------
enterprisedb@adminedb-ThinkPad-SL510:/tmp$ /opt/PostgresPlus/9.1AS/bin/psql -h 172.24.35.131  -p 5444 edb
psql (9.1.2.2)
Type "help" for help.

No entry for terminal type "xterm";
using dumb terminal settings.
edb=# \copy dept  to '/tmp/chiru_dept.copy'
edb=# \q

Copying data from local  system to remote system :
-----------------------------------------------------
enterprisedb@adminedb-ThinkPad-SL510:/tmp$ /opt/PostgresPlus/9.1AS/bin/psql -h 172.24.35.131  -p 5444 edb
edb=#  \copy test1  from  '/tmp/chiru_test1.copy'
edb=# select * from test1;
 deptno |   dname    |   loc
--------+------------+----------
     10 | ACCOUNTING | NEW YORK
     20 | RESEARCH   | DALLAS
     30 | SALES      | CHICAGO
(3 rows)