Unix/Linux之Oracle相关Shell(2)

5、将标准的txt文件load进Oracle数据库的shell脚本

sqlldr_in.sh(IBM的AIX环境下)

ORACLE_BASE=/oracle;export ORACLE_BASE

ORACLE_HOME=$ORACLE_BASE/product/10.2.0;export ORACLE_HOME

ORACLE_SID=commdb;export ORACLE_SID

DATE=`date +%Y%m%d`;export DATE

$ORACLE_HOME/bin/sqlldr cfa/cfa control=ENT_INFO.ctl log=ENT_INFO_$DATE.log rows=10000 readsize=20000000 bindsize=20000000 $ORACLE_HOME/bin/sqlldr cfa/cfa control=REPORT_CATALOG.ctl log=REPORT_CATALOG_$DATE.log rows=10000 readsize=20000000 bindsize=20000000 $ORACLE_HOME/bin/sqlldr cfa/cfa control=REPORT_DATA.ctl log=REPORT_DATA_$DATE.log rows=10000 readsize=20000000 bindsize=20000000 $ORACLE_HOME/bin/sqlldr cfa/cfa control=REPORT_RECORD.ctl log=REPORT_RECORD_$DATE.log rows=10000 readsize=20000000 bindsize=20000000

相关的四张表的控制文件的内容:

ENT_INFO.ctl:==

LOAD DATA

INFILE '/oracle/cfain/ENT_INFO_$DATE.txt'

TRUNCATE

INTO TABLE AIX_ENT_INFO

FIELDS TERMINATED BY '|'

TRAILING NULLCOLS

