Oracle Spatial 组件 说明

2024-04-04 02:08
文章标签 oracle 组件 说明 spatial

本文主要是介绍Oracle Spatial 组件 说明,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

 

一.Spatial 组件说明

 

在之前整理了几篇与Oracle组件相关的Blog:

Oracle8i/9i/10g/11g组件(Components) 说明

http://www.cndba.cn/Dave/article/1445

 

Oracle XDB 组件 重建 说明

http://blog.csdn.net/tianlesoftware/article/details/7323139

 

Oracle OLAP 组件 重建 说明

http://blog.csdn.net/tianlesoftware/article/details/7321333

 

在这篇我们看一下Spatial组件的说明。

 

在说明之前,我们先用如下SQL查看一下DB中的组件:

SQL> col comp_id for a15

SQL> col version for a15

SQL> col comp_name for a30

SQL> select comp_id,comp_name,versionfrom dba_registry

 2  ;

 

COMP_ID         COMP_NAME                      VERSION

--------------------------------------------- ---------------

XDB             Oracle XML Database            11.2.0.3.0

AMD             OLAP Catalog                   11.2.0.3.0

EM              Oracle Enterprise Manager      11.2.0.3.0

SDO             Spatial                        11.2.0.3.0

ORDIM           Oracle Multimedia              11.2.0.3.0

CONTEXT         Oracle Text                    11.2.0.3.0

ODM             Oracle Data Mining             11.2.0.3.0

EXF             Oracle Expression Filter       11.2.0.3.0

RUL             Oracle Rules Manager           11.2.0.3.0

OWM             Oracle Workspace Manager       11.2.0.3.0

CATALOG        Oracle Database CatalogViews  11.2.0.3.0

 

COMP_ID         COMP_NAME                      VERSION

--------------------------------------------- ---------------

CATPROC         Oracle Database Packages and T11.2.0.3.0

                ypes

 

JAVAVM         JServer JAVA VirtualMachine   11.2.0.3.0

XML             Oracle XDK                     11.2.0.3.0

CATJAVA         Oracle Database Java Packages  11.2.0.3.0

XOQ             Oracle OLAP API                11.2.0.3.0

APS             OLAP Analytic Workspace        11.2.0.3.0

 

17 rows selected.

--这里是我们DB 的所有组件列表, 其中有关OLAP 组件的说明,之前的Blog 已经说明,这里看一下Spatial 组件。

 

MOS上对该组件的说明如下:

Oracle Spatialis an extension to the Oracle RDBMS. An integrated set of functions andprocedures, that enables spatial information to be stored, managed andmaintained within Oracle. 

 

Oracle Spatialis designed to make spatial data management easier and more natural to users oflocation-enabled applications and geographic information system (GIS)applications. When spatial data is stored in an Oracle database, it can beeasily manipulated, retrieved, and related to all other data stored in thedatabase. 

--Oracle Spatial 组件是为了让空间数据管理更容易,更自然的使用location-enabled应用和GIS 应用。 当Spatial 数据存储在DB中时,它可以很容易的被操作和恢复,与之相关的其他数据也会存储在DB中。

 

It is an optionwhich provides integration of location with traditional relational attributedata for Internet and wireless location-based services. However, Oracle Spatialdoes not provide tools for spatial data collection, sophisticated analytical andvisualisation functionality provided by the traditional Geographic InformationSystems (GIS).

 

Oracle Spatial consists of the following:

(1)    A schema (MDSYS) thatprescribes the storage, syntax, and semantics of supported geometric datatypes.

(2)    Spatial indexing mechanisms.

(3)    A set of spatial operators andfunctions for performing area-of-interest queries, spatial join queries, andother spatial analysis operations.

(4)    Administrative utilities.

(5)    Java classes for accessing,manipulating and storing Spatial object types. This will be included in afuture distribution but is currently available from the Oracle TechnicalNetwork (OTN)

 

Spatial data isany data with a location component. Databases with geographic references, suchas addresses, phone numbers and postal codes may now analyse this informationusing third party geocoding tools and services. The Oracle Spatial geocodingfeature matches these records with a latitude/longitude point that is thenstored in the database. This facilitates analysis based on spatialrelationships of the associated data. The proximity of ATM machines tocustomers within a certain distance and the amount of money withdrawn perterritory are examples of geocoding feature usage.

 

