SQLLOADER 11 载入有换行符的数据(1) (no result)

一 描述

此档是sqlloader学习的第11篇.载入有换行符的数据,目的使用fix参数加载固定格式flat源数据文件.

二 操作环境

OS info

windows 2003 32bit

DB info

连接到:
Oracle9i Enterprise Edition Release 9.0.1.1.1 - Production
With the Partitioning option
JServer Release 9.0.1.1.1 - Production

SQL> set lines 150
SQL> COL PRODUCT FORMAT A55
SQL> COL VERSION FORMAT A15
SQL> COL STATUS FORMAT A15
SQL> SELECT * FROM PRODUCT_COMPONENT_VERSION;

PRODUCT                                                 VERSION         STATUS
------------------------------------------------------- --------------- ---------------
NLSRTL                                                  9.0.1.1.1       Production
Oracle9i Enterprise Edition                             9.0.1.1.1       Production
PL/SQL                                                  9.0.1.1.1       Production
TNS for 32-bit Windows:                                 9.0.1.1.0       Production

SQL>

other

脚本目录:C:\sqlloader_exec\ppt_case10

三 过程设计

1.准备的flat源数据demo17.dat
10,Sales,Virginia,01-april-2001,This is the Sales
Office in Virginia
20,Accounting,Virginia,13/04/2001,This is the Accounting
Office in Virginia
30,Consulting,Virginia,14/04/2001 12:02:02,This is the Consulting
Office in Virginia
40,Finance,Virginia,987268297,This is the Finance
Office in Virginia

(注:)
2.相关文件ppt_case10_1.sql
rem
rem
rem

set termout off

drop table dept_p10_1;
create table dept_p10_1 (deptno number(2),dname char(20),loc char(20),last_updated date,comments varchar2(100));
exit;

3.相关文件ppt_case10_1.ctl
LOAD DATA
INFILE demo17.dat "fix 70"
INTO TABLE DEPT_P10_1
TRUNCATE
FIELDS TERMINATED BY ','
TRAILING NULLCOLS
(DEPTNO,
DNAME "upper(:dname)",
LOC "upper(:loc)",
LAST_UPDATED "my_to_date( :last_updated )",
COMMENTS
)

4.以scott用户登 数据库运行ppt_case10_1.sql初始化环境.
5.在cmd命令下执行sqlldr加载ppt_case10_1.ctl控制文件命令
6.查看sqlldr日志信息
7.查看sqlldr bad日志信息
8.查看数据库加载成功的数据

四 详细步骤操作

1.以scott用户登 数据库运行ppt_case10_1.sql初始化环境.
C:\sqlloader_exec\ppt_case10>sqlplus "scott/tiger"

SQL*Plus: Release 9.0.1.0.1 - Production on 星期二 8月 7 11:15:22 2012

(c) Copyright 2001 Oracle Corporation.  All rights reserved.


连接到:
Oracle9i Enterprise Edition Release 9.0.1.1.1 - Production
With the Partitioning option
JServer Release 9.0.1.1.1 - Production

SQL> @ppt_case10_1
从Oracle9i Enterprise Edition Release 9.0.1.1.1 - Production
With the Partitioning option
JServer Release 9.0.1.1.1 - Production中断开

C:\sqlloader_exec\ppt_case10>

2.在cmd命令下执行sqlldr加载ppt_case10_1.ctl控制文件命令
C:\sqlloader_exec\ppt_case10>sqlldr "scott/tiger" control=ppt_case10_1.ctl

SQL*Loader: Release 9.0.1.1.1 - Production on 星期二 8月 7 11:15:35 2012

(c) Copyright 2001 Oracle Corporation.  All rights reserved.

达到提交点,逻辑记录计数4

C:\sqlloader_exec\ppt_case10>

3.查看sqlldr日志信息
SQL*Loader: Release 9.0.1.1.1 - Production on 星期二 8月 7 11:15:35 2012

(c) Copyright 2001 Oracle Corporation.  All rights reserved.

控制文件: ppt_case10_1.ctl
数据文件: demo17.dat
文件处理选项字符串: "fix 70"
错误文件: demo17.bad
废弃文件: 未作指定
:
(可废弃所有记录)

加载数: ALL
跳过数: 0
允许的错误: 50
绑定数组: 64 行,最大 256000 字节
继续:    未作指定
所用路径:       常规

表DEPT_P10_1
已加载从每个逻辑记录
插入选项对此表TRUNCATE生效
TRAILING NULLCOLS 选项生效

   列名                        位置      长度  中止 包装数据类型
------------------------------ ---------- ----- ---- ---- ---------------------
DEPTNO                              FIRST     *    ,      CHARACTER           
DNAME                                NEXT     *    ,      CHARACTER           
    列的 SQL 串: "upper(:dname)"
LOC                                  NEXT     *    ,      CHARACTER           
    列的 SQL 串: "upper(:loc)"
LAST_UPDATED                         NEXT     *    ,      CHARACTER           
    列的 SQL 串: "my_to_date( :last_updated )"
COMMENTS                             NEXT     *    ,      CHARACTER           

记录 1: 被拒绝 - 表 DEPT_P10_1 的列 LAST_UPDATED 出现错误。
ORA-06502: PL/SQL: 数字或值错误 :  字符到数值的转换错误
ORA-06512: 在"SCOTT.MY_TO_DATE", line 20

记录 2: 被拒绝 - 表 DEPT_P10_1 的列 DEPTNO 出现错误。
ORA-01722: 无效数字

记录 3: 被拒绝 - 表 DEPT_P10_1 的列 DEPTNO 出现错误。
ORA-01722: 无效数字

记录 4: 被拒绝 - 表 DEPT_P10_1 的列 DEPTNO 出现错误。
ORA-01722: 无效数字


表DEPT_P10_1:
0 行加载成功
由于数据错误, 4 行没有加载。
由于所有 WHEN 子句失败, 0 行没有加载。
由于所有字段都为空的, 0 行没有加载。


为结合数组分配的空间:    82560字节(64行)
读取   缓冲区字节数: 1048576

跳过的逻辑记录总数:        0
读取的逻辑记录总数:        4
拒绝的逻辑记录总数:        4
废弃的逻辑记录总数:        0

从星期二 8月  07 11:15:35 2012开始运行
在星期二 8月  07 11:15:37 2012处运行结束

经过时间为: 00: 00: 02.00
CPU 时间为: 00: 00: 00.05(可?

4.查看sqlldr bad日志信息
10,Sales,Virginia,01-april-2001,This is the Sales
Office in Virginia
20,Accounting,Virginia,13/04/2001,This is the Accounting
Office in Virginia
30,Consulting,Virginia,14/04/2001 12:02:02,This is the Consulting
Office in Virginia
40,Finance,Virginia,987268297,This is t

五 个人总结

关于sqlldr fix参数,很是无语.没有实验出来倒底要怎么使用.官档目前还没有读到相应的fix使用方法,这里留记!

六 资料参考引用

http://afy.itpub.net/post/1128/22073

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/11780477/viewspace-740207/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/11780477/viewspace-740207/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值