同步复制OneWay的数据库表研究
同步复制OneWay的数据库表研究 通过使用同步复制Oneway的数据库表的研究,来更加深入的了解同步复制的原理,数据同步的步骤。 本文以OneWay的父到子为例(从子到父只是角色变了,表的变化可以类比一下)。 系统环境 父库:Oracle 11.2.0.1 64Bit、 ArcSDE10 S
同步复制OneWay的数据库表研究
通过使用同步复制Oneway的数据库表的研究,来更加深入的了解同步复制的原理,数据同步的步骤。
本文以OneWay的父到子为例(从子到父只是角色变了,表的变化可以类比一下)。
系统环境
父库:Oracle 11.2.0.1 64Bit、 ArcSDE10 SP2 64Bit
子库:SQL Server 2008 64Bit、ArcSDE10 SP2 64Bit
两个库里面没有任何版本,STATE=0
执行操作
1:父库:注册版本、添加GlobeID。
2:执行复本操作,父库将相关的所有数据都导入到子库中。
父库:VERSIONS表中添加一条同步复制版本的记录。使用同步复制产生的版本名称都是以”SYNC_SEND_ReplicaObjectiD_”为前缀的,状态为16777216(这个数字还没有具体研究过,好像Oneway和Twoway是不一样的),一开始没有编辑之前,这两条记录的STATE_ID=0。
GDB_ITEMS表中添加一项Replica名称,默认为MyRelplica,是以XML存储,我们来看一下这个内容:子库的相关的连接参数信息,父库的相关角色等都描述的非常清楚。
子库:导入父库的所有数据(如果不加任何条件的话),导入之后直接就是注册版本状态。我查看了子库一开始的整体数据同步(非编辑父库同步),是不走状态表和增量表的,直接将父库的基表数据导入到子库的基表中。
VERSIONS表中无任何新添加的信息。
GDB_ITEMS表中添加一项Replica名称,默认为MyRelplica,是以XML存储,我们来看一下这个内容:父库的相关的连接参数信息,子库的相关角色等都描述的非常清楚。
3:对父库进行编辑
我对父库进行增、删、改三种方式的编辑行为,每做一次保存一下编辑,目的是记录一下相关的编辑状态。
父库的Versions表、States表等相关的版本表、增量表肯定发生了变化。如下Versions:
4:将父库变化的数据进行同步
父库的Versions表中发生了一些变化,首先我们查看一下同步复制的版本名称由原来的SYNC_SEND_4177_0变为SYNC_SEND_4177_1,这说明这个数字可以记录同步的次数。
GDB_ITEMS表中的Replica信息也发生了相关的变化
<mygenerationnumber>1</mygenerationnumber> <sibgenerationnumber>0</sibgenerationnumber> <sibmygenerationnumber>1</sibmygenerationnumber>
GDB_REPLICALOG表里面记录了同步的相关日志信息
子库里面我们可以看到,父库是通过版本表、增量表等信息将变化的数据同步过去的,那么我们在子库里面的相关表也同步过来了。
从上面的A表和STATES表可以看出,尽管我在父库里面是记录了三个不同状态的操作,但是在同步过程中,子库只记录一个相关的状态,这个状态可以记录同时编辑了N个数据,这样的话势必会提高子库的数据查询分析效率。
GDB_ITEMS表中的Replica信息也发生了相关的变化
<mygenerationnumber>0</mygenerationnumber> <sibgenerationnumber>1</sibgenerationnumber> <sibmygenerationnumber>0</sibmygenerationnumber> <replicastate>esriReplicaStateSendingAcknowledgment</replicastate>
同样也会更新子库中VERSIONS表的STATE_ID,将最新的ID同步更新。这样一次同步复制就完成了,那么我还是有一个疑问,系统是怎么将父库中关于某个同步要素类的变化的数据区分过去同步的,也就是他是将所有变化的数据给同步过去还是只同步最新变化的数据呢?带着这个问题我再一次做一个同步操作。
5:对父库做第二次编辑
我们可以看到父库里面VERSIONS表中
然后我们再看看族系表
其实从上面两个表我已经可以猜到系统肯定是只同步变化的数据,因为根据这两个表就能推出哪些是最新编辑的数据,因为系统记录了第一次同步之后第二次编辑之前的最新的状态值STATE_ID=55,根据这个值可以找到相关的族系名称LINEAGE_NAME=53,那么顺着这个族系名称找到最大的状态值就是最新编辑的记录的状态,从图上我们可以看到56、57、58都是最新编辑的,那么我们就可以从STATES表和增量表中将相关的信息记录出来。
5:第二次同步
父库GDB_REPLICALOG表里面记录了同步的相关日志信息
VERSIONS表中,果然同步版本名称又增加了1,同时更新了最新的状态值
GDB_ITEMS表中的Replica信息也发生了相关的变化
<mygenerationnumber>2</mygenerationnumber> <sibgenerationnumber>0</sibgenerationnumber> <sibmygenerationnumber>2</sibmygenerationnumber>
子库里面的A表和状态表
从上面的图更加坚定我刚才的猜测,系统只同步变化的数据,原来的状态值等于52的仍然没有变化,第二次同步过来的就是53(根据状态序列)。
GDB_ITEMS表中的Replica信息也发生了相关的变化
<mygenerationnumber>0</mygenerationnumber> <sibgenerationnumber>1</sibgenerationnumber> <sibmygenerationnumber>0</sibmygenerationnumber> <replicastate>esriReplicaStateSendingAcknowledgment</replicastate>
结论:通过上面对同步复制OneWay操作后数据库表信息的变化,基本上可以将这个编辑同步过程的步骤,或者系统设计的思路弄清楚,系统是根据子库父库存储的Replica的XML获取相关的角色、连接、数据描述等相关信息,然后编辑数据根据版本表、增量表将变化的数据读取然后进行相关的操作。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Go language is an efficient, concise and easy-to-learn programming language. It is favored by developers because of its advantages in concurrent programming and network programming. In actual development, database operations are an indispensable part. This article will introduce how to use Go language to implement database addition, deletion, modification and query operations. In Go language, we usually use third-party libraries to operate databases, such as commonly used sql packages, gorm, etc. Here we take the sql package as an example to introduce how to implement the addition, deletion, modification and query operations of the database. Assume we are using a MySQL database.

How to use MySQLi to establish a database connection in PHP: Include MySQLi extension (require_once) Create connection function (functionconnect_to_db) Call connection function ($conn=connect_to_db()) Execute query ($result=$conn->query()) Close connection ( $conn->close())

Hibernate polymorphic mapping can map inherited classes to the database and provides the following mapping types: joined-subclass: Create a separate table for the subclass, including all columns of the parent class. table-per-class: Create a separate table for subclasses, containing only subclass-specific columns. union-subclass: similar to joined-subclass, but the parent class table unions all subclass columns.

Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps

HTML cannot read the database directly, but it can be achieved through JavaScript and AJAX. The steps include establishing a database connection, sending a query, processing the response, and updating the page. This article provides a practical example of using JavaScript, AJAX and PHP to read data from a MySQL database, showing how to dynamically display query results in an HTML page. This example uses XMLHttpRequest to establish a database connection, send a query and process the response, thereby filling data into page elements and realizing the function of HTML reading the database.

1. Open DingTalk on your mobile phone and first select the avatar in the upper left corner. 2. Click Settings at the bottom of the pop-up page. 3. Then click on the settings on the page. 4. Open the calendar settings on the settings page. 5. Click on it and find the synchronized mobile schedule on the page. . 6. Then turn on the synchronization of mobile phone schedules.

Analysis of the basic principles of the MySQL database management system MySQL is a commonly used relational database management system that uses structured query language (SQL) for data storage and management. This article will introduce the basic principles of the MySQL database management system, including database creation, data table design, data addition, deletion, modification, and other operations, and provide specific code examples. 1. Database Creation In MySQL, you first need to create a database instance to store data. The following code can create a file named "my

PHP is a back-end programming language widely used in website development. It has powerful database operation functions and is often used to interact with databases such as MySQL. However, due to the complexity of Chinese character encoding, problems often arise when dealing with Chinese garbled characters in the database. This article will introduce the skills and practices of PHP in handling Chinese garbled characters in databases, including common causes of garbled characters, solutions and specific code examples. Common reasons for garbled characters are incorrect database character set settings: the correct character set needs to be selected when creating the database, such as utf8 or u