A common exampleof spatial data can be seen in a road map. A road map is a two-dimensionalobject that contains points, lines, and polygons that can represent cities,roads, and political boundaries such as states or provinces. A road map is avisualization of geographic information. The location of cities, roads, andpolitical boundaries that exist on the surface of the Earth are projected ontoa two-dimensional display or piece of paper, preserving the relative positionsand relative distances of the rendered objects. 

--Spatial Data 一个常见的示例就是road map。Road Map 是一个二维的对象,其包含点,线和多变形,这些信息可以代表一个城市,街道或者城市和省的边界。Road Map 是地理信息的形象化。

 

Spatial 组件的用户:

(1)    MDSYS:

The Oracle Spatial and Oracle interMedia Locator administratoraccount 

(2)    MDDATA:

The schema used by Oracle Spatial for storing Geocoder androuter data 

 

更多说明参考官网手册:

http://docs.oracle.com/cd/B19306_01/appdev.102/b14255/toc.htm

What is Oracle Spatial? A Technical UserIntroduction [ID 102313.1]

 

二.Spatial 组件重建

MOS:

Master Note for Oracle Spatial and OracleLocator Installation [ID 220481.1]

 

2.1 Spatial 组件卸载

MOS:

Steps for Manual De-installation of OracleSpatial [ID 179472.1]

 

2.1.1 准备工作

Before deinstalling Oracle Spatial, it isbest to drop all Spatial indexes.

--在卸载OracleSpatial 组件之前最好drop 掉所有的Spatial 索引。

 

Check if Spatial indexes exist in thedatabase: 

--可以使用如下SQL来检查:

connect / as sysdba 
select owner,index_name from dba_indexes  where ityp_name ='SPATIAL_INDEX';

 

Check if tables having Spatial columns(columns having datatype SDO_GEOMETRY) exist:

--检查是否有表使用Spatial列,即列的类型为:SDO_GEOMETRY.

set pages 200 
col owner for a20 
col table_name for a30 
col column_name for a25 

/* Formatted on 2012/3/8 13:48:49 (QP5v5.185.11230.41888) */

 SELECT owner, table_name, column_name

    FROM dba_tab_columns

  WHERE data_type = 'SDO_GEOMETRY' AND owner != 'MDSYS'

ORDER BY 1, 2,3;

 

Note: Removing MDSYS will drop (!) existingSDO_GEOMETRY columns from above tables! 

--在我们卸载Spatial组件时,会drop 掉所有表中包含SDO_GEOMETRY的列。

 

如果存在SDO_GEOMETRY列,那么参考MOS文档处理:

Re-installing Spatial with Existing TablesHaving an SDO_GEOMETRY Column [ID 250791.1]

 

2.1.2 drop Spatial 索引

To drop Spatial indexes: 
SQL>drop index <owner>.<indexname>; 

--如果有索引不能drop,加force 强制drop:

-- If some indexes cannot be dropped usethe FORCE option: 
SQL>drop index <owner>.<indexname> force; 

 

2.1.3 drop Spatical 用户:MDSYS

Then drop the user MDSYS: 

SQL>drop user MDSYS cascade; 

 

2.1.4 drop 同义词

Optionally drop all remaining publicsynonyms created for Spatial: 

--可选的操作,drop剩余的同义词,语法如下:

set pagesize 0 
set feed off 
spool dropsyn.sql 
select 'drop public synonym "' || synonym_name || '";' fromdba_synonyms where table_owner='MDSYS'; 
spool off;
@dropsyn.sql

 

2.1.5 Drop 其他用户

Spatial alsocreates a few user schemas during installation which can be dropped aswell: 

       --Spatial 在drop 期间也会产生新的用户,这些用户也可以被drop:

 

SQL>drop user mddata cascade; 


-- Only created as of release 11g: 

--这些用户仅在11g中产生:

SQL>drop user spatial_csw_admin_usrcascade; 
SQL>drop user spatial_wfs_admin_usr cascade; 

 

