sqluldr2的介紹
Sqluldr2
簡單介紹:
簡介:
Sqluldr2:專業用於大資料量匯出工具之一,效率比普通匯出快70%。 ( Sqlldr:專業用於匯入的工具之一,請注意兩個工具的區別。),在使用時,最好用磁碟寫入速度快,網路好,網速快的做。
內部實現:
-
#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
- 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
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/14184018/viewspace-751092/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- sqluldr2使用幾例SQL
- Cloudera的介紹Cloud
- Redis的介紹Redis
- MySQLTuner的介紹MySql
- VQGAN的介紹
- 介紹
- Mongo的bulkWrite介紹Go
- DruidDataSource的介紹UI
- ThreadLocal的介紹thread
- hazelcast的基本介紹AST
- boost庫的介紹
- HashSet的特性介紹
- 老的Websocket介紹Web
- Oracle使用sqluldr2匯出資料OracleSQL
- LAMP架構介紹、MYSQL介紹、安裝LAMP架構MySql
- JVM中堆的介紹JVM
- 伺服器的介紹伺服器
- ORACLE MTS的介紹(zt)Oracle
- Webpack 的簡單介紹Web
- orbeon form 的配置介紹ORBORM
- 代理ip的功能介紹
- 最通俗的機器學習介紹機器學習
- python類的介紹Python
- spring框架的介紹Spring框架
- ActiveMq的基礎介紹MQ
- HTML的介紹與seoHTML
- layui 的基本使用介紹UI
- JDBC的基礎介紹JDBC
- JQuery的介紹與使用jQuery
- Geth的命令列介紹命令列
- Promise的簡單介紹Promise
- CFRunloopObserverRef 的簡單介紹OOPServer
- java常用的框架介紹Java框架
- Mysql Binlog的介紹MySql
- SQL Server xtype的介紹SQLServer
- javascript prototype介紹的文章JavaScript
- rlwrap的安裝介紹
- Trim() 函式的介紹函式