数据批量导入Oracle数据库

  SQL*LOADER是大型数据

  仓库选择使用的加载方法,因为它提供了最快速的途径(DIRECT,PARALLEL)。现在,我们抛开其理论不谈,用实例来使

  您快速掌握SQL*LOADER的使用方法。

  首先,我们认识一下SQL*LOADER。

  在NT下,SQL*LOADER的命令为SQLLDR,在UNIX下一般为sqlldr/sqlload。

  如执行:d:oracle>sqlldr

  SQL*Loader: Release 8.1.6.0.0 - Production on 星期二 1月 8 11:06:42 2002

  (c) Copyright 1999 Oracle Corporation. All rights reserved.

  用法: SQLLOAD 关键字 = 值 [,keyword=value,...]

  有效的关键字:

  userid -- ORACLE username/password

  control -- Control file name

  log -- Log file name

  bad -- Bad file name

  data -- Data file name

  discard -- Discard file name

  discardmax -- Number of discards to allow (全部默认)

  skip -- Number of logical records to skip (默认0)

  load -- Number of logical records to load (全部默认)

  errors -- Number of errors to allow (默认50)

  rows -- Number of rows in conventional path bind array or between direct p

  ath data saves

  (默认: 常规路径 64, 所有直接路径)

  bindsize -- Size of conventional path bind array in bytes(默认65536)

  silent -- Supdivss messages during run (header,feedback,errors,discards,part

  itions)

  direct -- use direct path (默认FALSE)

  parfile -- parameter file: name of file that contains parameter specification

  s

  parallel -- do parallel load (默认FALSE)

  file -- File to allocate extents from

  skip_unusable_indexes -- disallow/allow unusable indexes or index partitions(默认FALSE)

  skip_index_maintenance -- do not maintain indexes, mark affected indexes as unusable(默认FALSE)

  commit_discontinued -- commit loaded rows when load is discontinued(默认FALSE)

  readsize -- Size of Read buffer (默认1048576)

  PLEASE NOTE: 命令行参数可以由位置或关键字指定。

  前者的例子是 'sqlload scott/tiger foo';

  后者的例子是 'sqlload control=foo userid=scott/tiger'.

  位置指定参数的时间必须早于但不可迟于由关键字指定的参数。例如,

  'SQLLOAD SCott/tiger control=foo logfile=log',

  但'不允许 sqlload scott/tiger control=foo log',

  即使允许参数 'log' 的位置正确。

  d:oracle>

  我们可以从中看到一些基本的帮助信息,这里,我用到的是中文的WIN2000 ADV SERVER。

  我们知道,SQL*LOADER只能导入纯文本,所以我们现在开始以实例来讲解其用法。

  一、已存在数据源result.csv,欲倒入ORACLE中FANCY用户下。

  result.csv内容:

  1,默认 Web 站点,192.168.2.254:80:,RUNNING

  2,other,192.168.2.254:80:test.com,STOPPED

  3,third,192.168.2.254:81:thirdabc.com,RUNNING

  从中,我们看出4列,分别以逗号分隔,为变长字符串。

  二、制定控制文件result.ctl

  result.ctl内容:

  load data

  infile 'result.csv'

  into table resultxt

  (resultid char terminated by ',',

  website char terminated by ',',

  ipport char terminated by ',',

  status char terminated by whitespace)

  说明:

  infile 指数据源文件 这里我们省略了默认的 discardfile result.dsc badfile result.bad

  into table resultxt 默认是INSERT,也可以into table resultxt APPEND为追加方式,或REPLACE

  terminated by ',' 指用逗号分隔

  terminated by whitespace 结尾以空白分隔

  三、此时我们执行加载:

  D:>sqlldr userid=fancy/testpass control=result.ctl log=resulthis.out

  SQL*Loader: Release 8.1.6.0.0 - Production on 星期二 1月 8 10:25:42 2002

  (c) Copyright 1999 Oracle Corporation. All rights reserved.

  SQL*Loader-941: 在描述表RESULTXT时出现错误

  ORA-04043: 对象 RESULTXT 不存在

  提示出错,因为数据库没有对应的表。

  四、在数据库建立表

  create table resultxt

  (resultid varchar2(500),

  website varchar2(500),

  ipport varchar2(500),

  status varchar2(500))

 

  /

