--Download: sqluldr2_linux_jb51.rar
After downloading and decompressing sqluldr, the contents of the folder are as follows:
sqluldr2.exe for 32-bit windows platform;
sqluldr2_linux32_10204.bin for linux32 bit operating system;
sqluldr2_linux64_10204.bin for linux64-bit operating system;
sqluldr264.exe is for 64-bit windows platform.
---One, install the sqluldr2 tool
cd /home/oracle/tools
unzip sqluldr2_linux_jb51.rar
--- use linux64 bit sqluldr2_linux64_10204.bin
mv sqluldr2_linux64_10204.bin sqluldr2
---Grant execute permission
chmod +x sqluldr2
--Add environment variable
vi .bash_profile
export LD_LIBRARY_PATH=$ORACLE_HOME/bin:$ORACLE_HOME/lib:/lib:/usr/lib
LD_LIBRARY_PATH=$ORACLE_HOME/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export LD_LIBRARY_PATH
---Execute sqluldr2 in the installation directory and see the following results, indicating that the installation is successful!
[oracle@test-zdhcsdb-tools]$ sqluldr2
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
--- 2. Execute the export under the sqluldr2 command line
[oracle@test tools]$ ls
csv.log data data.log scripts.txt sql.file sqluldr2
---Three, edit the SQL file
you sql.file
SELECT A.* FROM TEST.T_TEST_TA A
LEFT JOIN TEST.T_TEST_SF F
ON F.KN = A.ID
AND F.S_DT BETWEEN '20180501' AND '20180531'
WHERE A.T_DT BETWEEN '20180501' AND '20180531'
AND D.RY = '01';
---Execute command
--Produce N 40M files
time sqluldr2 user=test/123456 sql=sql.file field=0x2c record=0x0d0x0a size=40M text=CSV safe=Yes file=./data/csv201805_%b. csv fast=yes log=csv.log charset=ZHS16GBK
--- generate a file
time sqluldr2 user=test/123456 sql=sql.file field=0x2c record=0x0d0x0a text=CSV safe=Yes file=./data/csv201805.csv fast=yes log=csv.log charset=ZHS16GBK