已在测试环境测试ok
安装
将sqluldr2.exe sqluldr264.exe放在oracle的客户端product\11.2.0\client_1\BIN下面
cmd执行sqluldr2 出现帮助命令即为成功,建议安装完整oracle客户端
成功显示如下:
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
使用
sqluldr2 user=system/oracle123@192.168.1.110:1521/orcl query=“select * from test where myname=‘11111111111111111111111111111’” head=yes file=d:\my.csv charset=ZHS16GBK
执行发现命令没有报错,但无文件导出,sqlplus登陆发现system用户密码快到期,修改后可以正常导出
大表分割导出
sqluldr2 user=system/oracle123@192.168.1.110:1521/orcl query=“select * from test” head=yes file=d:\my_%B.csv batch=yes rows=4000
0 rows exported at 2023-02-14 18:58:12, size 0 MB.
4000 rows exported at 2023-02-14 18:58:12, size 0 MB.
output file d:\my_1.csv closed at 4000 rows, size 0 MB.
4000 rows exported at 2023-02-14 18:58:12, size 0 MB.
output file d:\my_2.csv closed at 4000 rows, size 0 MB.
2000 rows exported at 2023-02-14 18:58:12, size 0 MB.
output file d:\my_3.csv closed at 2000 rows, size 0 MB.
更多的使用可以参考help