oracle 中的demo與sqlldr 的用法


          在oracle的安裝目錄下有相應(yīng)的demo,包含創(chuàng)建表、增加記錄數(shù)據(jù)相應(yīng)的腳本。

          hr用戶(注意它的表空間為system)
              $ORACLE_HOME/demo/schema/human_resources/hr_main.sql,

          sh用戶(注意它的表空間為example)
              $ORACLE_HOME/demo/schema/sales_history/sh_main.sql,執(zhí)行完后一些表中的數(shù)據(jù)要通過sqlldr來導(dǎo)入數(shù)據(jù)。
              sqlldr 用法 
               $>sqlldr userid=sh/franlk control=*.ctl  log=*.log  (*代表相應(yīng)的文件)
              我們?cè)?ORACLE_HOME/demo/schema/sales_history/目錄下能夠看到.ctl與.dat文件
              .ctl是數(shù)據(jù)導(dǎo)入的規(guī)則文件,內(nèi)容如下:        

          LOAD DATA
          INFILE 'E:\oracle\ora92\demo\schema\sales_history\sh_sales.dat'  ------自定義部分(要導(dǎo)入的數(shù)據(jù))
          APPEND

          INTO TABLE sales
          FIELDS TERMINATED BY "|"                                                    ------依據(jù).dat中分隔符
          ( PROD_ID, CUST_ID, TIME_ID, CHANNEL_ID, PROMO_ID,
           QUANTITY_SOLD, AMOUNT_SOLD)

          因?yàn)?dat中的日期,我們必須設(shè)置一下NLS_LANG

          那么我們?cè)赿os下執(zhí)行順序應(yīng)該是:

          $>set NLS_LANG=american_america.zhs16cgb231280
          $>sqlldr userid=sh/franlk control=E:\oracle\ora92\demo\schema\sales_history\sh_cust.ctl log=E:\oracle\ora92\demo\schema\log\sh_cust.log

          $>sqlldr userid=sh/franlk control=E:\oracle\ora92\demo\schema\sales_history\sh_prod.ctl log=E:\oracle\ora92\demo\schema\log\sh_prod.log

          $>sqlldr userid=sh/franlk control=E:\oracle\ora92\demo\schema\sales_history\sh_promo.ctl log=E:\oracle\ora92\demo\schema\log\sh_promo.log

          $>sqlldr userid=sh/franlk control=E:\oracle\ora92\demo\schema\sales_history\sh_sales.ctl log=E:\oracle\ora92\demo\schema\log\sales.log



          注意:藍(lán)色為后來加上的,原文件是沒有的。





          歡迎大家訪問我的個(gè)人網(wǎng)站 萌萌的IT人

          posted on 2007-09-04 16:45 見酒就暈 閱讀(660) 評(píng)論(0)  編輯  收藏 所屬分類: DB

          <2025年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          導(dǎo)航

          統(tǒng)計(jì)

          常用鏈接

          留言簿(3)

          我參與的團(tuán)隊(duì)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          收藏夾

          BLOG

          FRIENDS

          LIFE

          搜索

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          主站蜘蛛池模板: 靖西县| 轮台县| 灵寿县| 柯坪县| 东乡族自治县| 旅游| 卢龙县| 阳新县| 上虞市| 蓬安县| 泽库县| 宁夏| 广平县| 林州市| 德阳市| 舞钢市| 陆川县| 海阳市| 明水县| 乌兰察布市| 西乌珠穆沁旗| 连云港市| 鹤岗市| 中西区| 临武县| 无为县| 卓尼县| 民县| 伊吾县| 嫩江县| 叶城县| 金秀| 理塘县| 浪卡子县| 乌拉特中旗| 永修县| 济宁市| 双牌县| 遂平县| 舞阳县| 金门县|