解决 sqluldr2 导出乱码问题

今天试了一下sqluldr2 导出数据,果然是超级快。

官方下载: http://www.anysql.net/software/sqluldr.zip

sqluldr2_linux32_10204.bin

sqluldr2_linux64_10204.bin

sqluldr2.exe

sqluldr264.exe

 

第一次执行报错:

[oracle@tora80 backup]$ ./sqluldr2_linux32_10204.bin user=scott/tiger query="select * from t1 where rownum<10001" head=yes file=/home/oracle/x.csv;
./sqluldr2_linux32_10204.bin: error while loading shared libraries: libclntsh.so.10.1: cannot open shared object file: No such file or directory
 

设置环境变量:

[oracle@tora80 ~]$ vi .bash_profile

export LD_LIBRARY_PATH=$ORACLE_HOME/lib

 

 

但是这次导出发现都是乱码

查看一下参数:

[oracle@tora80 ~]$ ./sqluldr2_linux32_10204.bin -help

SQL*UnLoader: Fast Oracle Text Unloader (GZIP, Parallel), Release 4.0.1
(@) Copyright Lou Fangxin (AnySQL.net) 2004 - 2010, all rights reserved.

License: Free for non-commercial useage, else 100 USD per server.

Usage: SQLULDR2 keyword=value [,keyword=value,...]

Valid Keywords:
   user    = username/password@tnsname
   sql     = SQL file name
   query   = select statement
   field   = separator string between fields
   record  = separator string between records
   rows    = print progress for every given rows (default, 1000000)
   file    = output file name(default: uldrdata.txt)
   log     = log file name, prefix with + to append mode
   fast    = auto tuning the session level parameters(YES)
   text    = output type (MYSQL, CSV, MYSQLINS, ORACLEINS, FORM, SEARCH).
   charset = character set name of the target database.
   ncharset= national character set name of the target database.
   parfile = read command option from parameter file

  for field and record, you can use '0x' to specify hex character code,
  \r=0x0d \n=0x0a |=0x7c ,=0x2c, \t=0x09, :=0x3a, #=0x23, "=0x22 '=0x27

发现有个参数charset

尝试一下:

[oracle@tora80 backup]$ ./sqluldr2_linux32_10204.bin user=scott/tiger query="select * from t1 where rownum<10001" head=yes charset=ZHS16GBK  file=/home/oracle/x.csv;

          0 rows exported at 2014-01-09 16:10:07, size 0 MB.
       10000 rows exported at 2014-01-09 16:10:08, size 3 MB.
         output file /home/oracle/x.txt closed at 10000 rows, size 3 MB.

 

ok! 没有乱码了

阅读更多
个人分类: oracle db
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