oracle跑批 shell,用shell脚本获取数据库服务器文件到应用服务器中完整版

#!/bin/bash

############################shell脚本说明##############xx#############

#获取数据库服务器文件到应用服务器中

#######################################################################

################具体实际步骤如下:###########

#前提:配置数据库服务器参数,配置文件路径

db_username=oracle #数据服务器登录用户账号

db_server_ip=10.192.xx.xxx #数据服务器ip

file_system_path1=/home/weblogic/files/rptExport #路径1(应用服务器存放文件路径)

file_system_path2=/home/oracle/ftp/files/rptExport #路径2 (数据库存放文件路径)

file_system_path3=/home/weblogic/files/rptExport #路径3 (shell脚本执行日志文件路径)

file_dt=$1 #文件日期,例如:20190321

exec_dt=`data "+%Y-%m-%d"` #执行日期

rm -f ${file_system_path3}/getfile_${exec_dt}.log

file_log =${file_system_path3}/getfile_${exec_dt}.log

echo "开始执行 GET DB TO WEB SERVER 跑批" >>${file_log}

echo "文件日期 :${file_dt}">>${file_log}

echo "执行日期 :${exec_dt}">>${exec_dt}

echo "WEB服务器文件存放目录:${file_system_path1}">>${file_log}

cd ${file_system_path1}

echo "sftp连接数据库服务器,执行命令:sftp ${db_server_ip}">>${file_log}

echo "sftp 连接数据库服务器获取下载文件,执行命令:get ${file_system_path2}/*${file_dt}*.gz">>${file_log}

echo "sftp连接数据库服务器下载文件,执行命令:rm ${file_system_path2}/*${file_dt}*.gz">>${file_log}

sftp ${db_username}@${db_server_ip}<> ${file_log}

echo "执行GET DB TO WEB SERVER 跑批结束">>${file_log}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值