Tuesday, March 01, 2011

Load DEM data through External Table

DEM data format
The dem data format is "x, y,z".The file names "tw20fix84.img_XYZ.txt"

Using existing DIRECTORY objects
For example: "DATA_PUMP_DIR", the location is "/home/oracle/app/oracle/admin/orcl/dpdump/"

Make sure  "tw20fix84.img_XYZ.txt" is under directory "/home/oracle/app/oracle/admin/orcl/dpdump/"

Grant READ & WRITE rights to user "FSMS" by system

SQL> GRANT READ, WRITE ON DIRECTORY DATA_PUMP_DIR TO FSMS;
Grant succeeded.


Create External Table "POINTS"

SQL> l
  1  CREATE TABLE POINTS ( X NUMBER, Y NUMBER, Z NUMBER)
  2     ORGANIZATION EXTERNAL
  3      ( TYPE ORACLE_LOADER
  4        DEFAULT DIRECTORY "DATA_PUMP_DIR"
  5        LOCATION
  6         ( "DATA_PUMP_DIR":'tw20fix84.img_XYZ.txt'
  7         )
  8      )
  9*    REJECT LIMIT UNLIMITED
SQL> /
Table created.

Verify External Table "POINTS" Is Working
SQL> select * from points where rownum < 3;
         X          Y          Z
---------- ---------- ----------
120.833064 25.3523955          0
120.833236 25.3523955          0

No comments: