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

相关文章

java中新生代和老生代的关系说明

《java中新生代和老生代的关系说明》:本文主要介绍java中新生代和老生代的关系说明,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录一、内存区域划分新生代老年代二、对象生命周期与晋升流程三、新生代与老年代的协作机制1. 跨代引用处理2. 动态年龄判定3. 空间分

MySQL之InnoDB存储引擎中的索引用法及说明

《MySQL之InnoDB存储引擎中的索引用法及说明》:本文主要介绍MySQL之InnoDB存储引擎中的索引用法及说明,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐... 目录1、背景2、准备3、正篇【1】存储用户记录的数据页【2】存储目录项记录的数据页【3】聚簇索引【4】二

mysql中的数据目录用法及说明

《mysql中的数据目录用法及说明》:本文主要介绍mysql中的数据目录用法及说明,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录1、背景2、版本3、数据目录4、总结1、背景安装mysql之后,在安装目录下会有一个data目录,我们创建的数据库、创建的表、插入的

Maven中的profiles使用及说明

《Maven中的profiles使用及说明》:本文主要介绍Maven中的profiles使用及说明,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录主要用途定义 Profiles示例:多环境配置激活 Profiles示例:资源过滤示例:依赖管理总结Maven 中的

Oracle 数据库数据操作如何精通 INSERT, UPDATE, DELETE

《Oracle数据库数据操作如何精通INSERT,UPDATE,DELETE》在Oracle数据库中,对表内数据进行增加、修改和删除操作是通过数据操作语言来完成的,下面给大家介绍Oracle数... 目录思维导图一、插入数据 (INSERT)1.1 插入单行数据,指定所有列的值语法:1.2 插入单行数据,指

Before和BeforeClass的区别及说明

《Before和BeforeClass的区别及说明》:本文主要介绍Before和BeforeClass的区别及说明,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录Before和BeforeClass的区别一个简单的例子当运行这个测试类时总结Before和Befor

Python pip下载包及所有依赖到指定文件夹的步骤说明

《Pythonpip下载包及所有依赖到指定文件夹的步骤说明》为了方便开发和部署,我们常常需要将Python项目所依赖的第三方包导出到本地文件夹中,:本文主要介绍Pythonpip下载包及所有依... 目录步骤说明命令格式示例参数说明离线安装方法注意事项总结要使用pip下载包及其所有依赖到指定文件夹,请按照以

Oracle修改端口号之后无法启动的解决方案

《Oracle修改端口号之后无法启动的解决方案》Oracle数据库更改端口后出现监听器无法启动的问题确实较为常见,但并非必然发生,这一问题通常源于​​配置错误或环境冲突​​,而非端口修改本身,以下是系... 目录一、问题根源分析​​​二、保姆级解决方案​​​​步骤1:修正监听器配置文件 (listener.

Spring组件实例化扩展点之InstantiationAwareBeanPostProcessor使用场景解析

《Spring组件实例化扩展点之InstantiationAwareBeanPostProcessor使用场景解析》InstantiationAwareBeanPostProcessor是Spring... 目录一、什么是InstantiationAwareBeanPostProcessor?二、核心方法解

Spring中管理bean对象的方式(专业级说明)

《Spring中管理bean对象的方式(专业级说明)》在Spring框架中,Bean的管理是核心功能,主要通过IoC(控制反转)容器实现,下面给大家介绍Spring中管理bean对象的方式,感兴趣的朋... 目录1.Bean的声明与注册1.1 基于XML配置1.2 基于注解(主流方式)1.3 基于Java