###this script run a query to generate an output file and ftp to remote site.
export ORACLE_SID=PROD
ORAENV_ASK=NO
. oraenv
FTP="ip.ip.ip.ip"
LOGIN="ftpuser"
PASS="password"
sqlplus -s " / as sysdba" < set verify off
set pagesize 0
set linesize 500
set head on
--set markup html on
set feedback off
set timing off
--set pagesize 0
set colsep ,
col channel_name format a29
col programme_name format a49
col house_media format a9
spool /folder/filename.csv
SELECT statement;
spool off
exit
EOF
ftp -nv $FTP < /folder/log.log
echo "############# Starting FTP to $FTP ###################"
user $LOGIN $PASS
type ascii
lcd /folder
del filename.csv
put filename.csv
dir filename.csv
quit
EOFLOG
echo finished ftp
export ORACLE_SID=PROD
ORAENV_ASK=NO
. oraenv
FTP="ip.ip.ip.ip"
LOGIN="ftpuser"
PASS="password"
sqlplus -s " / as sysdba" <
set pagesize 0
set linesize 500
set head on
--set markup html on
set feedback off
set timing off
--set pagesize 0
set colsep ,
col channel_name format a29
col programme_name format a49
col house_media format a9
spool /folder/filename.csv
SELECT statement;
spool off
exit
EOF
ftp -nv $FTP <
echo "############# Starting FTP to $FTP ###################"
user $LOGIN $PASS
type ascii
lcd /folder
del filename.csv
put filename.csv
dir filename.csv
quit
EOFLOG
echo finished ftp
Comments
Post a Comment