时间: 2024-08-02 13:36:06

数据批量导入Oracle数据库的相关文章

文本数据批量导入导出数据库功能~~急~~

问题描述 在asp.net中怎么实现txt和Iso文件批量导入跟导出,导入的数据内容作成报表打印哪个能这好给我个例子 解决方案 解决方案二:关键在于你自定义的文件格式

c++将txt数据批量导入mysql数据库的例子

////包括多线程的使用,数据库的操作和打开文件对话框的使用. #include "stdafx.h" #include <windows.h> #include <windowsx.h> #include "resource.h" #include "MainDlg.h" #include <SQL.H>//连接库:odbc32.lib odbccp32.lib #include <SQLEXT.H&g

批量Excel数据导入Oracle数据库

由于一直基于Oracle数据库上做开发,因此常常会需要把大量的Excel数据导入到Oracle数据库中,其实如果从事SqlServer数据库的开发,那么思路也是一样的,本文主要介绍如何导入Excel数据进入Oracle数据库的内容. 一般我们拿到的Excel数据,都会有一个表头说明,然后下面是一连串的数据内容,如下图所示:   而Oracle中数据库一般为英文名称,中文名称就需要转义,为了方便导入,我把中文名称对照数据库的字段,把表头修改为对应的字段名称,如果没有数据库对应的字段,那么删除Exc

ExcelFileParser处理excel获得数据 可作批量导入到数据库

ExcelFileParser处理excel获得数据 可作批量导入到数据库 提交表单 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <

Linux/Unix shell 自动导入Oracle数据库

      使用shell脚本实现对Oracle数据库的监控与管理将大大简化DBA的工作负担,如常见的对实例的监控,监听的监控,告警日志的监控,以及数据库的备份,AWR report的自动邮件等.本文给出Linux 下使用 shell 脚本来实现自动导入Oracle数据库.        Linux Shell以及导入导出的相关参考:        Linux/Unix shell 脚本中调用SQL,RMAN脚本        Linux/Unix shell sql 之间传递变量       

字段-如何将某个文件(如:*.csv)导入oracle数据库并更新

问题描述 如何将某个文件(如:*.csv)导入oracle数据库并更新 现在要实现以导入并更新功能,不是使用数据库自带的导入功能, 而是使用编写程序的方式来实现: 具体功能如下: 1. 首先要判断该目录有没有此文件(*.CSV) 2.然后要读取里面的数据,(csv文件里的格式是以","分隔的) 我需要对其进行分组:(好和数据库里的字段想对应) csv文件格式的第一列是和数据库的某个字段是相对应的(就是更新条件) csv格式是"文本,值","文本,值&quo

将excel中的数据批量导入到access

<% DB="db1.mdb" path=Server.MapPath(DB) set conn=server.createobject("adodb.Connection") connstr="provider=Microsoft.Jet.OLEDB.4.0;Data Source="&path conn.Open connstr Set rs=server.CreateObject("adodb.recordset&q

提问如何用vb.net实现将excel文件导入oracle数据库

问题描述 提问如何用vb.net实现将excel文件导入oracle数据库,或者是csv文件也可以需要新建一个表,将文本中的内容导入这个表,需要有框架,大体就是选择一个文件,导入就可以 解决方案 解决方案二:Refertothreadfollowshttp://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=150437&SiteID=1DimMyCommandAsSystem.Data.OleDb.OleDbDataAdapterDimMyConn

100个GB的数据,放在ORACLE数据库中,然后基于大数据平台处理

问题描述 100个GB的数据,放在ORACLE数据库中,然后基于大数据平台处理,求助 解决方案 解决方案二:你确定你的是大数据?解决方案三:引用1楼War_Craft_World的回复: 你确定你的是大数据? 100G数据第一相比普通数据够大第二是数据简称大数据解决方案四:直接上阿里云就是了,有数据处理,要不就是自己搭建环境,