DM8共享集群DSC初始化DB实例报错
DM8共享集群DSC初始化DB实例报错
问题描述
启动dmcss和dmasmsvr服务启动后,初始化DB实例提示如下报错:
[dmdba@localhost DSC0]$ /dmdb8/dmdbms/bin/dminit control=/dmdb8/dmdbms/dsc_config/DSC0/dminit.ini
initdb V8
db version: 0x7000c
file dm.key not found, use default license!
License will expire on 2024-04-17
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
log file path: +DMREDO/DSC0_LOG01.log
log file path: +DMREDO/DSC0_LOG02.log
log file path: +DMREDO/DSC1_LOG01.log
log file path: +DMREDO/DSC1_LOG02.log
write to dir [+DMDATA/data/DSC].
fsm_file_add group_id 1, file_id 0, size_in_pages 320000, path +DMDATA/data/ROLL.dbf failed, code -7004
Please check whether exist file or directory with the same name or view the log for more infomation, code:[-7014]
fail to init db.
问题分析
--查看初始化实例配置文件dminit.ini
[dmdba@~]# cat /dmdb8/dmdbms/dsc_config/DSC0/dminit.ini
DB_NAME = DSC #初始化数据库名称
SYSDBA_PWD = SYSDBA_PWD
SYSTEM_PATH = +DMDATA/data #初始化数据库存放的路径
SYSTEM = +DMDATA/data/SYSTEM.dbf #SYSTEM表空间路径
SYSTEM_SIZE = 1024 #SYSTEM表空间大小
ROLL = +DMDATA/data/ROLL.dbf #ROLL表空间路径
ROLL_SIZE = 10000 #ROLL表空间大小
MAIN = +DMDATA/data/MAIN.dbf #MAIN表空间路径
MAIN_SIZE = 1024 #MAIN表空间大小
CTL_PATH = +DMDATA/data/dm.ctl #DM.CTL控制文件路径
CTL_SIZE = 8 #DM.CTL控制文件大小
LOG_SIZE = 1024 #日志文件大小
DCR_PATH = /dev/dm/asm-dmdcr #DCR磁盘路径
DCR_SEQNO = 0 #连接DMASM节点节点号
AUTO_OVERWRITE = 1 #文件存在时的处理方式
PAGE_SIZE = 32
EXTENT_SIZE = 16
BLANK_PAD_MODE = 1
[DSC0] #具体节点都是以[XXX]开始,节点实例名就是XXX
CONFIG_PATH = /dmdb8/dmdbms/dsc_config/DSC0 #配置文件存放路径
PORT_NUM = 5236 #节点服务器监听通讯端口号,服务器配置此参数,取值范围1024~65534,发起连接端的端口在1024~65535之间随机分配
MAL_HOST = 192.168.183.100 #节点MAL系统使用IP 心跳ip
MAL_PORT = 11246 #MAL监听端口,用于数据守护、DSC、MPP等环境中各节点实例之间MAL链路配置,监听端端口配置此参数,取值范围1024~65534,发起连接端的端口在1024~65535之间随机分配
LOG_PATH = +DMREDO/DSC0_LOG01.log #日志文件路径
LOG_PATH = +DMREDO/DSC0_LOG02.log #日志文件路径
[DSC1] #具体节点都是以[XXX]开始,节点实例名就是XXX
CONFIG_PATH = /dmdb8/dmdbms/dsc_config/DSC1 #配置文件存放路径
PORT_NUM = 5236 #节点服务器监听通讯端口号,服务器配置此参数,取值范围1024~65534,发起连接端的端口在1024~65535之间随机分配
MAL_HOST = 192.168.183.130 #节点MAL系统使用IP 心跳ip
MAL_PORT = 11246 #MAL监听端口,用于数据守护、DSC、MPP等环境中各节点实例之间MAL链路配置,监听端端口配置此参数,取值范围1024~65534,发起连接端的端口在1024~65535之间随机分配
LOG_PATH = +DMREDO/DSC1_LOG01.log #日志文件路径
LOG_PATH = +DMREDO/DSC1_LOG02.log #日志文件路径
--删除初始化生成的参数文件和数据文件
db0节点删除共享磁盘中的目录
[dmdba@localhost DSC0]$ /dmdb8/dmdbms/bin/dmasmtool dcr_ini=/dmdb8/dmdbms/dsc_config/DSC0/dmdcr.ini
ASM>ls -l
ASM>ls -l
+
disk groups total [5]......
NO.1 name: DMREDO
id: 0
au_size: 1.00 MB
extent_size: 4
total_size: 10.00 GB
free_size: 8.99 GB
create_time: 2023-11-17 15:20:33
modify_time: 2023-11-17 15:20:33
NO.2 name: DMDATA
id: 1
au_size: 1.00 MB
extent_size: 4
total_size: 10.00 GB
free_size: 9.60 GB
create_time: 2023-11-17 15:20:56
modify_time: 2023-11-17 15:20:56
NO.3 name: DMARCH
id: 2
au_size: 1.00 MB
extent_size: 4
total_size: 10.00 GB
free_size: 9.99 GB
create_time: 2023-11-17 15:21:06
modify_time: 2023-11-17 15:21:06
NO.4 name: VOTE
id: 125
au_size: 1.00 MB
extent_size: 4
total_size: 1.00 GB
free_size: 1000.00 MB
create_time: 2023-11-17 15:10:06
modify_time: 2023-11-17 15:10:41
NO.5 name: DCR
id: 126
au_size: 1.00 MB
extent_size: 4
total_size: 1.00 GB
free_size: 1000.00 MB
create_time: 2023-11-17 15:09:50
modify_time: 2023-11-17 15:11:41
Used time: 2.222(ms).
ASM>cd DMDATA
+DMDATA
Used time: 2.216(ms).
ASM>rm -rf *
Used time: 10.445(ms).
ASM>cd ../
Used time: 1.914(ms).
ASM>ls -l
db0节点删除初始化生成的参数文件
rm -f /dmdb8/dmdbms/dsc_config/DSC0/dmdcr.ini
rm -f /dmdb8/dmdbms/dsc_config/DSC0/sqllog.ini
db1节点删除初始化生成的参数文件
rm -f /dmdb8/dmdbms/dsc_config/DSC1/dmdcr.ini
rm -f /dmdb8/dmdbms/dsc_config/DSC1/sqllog.ini
--db0节点清理磁盘头
su - root
dd if=/dev/zero of=/dev/sbe bs=1k count=1
dd if=/dev/zero of=/dev/sbf bs=1k count=1
dd if=/dev/zero of=/dev/sbd bs=1k count=1
--db0节点重新初始化ASM磁盘
[dmdba@~]#/dmdb8/dmdbms/bin/dmasmcmd
#asm script file
#初始化 DMASM 磁盘
ASM>create asmdisk '/dev/dm/asm-dmdata' 'DATA0'
ASM>create asmdisk '/dev/dm/asm-dmredo' 'REDO0'
ASM>create asmdisk '/dev/dm/asm-dmarch' 'ARCH0'
--在 db0 节点再次执行初始化 db 命令
[dmdba@~]# /dmdb8/dmdbms/bin/dminit control=/dmdb8/dmdbms/dsc_config/DSC0/dminit.ini
依旧是上面的报错。
一直掉在下面的报错坑中,在坑里呆了有小半天的时间。
Please check whether exist file or directory with the same name or view the log for more infomation, code:[-7014]
从下午3点左右一直到6点半左右,达梦厂家交流群、达梦官方在线社区平台都进行了咨询,还手动进入+DMDATA磁盘手动创建了data目录。最后求助无缘,想着扒拉下官方文档吧,逐行看一行也没敢跳过,最终发现
--过滤出参数文件中关于size大小的参数
[dmdba@localhost DSC0]$ cat /dmdb8/dmdbms/dsc_config/DSC0/dminit.ini |grep SIZE
SYSTEM_SIZE = 1024
ROLL_SIZE = 10000
MAIN_SIZE = 1024
CTL_SIZE = 8
LOG_SIZE = 2048
PAGE_SIZE = 32
EXTENT_SIZE = 16
--查看ASM磁盘大小
[dmdba@localhost DSC0]$ /dmdb8/dmdbms/bin/dmasmcmd
DMASMCMD V8
ASM>listdisks /dev/dm
[/dev/dm/asm-dmvote]: Used ASM disk, name:[DMASMvote], size:[1024M], group_id:[125], disk_id:[0]
[/dev/dm/asm-dmdcr]: Used ASM disk, name:[DMASMdcr], size:[1024M], group_id:[126], disk_id:[0]
[/dev/dm/asm-dmdata]: Unused ASM disk, name:[DMASMDATA0], size:[10239M]
[/dev/dm/asm-dmarch]: Unused ASM disk, name:[DMASMARCH0], size:[10239M]
[/dev/dm/asm-dmredo]: Unused ASM disk, name:[DMASMREDO0], size:[10239M]
Used time: 4.025(ms).
/dmdb8/dmdbms/dsc_config/DSC0/dminit.ini 数据文件的总大小超过了磁盘最大空间,因此初始化失败。
解决办法
将文件类的参数统一改成128重新初始化
--查看更改后的参数
[dmdba@localhost DSC0]$ cat /dmdb8/dmdbms/dsc_config/DSC0/dminit.ini |grep SIZE
SYSTEM_SIZE = 128
ROLL_SIZE = 128
MAIN_SIZE = 128
CTL_SIZE = 8
LOG_SIZE = 128
PAGE_SIZE = 32
EXTENT_SIZE = 16
--再次初始化
[dmdba@localhost DSC0]$ /dmdb8/dmdbms/bin/dminit control=/dmdb8/dmdbms/dsc_config/DSC0/dminit.ini
initdb V8
db version: 0x7000c
file dm.key not found, use default license!
License will expire on 2024-04-17
value of the log file size error.
the log file size is between 256 and 8192.
Read ini file(/dmdb8/dmdbms/dsc_config/DSC0/dminit.ini) error in line 12, code(-1)
fail to init db.
LOG_SIZE取值范围256 and 8192单位M
将LOG_SIZE更改为256重新初始化成功
[dmdba@localhost DSC0]$ /dmdb8/dmdbms/bin/dminit control=/dmdb8/dmdbms/dsc_config/DSC0/dminit.ini
initdb V8
db version: 0x7000c
file dm.key not found, use default license!
License will expire on 2024-04-17
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
log file path: +DMREDO/DSC0_LOG01.log
log file path: +DMREDO/DSC0_LOG02.log
log file path: +DMREDO/DSC1_LOG01.log
log file path: +DMREDO/DSC1_LOG02.log
FILE "/dmdb8/dmdbms/dsc_config/DSC0/dm.ini" has already existed
FILE "/dmdb8/dmdbms/dsc_config/DSC0/sqllog.ini" has already existed
FILE "/dmdb8/dmdbms/dsc_config/DSC1/dm.ini" has already existed
FILE "/dmdb8/dmdbms/dsc_config/DSC1/sqllog.ini" has already existed
write to dir [+DMDATA/data/DSC].
create dm database success. 2023-11-17 18:49:14
总结
自己粗心给自己挖的坑,栽坑里久了才想起来去看官方文档。曾经有好几个大佬说过没事多看看官方文档,官方文档上面写的特别清楚,自我拙见的认为官方文档内容多分析解决文件时效低一直偷懒忽略。这次算上给自己长教训了。