配置导出的表:(configure.sh)
1 #!/bin/bash 2 3 function get_config() { 4 tables=( 5 BLOG 6 WF_PROCESS 7 WF_TASK 8 WF_TASK_ACTOR 9 ) 10 echo ${tables[@]} 11 }
主程序代码:(start.sh)
1 #!/bin/bash 2 3 source ./configure.sh 4 5 tables=$(get_config) 6 7 tmp_script=tmp/export.sh 8 9 for table in ${tables[@]} 10 do 11 echo "**** ${table} **** " 12 #echo "hello ${table} * !!" > ${file} 13 #chmod +x ${file} 14 echo "sqlplus -s 'SAJT_YUM/dzfp123@orcl' << "EOF"" > ${tmp_script} 15 echo "EXEC sql_to_csv('select * from ${table}','OUT_PATH','${table}.csv')" >> ${tmp_script} 16 echo "EOF" >> ${tmp_script} 17 chmod +x ${tmp_script} 18 ${tmp_script} 19 20 done 21 ~
oracle 导出数据的存储过程:
参考:http://blog.csdn.net/huangzhijie3918/article/details/72732816