> For the complete documentation index, see [llms.txt](https://uia.gitbook.io/simple-data-migration-tool/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://uia.gitbook.io/simple-data-migration-tool/basic-concept.md).

# Basic Concept

## Simple Guide

同步計畫以 XML 進行設計，XML 包括四個子集：

* jobSpace
* taskSpace
* tableSpace
* databaseSpace

### jobSpace

定義待執行的工作 (job)，內容包括：

* 資料搜尋策略
* 工作項 (item) 及對應任務 (task)
* 資料來源 (source)
* 轉移目的 (target)

### taskSpace

定義可被工作項 (item) 調用的任務，內容包括：

* 來源資料表 (source) 與目的資料表 (target)
* 子任務群 (next, plan, task)

### tableSpace

補充資料表的主鍵。

### databaseSpace

定義工作 (job) 中資料來源 (source) 與轉移目的 (target) 參考到的資料庫。配合整合測試，可配置特殊的 IDLE 資料庫，用於模擬資料的轉移。

```markup
<databaseSpace>
  <database>
    <id>IDLE</id>
    <host>0.0.0.0</host>
    <port>0</port>
    <dbName></dbName>
    <user></user>
    <password></password>
    <driverClass>uia.tmd.IdleAccess</driverClass>
  </database>
</databaseSpace>
```

## Samples

```markup
<?xml version="1.0" encoding="UTF-8"?>
<tmd xmlns="http://tmd.uia/model/xml">
	<jobSpace>
		<job name="MVSDB_ALL_IDLE" source="IVP1" target="IDLE">
			<item taskName="hspt" />
			<item taskName="ivp" />		
			<item taskName="ivp_agent" />		
			<item taskName="ivp_event_def" />		
			<item taskName="ivp_raw" />		
			<item taskName="ivp_raw_event" />		
			<item taskName="ivp_run" driverName="uia.tmd.impl.MyItemRunner">
				<args>
					<arg>created_time</arg>
				</args>
			</item>
			<item taskName="ivp_run_memo" />		
		</job>
		<job name="MVSDB_ALL_IVP2" source="IVP1" target="IVP2">
			<item taskName="hspt" />
			<item taskName="ivp" />		
			<item taskName="ivp_agent" />		
			<item taskName="ivp_event_def" />		
			<item taskName="ivp_raw" />		
			<item taskName="ivp_raw_event" />		 
			<item taskName="ivp_run" driverName="uia.tmd.impl.MyItemRunner">
				<args>
					<arg>created_time</arg>
				</args>
			</item>
			<item taskName="ivp_run_memo" />		
		</job>
	</jobSpace>
	<taskSpace>
		<task name="hspt">
			<sourceSelect table="hspt" />
			<targetUpdate />
		</task>
		<task name="ivp">
			<sourceSelect table="ivp" />
			<targetUpdate />
		</task>
		<task name="ivp_agent">
			<sourceSelect table="ivp_agent" />
			<targetUpdate />
		</task>
		<task name="ivp_event_def">
			<sourceSelect table="ivp_event_def" />
			<targetUpdate />
		</task>
		<task name="ivp_raw">
			<sourceSelect table="ivp_raw" />
			<targetUpdate />
		</task>
		<task name="ivp_raw_event">
			<sourceSelect table="ivp_raw_event" />
			<targetUpdate />
		</task>
		<task name="ivp_run">
			<sourceSelect table="ivp_run" />
			<targetUpdate />
		</task>
		<task name="ivp_run_memo">
			<sourceSelect table="ivp_run_memo" />
			<targetUpdate />
		</task>
	</taskSpace>
	<tableSpace />
	<databaseSpace>
		<database>
			<id>IDLE</id>
			<host>0.0.0.0</host>
			<port>0</port>
			<dbName></dbName>
			<user></user>
			<password></password>
			<driverClass>uia.tmd.IdleAccess</driverClass>
		</database>
		<database>
			<id>IVP1</id>
			<host>localhost</host>
			<port>5432</port>
			<dbName>mvsdb</dbName>
			<user>huede</user>
			<password>huede</password>
			<driverClass>uia.tmd.access.PGSQLAccess</driverClass>
		</database>
		<database>
			<id>IVP2</id>
			<host>localhost</host>
			<port>5432</port>
			<dbName>mvsdb2</dbName>
			<user>huede</user>
			<password>huede</password>
			<driverClass>uia.tmd.access.PGSQLAccess</driverClass>
		</database>
	</databaseSpace>
</tmd>
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://uia.gitbook.io/simple-data-migration-tool/basic-concept.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
