前言
如何在sqlldr中的ctl文件的infile里 引入变量 折腾一晚上 实在没招啊测试明细
生成加载到ORACLE的原数据[oracle@seconary zhaixunyang]$ pwd
/home/oracle/zhaixunyang
[oracle@seconary zhaixunyang]$ more data_source.txt
1,2
2,3
3,4
创建用于加载数据的测试表
[oracle@seconary zhaixunyang]$ sqlplus scott/system
SQL*Plus: Release 11.2.0.1.0 Production on Thu Jun 11 14:20:05 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> create table t_source(a int,b int);
Table created.
生成SQL LOADER加载数据的控制文件
[oracle@seconary zhaixunyang]$ more insert_source.ctl
load data
infile '/home/oracle/zhaixunyang/data_source.txt'
append into table t_source
fields terminated by ','
(a,b)
运行sql loader
[oracle@seconary zhaixunyang]$ sqlldr userid=scott/system control=insert_source.ctl log=sqlloader.log
SQL*Loader: Release 11.2.0.1.0 - Production on Thu Jun 11 14:23:57 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Commit point reached - logical record count 4
验证SQLLOADER加载结果
[oracle@seconary zhaixunyang]$ sqlplus scott/system
SQL*Plus: Release 11.2.0.1.0 Production on Thu Jun 11 14:24:16 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select a,b from t_source;
A B
---------- ----------
1 2
2 3
3 4
截断测试表数据
[oracle@seconary zhaixunyang]$ sqlplus scott/system
SQL*Plus: Release 11.2.0.1.0 Production on Thu Jun 11 14:26:57 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> truncate table t_source;
Table truncated.
复制原数据到ORACLE_HOME下
[oracle@seconary zhaixunyang]$ cp data_source.txt $ORACLE_HOME
[oracle@seconary zhaixunyang]$
调整SQL LOADER 控制文件
[oracle@seconary zhaixunyang]$ more insert_source.ctl
load data
infile '$ORACLE_HOME/data_source.txt'
append into table t_source
fields terminated by ','
(a,b)
运行sql loader
[oracle@seconary zhaixunyang]$ sqlldr userid=scott/system control=insert_source.ctl log=sqlloader.log
SQL*Loader: Release 11.2.0.1.0 - Production on Thu Jun 11 14:31:43 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Commit point reached - logical record count 4
[oracle@seconary zhaixunyang]$ sqlplus scott/system
SQL*Plus: Release 11.2.0.1.0 Production on Thu Jun 11 14:32:23 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select a,b from t_source;
A B
---------- ----------
1 2
2 3
3 4
个人简介
8年oracle从业经验,具备丰富的oracle技能,目前在国内北京某专业oracle服务公司从事高级技术顾问。
服务过的客户:
中国电信
中国移动
中国联通
中国电通
国家电网
四川达州商业银行
湖南老百姓大药房
山西省公安厅
中国邮政
北京302医院
河北廊坊新奥集团公司
项目经验:
中国电信3G项目AAA系统数据库部署及优化
中国联通CRM数据库性能优化
中国移动10086电商平台数据库部署及优化
湖南老百姓大药房ERR数据库sql优化项目
四川达州商业银行TCBS核心业务系统数据库模型设计和RAC部署及优化
四川达州商业银行TCBS核心业务系统后端批处理存储过程功能模块编写及优化
北京高铁信号监控系统RAC数据库部署及优化
河南宇通客车数据库性能优化
中国电信电商平台核心采购模块表模型设计及优化
中国邮政储蓄系统数据库性能优化及sql优化
北京302医院数据库迁移实施
河北廊坊新奥data guard部署及优化
山西公安厅身份证审计数据库系统故障评估
国家电网上海灾备项目4 node rac+adg
贵州移动crm及客服数据库性能优化项目
贵州移动crm及客服务数据库sql审核项目
深圳穆迪软件有限公司数据库性能优化项目
贵州移动crm及客服数据库性能优化项目
贵州移动crm及客服务数据库sql审核项目
深圳穆迪软件有限公司数据库性能优化项目
联系方式:
手机:18201115468
qq : 305076427
qq微博: wisdomone1
新浪微博:wisdomone9
qq群:275813900
itpub博客名称:wisdomone1
http://blog.itpub.net/9240380/
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9240380/viewspace-1696699/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/9240380/viewspace-1696699/