1,
因为要定时运行此脚本.采用crontab
crontab -e oracle --编辑oracle 用户的crontab作业列表
1 12 * * 6 运行shell脚本目录/run.sh ---红色改成局方需要定时运行的时间
chmod u+x 运行shell脚本目录/run.sh ---给于脚本执行权限
2,run.sh脚本文件内容如下:
. ./. profile
sqlplus aaa/aaa @运行脚本文件目录/exp_txt.sql
mv 存储txt文件目录/true.txt 存储txt文件目录/true_$(date +%y%m%d).txt ---采用对生成的txt文件重命名,不然会覆盖原有的
2,exp_txt.sql内容如下:
set pagesize 9999
set feedback off
spool 存储txt文件目录/true.txt ---true.txt就是局方要的txt文件
select mdn,imsi from mdn_imsi;
spool off
exit
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9240380/viewspace-547195/
,如需转载,请注明出处,否则将追究法律责任。