Friday, January 20, 2017

SQL*Loader loads data from external files into tables of an Oracle database



SQL> create table test(ename varchar2(20),eno number(2),sal number(5));

Table created.

SQL> select * from tab;

TNAME       TABTYPE CLUSTERID
------------------------------ ------- ----------
BIN$P/EdWqqbIMzgU2gBqMALTQ==$0 TABLE
TEST       TABLE

$cd /u01/
$vi test.ctl
LOAD DATA
INFILE*
INTO TABLE TEST
fields terminated by','
(ename,eno,sal)
begindata
adeeb,23,565
pansoft,26,125
zubair,25,55
abdul,21,156
mahesh,56,147

[oracle@pansoft104 u01]$ export ORACLE_SID=dot
[oracle@pansoft104 u01]$ sqlldr userid=pansoft/pansoft control=test.ctl log=sqlldr.log direct=y

SQL*Loader: Release 11.2.0.4.0 - Production on Fri Oct 28 22:54:51 2016

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.


Load completed - logical record count 5.
SQL> conn pansoft/pansoft;
Connected.
SQL> select * from test;

ENAME    ENO        SAL
-------------------- ---------- ----------
adeeb     23        565
pansoft     26        125
zubair     25 55
abdul     21        156
mahesh     56        147

[oracle@pansoft104 u01]$ vi sqlappend.ctl
LOAD DATA
INFILE *
append
INTO TABLE test
fields terminated by','
(ename,eno,sal)
begindata
append,15,236

[oracle@pansoft104 u01]$ sqlldr userid=pansoft/pansoft control=sqlappend.ctl log=sqlldr.log direct=y

SQL*Loader: Release 11.2.0.4.0 - Production on Fri Oct 28 23:03:44 2016

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.


Load completed - logical record count 1.

SQL> conn pansoft/pansoft
Connected.
SQL> 
SQL> select * from test;

ENAME    ENO        SAL
-------------------- ---------- ----------
adeeb     23        565
pansoft     26        125
zubair     25 55
abdul     21        156
mahesh     56        147
append     15        236

6 rows selected.


No comments:

Post a Comment

Featured post

Migrate OCR & vote from external to normal or High redundancy in ASM

How to Move OCR & Vote from external to Normal or high. 1)  Create New diskgroup(CRS) with suitable redundancy for OCR and Voting files....

Popular Posts