Oracle:
DROP PUBLIC DATABASE LINK NM_HN;
CREATE PUBLIC DATABASE LINK NM_HN
CONNECT TO XZXT
IDENTIFIED BY <PWD>
USING '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP) (HOST=10.184.17.3) (PORT=1521) )(CONNECT_DATA=(SERVICE_NAME=XZXT1)))';
mysql:
1、檢視target端是否安裝了FEDERATED存儲引擎
mysql> show engines ;
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| CSV | YES | CSV storage engine | NO | NO | NO |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| MyISAM | YES | MyISAM storage engine | NO | NO | NO |
| BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | NULL |
| ARCHIVE | YES | Archive storage engine | NO | NO | NO |
| InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
注意:如果沒有安裝FEDERATED 引擎 執行install plugin federated soname 'ha_federated.so';
這裡已經安裝好了,隻是沒有啟用
2、将federated添加到my.cnf 重新開機資料庫
vi /etc/my.cnf
[mysqld]
federated
service mysql restart
mysql> show engines;
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO |
| MyISAM | YES | MyISAM storage engine | NO | NO | NO |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| ARCHIVE | YES | Archive storage engine | NO | NO | NO |
| PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |
| FEDERATED | YES | Federated MySQL storage engine | NO | NO | NO |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
這裡FEDERATED 引擎已經啟用。
在目标資料庫中,建立同步傳輸
目标端:
CREATE TABLE `t` (
`SYSTEM_TYPE` varchar(100) DEFAULT NULL,
`ORDER_DATE` int(6) DEFAULT NULL,
`CUSTOMER_ID` varchar(40) DEFAULT NULL,
`UBI_UID` varchar(40) DEFAULT NULL,
`FOI_ORDERTIME` varchar(100) DEFAULT NULL,
`FOI_ORDERNO` varchar(40) DEFAULT NULL,
`FOI_KEY` varchar(2500) DEFAULT NULL,
`FOI_KEYTYPE` varchar(40) DEFAULT NULL,
`CODENAME` varchar(100) DEFAULT NULL,
`ORDER_STATUS` varchar(20) DEFAULT NULL,
`FOI_ORDERTYPE` varchar(60) DEFAULT NULL,
`QYZM` int(11) DEFAULT NULL,
`GDCZ` int(11) DEFAULT NULL,
`GLRY` int(11) DEFAULT NULL,
`QYDWTZ` int(11) DEFAULT NULL,
`FRDWTZ` int(11) DEFAULT NULL,
`FRZWRZ` int(11) DEFAULT NULL,
`CXFR` int(11) DEFAULT NULL,
`CXGD` int(11) DEFAULT NULL,
`CXGG` int(11) DEFAULT NULL,
`ORDER_TYPE` varchar(20) DEFAULT NULL,
`DESC_INFO2` varchar(50) DEFAULT NULL
) ENGINE=federated connection = 'mysql://root:[email protected]:3306/czb/F_ORDERINFO_DETAIL';
-
- 注意:源端表結構 engine=federated connection = 'mysql://使用者:密碼@IP位址:端口/庫名稱/表名稱';
- 注意:資料庫密碼中不要有'@'、':'、'/'、‘.’等特殊字元
轉載于:https://www.cnblogs.com/learningJAVA/p/5663500.html