oracle spatial初试

一、下载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.


 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值