Linux 把shell脚本执行的结果写到文件中

Linux自动化任务执行时,shell脚本的内容一值没有写到文件中
[ora11g@taopeng u01]$ cat select_emp.sh
export PATH=/u01/oracle/db_1/bin:$PATH
export ORACLE_SID=orcl
sqlplus scott/oracle @/u01/select_emp.sql
[ora11g@taopeng u01]$ cat select_emp.sql
select * from emp ;
quit

两个方法:
1.用Oracle 的spool方法 在sql语句里面加两行select_emp.sql 写成这样:
spool emp.txt;
select * from emp;
spool off
quit
2.使用linux方法:
增加一个shell调用这个select_emp.sh:就取名为:run_select.sh 内容为:
./select_emp.sh 1>emp.txt 2>/dev/null
温馨提示:答案为网友推荐,仅供参考

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网