1、创建块设备--通过DD在本地创建块设备
dd if=/dev/zero of=DCR bs=1M seek=1000 count=0
dd if=/dev/zero of=VOT bs=1M seek=1000 count=0
dd if=/dev/zero of=DATA bs=1M seek=10000 count=0
losetup /dev/loop0 /DSC/DCR
losetup /dev/loop1 /DSC/VOT
losetup /dev/loop2 /DSC/DATA
losetup -f
2、用UDEV创建raw
vi /etc/udev/rules.d/90-raw.rules
ACTION=="add",KERNEL=="/dev/loop0",RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add",KERNEL=="/dev/loop1",RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add",KERNEL=="/dev/loop2",RUN+="/bin/raw /dev/raw/raw3 %N"
KERNEL=="raw[1-3]", OWNER="dmdba", GROUP="dinstall", MODE="660"
raw /dev/raw/raw1 /dev/loop0
raw /dev/raw/raw2 /dev/loop1
raw /dev/raw/raw3 /dev/loop2
3、创建配置文件
--两个节点都执行
mkdir -p /home/dmdba/config
vim /home/dmdba/config/dmdcr_cfg.ini
DCR_N_GRP = 3
DCR_VTD_PATH = /dev/raw/raw2
DCR_OGUID = 63635
[GRP]
DCR_GRP_TYPE = CSS
DCR_GRP_NAME = CSS
DCR_GRP_N_EP = 2
DCR_GRP_DSKCHK_CNT = 60
[CSS]
DCR_EP_NAME = CSS1
DCR_EP_HOST = 10.0.4.11
DCR_EP_PORT = 9341
[CSS]
DCR_EP_NAME = CSS2
DCR_EP_HOST = 10.0.4.11
DCR_EP_PORT = 19341
[GRP]
DCR_GRP_TYPE = ASM
DCR_GRP_NAME = ASM
DCR_GRP_N_EP = 2
DCR_GRP_DSKCHK_CNT = 60
[ASM]
DCR_EP_NAME = ASM1
DCR_EP_SHM_KEY = 93360
DCR_EP_SHM_SIZE = 10
DCR_EP_HOST = 10.0.4.11
DCR_EP_PORT = 9351
DCR_EP_ASM_LOAD_PATH = /dev/raw
[ASM]
DCR_EP_NAME = ASM2
DCR_EP_SHM_KEY = 93361
DCR_EP_SHM_SIZE = 10
DCR_EP_HOST = 10.0.4.11
DCR_EP_PORT = 19351
DCR_EP_ASM_LOAD_PATH = /dev/raw
[GRP]
DCR_GRP_TYPE = DB
DCR_GRP_NAME = DSC
DCR_GRP_N_EP = 2
DCR_GRP_DSKCHK_CNT = 60
[DSC]
DCR_EP_NAME = DSC1
DCR_EP_SEQNO = 0
DCR_EP_PORT = 5236
DCR_CHECK_PORT = 9741
[DSC]
DCR_EP_NAME = DSC2
DCR_EP_SEQNO = 1
DCR_EP_PORT = 15236
DCR_CHECK_PORT = 19741
4、创建ASM磁盘
---主节点执行
dmasmcmd
create dcrdisk '/dev/raw/raw1' 'dcr'
create votedisk '/dev/raw/raw2' 'vote'
create asmdisk '/dev/raw/raw3' 'DATA0'
5、文件初始化 dcrdisk 和 votedisk
--主节点执行
注意 DMASMCMD工具中执行命令结尾不要加分号
在ASM命令行执行
dmasmcmd
--初始化 DCR
init dcrdisk '/dev/raw/raw1' from '/home/dmdba/config/dmdcr_cfg.ini' identified by '123456'
--初始化 VOT
init votedisk '/dev/raw/raw2' from '/home/dmdba/config/dmdcr_cfg.ini'
6、配置MAL系统配置文件
--两个节点都执行
vi /home/dmdba/config/dmasvrmal.ini
[MAL_INST1]
MAL_INST_NAME = ASM1
MAL_HOST = 10.0.4.11
MAL_PORT = 7236
[MAL_INST2]
MAL_INST_NAME = ASM2
MAL_HOST = 10.0.4.11
MAL_PORT = 17236
7、配置dcr配置文件
--节点1
vi /home/dmdba/config/dmdcr.ini
DMDCR_PATH = /dev/raw/raw1
DMDCR_MAL_PATH =/home/dmdba/config/dmasvrmal.ini #dmasmsvr 使用的 MAL 配置文件路径
DMDCR_SEQNO = 0
#ASM 重启参数,命令行方式启动
DMDCR_ASM_RESTART_INTERVAL =10
DMDCR_ASM_STARTUP_CMD = /home/dmdba/dmdbms/bin/dmasmsvr dcr_ini=/home/dmdba/config/dmdcr.ini
#DB 重启参数,命令行方式启动
DMDCR_DB_RESTART_INTERVAL = 30
DMDCR_DB_STARTUP_CMD = /home/dmdba/dmdbms/bin/dmserver path=/home/dmdba/config/dsc1/dm.ini dcr_ini=/home/dmdba/config/dmdcr.ini
8、启动DMCSS服务
./dmcss dcr_ini=/home/dmdba/config/dmdcr.ini
--节点2
vi /home/dmdba2/config/dmdcr.ini
DMDCR_PATH = /dev/raw/raw1
DMDCR_MAL_PATH =/home/dmdba2/config/dmasvrmal.ini #dmasmsvr 使用的 MAL 配置文件路径
DMDCR_SEQNO = 1
#ASM 重启参数,命令行方式启动
DMDCR_ASM_RESTART_INTERVAL =10
DMDCR_ASM_STARTUP_CMD = /home/dmdba2/dmdbms/bin/dmasmsvr dcr_ini=/home/dmdba2/config/dmdcr.ini
#DB 重启参数,命令行方式启动
DMDCR_DB_RESTART_INTERVAL = 30
DMDCR_DB_STARTUP_CMD = /home/dmdba2/dmdbms/bin/dmserver path=/home/dmdba2/config/dsc2/dm.ini dcr_ini=/home/dmdba2/config/dmdcr.ini
8、启动DMCSS
--两个节点都启动
./dmcss dcr_ini=/home/dmdba2/config/dmdcr.ini
9、创建磁盘组
--节点1 执行
./dmasmtool dcr_ini=/home/dmdba/config/dmdcr.ini
create diskgroup 'DMDATA' asmdisk '/dev/raw/raw3'
10、初始化实例
vi /home/dmdba/config/dminit.ini
--节点1 执行
db_name = DSC
system_path = +DMDATA/data
system = +DMDATA/data/dsc/system.dbf
system_size = 128
roll = +DMDATA/data/dsc/roll.dbf
roll_size = 128
main = +DMDATA/data/dsc/main.dbf
main_size = 128
ctl_path = +DMDATA/data/dsc/dm.ctl
ctl_size = 8
log_size = 1024
dcr_path = /dev/raw/raw1 #dcr 磁盘路径,目前不支持 asm,只能是裸设备
dcr_seqno = 0
auto_overwrite = 1
[DSC1] #inst_name 跟 dmdcr_cfg.ini 中 DB 类型 group 中 DCR_EP_NAME 对应
config_path = /home/dmdba/config/dsc1
port_num = 5236
mal_host = 10.0.4.11
mal_port = 9236
log_path = +DMDATA/log/DSC1_log01.log
log_path = +DMDATA/log/DSC1_log02.log
[DSC2] #inst_name 跟 dmdcr_cfg.ini 中 DB 类型 group 中 DCR_EP_NAME 对应
config_path = /home/dmdba/config/dsc2
port_num = 15236
mal_host = 10.0.4.11
mal_port = 19236
log_path = +DMDATA/log/DSC2_log01.log
log_path = +DMDATA/log/DSC2_log02.log
./dminit control=/home/dmdba/config/dminit.ini
[dmdba@VM-4-11-centos bin]$ ./dminit control=/home/dmdba/config/dminit.ini
initdb V8
db version: 0x7000c
file dm.key not found, use default license!
License will expire on 2022-07-09
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
log file path: +DMDATA/log/DSC1_log01.log
log file path: +DMDATA/log/DSC1_log02.log
log file path: +DMDATA/log/DSC2_log01.log
log file path: +DMDATA/log/DSC2_log02.log
write to dir [+DMDATA/data/DSC].
create dm database success. 2022-04-02 15:08:07
[dmdba@VM-4-11-centos bin]$
11、初始化成功配置节点2
在1节点修改 /home/dmdba/config/dminit.ini
修改 config_path = /home/dmdba/config/dsc2
chown -R dmdba2:dinstall /home/dmdba2/config/dsc2
cp -rf dsc2 /home/dmdba2/config/
chown -R dmdba2:dinstall /home/dmdba2/config/dsc2
修改 /home/dmdba2/config/dsc2/dm.ini 参数
修改 CONFIG_PATH = /home/dmdba2/config/dsc2
然后重启节点1 和节点2 DMCSS进程
12、配置客户端文件
vi /etc/dm_svc.conf
dmdsc=(10.0.4.11:5236,10.0.4.11:15236)
[dmdba@VM-4-11-centos bin]$ vi /etc/dm_svc.conf
[dmdba@VM-4-11-centos bin]$ disql SYSDBA/SYSDBA@dmdsc
服务器[10.0.4.11:15236]:处于普通打开状态
登录使用时间 : 2.308(ms)
disql V8
SQL> select * from v$dsc_ep_info;
行号 EP_NAME EP_SEQNO EP_GUID EP_TIMESTAMP EP_MODE EP_STATUS
---------- ------- ----------- -------------------- -------------------- ------------ ---------
1 DSC1 0 671154250 671155025 Control Node OK
2 DSC2 1 671213185 671213738 Normal Node OK
已用时间: 9.369(毫秒). 执行号:0.
SQL>
13、节点2 配置监听服务
vi /home/dmdba2/config/dmcssm.ini
#和 dmdcr_cfg.ini 中的 DCR_OGUID 保持一致
CSSM_OGUID = 63635
#配置所有 CSS 的连接信息,
#和 dmdcr_cfg.ini 中 CSS 配置项的 DCR_EP_HOST 和 DCR_EP_PORT 保持一致
CSSM_CSS_IP = 10.0.4.11:9341
CSSM_CSS_IP = 10.0.4.11:19341
CSSM_LOG_PATH =/home/dmdba2/dmdbms/log #监视器日志文件存放路径
CSSM_LOG_FILE_SIZE = 1024 #每个日志文件最大 1024 MB
CSSM_LOG_SPACE_LIMIT = 0 #不限定日志文件总占用空间
./dmcssm ini_path=/home/dmdba2/config/dmcssm.ini
通过show 命令查看