标签:插入数据 image 服务器 str from magic 搭建 查询 配置
服务器 | ip | 实例名 | PORT_NUM | MAL_PORT | MAL_DW_PORT | GROUP |
---|---|---|---|---|---|---|
主1 | 192.168.44.221 | GRP1_MPP_EP01 | 5236 | 5337 | 5253 | GRP1 |
备1 | 192.168.44.222 | GRP1_MPP_EP11 | 5237 | 5338 | 5254 | GRP1 |
主2 | 192.168.44.222 | GRP2_MPP_EP02 | 5236 | 5337 | 5253 | GRP2 |
备2 | 192.168.44.221 | GRP2_MPP_EP22 | 5237 | 5338 | 5254 | GRP2 |
本例中采取机器交叉的方式配置两个备数据库
192.168.44.221节点初始化库至目录 /home/dmdba/data/:
GRP1主库:./dminit path=/home/dmdba/data db_name=EP01 instance_name=GRP1_MPP_EP01
GRP2备库:./dminit path=/home/dmdba/data db_name=EP22 instance_name=GRP2_MPP_EP22
192.168.44.222节点初始化库至目录 /home/dmdba/data/:
GRP2主库:./dminit path=/home/dmdba/data db_name=EP02 instance_name=GRP2_MPP_EP02
GRP1备库:./dminit path=/home/dmdba/data db_name=EP11 instance_name=GRP1_MPP_EP11
1.脱机备份:
./dmrman CTLSTMT="BACKUP DATABASE ‘/home/dmdba/data/EP01/dm.ini‘ FULL TO BACKUP_FILE1 BACKUPSET ‘/home/dmdba/back/EP01‘"
2.拷贝备份文件到备库所在机器
scp -r /home/dmdba/back/EP01 root@192.168.44.222:/home/dmdba/back
3.执行脱机数据库还原与恢复
./dmrman ctlstmt="RESTORE DATABASE ‘/home/dmdba/data/EP11/dm.ini‘ FROM BACKUPSET ‘/home/dmdba/back/EP01‘"
./dmrman ctlstmt="RECOVER DATABASE ‘/home/dmdba/data/EP11/dm.ini‘ FROM BACKUPSET ‘/home/dmdba/back/EP01‘"
./dmrman CTLSTMT="RECOVER DATABASE ‘/home/dmdba/data/EP11/dm.ini‘ UPDATE DB_MAGIC"
EP22同EP11。
INSTANCE_NAME = GRP1_MPP_EP01
PORT_NUM = 5236
DW_INACTIVE_INTERVAL = 60
ALTER_MODE_STATUS = 0
ENABLE_OFFLINE_TS = 2
MAL_INI = 1
ARCH_INI = 1
MPP_INI = 1
RLOG_SEND_APPLY_MON = 64
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5
[MAL_INST1]
MAL_INST_NAME = GRP1_MPP_EP01
MAL_HOST = 192.168.44.221
MAL_PORT = 5337
MAL_INST_HOST = 192.168.44.221
MAL_INST_PORT = 5236
MAL_DW_PORT = 5253
MAL_INST_DW_PORT = 5243
[MAL_INST2]
MAL_INST_NAME = GRP2_MPP_EP02
MAL_HOST = 192.168.44.222
MAL_PORT = 5337
MAL_INST_HOST = 192.168.44.222
MAL_INST_PORT = 5236
MAL_DW_PORT = 5253
MAL_INST_DW_PORT = 5243
[MAL_INST3]
MAL_INST_NAME = GRP1_MPP_EP11
MAL_HOST = 192.168.44.222
MAL_PORT = 5338
MAL_INST_HOST = 192.168.44.222
MAL_INST_PORT = 5237
MAL_DW_PORT = 5254
MAL_INST_DW_PORT = 5244
[MAL_INST4]
MAL_INST_NAME = GRP2_MPP_EP22
MAL_HOST = 192.168.44.221
MAL_PORT = 5338
MAL_INST_HOST = 192.168.44.221
MAL_INST_PORT = 5237
MAL_DW_PORT = 5254
MAL_INST_DW_PORT = 5244
[ARCHIVE_REALTIME1]
ARCH_TYPE = REALTIME
ARCH_DEST = GRP1_MPP_EP11
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /home/dmdba/data/EP01/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0
[service_name1]
mpp_seq_no = 0
mpp_inst_name = GRP1_MPP_EP01
[service_name2]
mpp_seq_no = 1
mpp_inst_name = GRP2_MPP_EP02
转换命令如下:
./dmctlcvt TYPE=2 SRC=/home/dmdba/data/EP01/dmmpp.ini DEST=/home/dmdba/data/EP01/dmmpp.ctl
以 Mount 方式启动主库。
./dmserver /home/dmdba/data/EP01/dm.ini mount
启动命令行工具 dIsql,使用 MPP 类型为 LOCAL 方式,登录主库设置 OGUID 值。
./disql SYSDBA/SYSDBA*LOCAL@localhost:5236
SQL>SP_SET_PARA_VALUE(1, ‘ALTER_MODE_STATUS‘, 1);
SQL>sp_set_oguid(45330);
SQL>alter database primary;
SQL>SP_SET_PARA_VALUE(1, ‘ALTER_MODE_STATUS‘, 0);
INSTANCE_NAME = GRP2_MPP_EP02
PORT_NUM = 5236
DW_INACTIVE_INTERVAL = 60
ALTER_MODE_STATUS = 0
ENABLE_OFFLINE_TS = 2
MAL_INI = 1
ARCH_INI = 1
MPP_INI = 1
RLOG_SEND_APPLY_MON = 64
同GRP1_MPP_EP01
[ARCHIVE_REALTIME1]
ARCH_TYPE = REALTIME
ARCH_DEST = GRP2_MPP_EP22
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /home/dmdba/data/EP02/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0
同GRP_MPP_EP01,拷贝 dmmpp.ctl 到/home/dmdba/data/EP02/目录即可。
以 Mount 方式启动主库。
./dmserver /home/dmdba/data/EP02/dm.ini mount
启动命令行工具 dIsql,使用 MPP 类型为 LOCAL 方式,登录主库设置 OGUID 值。
./disql SYSDBA/SYSDBA*LOCAL@localhost:5236
SQL>SP_SET_PARA_VALUE(1, ‘ALTER_MODE_STATUS‘, 1);
SQL>sp_set_oguid(45331);
SQL>alter database primary;
SQL>SP_SET_PARA_VALUE(1, ‘ALTER_MODE_STATUS‘, 0)
INSTANCE_NAME = GRP1_MPP_EP11
PORT_NUM = 5236
DW_INACTIVE_INTERVAL = 60
ALTER_MODE_STATUS = 0
ENABLE_OFFLINE_TS = 2
MAL_INI = 1
ARCH_INI = 1
MPP_INI = 1
RLOG_SEND_APPLY_MON = 64
直接将实例GRP1_MPP_EP01 配置的dmmal.ini 拷贝到/home/dmdba/data/EP11目录中。
[ARCHIVE_REALTIME1]
ARCH_TYPE = REALTIME
ARCH_DEST = GRP1_MPP_EP01
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /home/dmdba/data/EP11/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0
直接将实例GRP1_MPP_EP01的dmmpp.ctl拷贝到/home/dmdba/data/EP11目录中。
以 Mount 方式启动主库。
./dmserver /home/dmdba/data/EP11/dm.ini mount
启动命令行工具 dIsql,使用 MPP 类型为 LOCAL 方式,登录主库设置 OGUID 值。
./disql SYSDBA/SYSDBA*LOCAL@localhost:5237
SQL>SP_SET_PARA_VALUE(1, ‘ALTER_MODE_STATUS‘, 1);
SQL>sp_set_oguid(45330);
SQL>alter database STANDBY;
SQL>SP_SET_PARA_VALUE(1, ‘ALTER_MODE_STATUS‘, 0);
INSTANCE_NAME = GRP2_MPP_EP22
PORT_NUM = 5236
DW_INACTIVE_INTERVAL = 60
ALTER_MODE_STATUS = 0
ENABLE_OFFLINE_TS = 2
MAL_INI = 1
ARCH_INI = 1
MPP_INI = 1
RLOG_SEND_APPLY_MON = 64
直接将实例GRP1_MPP_EP01 配置的dmmal.ini 拷贝到/home/dmdba/data/EP22目录中。
[ARCHIVE_REALTIME1]
ARCH_TYPE = REALTIME
ARCH_DEST = GRP2_MPP_EP02
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /home/dmdba/data/EP22/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0
直接将实例GRP1_MPP_EP01的dmmpp.ctl拷贝到/home/dmdba/data/EP22目录中。
以 Mount 方式启动主库。
./dmserver /home/dmdba/data/EP22/dm.ini mount
启动命令行工具 dIsql,使用 MPP 类型为 LOCAL 方式,登录主库设置 OGUID 值。
./disql SYSDBA/SYSDBA*LOCAL@localhost:5237
SQL>SP_SET_PARA_VALUE(1, ‘ALTER_MODE_STATUS‘, 1);
SQL>sp_set_oguid(45331);
SQL>alter database STANDBY;
SQL>SP_SET_PARA_VALUE(1, ‘ALTER_MODE_STATUS‘, 0);
在GRP1_MPP_EP01上创建 LIST 分布表 T_LIST。
用disql进行全局登录:
./disql SYSDBA/SYSDBA*GLOBAL@localhost:5236
建分布列表:
CREATE TABLE T_LIST(C1 INT, C2 CHAR(10)) DISTRIBUTED BY LIST (C1) (VALUES(1,2,3,4,5) ON GRP1_MPP_EP01,VALUES(6,7,8,9,10) ON GRP2_MPP_EP02);
建立表T_LIST根据C1字段进行分布。值为1-5的数据行分部到A机器实例名为GRP1_MPP_EP01的库内。值为6-10的分部到B机器实例名为GRP2_MPP_EP02的库内。
insert into T_LIST values(1,‘a‘);
insert into T_LIST values(2,‘b‘);
insert into T_LIST values(6,‘f‘);
insert into T_LIST values(7,‘g‘);
GRP1_MPP_EP01使用全局GLOBAL登录方式查询出来的结果是各节点的合集,使用LOCAL本地登录是该节点的数据。
GRP2_MPP_EP02使用全局GLOBAL登录方式查询出来的结果是各节点的合集,使用LOCAL本地登录是该节点的数据
标签:插入数据 image 服务器 str from magic 搭建 查询 配置
原文地址:https://www.cnblogs.com/itschen/p/14619712.html