oracle数据导出工具sqluldr2安装及使用
sqluldr2是一款Oracle數據快速導出工具,包含32、64位程序,sqluldr2在大數據量導出方面速度超快,能導出億級數據為excel文件,另外它的導入速度也是非常快速,功能是將數據以TXT/CSV等格式導出
1,下載sqluldr2,選擇linux64位版本
https://pan.baidu.com/s/1JCH8Rn-aCFyqEyouXE0k7Q
2,將sqluldr2_linux64_10204.bin 拷貝到oracle安裝目錄
3,執行命令sqluldr2_linux64_10204.bin,報錯如下
4,發現當前環境有libclntsh.so.11.1,與sqluldr2 所需包差小版本號,嘗試建立軟連接文件
ln -s? libclntsh.so.11.1 libclntsh.so.10.1
再次執行sqluldr2_linux64_10204.bin,成功,顯示其相關參數幫助。
[oracle@base0182 ~]$ sqluldr2_linux64_10204.bin 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@tnsnamesql???? = SQL file namequery?? = select statementfield?? = separator string between fieldsrecord? = separator string between recordsrows??? = print progress for every given rows (default, 1000000) file??? = output file name(default: uldrdata.txt)log???? = log file name, prefix with + to append modefast??? = 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 主要參數說明Field? 分隔符? 指定字段分隔符,默認為逗號
record 分隔符? 指定記錄分隔符,默認為回車換行,Windows下的換行
quote? 引號符? 指定非數字字段前后的引號符
例如現在要改變默認的字段分隔符,用“#”來分隔記錄,導出的命令如下所示:
sqluldr2? test/test sql=tmp.sql field=#
在指定分隔符時,可以用字符的ASCII代碼(0xXX,大寫的XX為16進制的ASCII碼值)來指定一個字符,常用的字符的ASCII代碼如下:
回車=0x0d,換行=0x0a,TAB鍵=0x09,|=0x7c,&=0x26,雙引號=0x22,單引號=0x27
在選擇分隔符時,一定不能選擇會在字段值中出現的字符, 如有文字描述字段,就不能使用默認的逗號分隔符。
5,執行數據導出
5.1,常規導出
sqluldr2_linux64_10204.bin? user=test/test@history_162 query="select * from temp_001" head='yes' file=/home/oracle/temp_001.txt
sqluldr2_linux64_10204.bin? user=test/test@history_162 query=tmp.sql head='yes' file=/home/oracle/temp_001.txt
tmp.sql的內容為:select * from temp_001
5.3,使用log參數
當集成sqluldr2在腳本中時,就希望屏蔽上不輸出這些信息,但又希望這些信息能保留,這時可以用“LOG”選項來指定日志文件名。
sqluldr2_linux64_10204.bin? user=test/test@history_162 query=tmp.sql head='yes' file=/home/oracle/temp_001.txt log=+d:\tmp001.log
5.4,使用 table 參數
當使用 table 參數時,在目錄下會生成對應的ctl控制文件,如下語句會生成temp_001_sqlldr.ctl文件。
sqluldr2_linux64_10204.bin? user=test/test@history_162 query=tmp_sql table=temp_001 head='yes' file=/home/oracle/temp_001.txt
總結
以上是生活随笔為你收集整理的oracle数据导出工具sqluldr2安装及使用的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: C++多线程(一)
- 下一篇: E20170830-mk