Unix/Linux之Oracle相关Shell(3)

REPORT_CATALOG.ctl:==
LOAD DATA
INFILE '/Oracle/cfain/REPORT_CATALOG_$DATE.txt'
TRUNCATE
INTO TABLE AIX_REPORT_CATALOG
FIELDS TERMINATED BY '|'
TRAILING NULLCOLS

MODELNO "NVL(:MODELNO,'0')",MODELNAME "NVL(:MODELNAME,' ')",MODELTYPE "NVL(:MODELTYPE,'0')",MODELCLASS "NVL(:MODELCLASS,'0')"

REPORT_DATA.ctl:==
LOAD DATA
INFILE '/oracle/cfain/REPORT_DATA_$DATE.txt'
TRUNCATE
INTO TABLE AIX_REPORT_DATA
FIELDS TERMINATED BY '|'
TRAILING NULLCOLS

REPORTNO "NVL(:REPORTNO,'0')",ROWNO "NVL(:ROWNO,' ')",ROWNAME "NVL(:ROWNAME,'0')",COL2VALUE "NVL(:COL2VALUE,'0')"

REPORT_RECORD.ctl:==
LOAD DATA
INFILE '/oracle/cfain/REPORT_RECORD_$DATE.txt'
TRUNCATE
INTO TABLE AIX_REPORT_RECORD
FIELDS TERMINATED BY '|'
TRAILING NULLCOLS

REPORTNO "NVL(:REPORTNO,'0')",REPORTDATE "NVL(:REPORTDATE,' ')",MODELNO "NVL(:MODELNO,'0')",REPORTSCOPE "NVL(:REPORTSCOPE,'0')",OBJECTNO "NVL(:OBJECTNO,'0')"

那一天的数据文件名举例:
ENT_INFO_20090909.txt REPORT_CATALOG_20090909.txt REPORT_DATA_20090909.txt REPORT_RECORD_20090909.txt

6、用ftp配置Unix/Linux文件的自动传输
ftpget.sh文件内容:(RedHat AS4环境下)
export DATE=`date +%Y%m%d`;
ftp -n<<!
open 192.168.80.5
user oracle oracle
prompt off
mget dl_$DATE.dmp yh_$DATE.dmp
quit

注:顺带说明一下:linux下,ftp的相关启动关闭命令如下:[root@localhost ~]# /etc/init.d/vsftpd start [root@localhost ~]# /etc/init.d/vsftpd stop [root@localhost ~]# /etc/init.d/vsftpd restart
说明:。sh脚本要有执行权限;ftp服务开启与关闭要在根用户下执行;本文用到的例子有在RedHat as4环境下的,有在IBM AIX环境下的,其中涉及到的环境变量等,都大同小异;脚本测试好之后可以配在Linux/Unix调度程序crontab中,以实现shell的自动定时运行!

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wwpxjj.html