sqlplus
@/home/oracle/oradb/CFG_MAP_SCENE_20180821151727.sql
或直接
sqlplus nps/Nt1@orcl @/home/oracle/oradb/CFG_MAP_SCENE_20180821151727.sql
sql脚本:
DROP TABLE CFG_MAP_SCENE;
CREATE TABLE CFG_MAP_SCENE (
CITY VARCHAR2(64),
INDEX_ID NUMBER,
PLANET_ID NUMBER,
SCENE_NAME VARCHAR2(64),
HEIGHT NUMBER,
CENTROIDX NUMBER,
CENTROIDY NUMBER,
VMAP CLOB,
GEOM MDSYS.SDO_GEOMETRY);
COMMIT;
DELETE FROM USER_SDO_GEOM_METADATA
WHERE TABLE_NAME = 'CFG_MAP_SCENE' AND COLUMN_NAME = 'GEOM' ;
COMMIT;
insert into user_sdo_geom_metadata(table_name,COLUMN_NAME,DIMINFO, SRID)
values(
'CFG_MAP_SCENE',
'GEOM',
MDSYS.SDO_DIM_ARRAY(
MDSYS.SDO_DIM_ELEMENT('X',120.797934,122.055879,0.005),
MDSYS.SDO_DIM_ELEMENT('Y',30.605716,31.850379,0.005)
),
4326
);
CREATE INDEX building_sidx ON CFG_MAP_SCENE(GEOM)
INDEXTYPE IS MDSYS.SPATIAL_INDEX
parameters ('layer_gtype =polygon');
COMMIT;
导入文件:
sqlldr nps/Nt1@orcl control=CFG_MAP_SCENE_20180821151727.ctl log=log.log bad=bad.log
ctl内容:
LOAD DATA
CHARACTERSET 'UTF8'
INFILE 'scene_20180821151727.txt'
APPEND
CONTINUEIF NEXT(1:1) = '#'
INTO TABLE CFG_MAP_SCENE
FIELDS TERMINATED BY '|'
TRAILING NULLCOLS (
CITY,
INDEX_ID,
PLANET_ID,
SCENE_NAME,
HEIGHT,
CENTROIDX,
CENTROIDY,
VMAP char(1000000),
GEOM COLUMN OBJECT
(
SDO_GTYPE INTEGER EXTERNAL,
SDO_SRID INTEGER EXTERNAL,
SDO_ELEM_INFO VARRAY TERMINATED BY '|/'
(X FLOAT EXTERNAL),
SDO_ORDINATES VARRAY TERMINATED BY '|/'
(X FLOAT EXTERNAL)
)
)
查看当前用户的表
select table_name from user_tables;
TABLE_NAME
--------------------------------------------------------------------------------
STUDENT
CFG_MAP_SCENE