开发提出需要从Greenplum同步到Oracle的解决方案,写了个脚本用于定时调度处理。Linux-6-64下安装Oracle 12C笔记 http://www.linuxidc.com/Linux/2013-07/86805.htm在CentOS 6.4下安装Oracle 11gR2(x64) http://www.linuxidc.com/Linux/2014-02/97374.htmOracle 11gR2 在VMWare虚拟机中安装步骤 http://www.linuxidc.com/Linux/2013-09/89579p2.htmDebian 下 安装 Oracle 11g XE R2 http://www.linuxidc.com/Linux/2014-03/98881.htm脚本如下:#!/bin/sh #copy_gp_2_ora.sh if [ $# -ne 1 ]; then echo "Usage: sh $0 tablename" exit 1 fi TABLENAME=$1
psql -h <host> -U <user> <db><<EOF iming off set client_encoding="gb18030"; copy $TABLENAME to "/home/oracle/$TABLENAME.txt" csv q EOF
echo "load data infile "$TABLENAME.txt" discardfile "$TABLENAME.dis" append into table $TABLENAME fields terminated by "," optionally enclosed by """ (id)">"$TABLENAME.ctl"