Oracle's import tool, very fast, here to remember the use of external tables, usually external tables to remember too much syntax for example:
CREATE TABLE PROD_MASTER ( "EMPNO" NUMBER, "ENAME" VARCHAR2(50), "HIREDATE" DATE, "DEPTNO" NUMBER)ORGANIZATION external ( TYPE oracle_loader DEFAULT DIRECTORY ext_table ACCESS PARAMETERS ( RECORDS DELIMITED BY NEWLINE CHARACTERSET US7ASCII preprocessor ext_table:‘uncompress.sh‘ BADFILE ‘EXT_TABLE‘:‘prod_master.dat.bad‘ LOGFILE ‘1.log_xt‘ READSIZE 1048576 FIELDS TERMINATED BY "," LDRTRIM MISSING FIELD VALUES ARE NULL REJECT ROWS WITH ALL NULL FIELDS ( "EMPNO" CHAR(255) TERMINATED BY ",", "ENAME" CHAR(255) TERMINATED BY ",", "HIREDATE" CHAR(10) TERMINATED BY "," DATE_FORMAT DATE MASK ‘dd-mon-yyyy‘, "DEPTNO" CHAR(255) TERMINATED BY "," ) ) location ( ‘prod_master.dat.gz‘ ))REJECT LIMIT UNLIMITED
If you hit the whole hand, this workload is a bit large, you can consider the system itself, the steps are as follows:
1 Checking components:
SELECT * FROM V$OPTION WHERE PARAMETER = ‘Oracle Database Vault‘;select comp_id,comp_name, version, status from dba_registry;chopt disable dv
If you do not close
SQL> select * from prod_master;select * from prod_master*ERROR at line 1:ORA-29913: error in executing ODCIEXTTABLEOPEN calloutORA-29400: data cartridge errorKUP-04094: preprocessing cannot be performed if Database Vault is installed
2 Creating a Table
CREATE TABLE PROD_MASTER ( "EMPNO" NUMBER, "ENAME" VARCHAR2(50), "HIREDATE" DATE, "DEPTNO" NUMBER)
3 Creating a control file
Cat Prod_master.ctl
load datainfile ‘/home/oracle/scripts/prod_master.dat.gz‘append into table prod_masterfields terminated by ","trailing nullcols(empno,ename,hiredate date(10) ‘dd-mon-yyyy‘,deptno)
4 Creating a storage directory
create directory ext as ‘/home/oracle/ext‘;grant read,write,execute on ext;
5 Creating statements that build external tables
sqlldr userid=hr/hr control=prod_master.ctl extern_table=gernerate_only log=create_table.sql
Modify this because compression is enabled:
PREPROCESSOR EXT:‘uncompress.sh‘ --Preprocessor before readsize
SQLLDR generation of Oracle external tables