2.1.6 其他注意事项:

(1)如果我们删除Spatial 后,还可以从v$option中查到记录,如:
SQL> select * from v$option where parameter = 'Spatial';
PARAMETER VALUE
------------------------------- ----------
Spatial TRUE

这个暂时没有没有解决方法,因为与Spatial 相关的表和索引我们之前已经droped,但是v$option 并没有更新,这个可能是Oracle 的BUG:

BUG:3069432 -V$OPTION NOT UPDATED AFTER DEINSTALLING SPATIAL OPTION

 

具体可以参考:

Removed Spatial Option But Spatial StillAppears In V$Option [ID 273573.1]

 

(2)必须安装Spatial 组件

如果我们卸载了Spatial 组件之后,又不打算重装Spatial 组件,那么我们至少必须安装Spatial 组件的一个子组件:Oracle Locator。 这样就可以避免以后升级中依赖关系带来的问题,比如XDB 组件。

 

(3)彻底清除Spatial 组件

如果Spatial 安装失败或者安装到其他用户下面,那么可以参考如下文档,直接drop 所有相关的对象来清除所有Spatial组件对象。

AccidentallyInstalled SPATIAL Into SYS, SYSTEM Or Another Schema [ID 413693.1]

 

 

2.2 Spatial 组件安装

MOS:

Steps for Manual Installation /Verification of Spatial 10g / 11g [ID 270588.1]

Steps for Manual Installation of Oracle 9iSpatial [ID 220484.1]

 

2.2.1 Oracle 9i 安装Spatial

       在Oracle 9i中,Spatial 组件是预选安装的,只要只要同意,就可以安装了。如果我们使用DBCA 来创建示例,Spatial 组件也是默认安装的。

       如果我们在创建实例时没有安装Spatial 组件,那么可以使用如下方法:

 

Oracle 9i 中的条件是初始化参数中的COMPATIBLE 参数值大于 9.0.0.0.0.

 

2.2.1.1 Check if the userORDSYS already exists:

--检查ORDSYS用户是否存在:

Connect to the database instance specifyingAS SYSDBA.

SQL> select username from dba_userswhere username='ORDSYS';

 

(1)If ORDSYS does NOT exist:

--如果ORDSYS不存在:

SQL> @?/ord/admin/ordinst.sql

 

This will createthe ORDSYS user and the MDSYS user with the required privileges.

The accountMDSYS will be locked by default by this script (in release 9.2 only).

这个脚本会创建ORDSYS 和 MDSYS 用户。 在9.2中,MDSYS 默认会被lock。

 

(2)If the ORDSYS user already existsand the MDSYS user does NOT exist:

--如果ORDSYS已经存在,而MDSYS 不存在,操作如下:

create the user MDSYS by running followingcommand:

create user MDSYS identified by<password> account lock;

grant the required privileges to MDSYS byrunning:

SQL> @?/md/admin/mdprivs.sql

 

(3)    If the ORDSYS user already exists AND the MDSYS user already existsthen you are advised to verify if the installation has been done correctly andde-install Spatial first in case of re-installation. 

--如果ORDSYS 和MDSYS 都存在,那么就需要在安装之前先卸载他们,具体的卸载不丑,参考第一部分的说明。

 

 

2.2.1.2 Install Spatial by running thefollowing procedure, as the MDSYS account should be locked you must login assys and then change the current schema:

--运行如下脚本安装Spatial:

SQL>connect / as sysdba 
SQL>alter session set current_schema=MDSYS; 
SQL>@?/md/admin/mdinst.sql

 

2.2.1.3 It is strongly recommended that theMDSYS user account remains locked. The MDSYS user is created with administratorprivileges; therefore, it is important to protect this account fromunauthorized use. 

--默认情况下MDSYS账户是locked的,这个账户有administrator 的权限,因此推荐保持lock 状态,如果解锁,使用如下命令:

 

To lock the MDSYS user, connect as SYS andenter the following command:

SQL> alter user MDSYS account lock;

 

2.2.2 Oracle 10g/11g 安装Spatial

 

2.2.2.1 准备工作

To be able to doa successful Spatial 10g / 11g installation you need to have the followingproducts already installed:

--在Oracle 10g/11g 中安装Spatial 组件,必须先保证如下三个组件已经存在:

(1)    JServer JAVA Virtual Machine

(2)    Oracle interMedia   

(3)    Oracle XML Database

 

To verify if the products are installed andvalid run:

--验证以上三个组件,可以使用如下SQL:

SQL> col comp_id for a12

SQL> col version for a15

SQL> col status for a15

SQL> select comp_id,version,status fromdba_registry where comp_id in ('JAVAVM','ORDIM','XDB');

 

COMP_ID     VERSION         STATUS

------------ ------------------------------

XDB         11.2.0.3.0      VALID

ORDIM       11.2.0.3.0      VALID

JAVAVM      11.2.0.3.0      VALID


如果没有安装或者无效,就需要解决这些组件,具体可以参考:

Oracle XDB 组件 重建 说明

http://blog.csdn.net/tianlesoftware/article/details/7323139


Oracle JAVAVM 组件 Reload 说明
http://www.cndba.cn/Dave/article/1328


Where to Find the Information to Install,Upgrade, Downgrade and Deinstall interMedia/Oracle Multimedia? [ID 337415.1]

 


2.2.2.2 安装Spatial 组件

If the MDSYS user does NOT exist:

--如果MDSYS 用户不存在:

create the user MDSYS by running followingcommand:

SQL> createuser MDSYS identified by <password> default tablespace SYSAUX accountlock;

 

--赋权:

grant the required privileges to MDSYS byrunning:

   SQL> @?/md/admin/mdprivs.sql

 

If the MDSYSuser already exists then you are advised to verify if the installation has beendone correctly and de-install Spatial first in case of re-installation.

--如果用户已经存在,那么在安装之前最好先卸载, 具体卸载步骤参考第一部分。

 

   See the verification checks at the bottom of this note and a link tode-installation note.

 

Install Spatialby executing the steps shown below. Note you need to run this as a SYSDBA user!

--使用sysdaba 用户执行如下步骤:

   SQL> connect / as sysdba

   SQL> spool spatial_installation.lst

   SQL> @?/md/admin/mdinst.sql

   SQL> spool off

 

    At the end of the installation some verification steps are automaticallyexecuted!

You can also manually run the theverification steps later on.

 

It is stronglyrecommended that the MDSYS user account remains locked. The MDSYS user is createdwith administrator privileges; therefore, it is important to protect thisaccount from unauthorized use. 

 

To lock theMDSYS user, connect as SYS and enter the following command:

   SQL> alter user MDSYS account lock;

 

2.2.2.3 验证安装

 

Execute the following steps to verify ifSpatial is installed correctly:

SQL> connect/ as sysdba 
    SQL> set serveroutput on
    SQL> execute validate_sdo;
    SQL> select comp_id, control,schema, version, status, comp_name from dba_registry where comp_id='SDO';
    SQL> select object_name,object_type, status from dba_objects where owner='MDSYS' and status <>'VALID' order by object_name;

--示例:

SQL> execute validate_sdo;

PL/SQL procedure successfully completed.

 

SQL> select comp_id, control, schema,version, status, comp_name from dba_registry where comp_id='SDO';

 

COMP_ID     CONTROL      SCHEMA       VERSION         STATUS          COMP_NAME

------------ ------------ --------------------------- --------------- ---------

SDO         SYS          MDSYS        11.2.0.3.0      VALID           Spatial

 

 

 

 

-------------------------------------------------------------------------------------------------------

版权所有,文章允许转载,但必须以链接方式注明源地址,否则追究法律责任!

QQ:492913789

Email:ahdba@qq.com

Blog:  http://www.cndba.cn/dave

Weibo: http://weibo.com/tianlesoftware

Twitter: http://twitter.com/tianlesoftware

Facebook: http://www.facebook.com/tianlesoftware

Linkedin: http://cn.linkedin.com/in/tianlesoftware

 

 

-------加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请----

DBA1 群:62697716(满);   DBA2 群:62697977(满)  DBA3 群:62697850(满)  

