环境:两台服务器均为centos 7,安装相同版本的达梦数据库
源端:192.168.43.110 端口:5236 实例名:DMSERVER
目的端:192.168.43.111 端口:5238 实例名:DMDB
1.修改dm.ini中的MAL_INI=1,INSTANCE_NAME
---源端:
INSTANCE_NAME = DMSERVER
MAL_INI = 1
---目的端:
INSTANCE_NAME = DMDB
MAL_INI = 1
2.在两台服务器上创建dmmal.ini文件,两个文件需要相同
注意mal_port不能与数据库的端口相同,mal_port端口是用来两个服务器通讯用的
[mal_inst1]
mal_inst_name = DMSERVER
mal_host = 192.168.43.110
mal_port = 5239
[mal_inst2]
mal_inst_name = DMDB
mal_host = 192.168.43.111
mal_port = 5239
创建完成后,重启数据库服务
3.在192.168.43.111创建dblink
create link “模式”.“DBlink名称” connect ‘连接源类型(DAMENG/ORACLE/ODBC)’ with “用户名” identified by “密码” using ‘IP/端口号’
SQL> create link "SYSDBA"."q1" connect 'DAMENG' with "SYSDBA" identified by "Dameng123" using '192.168.43.110/5239';
executed successfully
used time: 5.728(ms). Execute id is 400.
4.在11上查看110上的表:
SQL> select * from T1@a2;
行号 A
---------- -----------
1 1
2 2
3 3
4 4
管理DBLink
1.查看dblink信息:
SQL> select * from dba_db_links;
LINEID OWNER DB_LINK USERNAME HOST CREATED
---------- ------ ------- -------- ------------------- --------------------------
1 SYSDBA a110 SYSDBA 192.168.43.110/5239 2021-09-23 15:35:00.537889
2 SYSDBA a2 SYSDBA 192.168.43.110/5239 2021-09-23 15:37:30.341843
2.删除dblink:
drop link "SYSDBA"."a2";
更多相关问题请浏览:
达梦云适配技术社区:https://eco.dameng.com/