ociuldr 支持分多个数据文件

在审计工作,将几亿条的oracle数据通过sqlserver自带工具导入到sqlserver中,速度不是特别的理想,虽然通过视图方式能提高一些速度,但是既不简洁,也不方便。

用ociuldr工具,可以支持生成多个数据文件,并通过bcp方式导入到sqlserver中,速度狠理想。


ociuldr工具默认一个batch是50W条记录(即:batch=2 表示100W条记录生成一个文件),通过指定file选项来定义生成的数据文件名,中间请用包含” %b “字样,

” %b “ 会被打印成序列号:


在虚拟机模拟如下:

SQL> select count(*) from yoon;

COUNT(*)
----------
7340032

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

1. 将ociuldr工具上传至BIN目录下

2. chown oracle.oinstall ociuldr

3. chmod 775 ociuldr

[oracle@db01 ~]$ ociuldr -help
Usage: ociuldr user=... query=... field=... record=... file=...
(@) Copyright Lou Fangxin 2004/2005, all rights reserved.
Notes:
-si = enable logon as SYSDBA
user = username/password@tnsname
sql = SQL file name
query = select statement
field = seperator string between fields
record= seperator string between records
file = output file name(default: uldrdata.txt)
read = set DB_FILE_MULTIBLOCK_READ_COUNT at session level
sort = set SORT_AREA_SIZE & SORT_AREA_RETAINED_SIZE at session level (UNIT:MB)
hash = set HASH_AREA_SIZE at session level (UNIT: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
mode = sqlldr option, INSERT or APPEND or REPLACE or TRUNCATE
log = log file name, prefix with + to append mode
long = maximum long field size
array = array fetch size
buffer= sqlldr READSIZE and BINDSIZE, default 16 (MB)

for field and record, you can use '0x' to specify hex character code,
\r=0x0d \n=0x0a |=0x7c ,=0x2c \t=0x09[oracle@db01 ~]# su - oracle

[oracle@db01 ~]$ ociuldr
user=scott/tiger@orcl query="select * from scott.yoon" field='<[!]>' record='<[end]>' file=/u01/yoon_%b.txt table=scott.yoon batch=2

2050 bytes allocated for column EMPNO (1)

550 bytes allocated for column ENAME (2)
500 bytes allocated for column JOB (3)
2050 bytes allocated for column MGR (4)
1050 bytes allocated for column HIREDATE (5)
2050 bytes allocated for column SAL (6)
2050 bytes allocated for column COMM (7)
2050 bytes allocated for column DEPTNO (8)

0 rows exported at 2014-10-30 01:13:21
500000 rows exported at 2014-10-30 01:13:46
1000000 rows exported at 2014-10-30 01:14:15
output file /u01/yoon_1.txt closed at 1000000 rows.
500000 rows exported at 2014-10-30 01:14:40
1000000 rows exported at 2014-10-30 01:15:07
output file /u01/yoon_2.txt closed at 1000000 rows.
500000 rows exported at 2014-10-30 01:15:36
1000000 rows exported at 2014-10-30 01:16:02
output file /u01/yoon_3.txt closed at 1000000 rows.
500000 rows exported at 2014-10-30 01:16:29
1000000 rows exported at 2014-10-30 01:16:48
output file /u01/yoon_4.txt closed at 1000000 rows.
500000 rows exported at 2014-10-30 01:17:05
1000000 rows exported at 2014-10-30 01:17:12
output file /u01/yoon_5.txt closed at 1000000 rows.
500000 rows exported at 2014-10-30 01:17:17
1000000 rows exported at 2014-10-30 01:17:22
output file /u01/yoon_6.txt closed at 1000000 rows.
500000 rows exported at 2014-10-30 01:17:27
1000000 rows exported at 2014-10-30 01:17:32
output file /u01/yoon_7.txt closed at 1000000 rows.
340032 rows exported at 2014-10-30 01:17:38
output file /u01/yoon_8.txt closed at 340032 rows.


[root@db01 u01]# ls
app backup yoon_1.txt yoon_2.txt yoon_3.txt yoon_4.txt yoon_5.txt yoon_6.txt yoon_7.txt yoon_8.txt

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
内容来自互联网,如有侵权通知后删除 sqluldr2是一款Oracle数据快速导出工具,包含32、64位程序,sqluldr2在大数据量导出方面速度超快,能导出亿级数据为excel文件,另外它的导入速度也是非常快速,功能是将数据以TXT/CSV等格式导出,有需要的赶快下载吧! oracle数据导出工具sqluldr2 基本简介   下载完sqluldr解压后,文件夹内容如下:   sqluldr2.exe 用于32位windows平台;   sqluldr2_linux32_10204.bin 适用于linux32位操作系统;   sqluldr2_linux64_10204.bin 适用于linux64位操作系统;   sqluldr264.exe 用于64位windows平台。 使用方法   1、首先将sqluldr2.exe复制到执行目录下,即可开始使用   2、查看help 帮助 sqluldr2 官方下载   3、执行数据导出命令   3.1、常规导出   sqluldr2 test/test@127.0.1.1/orcl query="select * from temp_001" head=yes file=d:\tmp001.csv   说明:head=yes 表示输出表头 oracle数据导出工具sqluldr2   3.2、使用sql参数   sqluldr2 test/test@127.0.1.1/orcl sql=test_sql.sql head=yes file=d:\tmp001.csv   test_sql的内容为:   select * from temp_001 sqluldr2 官方下载   3.3、使用log参数   当集成sqluldr2在脚本中时,就希望屏蔽上不输出这些信息,但又希望这些信息能保留,这时可以用“LOG”选项来指定日志文件名。   sqluldr2 test/test@127.0.1.1/orcl sql=test_sql.sql head=yes file=d:\tmp001.csv log=+d:\tmp001.log oracle数据导出工具sqluldr2   3.4、使用 table 参数   当使用 table 参数时,在目录下会生成对应的ctl控制文件,如下语句会生成temp_001_sqlldr.ctl文件。   sqluldr2 test/test@127.0.1.1/orcl query="select * from temp_001" table=temp_001 head=yes file=d:\tmp001.csv sqluldr2 官方下载   生成的控制文件temp_001_sqlldr.ctl的内容如下: oracle数据导出工具sqluldr2   4、主要参数说明   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   在选择隔符时,一定不能选择会在字段值中出现的字符

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值