sqluldr2 简单介绍 : 简介: sqluldr2 :专业用于大数据量导出工具之一,效率比普通导出快70%。 ( sqlldr :专业用于导入的工具之一,请注意两个工具的区别。),在使用时,最好用磁盘写入速度快,网络好,网速快的做。 内部实现 : [sql] view plaincopy #inc
sqluldr2
简单介绍:
简介:
sqluldr2:专业用于大数据量导出工具之一,效率比普通导出快70%。 ( sqlldr:专业用于导入的工具之一,请注意两个工具的区别。),在使用时,最好用磁盘写入速度快,网络好,网速快的做。
内部实现:
[sql] view plaincopy
#include #include sqluldr2.h void main() { void *h = null; sqluldr2handlealloc(&h); if(h != null) { sqluldr2handlesetattr(h, user=sys); sqluldr2handlesetattr(h, query=select * from tab); sqluldr2handleexecute(h); sqluldr2handlefree(h); } }
工具列表:
针对不同平台用不同的导出工具:
windows: sqluldr2.exe
linux(32位): sqluldr2_linux32_10204.bin
linux(64位): sqluldr2_linux64_10204.bin
使用说明 (windows平台):
使用sqluldr2的步骤:
1.打开运行àcmd进入到sqluldr2.exe的当前目录
2.参数介绍
user=用户/密码@tns
query=”查询语句”
file= 导出的路径
head= 输出信息时,yes表示要表头,no表示不要表头
注意:想查看更多参数,请输入 sqluldr2 help=yes
[sql] view plaincopy
c:\users\meng\desktop\sqluldr2>sqluldr2.exe help=yes 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 read = set db_file_multiblock_read_count at session level sort = set sort_area_size at session level (unit:mb) hash = set hash_area_size at session level (unit:mb) array = array fetch size head = print row header(yes|no) batch = save to new file for every rows batch (yes/no) size = maximum output file piece size (unib:mb) serial = set _serial_direct_read to true at session level trace = set event 10046 to given level at session level table = table name in the sqlldr control file control = sqlldr control file and path. mode = sqlldr option, insert or append or replace or truncate buffer = sqlldr readsize and bindsize, default 16 (mb) long = maximum long field size width = customized max column width (w1:w2:...) quote = optional quote string data = disable real data unload (no, off) alter = alter session sqls to be execute before unload safe = use large buffer to avoid ora-24345 error (yes|no) crypt = encrypted user information only (yes|no) sedf/t = enable character translation function null = replace null with given value escape = escape character for special characters escf/t = escape from/to characters list format = mysql: mysql insert sqls, sql: insert sqls. exec = the command to execute the sqls. prehead = column name prefix for head line. rowpre = row prefix string for each line. rowsuf = row sufix string for each line. colsep = separator string between column name and value. presql = sql or scripts to be executed before data unload. postsql = sql or scripts to be executed after data unload. lob = extract lob values to single file (file). lobdir = subdirectory count to store lob files . split = table name for automatically parallelization. degree = parallelize data copy degree (2-128). hint = mysql sql hint for the insert, for example ignore. unique = unique column list for the mysql target table. update = enable mysql on duplicate sql statement(yes/no). 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 c:\users\meng\desktop\sqluldr2>
代码例子1:
sqluldr2.exe user=用户/密码@tnsquery=select /*+ parallel(8) */ *from cs_xxx dt,cfg_xxx devdim105 wheredt.starttime>=to_date('2012-06-27 00:00:00','yyyy-mm-dd hh24:mi:ss') and dt.starttime
代码例子2(这种方式用于导出的查询sql很长,那么就把sql写在123.sql文件里 ):
sqluldr2.exe user=用户/密码@tns sql=123.sqlhead=yes file=f:\cs_xxx_test.csv
3.在cmd里,直接把步骤2的代码例子1 ,贴进去执行。
注:如果执行报报错,就有可能是环境变量path的问题,还有就是plsql需要的oci.dll文件等多个dll文件,请放在sqluldr2的目录下。
4.查看结果f:\cs_xxx_test.csv
5.打开csv里面的内容,就可以用sqlldr进行 入库。