First: 把工具shp2sdo和要导入的文件放到一个文件夹里
//Windows+R cmd
Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.
C:\Documents and Settings\Administrator>cd /d d:\s //用cd命令进入到工具所在文件夹
//shp2sdo可以从网上获取(oracle官网)
D:\s>shp2sdo //运行工具
shp2sdo - Shapefile(r) To Oracle Spatial Converter
Version 2.15 21-May-2004
Copyright 1997,2004 Oracle Corporation
For use with Oracle Spatial.
Input shapefile (no extension): emidastrm //输入文件名(不要扩展名的)
Shape file emidastrm.shp contains 62 linestrings
Output table [emidastrm]:
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=[528450.000000,534024.000000] Y=[5212523.000000,5218918.000000]
Override ? [N]:
Processing shapefile emidastrm into spatial table EMIDASTRM
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 : 62 linestrings processed
The following files have been created:
emidastrm.sql : SQL script to create the table
emidastrm.ctl : Control file for loading the table
emidastrm.dat : Data file //(新产生三个文件)
//Second: 连接到oracle数据库 用sqlplus命令
D:\s>sqlplus dx20/dx20@ora9i
SQL*Plus: Release 9.2.0.1.0 - Production on 星期五 11月 2 17:43:23 2012
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
连接到:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
Third : 运行*.sql脚本文件
SQL> @emidastrm.sql
DROP TABLE EMIDASTRM
*
ERROR 位于第 1 行:
ORA-00942: 表或视图不存在
表已创建。
已删除0行。
已创建 1 行。
提交完成。
SQL> exit
从Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production中断开
//D:\s>sqlldr dx20/dx20@ora9i emidastrm.ctl
D:\s>sqlldr dx20/dx20@ora9i
control = emidastrm.ctl)
SQL*Loader: Release 9.2.0.1.0 - Production on 星期五 11月 2 17:47:09 2012
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
达到提交点,逻辑记录计数61
达到提交点,逻辑记录计数62
D:\s>
//多了好几个文件 *.ctl *.dat *.sql *.log
查询:
Geometry column [GEOM]:
D:\s>sqlplus dx20/dx20@ora9i
SQL*Plus: Release 9.2.0.1.0 - Production on 星期五 11月 2 18:17:09 2012
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
连接到:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
SQL> select geom from emidastrm where rownum<3;
GEOM(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
--------------------------------------------------------------------------------
SDO_GEOMETRY(2002, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1), SDO_ORDINATE_ARRAY(
533595, 5213274, 533569, 5213289, 533554, 5213306, 533544, 5213324, 533534, 5213
338, 533516, 5213359, 533496, 5213389, 533474, 5213418, 533454, 5213438, 533440,
5213452, 533435, 5213463, 533429, 5213483, 533424, 5213508, 533421, 5213538, 53
3421, 5213562, 533414, 5213585, 533401, 5213601))
SDO_GEOMETRY(2002, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1), SDO_ORDINATE_ARRAY(
531631, 5213197, 531629, 5213207, 531628, 5213231, 531627, 5213258, 531628, 5213
283, 531635, 5213309, 531655, 5213346, 531679, 5213374, 531701, 5213398, 531730,
5213417, 531745, 5213436, 531747, 5213454))
在ArcMap中显示emidastrm.shp的属性表和以上查询到的数据作对比。
在oracle数据库中显示emidastrm.shp。
和在ArcMap中显示作对比。