- 浏览: 1000568 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (529)
- 服务器 (8)
- jsp (1)
- java (6)
- AIX (1)
- solaris (3)
- linux学习 (53)
- javaScript (2)
- hibernate (1)
- 数据库 (74)
- sql语句 (8)
- oracle 学习 (75)
- oracle 案例 (42)
- oracle 管理 (42)
- Oracle RAC (27)
- oracle data guard (12)
- oracle 参数讲解 (14)
- Oracle 字符集 (8)
- oracle性能调优 (24)
- oracle备份与恢复 (12)
- oracle Tablespace (9)
- oracle性能诊断艺术 (1)
- oracle 11g学习 (5)
- oracle streams (1)
- oracle upgrade and downgrade (4)
- db2学习 (13)
- db2命令学习 (2)
- mysql (28)
- sql server (30)
- sql server 2008 (0)
- 工具 (10)
- 操作系统 (3)
- c++ (1)
- stock (1)
- 生活 (5)
- HADOOP (2)
最新评论
-
massjcy:
...
如何将ubuntu文件夹中文名改为英文 -
skypiea:
谢谢。。。
终于解决了。。。
Oracle 10.2.0.4(5)EM不能启动的解决方案(Patch 8350262) -
qwe_rt:
引用vi /etc/sysconfig/network 请问 ...
Linux操作系统下配置静态IP上网 -
liuqiang:
sudo killall -9 apache2
ps 和 kill 命令详解 -
dazuiba:
引用*绝杀 kill -9 PID 当使用此命令时,一定要通过 ...
ps 和 kill 命令详解
自己写的通用的sqlldr导入脚本,配置在crontab 里面,每天自动导入数据:
#!/bin/bash
export ORACLE_BASE=/home/db/oracle/oracledb
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=BTOG
export PATH=$ORACLE_HOME/bin:$PATH
export NLS_LANG="SIMPLIFIED CHINESE_CHINA".AL32UTF8
username=bimp
password=bimp
active_logfile_datadir=/opt/b2gbak216/.test/active_log_file
logfile_prefix_name=active_log
active_log_file_ctl=
insert_file_log(){
local file_name=$1
local operator_code=`
sqlplus -S /nolog <<EOF
conn $username/$password
set heading off feedback off
var out_file_id number;
call file_log_insert('$file_name',:out_file_id);
select :out_file_id from dual;
quit
EOF`
echo $operator_code
}
update_file_log(){
local file_id=$1
local operate_status=$2
local file_data=$3
local operator_code=`
sqlplus -S /nolog <<EOF
conn $username/$password
set heading off feedback off
var out_result_code number;
call file_log_update($file_id,'$operate_status','$file_data',:out_result_code);
select :out_result_code from dual;
EOF`
echo $operator_code
}
file_load(){
local data_child_dir=`ls -t $datadir`
for data_dir in $data_child_dir;do
if [ -d $data_dir ];then
all_data_file=`ls $data_dir`
for data_file in $all_data_file;do
centrol_file_load $datadir/$data_dir/$data_file $centrol_ctl $file_prefix_name $file_postfix_name
done
if [ -z $1 ];then
exit
fi
fi
done
}
file_load_all(){
file_load all
}
customer_tran_file_load(){
local datadir=/home/db/oracle/oracledb/flash_recovery_area/customer_tran
local control_ctl=/home/db/oracle/oracledb/flash_recovery_area/sqlldr/customer_tran/customer_tran.ctl
local file_prefix_name=TRAN_110_
local file_postfix_name=txt
local all_data_file=`ls $datadir|grep "$file_postfix_name$"`
for data_file in $all_data_file;do
centrol_file_load $datadir/$data_file $control_ctl $file_prefix_name $file_postfix_name
done
}
active_log_file_load(){
all_data_file=`ls $active_logfile_datadir`
for data_file in $all_data_file;do
centrol_file_load $active_logfile_datadir/$data_file $active_log_file_ctl $logfile_prefix_name $file_postfix_name
done
}
# manual load one file,the file path is absolute path
manual_file_load(){
local data_file
local control_file
local file_prefix_name
local file_postfix_name
echo -n "please input the data file name(absolute path):"
read data_file
echo -n "please input the control file name:"
read control_file
echo -n "please input the data file prefix name[]:"
read file_prefix_name
echo -n "please input the data file postfix name[]:"
read file_postfix_name
if [ -z $file_prefix_name ];then
file_prefix_name=all
fi
if [ -z $file_postfix_name ];then
file_postfix_name=all
fi
centrol_file_load $data_file $control_file $file_prefix_name $file_postfix_name
}
centrol_file_load(){
if [ -z $1 ];then
echo "call centrol_file_load function you must input the data file name"
exit 1
fi
if [ -z $2 ];then
echo "call centrol_file_load function you must input the control file name"
exit 1
fi
if [ -z $3 ];then
echo "call centrol_file_load function you must input the data file's prefix name"
exit 1
fi
if [ -z $4 ];then
echo "call centrol_file_load function you must input the data file's postfix name"
exit 1
fi
local l_data_file=$1
local l_control_file=$2
local l_file_prefix_name=$3
local l_file_postfix_name=$4
local l_simple_data_file_name=`basename $l_data_file`
if [ -f "$l_data_file" ] && [ -s "$l_data_file" ];then
if [ ${l_simple_data_file_name:0:${#l_file_prefix_name}} == $l_file_prefix_name ] || [ $l_file_prefix_name == "all" ];then
if [ ${l_simple_data_file_name##*.} == $l_file_postfix_name ] || [ $l_file_postfix_name == "all" ];then
#1.insert the datafile to databasea
v_file_id=`insert_file_log $l_data_file`
if [ $v_file_id != "0" ];then
if [ $l_control_file != "" ] && [ -f "$l_control_file" ] && [ -s "$l_control_file" ];then
#2.sqlload read datafile data to database
load_data $l_data_file $l_control_file
#3.if sqlload the data success,update the file operate_status from the database
if [ -f "$l_data_file.bad" ];then
update_file_log $v_file_id 0 ${l_simple_data_file_name:${#l_file_prefix_name}:8}
else
update_file_log $v_file_id 2 ${l_simple_data_file_name:${#l_file_prefix_name}:8}
tar -czf $l_data_file.tar.gz $l_data_file
mv $l_data_file.tar.gz /home/db/oracle/oracledb/flash_recovery_area/data_archive/
rm -fr $l_data_file
fi
else
update_file_log $v_file_id 0 ${l_simple_data_file_name:${#l_file_prefix_name}:8}
echo "file load errors,because the the control file is not exists or control file is empty or control file errors"
fi
else
echo "file load errors,because the file name $l_data_file have be in the database or database error"
fi
else
echo "data file load errors,the data file postfix name ${l_simple_data_file_name:0:${#l_file_prefix_name}} and l_file_postfix_name param value is $l_file_postfix_name not equal"
fi
else
echo "data file load errors,the data file prefix name ${l_simple_data_file_name##*.} and l_file_prefix_name param value is $l_file_postfix_name not equal"
fi
else
echo "data file load errors,because the data file $l_data_file is not exists or data file is empty"
fi
}
load_data(){
if [ -z $1 ];then
echo "call load_data function you must input the data file name"
exit 1
fi
if [ -z $2 ];then
echo "the control_file param is need"
exit 1
fi
if [ -f $1 ] && [ -f $2 ];then
local file_name=$1
local control_file=$2
sqlldr $username/$password CONTROL="${control_file}" DATA="${file_name}" BAD="${file_name}.bad" DISCARD="${file_name}.disc" LOG="${file_name}.log" ERRORS=100 DIRECT=true SKIP=1 rows=10000
else
echo "the data_file $file_name or control_file $control_file is not exists"
fi
}
case "$1" in
customer_tran_file_load)
customer_tran_file_load
;;
active_log_file_load)
active_log_file_load
;;
manual_file_load)
manual_file_load
;;
insert_file_log)
insert_file_log
;;
update_file_log)
update_file_log
;;
load_data)
load_data
;;
*)
echo $"Usage: $0 {customer_tran_file_load|active_log_file_load|insert_file_log|update_file_log|load_data|active_log_file_load|manual_file_load}"
exit 1
;;
esac
exit 0
发表评论
-
centos 编译 安装 protobuf
2012-08-15 17:01 8599yum -y install gcc+ gcc-c++ yu ... -
linux下删除文件后没有释放空间(转)
2012-08-08 11:07 1924问题 文件被删除后,空间没有被释放 原因 在Linux或者 ... -
red hat/Centos/Oracle linux禁用单用户模式
2012-07-26 23:55 2001目的是禁用red hat/Centos/Oracle linu ... -
oracle linux server 6.0修改网卡名称
2012-07-26 01:12 2163修改网卡规则:先关闭网络服务,修改配置文件网卡的HWADDR值 ... -
centos6.0配置本地yum
2012-07-25 23:54 929centos6.0配置本地yum 使用vm虚拟机安装的cen ... -
Connection activation failed Device not managed by NetworkManager
2012-07-22 20:26 1432系统中有两个服务在管理网络,所以需要停掉一个, 1. Re ... -
warning: waiting for transaction lock on /var/lib/rpm/__db.000
2012-06-06 12:03 1157故障现象:[root@localhost Mysql4.1.1 ... -
Linux 查看目录大小及文件数量命令
2012-04-10 10:29 1187查看当前目录大小: [root@21andy.com]# ... -
linux /dev/shm的用途
2011-11-22 10:36 335321.linux下的/dev/shm是什么? /dev/shm ... -
configure/make/make install的作用
2011-08-12 01:10 860这些都是典型的使用GNU的AUTOCONF和AUTOMAKE产 ... -
执行脚本出现bin/bash: bad interpreter: No such file or directory
2011-07-27 16:50 722错误原因之一很有可能是你的脚本文件是DOS格式的, 即每一行的 ... -
Ubuntu下Oracle的自动启动
2011-07-06 23:38 2444一、使用root用户修改/etc/oratab 文件: $ ... -
如何将ubuntu文件夹中文名改为英文
2011-03-07 02:10 8533ubuntu对中文的支持越来越好,这自然是好事。不过在终端下输 ... -
Ubuntu 10.04下的搭建SUN JAVA开发环境
2011-03-07 00:53 923下面是Ubuntu 10.04下的搭 ... -
Ubuntu Server 安装图形桌面环境
2011-03-07 00:43 11621.准备环境首先得安装好ubuntu-10.04-server ... -
ubuntu安装SSH,支持开启sftp服务
2011-03-06 23:55 2695ubuntu安装SSH 安装 SSH(Secure Shel ... -
ubuntu终端乱码问题解决方案
2011-03-05 23:12 1813解决方法: 一. Ubuntu默认的中文字符编 ... -
linux使用sar命令进行系统监视优化
2011-01-23 01:30 3915了解如何将用户抱怨与 ... -
Linux启动过程简介
2011-01-22 23:56 1073Bootloader 在Alpha/AXP平台 ... -
Linux下很全面的监控工具dstat
2011-01-17 02:02 12411) 工具说明dstat是一个用来替换 vmstat,ios ...
相关推荐
oracle sqlldr导入带有自动增加的数据实例
主要用于sqlldr,里面有例子的代码,可以参考
利用 sqluldr2导出数据 使用sqlldr导入数据 通过merge into 合并更新数据。
windowns下利用bat命令+oracle的sqlldr功能导入数据,导入速度很快
使用sqlldr批量导入数据:http://blog.csdn.net/gengwx_2008/article/details/43792301
spool导出与sqlldr导入,一个简单的例子,详细的看命令帮助好了
oracle sqlldr多文件批量导入
MySQL数据导入到Oracle的中间件,其工作原理是将MySQL数据的导出命令写入到d:/mysqltooracle/exportcmd.txt,打开该文件即可获取需要手动执行的导出MySQL数据的sql脚本,执行后会在 “/var/mysqltooracle”(针对...
sqlldr自动生成控制文件导入到表,可以做到备份的目的,全自动
NULL 博文链接:https://fly5650104.iteye.com/blog/1939052
利用sqlldr大量数据导入,方便,快速
sqlldr报超出字符长度错误,可以参考的好资料。
主要介绍了Oracle sqlldr导入一个日期列实例详解的相关资料,需要的朋友可以参考下
Oracle sqlldr 大批量数据导入工具使用实例,通过Oracle 自带的sqlldr 工具可快速导入大批量的数据至Oracle中。 工具使用前提条件: 1.安装的Oracle Client 不能为精简版,要不然就找不到sqlldr.exe 2.将Oracle的...
用于手工将数据导入SQL SERVER数据库中,暂时支持2008和2012,2016没有试过,可以很快速的导入数据入库。欢迎大家下载
在java代码中调用执行shell脚本,sqlldr导数与使用sqlplus在shell调用执行存储过程。 linux环境中有2个dba的用户:oracle、erm 还有1个web用户:erm 在linux环境中,这三个用户都可以直接在任意目录下执行该shell...
sqlldr配置文件详解 python脚本根据csv文件批量生成sqlldr传输所需ctl文件和sqlldr脚本, 修改参数为自己本机配置后,运行脚本,复制输出结果到cmd下,直接...批量sqlldr导入.py 批量导入文件SQL语句 示例:祁东县.ctl
VS2013 C#.Net开发 C#利用SqlLdr 数据批量导入Oracle程序源码,高效可达万行/秒。 1.可多表同时执行 2.可视导入信息反馈,可查看错误数据及导入日志。 3.内含 批处理 执行方法 及 导入 ldr Demo文件。 4.内含导数据...
C# 通过oracle sqlldr 将TXT批量导入oracle 一个文件夹里有大量的TXT文件,以"~"区分各字段. 这个程序能批量将此文件夹里的所有的文件导入oralce 并按日期把已导入的TXT文件复制另一个文件夹