一、下载shp2sdo 工具,将工具放在 oracle按照目录下的bin目录下
oracle的bin目录一般为:D:\app\***\product\11.2.0\dbhome_2\BIN
或者:在开始菜单中的oracle-OraDb11g_home1 >配置和移植工具>Database Configuration Assistance 右键属性,打开文件位置 即可看到BIN目录
二、
(1)cmd 到 shp文件目录下,运行命令
D:\oraclespatial\shp2sdo\shp>shp2sdo.exe
shp2sdo - Shapefile(r) To Oracle Spatial Converter
Version 2.15 21-May-2004
Copyright 1997,2004 Oracle Corporation
For use with Oracle Spatial.
(2)输入shp文件名,会生成sql,ctl,dat文件:
Input shapefile (no extension): wzs
Shape file wzs.shp contains 1 polygons
Output table [wzs]:
Output data model [O]:
Geometry column [GEOM]:
ID column []:
Use a spatial reference system ID (SRID) ? [N]:
Change tolerance value from the default (0.00000005) ? [N]:
Generate data inside control files ? [N]:
Target database Oracle8i? [N]:
Spatial Data requires more than 6 digits precision? [N]:
Bounds: X=[322971.488900,365999.591200] Y=[2061134.731500,2106240.455700]
Override ? [N]:
Processing shapefile wzs into spatial table WZS
Data model is object-relational
Geometry column is GEOM
Points stored in SDO_POINT attributes
Data is in a separate file(s)
Control file generation for Oracle9i or higher
Spatial data loaded with 6 digits of precision
Conversion complete : 1 polygons processed
The following files have been created:
wzs.sql : SQL script to create the table
wzs.ctl : Control file for loading the table
wzs.dat : Data file
(3)登录数据库
D:\oraclespatial\shp2sdo\shp>sqlplus XX/**@SID
SQL*Plus: Release 11.2.0.1.0 Production on Tue Apr 30 09:21:19 2019
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Productio
With the Partitioning, OLAP, Data Mining and Real Application Testing optio
(4)读取sql文件
SQL> @wzs.sql
DROP TABLE WZS
*
ERROR at line 1:
ORA-00942: table or view does not exist
Table created.
1 row deleted.
1 row created.
Commit complete.
(5)完成后退出
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing optio
(6)上载数据:
D:\oraclespatial\shp2sdo\shp>sqlldr xx/**@sid
SQL*Loader: Release 11.2.0.1.0 - Production on 星期二 4月 30 09:22:36 2019
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserve
达到提交点 - 逻辑记录计数 1
(7)创建索引:
SQL> create index IDX_WZS on wzs(geom) indextype is mdsys.spatial_index;
Index created.