Home >Database >Mysql Tutorial >Oracle 下导入txt的shell脚本以及配置

Oracle 下导入txt的shell脚本以及配置

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-07 16:54:271040browse

首先有一个info.txt文件,文件内容其中一条是如下的情况FFF_GGG_FF|GOD|254|254|16384|16384|254|254|接下来先是在Oracle中创建相

首先有一个info.txt文件,文件内容其中一条是如下的情况

FFF_GGG_FF|GOD|254|254|16384|16384|254|254|

接下来先是在Oracle中创建相应的表,结构如下:

SQL> desc info;
TABLENAME VARCHAR2(200)
OWNUSER VARCHAR2(100)
EXPNUMS NUMBER(12)
EXPLOGNUMS NUMBER(12)
EXPSIZE NUMBER(12)
IMPSIZE NUMBER(12)
IMPLOGNUMS NUMBER(12)
IMPNUMS NUMBER(12)

接下来配置导入的控制文件info.ctl

load data
infile 'info.txt'
append into table info
fields terminated by '|'
(
TABLENAME,
OWNUSER,
EXPNUMS,
EXPLOGNUMS,
EXPSIZE,
IMPSIZE,
IMPLOGNUMS,
IMPNUMS
)

接下来是info.sh的脚本

#!/bin/bash

sqlldr senwei/senwei control=$HOME/oracle/info.ctl

哎呀 其实就一句命令,真不好意思……

还有一句就是想把info.txt转换为excel格式,然后在windows打开。但是在linux环境下执行的语句

cat exp_imp_report.list|sed 's/|/\t/g' >aa.xls

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn