美文网首页
DB2装数shell脚本

DB2装数shell脚本

作者: berry是浆果 | 来源:发表于2020-10-23 10:15 被阅读0次
#!/bin/bash
#export LANG=zh_CN
#export NLS_LANG=zh_CN.UTF-8
export NLS_LANG=AMERICAN.AL32UTF8

##########################主程序##########################
#程序使用方法提示
if [ $# -ne 4 ]
then
    echo "Usage:`basename $0` YYYYMMDD TABLE_NAME FILE_NAME SYS_NAME"
    exit 1
fi

#变量声明
dbUser=yusp
dbPassword=yusp
dbName=YUSP

ETL_DATE=$1
TABLE_NAME=$2
FILE_NAME=$3_${ETL_DATE}.dat
FLAG_NAME=$3_${ETL_DATE}.flg
SYS_ID=$4
DATA_DIR=/impdata/${SYS_ID}/${ETL_DATE}

if [ -e ${DATA_DIR}/$FILE_NAME ]
then
    echo "data file is ready"
else
    echo "data file dose not exit"
    #数据文件不存在则报错退出
    exit -1
fi

#数据装载
echo "db2 client import from ${DATA_DIR}/$FILE_NAME of del modified by coldel0x01 commitcount 100000 insert into $TABLE_NAME"
db2 connect to ${dbName} user ${dbUser} using ${dbPassword};
db2 "load client from ${DATA_DIR}/$FILE_NAME of del modified by timestampformat=\"YYYYMMDDHHMMSS\" dateformat=\"YYYY-MM-DD\" codepage=1383 coldel0x01 nochardel replace into $TABLE_NAME nonrecoverable"

相关文章

  • DB2装数shell脚本

  • shell 传递参数

    shell 传递参数 我们可以在执行shell脚本时,向脚本传递参数,脚本内获取参数的格式为: $n,n代表一个数...

  • 数据分析工作中shell脚本的使用

    这篇文章主要通过工作中shell脚本案例,介绍shell脚本中常用知识点 下面的这个脚本表示使用sqoop把生产数...

  • Shell入门笔记

    Shell脚本:Linux Shell脚本学习指南菜鸟教程 - Shell教程Linux入门 - Shell脚本是...

  • 2018-09-26

    shell脚本 1.1、什么是shell脚本(shell script , ...

  • Shell script + crontab实现Mysql定时备

    一、Shell 脚本 Shell 脚本(shell script),是一种为 shell 编写的脚本程序。 业界所...

  • 嵌入式day12

    shell脚本的本质 shell脚本语言是解释型语言 shell脚本的本质:shell命令的有序集合 shell编...

  • shell脚本

    什么是shell脚本 Shell 脚本(shell script),是一种为 shell 编写的脚本程序。业界所说...

  • Shell脚本语法

    1. Shell脚本简介Shell 脚本(shell script),是一种为 shell 编写的脚本程序。业界所...

  • shell脚本

    什么是Shell脚本 Shell脚本(英语:Shell script),又称Shell命令稿、程序化脚本,是一种电...

网友评论

      本文标题:DB2装数shell脚本

      本文链接:https://www.haomeiwen.com/subject/iozmmktx.html