oracel 学习之:sqluldr2使用

2023-11-22 02:08
文章标签 学习 使用 sqluldr2 oracel

本文主要是介绍oracel 学习之:sqluldr2使用,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

                                                                                       sqluldr2
  
简单介绍
简介:
Sqluldr2:专业用于大数据量导出工具之一,效率比普通导出快70%。 ( Sqlldr:专业用于导入的工具之一,请注意两个工具的区别。),在使用时,最好用磁盘写入速度快,网络好,网速快的做。
内部实现
[sql] view plain copy print ?
  1. #include <stdio.h>  
  2. #include "sqluldr2.h"  
  3.    
  4. void main()  
  5. {  
  6.  void *h = NULL;  
  7.  SQLULDR2HandleAlloc(&h);  
  8.   if(h != NULL)  
  9.   {  
  10.      SQLULDR2HandleSetAttr(h, "USER=SYS");  
  11.      SQLULDR2HandleSetAttr(h, "QUERY=SELECT * FROM TAB");  
  12.      SQLULDR2HandleExecute(h);  
  13.      SQLULDR2HandleFree(h);  
  14.   }  
  15. }  
  16.    
#include <stdio.h>
#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 plain copy print ?
  1. C:\Users\meng\Desktop\sqluldr2>sqluldr2.exe help=yes  
  2.   
  3.   
  4. SQL*UnLoader: Fast Oracle Text Unloader (GZIP, Parallel), Release 4.0.1  
  5. (@) Copyright Lou Fangxin (AnySQL.net) 2004 - 2010, all rights reserved.  
  6.   
  7.   
  8. License: Free for non-commercial useage, else 100 USD per server.  
  9.   
  10.   
  11. Usage: SQLULDR2 keyword=value [,keyword=value,...]  
  12.   
  13.   
  14. Valid Keywords:  
  15.    user    = username/password@tnsname  
  16.    sql     = SQL file name  
  17.    query   = select statement  
  18.    field   = separator string between fields  
  19.    record  = separator string between records  
  20.    rows    = print progress for every given rows (default, 1000000)  
  21.    file    = output file name(default: uldrdata.txt)  
  22.    log     = log file name, prefix with + to append mode  
  23.    fast    = auto tuning the session level parameters(YES)  
  24.    text    = output type (MYSQL, CSV, MYSQLINS, ORACLEINS, FORM, SEARCH).  
  25.    charset = character set name of the target database.  
  26.    ncharset= national character set name of the target database.  
  27.    parfile = read command option from parameter file  
  28.    read    = set DB_FILE_MULTIBLOCK_READ_COUNT at session level  
  29.    sort    = set SORT_AREA_SIZE at session level (UNIT:MB)  
  30.    hash    = set HASH_AREA_SIZE at session level (UNIT:MB)  
  31.    array   = array fetch size  
  32.    head    = print row header(Yes|No)  
  33.    batch   = save to new file for every rows batch (Yes/No)  
  34.    size    = maximum output file piece size (UNIB:MB)  
  35.    serial  = set _serial_direct_read to TRUE at session level  
  36.    trace   = set event 10046 to given level at session level  
  37.    table   = table name in the sqlldr control file  
  38.    control = sqlldr control file and path.  
  39.    mode    = sqlldr optionINSERT or APPEND or REPLACE or TRUNCATE  
  40.    buffer  = sqlldr READSIZE and BINDSIZE, default 16 (MB)  
  41.    long    = maximum long field size  
  42.    width   = customized max column width (w1:w2:...)  
  43.    quote   = optional quote string  
  44.    data    = disable real data unload (NOOFF)  
  45.    alter   = alter session SQLs to be execute before unload  
  46.    safe    = use large buffer to avoid ORA-24345 error (Yes|No)  
  47.    crypt   = encrypted user information only (Yes|No)  
  48.    sedf/t  = enable character translation function  
  49.    null    = replace null with given value  
  50.    escape  = escape character for special characters  
  51.    escf/t  = escape from/to characters list  
  52.    format  = MYSQL: MySQL Insert SQLs, SQL: Insert SQLs.  
  53.    exec    = the command to execute the SQLs.  
  54.    prehead = column name prefix for head line.  
  55.    rowpre  = row prefix string for each line.  
  56.    rowsuf  = row sufix string for each line.  
  57.    colsep  = separator string between column name and value.  
  58.    presql  = SQL or scripts to be executed before data unload.  
  59.    postsql = SQL or scripts to be executed after data unload.  
  60.    lob     = extract lob values to single file (FILE).  
  61.    lobdir  = subdirectory count to store lob files .  
  62.    split   = table name for automatically parallelization.  
  63.    degree  = parallelize data copy degree (2-128).  
  64.    hint    = MySQL SQL hint for the Insertfor example IGNORE.  
  65.    unique  = Unique Column List for the MySQL target table.  
  66.    update  = Enable MySQL ON DUPLICATE SQL statement(YES/NO).  
  67.   
  68.   
  69.   for field and record, you can use '0x' to specify hex character code,  
  70.   \r=0x0d \n=0x0a |=0x7c ,=0x2c, \t=0x09, :=0x3a, #=0x23, "=0x22 '=0x27  
  71.   
  72. C:\Users\meng\Desktop\sqluldr2>  
  73.    
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<=to_date('2012-06-2700:01:59','yyyy-mm-dd hh24:mi:ss') AND dt.msc= devdim105.mapvalue(+) ANDdevdim105.deviceid=15 " head=yes FILE=F:\cs_XXX_test.csv
代码例子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进行 入库。
转自: http://blog.csdn.net/shushugood/article/details/7725984

这篇关于oracel 学习之:sqluldr2使用的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/406707

相关文章

使用Java将DOCX文档解析为Markdown文档的代码实现

《使用Java将DOCX文档解析为Markdown文档的代码实现》在现代文档处理中,Markdown(MD)因其简洁的语法和良好的可读性,逐渐成为开发者、技术写作者和内容创作者的首选格式,然而,许多文... 目录引言1. 工具和库介绍2. 安装依赖库3. 使用Apache POI解析DOCX文档4. 将解析

Qt中QUndoView控件的具体使用

《Qt中QUndoView控件的具体使用》QUndoView是Qt框架中用于可视化显示QUndoStack内容的控件,本文主要介绍了Qt中QUndoView控件的具体使用,具有一定的参考价值,感兴趣的... 目录引言一、QUndoView 的用途二、工作原理三、 如何与 QUnDOStack 配合使用四、自

C++使用printf语句实现进制转换的示例代码

《C++使用printf语句实现进制转换的示例代码》在C语言中,printf函数可以直接实现部分进制转换功能,通过格式说明符(formatspecifier)快速输出不同进制的数值,下面给大家分享C+... 目录一、printf 原生支持的进制转换1. 十进制、八进制、十六进制转换2. 显示进制前缀3. 指

使用Python构建一个Hexo博客发布工具

《使用Python构建一个Hexo博客发布工具》虽然Hexo的命令行工具非常强大,但对于日常的博客撰写和发布过程,我总觉得缺少一个直观的图形界面来简化操作,下面我们就来看看如何使用Python构建一个... 目录引言Hexo博客系统简介设计需求技术选择代码实现主框架界面设计核心功能实现1. 发布文章2. 加

shell编程之函数与数组的使用详解

《shell编程之函数与数组的使用详解》:本文主要介绍shell编程之函数与数组的使用,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录shell函数函数的用法俩个数求和系统资源监控并报警函数函数变量的作用范围函数的参数递归函数shell数组获取数组的长度读取某下的

使用Python开发一个带EPUB转换功能的Markdown编辑器

《使用Python开发一个带EPUB转换功能的Markdown编辑器》Markdown因其简单易用和强大的格式支持,成为了写作者、开发者及内容创作者的首选格式,本文将通过Python开发一个Markd... 目录应用概览代码结构与核心组件1. 初始化与布局 (__init__)2. 工具栏 (setup_t

Python虚拟环境终极(含PyCharm的使用教程)

《Python虚拟环境终极(含PyCharm的使用教程)》:本文主要介绍Python虚拟环境终极(含PyCharm的使用教程),具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,... 目录一、为什么需要虚拟环境?二、虚拟环境创建方式对比三、命令行创建虚拟环境(venv)3.1 基础命令3

Python Transformer 库安装配置及使用方法

《PythonTransformer库安装配置及使用方法》HuggingFaceTransformers是自然语言处理(NLP)领域最流行的开源库之一,支持基于Transformer架构的预训练模... 目录python 中的 Transformer 库及使用方法一、库的概述二、安装与配置三、基础使用:Pi

关于pandas的read_csv方法使用解读

《关于pandas的read_csv方法使用解读》:本文主要介绍关于pandas的read_csv方法使用,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录pandas的read_csv方法解读read_csv中的参数基本参数通用解析参数空值处理相关参数时间处理相关

使用Node.js制作图片上传服务的详细教程

《使用Node.js制作图片上传服务的详细教程》在现代Web应用开发中,图片上传是一项常见且重要的功能,借助Node.js强大的生态系统,我们可以轻松搭建高效的图片上传服务,本文将深入探讨如何使用No... 目录准备工作搭建 Express 服务器配置 multer 进行图片上传处理图片上传请求完整代码示例