將.csv格式的檔案匯入oracle資料庫中

來源:互聯網
上載者:User

標籤:oracle   資料庫   關鍵字   field   

將.csv格式的檔案匯入oracle資料庫中

第一種方法

1、選擇工具---文本匯入器

650) this.width=650;" width="554" height="346" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />

2、選擇 到oracle的資料選擇所有者和表。

650) this.width=650;" width="554" height="346" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />

3、選擇開啟檔案,選擇要匯入的文本

650) this.width=650;" width="554" height="284" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />

4、在field中配置表的對應關係,filed1對應的是.csv中的第一列,配置對應資料的那一列,注意類型,不然匯入資料會報錯。之後點匯入,完成。

650) this.width=650;" width="554" height="340" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />

 

 

第二種方法

1、建立控制檔案

如,在E:\建立 test.ctl檔案,檔案內容為

load data ---控制檔案標誌

infile‘e:/asd.csv‘---要輸入的檔案名稱及路徑

into tablejyzxsj_rdl---要插入的表

fields terminatedby ‘,‘---以,問分割符號

(GUID,RDL,LJDL,DATETIME timestamp"yyyy-mm-dd")----定義列對應表中的順序

注意:日期格式需要格式化如:DATETIME timestamp "yyyy-mm-dd"

控制檔案中指定插入資料的方式關鍵字

Insert,為預設方式,在資料裝載開始要求表為空白

Append,在表中追加新紀錄

Replace,刪除舊紀錄,替換成新裝載的紀錄

Truncate,同上

 

2、在dos視窗下執行命令實現資料匯入

sqlldr sgbiz/[email protected]:1521/dljydbcontrol=e:/test.ctl log=e:/test.log

650) this.width=650;" width="554" height="161" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />

650) this.width=650;" width="462" height="266" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />


本文出自 “小戴” 部落格,請務必保留此出處http://daid110.blog.51cto.com/11467231/1924647

將.csv格式的檔案匯入oracle資料庫中

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.