在linux下导出 csv,dat,txt 等各种详单数据(只针对大数据量导出)
[root@racdb1 tmp]# ls sqluldr2_linux64_10204.bin [root@racdb1 tmp]# ./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@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 [root@racdb1 tmp]# ls
--导出命令
[root@racdb1 tmp]# ls sqluldr2_linux64_10204.bin [root@racdb1 tmp]# pwd /home/data/tmp [root@racdb1 tmp]# ./sqluldr2_linux64_10204.bin USER=用户名/密码@ip:1521/sid QUERY="select /*+ parallel(8) */ a||'|'||b from cs_xxx dt where rownum<10 " head=no FILE=/home/data/tmp/cs_xxx.dat 0 rows exported at 2013-02-19 11:11:18, size 0 MB. 9 rows exported at 2013-02-19 11:11:18, size 0 MB. output file /home/data/tmp/cs_xxx.dat closed at 9 rows, size 0 MB. [root@racdb1 tmp]# ll total 184 -rw-r--r-- 1 root root 28 Feb 19 11:11 cs_xxx.dat -rwxrwxrwx 1 root root 176170 Feb 19 11:01 sqluldr2_linux64_10204.bin [root@racdb1 tmp]# more cs_third_cdr.dat | | 2532860098|