CUSTOMERID           "nvl(:CUSTOMERID        ,'0')",CORPID               "nvl(:CORPID            ,'0')",ENTERPRISENAME       "nvl(:ENTERPRISENAME    ,'0')",ENGLISHNAME          "nvl(:ENGLISHNAME       ,'0')",FICTITIOUSPERSON     "nvl(:FICTITIOUSPERSON ,'0')",ORGNATURE            "nvl(:ORGNATURE         ,'0')",FINANCETYPE          "nvl(:FINANCETYPE       ,'0')",ENTERPRISEBELONG     "nvl(:ENTERPRISEBELONG ,'0')",INDUSTRYTYPE         "nvl(:INDUSTRYTYPE      ,'0')",INDUSTRYTYPE1        "nvl(:INDUSTRYTYPE1     ,'0')",INDUSTRYTYPE2        "nvl(:INDUSTRYTYPE2     ,'0')",PRIVATE              "nvl(:PRIVATE           ,'0')",ECONOMYTYPE          "nvl(:ECONOMYTYPE       ,'0')",ORGTYPE              "nvl(:ORGTYPE           ,'0')",MOSTBUSINESS         "nvl(:MOSTBUSINESS      ,'0')",BUDGETTYPE           "nvl(:BUDGETTYPE        ,'0')",RCCURRENCY           "nvl(:RCCURRENCY        ,'0')",REGISTERCAPITAL      "nvl(:REGISTERCAPITAL   ,'0')",PCCURRENCY           "nvl(:PCCURRENCY        ,'0')",PAICLUPCAPITAL       "nvl(:PAICLUPCAPITAL    ,'0')",FUNDSOURCE           "nvl(:FUNDSOURCE        ,'0')",TOTALASSETS          "nvl(:TOTALASSETS       ,'0')",NETASSETS            "nvl(:NETASSETS         ,'0')",ANNUALINCOME         "nvl(:ANNUALINCOME      ,'0')",SCOPE                "nvl(:SCOPE             ,'0')",LIMIT                "nvl(:LIMIT             ,'0')",CREDITDATE           "nvl(:CREDITDATE        ,'0')",LICENSENO            "nvl(:LICENSENO         ,'0')",LICENSEDATE          "nvl(:LICENSEDATE       ,'0')",LICENSEMATURITY      "nvl(:LICENSEMATURITY   ,'0')",SETUPDATE            "nvl(:SETUPDATE         ,'0')",INSPECTIONYEAR       "nvl(:INSPECTIONYEAR    ,'0')",LOCKSITUATION        "nvl(:LOCKSITUATION     ,'0')",TAXNO                "nvl(:TAXNO             ,'0')",BANKLICENSE          "nvl(:BANKLICENSE       ,'0')",BANKID               "nvl(:BANKID            ,'0')",MANAGEAREA           "nvl(:MANAGEAREA        ,'0')",BANCHAMOUNT          "nvl(:BANCHAMOUNT       ,'0')",EXCHANGEID           "nvl(:EXCHANGEID        ,'0')",REGISTERADD          "nvl(:REGISTERADD       ,'0')",CHARGEDEPARTMENT     "nvl(:CHARGEDEPARTMENT ,'0')",OFFICEADD            "nvl(:OFFICEADD         ,'0')",OFFICEZIP            "nvl(:OFFICEZIP         ,'0')",COUNTRYCODE          "nvl(:COUNTRYCODE       ,'0')",REGIONCODE           "nvl(:REGIONCODE        ,'0')",VILLAGECODE          "nvl(:VILLAGECODE       ,'0')",VILLAGENAME          "nvl(:VILLAGENAME       ,'0')",RELATIVETYPE         "nvl(:RELATIVETYPE      ,'0')",OFFICETEL            "nvl(:OFFICETEL         ,'0')",OFFICEFAX            "nvl(:OFFICEFAX         ,'0')",WEBADD               "nvl(:WEBADD            ,'0')",EMAILADD             "nvl(:EMAILADD          ,'0')",EMPLOYEENUMBER       "nvl(:EMPLOYEENUMBER    ,'0')",MAINPRODUCTION       "nvl(:MAINPRODUCTION    ,'0')",NEWTECHCORPORNOT     "nvl(:NEWTECHCORPORNOT ,'0')",LISTINGCORPORNOT     "nvl(:LISTINGCORPORNOT ,'0')",HASIERIGHT           "nvl(:HASIERIGHT        ,'0')",HASDIRECTORATE       "nvl(:HASDIRECTORATE    ,'0')",BASICBANK            "nvl(:BASICBANK         ,'0')",BASICACCOUNT         "nvl(:BASICACCOUNT      ,'0')",MANAGEINFO           "nvl(:MANAGEINFO        ,'0')",CUSTOMERHISTORY      "nvl(:CUSTOMERHISTORY   ,'0')",PROJECTFLAG          "nvl(:PROJECTFLAG       ,'0')",REALTYFLAG           "nvl(:REALTYFLAG        ,'0')",WORKFIELDAREA        "nvl(:WORKFIELDAREA     ,'0')",WORKFIELDFEE         "nvl(:WORKFIELDFEE      ,'0')",ACCOUNTDATE          "nvl(:ACCOUNTDATE       ,'0')",LOANCARDNO           "nvl(:LOANCARDNO        ,'0')",LOANCARDPASSWORD     "nvl(:LOANCARDPASSWORD ,'0')",LOANCARDINSYEAR      "nvl(:LOANCARDINSYEAR   ,'0')",LOANCARDINSRESULT    "nvl(:LOANCARDINSRESULT ,'0')",LOANFLAG             "nvl(:LOANFLAG          ,'0')",FINANCEORNOT         "nvl(:FINANCEORNOT      ,'0')",FINANCEBELONG        "nvl(:FINANCEBELONG     ,'0')",CREDITBELONG         "nvl(:CREDITBELONG      ,'0')",CREDITLEVEL          "nvl(:CREDITLEVEL       ,'0')",EVALUATEDATE         "nvl(:EVALUATEDATE      ,'0')",OTHERCREDITLEVEL     "nvl(:OTHERCREDITLEVEL ,'0')",OTHEREVALUATEDATE    "nvl(:OTHEREVALUATEDATE ,'0')",OTHERORGNAME         "nvl(:OTHERORGNAME      ,'0')",INPUTORGID           "nvl(:INPUTORGID        ,'0')",INPUTUSERID          "nvl(:INPUTUSERID       ,'0')",INPUTDATE            "nvl(:INPUTDATE         ,'0')",UPDATEORGID          "nvl(:UPDATEORGID       ,'0')",UPDATEUSERID         "nvl(:UPDATEUSERID      ,'0')",UPDATEDATE           "nvl(:UPDATEDATE        ,'0')",REMARK               "nvl(:REMARK            ,'0')",TAXNO1               "nvl(:TAXNO1            ,'0')",FICTITIOUSPERSONID   "nvl(:FICTITIOUSPERSONID,'0')",GROUPFLAG            "nvl(:GROUPFLAG         ,'0')",EVALUATELEVEL        "nvl(:EVALUATELEVEL     ,'0')",MYBANK               "nvl(:MYBANK            ,'0')",MYBANKACCOUNT        "nvl(:MYBANKACCOUNT     ,'0')",OTHERBANK            "nvl(:OTHERBANK         ,'0')",OTHERBANKACCOUNT     "nvl(:OTHERBANKACCOUNT ,'0')",TEMPSAVEFLAG         "nvl(:TEMPSAVEFLAG      ,'0')",FINANCEDEPTTEL       "nvl(:FINANCEDEPTTEL    ,'0')",ECGROUPFLAG          "nvl(:ECGROUPFLAG       ,'0')",SUPERCORPNAME        "nvl(:SUPERCORPNAME     ,'0')",SUPERLOANCARDNO      "nvl(:SUPERLOANCARDNO   ,'0')",SUPERCERTTYPE        "nvl(:SUPERCERTTYPE     ,'0')",SMEINDUSTRYTYPE      "nvl(:SMEINDUSTRYTYPE   ,'0')",SELLSUM              "nvl(:SELLSUM           ,'0')",SUPERCERTID          "nvl(:SUPERCERTID       ,'0')",ISVOUCHCORP          "nvl(:ISVOUCHCORP       ,'0')"

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wwpxjj.html