磁盘空间不足的情况下,利用命名或者匿名管道迁移和导入数据;需要注意命名管道的权限问题。0. Name PIP 0[[email protected] ~]$ psql gtlions -ac "select 't3' tab,count(*) from t3 union all select 't4',count(*) from t4;"select 't3' tab,count(*) from t3 union all select 't4',count(*) from t4; tab | count-----+------- t3 | 100 t4 | 0(2 rows) [[email protected] ~]$ mknod syncpip p[[email protected] ~]$ psql gtlions -p 5432 -c "copy t3 to '/home/pg/sync'"|psql gtlions -p 5432 -c "copy t4 from '/home/pg/sync'" ERROR: could not open file "/home/pg/sync" for reading: No such file or directory[[email protected] ~]$ psql gtlions -p 5432 -c "copy t3 to '/home/pg/syncpip'"|psql gtlions -p 5432 -c "copy t4 from '/home/pg/syncpip'" COPY 100[[email protected] ~]$ psql gtlions -p 5432 -c "copy t3 to '/home/pg/syncpip'"|psql gtlions -p 5432 -c "copy t4 from '/home/pg/syncpip'" COPY 100[[email protected] ~]$ psql gtlions -p 5432 -c "copy t3 to '/home/pg/syncpip'"|psql gtlions -p 5432 -c "copy t4 from '/home/pg/syncpip'" COPY 100[[email protected] ~]$ psql gtlions -p 5432 -c "copy t3 to '/home/pg/syncpip'"|psql gtlions -p 5432 -c "copy t4 from '/home/pg/syncpip'" COPY 100[[email protected] ~]$ psql gtlions -ac "select 't3' tab,count(*) from t3 union all select 't4',count(*) from t4;"select 't3' tab,count(*) from t3 union all select 't4',count(*) from t4; tab | count-----+------- t3 | 100 t4 | 400(2 rows)1. Name PIP 1[[email protected] ~]$ rm -rf sync*[[email protected] ~]$ mkfifo syncpip[[email protected] ~]$ ll syncpipprw-rw-r-- 1 pg pg 0 11月 6 09:15 syncpip[[email protected] ~]$ psql gtlions -p 5432 -c "copy t3 to '/home/pg/syncpip'"|psql gtlions -p 5432 -c "copy t4 from '/home/pg/syncpip'" COPY 100[[email protected] ~]$ psql gtlions -p 5432 -c "copy t3 to '/home/pg/syncpip'"|psql gtlions -p 5432 -c "copy t4 from '/home/pg/syncpip'" COPY 100[[email protected] ~]$ psql gtlions -p 5432 -c "copy t3 to '/home/pg/syncpip'"|psql gtlions -p 5432 -c "copy t4 from '/home/pg/syncpip'" COPY 100[[email protected] ~]$ psql gtlions -p 5432 -c "copy t3 to '/home/pg/syncpip'"|psql gtlions -p 5432 -c "copy t4 from '/home/pg/syncpip'" COPY 100[[email protected] ~]$ psql gtlions -ac "select 't3' tab,count(*) from t3 union all select 't4',count(*) from t4;"select 't3' tab,count(*) from t3 union all select 't4',count(*) from t4; tab | count-----+------- t3 | 100 t4 | 800(2 rows) 2. UnName PIP[[email protected] ~]$ psql gtlions -p 5432 -c "copy t3 to stdout"|psql gtlions -p 5432 -c "copy t4 from stdin" [[email protected] ~]$ psql gtlions -p 5432 -c "copy t3 to stdout"|psql gtlions -p 5432 -c "copy t4 from stdin" [[email protected] ~]$ psql gtlions -p 5432 -c "copy t3 to stdout"|psql gtlions -p 5432 -c "copy t4 from stdin" [[email protected] ~]$ psql gtlions -p 5432 -c "copy t3 to stdout"|psql gtlions -p 5432 -c "copy t4 from stdin" [[email protected] ~]$ psql gtlions -p 5432 -c "copy t3 to '/home/pg/syncpip'"|psql gtlions -p 5432 -c "copy t4 from '/home/pg/syncpip'" COPY 100[[email protected] ~]$ psql gtlions -ac "select 't3' tab,count(*) from t3 union all select 't4',count(*) from t4;" select 't3' tab,count(*) from t3 union all select 't4',count(*) from t4; tab | count-----+------- t3 | 100 t4 | 1300(2 rows)-EOF-
(以上内容不代表本站观点。) --------------------------------- |