DBA 超级群:63306533(满);  DBA4 群:83829929   DBA5群: 142216823

DBA6 群:158654907    DBA7 群:172855474   DBA总群:104207940

这篇关于Oracle Spatial 组件 说明的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/874543

相关文章

Springboot项目构建时各种依赖详细介绍与依赖关系说明详解

《Springboot项目构建时各种依赖详细介绍与依赖关系说明详解》SpringBoot通过spring-boot-dependencies统一依赖版本管理,spring-boot-starter-w... 目录一、spring-boot-dependencies1.简介2. 内容概览3.核心内容结构4.

redis和redission分布式锁原理及区别说明

《redis和redission分布式锁原理及区别说明》文章对比了synchronized、乐观锁、Redis分布式锁及Redission锁的原理与区别,指出在集群环境下synchronized失效,... 目录Redis和redission分布式锁原理及区别1、有的同伴想到了synchronized关键字

MySQL 临时表创建与使用详细说明

《MySQL临时表创建与使用详细说明》MySQL临时表是存储在内存或磁盘的临时数据表,会话结束时自动销毁,适合存储中间计算结果或临时数据集,其名称以#开头(如#TempTable),本文给大家介绍M... 目录mysql 临时表详细说明1.定义2.核心特性3.创建与使用4.典型应用场景5.生命周期管理6.注

Java中数组与栈和堆之间的关系说明

《Java中数组与栈和堆之间的关系说明》文章讲解了Java数组的初始化方式、内存存储机制、引用传递特性及遍历、排序、拷贝技巧,强调引用数据类型方法调用时形参可能修改实参,但需注意引用指向单一对象的特性... 目录Java中数组与栈和堆的关系遍历数组接下来是一些编程小技巧总结Java中数组与栈和堆的关系关于

Oracle迁移PostgreSQL隐式类型转换配置指南

《Oracle迁移PostgreSQL隐式类型转换配置指南》Oracle迁移PostgreSQL时因类型差异易引发错误,需通过显式/隐式类型转换、转换关系管理及冲突处理解决,并配合验证测试确保数据一致... 目录一、问题背景二、解决方案1. 显式类型转换2. 隐式转换配置三、维护操作1. 转换关系管理2.

Oracle查询表结构建表语句索引等方式

《Oracle查询表结构建表语句索引等方式》使用USER_TAB_COLUMNS查询表结构可避免系统隐藏字段(如LISTUSER的CLOB与VARCHAR2同名字段),这些字段可能为dbms_lob.... 目录oracle查询表结构建表语句索引1.用“USER_TAB_COLUMNS”查询表结构2.用“a

Oracle数据库定时备份脚本方式(Linux)

《Oracle数据库定时备份脚本方式(Linux)》文章介绍Oracle数据库自动备份方案,包含主机备份传输与备机解压导入流程,强调需提前全量删除原库数据避免报错,并需配置无密传输、定时任务及验证脚本... 目录说明主机脚本备机上自动导库脚本整个自动备份oracle数据库的过程(建议全程用root用户)总结

mybatis-plus QueryWrapper中or,and的使用及说明

《mybatis-plusQueryWrapper中or,and的使用及说明》使用MyBatisPlusQueryWrapper时,因同时添加角色权限固定条件和多字段模糊查询导致数据异常展示,排查发... 目录QueryWrapper中or,and使用列表中还要同时模糊查询多个字段经过排查这就导致只要whe

Olingo分析和实践之OData框架核心组件初始化(关键步骤)

《Olingo分析和实践之OData框架核心组件初始化(关键步骤)》ODataSpringBootService通过初始化OData实例和服务元数据,构建框架核心能力与数据模型结构,实现序列化、URI... 目录概述第一步:OData实例创建1.1 OData.newInstance() 详细分析1.1.1

SpringBoot改造MCP服务器的详细说明(StreamableHTTP 类型)

《SpringBoot改造MCP服务器的详细说明(StreamableHTTP类型)》本文介绍了SpringBoot如何实现MCPStreamableHTTP服务器,并且使用CherryStudio... 目录SpringBoot改造MCP服务器(StreamableHTTP)1 项目说明2 使用说明2.1