DB_USER=bidw #DB USER
DB_PWD=zaq12wsx #DB PASSWORD
DB_SERV=abc_dw_prd #DB SERVICE NAME
sqlplus -s $DB_USER/$DB_PWD@$DB_SERV<<EOF
set underline off
set trimspool on //去除重定向(spool)输出每行的拖尾空格,缺省为off
set linesize 5200
set pagesize 20000
set newpage 1
set heading off //输出域标题,缺省为on 设置为off就去掉了select结果的字段名,只显示数据
set term off
set wrap on
set echo off //设置运行命令是是否显示语句
set feedback off //回显本次sql命令处理的记录条数
set newp none //设置查询出来的数据分多少页显示,如果需要连续的数据,中间不要出现空行就把newp设置为none,这样输出的数据行都是连续的,中间没有空行之类的
set pagesize 0 //输出每页行数,缺省为24,为了避免分页,可设定为0
set termout off //显示脚本中的命令的执行结果
spool /u/ODI2F/salebudget_3101G.txt
#使用你的select语句进行替换;
spool off
EOF
jdbc:snps:dbfile?ENCODING=utf8
再导出文件,中文已经能正常显示。
附JAVA文件编码类型:
https://docs.oracle.com/javase/8/docs/technotes/guides/intl/encoding.doc.html
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/675255/viewspace-2063981/ ,如需转载,请注明出处,否则将追究法律责任。