ArcSDE for cross-database Association

Source: Internet
Author: User
Some users have asked this question before. I want to associate data. This is very simple. ArcSDE provides many association methods, such as join, view, and QueryLayer. For details, see blog. csdn. netlinghe301articledetails6649717

Some users have previously asked such a question that I want to associate data. This is very simple. ArcSDE provides many association methods, such as join, view, and QueryLayer. For details, refer: http://blog.csdn.net/linghe301/article/details/6649717 but the conditions that the user requires are special, the two data is distributed in two databases, which can

Some users have asked such a question before.

I want to associate data. This is very simple. ArcSDE provides many join methods, such as join, view, and QueryLayer,

Http://blog.csdn.net/linghe301/article/details/6649717

However, the conditions required by users are special. Can these two data be associated if they are distributed in two databases? The answer is yes. Next we will demonstrate how to perform cross-database Association one by one. In fact, the key step is the cross-database query of the Oracle database. Other aspects are the same as that of a database.


For example, we have a database in orcl where the user test table is "place", and the user sde table in another database in orcl2 is "owner ".

First, let's look at the structure of the two tables.

C: \ Users \ Administrator> sqlplus test/test @ orclSQL * Plus: Release 11.2.0.1.0 Production on Monday February 6 15:50:04 2012 Copyright (c) 1982,201 0, Oracle. all rights reserved. connect to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0-64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL> desc place; is the name blank? Type ----------------------------------------- -------- -------------------------- objectid not null number (38) NAME NVARCHAR2 (50) pid number (38) id number (38) shape sde. ST_GEOMETRY

View another instance and view the owner structure
C: \ Users \ Administrator> sqlplus sys/oracle @ orcl2 as sysdbaSQL * Plus: Release 11.2.0.1.0 Production on Monday February 6 15:50:52 2012 Copyright (c) 1982,201 0, Oracle. all rights reserved. connect to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0-64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL> desc sde. owner; is the name empty? Type ----------------------------------------- -------- ------------------------- objectid not null number (38) pid number (10) id number (10) NAME NVARCHAR2 (50) NAME1 NVARCHAR2 (50)
Place is a space table, and owner is an attribute table. The IDS of these two tables are associated fields.

First, we associate the two tables at the database level.

create public database link ABB  connect to SDE  using 'orcl2';


create public database link ABC  connect to SDE  using '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.100.111)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=orcl2)))';

The above two association methods can be used. The specific step is to connect to the sys user of the Instance orcl, and then ABB is the dblink name created by you, orcl2 is the Instance name/network service name of the remote database, and sde is the user/password used to log on to the remote database. Then, dblink accesses the local remote database 'orcl2' in the local database.

The table names of a user in another instance should be:

Username. Table Name @ database connection name (above link name)

SQL> conn sys/oracle @ orcl as sysdba is connected. SQL> create public database link ABB connect to sde identified by sde using 'orcl2 '; the database link has been created. SQL> desc sde. owner @ ABB; is the name blank? Type ---------------------------------------------- -------------------------- objectid not null number (38) pid number (10) id number (10) NAME NVARCHAR2 (50) NAME1 NVARCHAR2 (50)
SQL> conn sys/oracle @ orcl as sysdba is connected. SQL> create public database link ABB connect to sde identified by sde using 'orcl2 '; the database link has been created. SQL> desc sde. owner @ ABB; is the name blank? Type ---------------------------------------------- -------------------------- objectid not null number (38) pid number (10) id number (10) NAME NVARCHAR2 (50) NAME1 NVARCHAR2 (50)


Create public as much as possible. Otherwise, different users have permissions.If you have high permission requirements, you can also choose not to use public

Create related views.

SQL> create or replace view myview1 as select test. place. pid, test. place. shape: sde.owner@ABB.name from test. place, sde. owner @ ABB where test. place. sde.owner@ABB.id; create or replace view myview1 as select test. place. pid, test. place. shape: sde.owner@ABB.name from test. place, sde. owner @ ABB where test. place. id = sde.owner@ABB.id * 1st Line Error: ORA-02019: connection to remote database not found description ORA-04054: database link ABB. ID does not exist

It can be seen that the id field system in the owner table in the orcl instance is not supported directly using the sde.owner@ABB.id under the orcl instance, so we will create a synonym in the sde. owner @ ABB under the orcl instance to replace.

Create Synonym

SQL> conn sys/oracle @ orcl as sysdba is connected. SQL> create public synonym mysyn1 for sde. owner @ abb; the synonym has been created. SQL> conn test/test @ orcl; connected. SQL> desc mysyn1; is the name blank? Type ---------------------------------------------- -------------------------- objectid not null number (38) pid number (10) id number (10) NAME NVARCHAR2 (50) NAME1 NVARCHAR2 (50)

Create View
SQL> create or replace view myview1 as select test. place. pid, test. place. shape, mysyn1.name from test. place, mysyn1 where test. place. id = mysyn1.id; the view has been created.

ArcSDE Registration
C:\Users\Administrator>sdelayer -o register -l myview1,shape -e a -t ST_GEOMETRY -i sde:oracle11g:orcl  -u test -p testArcSDE 10.0  for Oracle11g Build 1937 Tue Aug 16 16:08:18  2011Layer    Administration Utility-----------------------------------------------------Successfully Created Layer.





Conclusion: I personally feel that this method of association is not stable. At least I load the layer data to ArcGIS Desktop, causing the Desktop software to crash (or possibly due to my environment problems ), however, there is no problem in using SQL operations. We recommend that you use this method with caution.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.