dm8在Linux环境安装详细步骤 - - 2025年1月之后dm8
- 环境介绍
- 1 修改操作系统资源限制
- 2 操作系统创建用户
- 3 操作系统配置
- 4 数据库安装
- 5 初始化数据库
- 6 实例参数优化
- 7 登录数据库配置归档与备份
- 8 配置审计
- 9 创建用户
- 10 屏蔽关键字与数据库兼容模式
- 11 jdbc连接串配置
- 12 更多达梦数据库学习使用列表
环境介绍
- Cpu x86
- Os Kylin v10 sp2
- Dm8 1-4-6-2024.12.25-255012-20119-ENT
–03134284294-20241225-255012-20119 Pack20 - 数据库程序安装路径 /opt/dmdba/dmdbms
- 数据库实例安装路径 /opt/dmdba/dmdata
- 数据库归档日志路径 /opt/dmdba/dmarch
- 数据库异常CORE路径 /opt/dmdba/dmcore
- 数据库备份路径 /opt/dmdba/data/DAMENG/bak
- 数据库安装包路径 /opt/dmdba
- 安装前操作系统环境检查 - - 点击跳转
- 操作系统建议安装 tar、telnet、perf、gdb、nmon、pstack、iostat、netstat、ethtool 等工具包 , 遇到问题方便分析
磁盘测速 低于25MB/S 不满足上线规范要求,可能存在性能瓶颈
dd if=/dev/sdb of=test bs=32k count=20k oflag=dsync
dd if=/dev/vdb of=test bs=32k count=20k oflag=dsync
/dev/sdb 是数据盘符名称,根据实际环境修改
/dev/vdb 是数据盘符名称,根据实际环境修改
1 修改操作系统资源限制
# 使用 root 用户
vi /etc/security/limits.conf
* soft nproc 10240
* hard nproc 10240
dmdba soft nproc 10240
dmdba hard nproc 10240
dmdba soft nofile 65536
dmdba hard nofile 65536
dmdba hard data unlimited
dmdba soft data unlimited
dmdba hard fsize unlimited
dmdba soft fsize unlimited
dmdba soft core unlimited
dmdba hard core unlimited
2 操作系统创建用户
groupadd dinstall
useradd -g dinstall dmdba
passwd dmdba
**********
**********
mkdir -p /opt/dmdba
chown -R dmdba:dinstall /opt/dmdba
3 操作系统配置
cat /etc/sysctl.conf
echo vm.overcommit_memory = 0 >> /etc/sysctl.conf && sysctl -p
echo kernel.core_pattern = /opt/dmdba/dmcore/core-%e-%p-%s >> /etc/sysctl.conf && sysctl -p
echo vm.numa_stat = 0 >> /etc/sysctl.conf && sysctl -p
echo vm.min_free_kbytes = 1153434 >> /etc/sysctl.conf && sysctl -p
echo vm.swappiness = 10 >> /etc/sysctl.conf && sysctl -p
sed -ri 's/.*swap.*/#&/' /etc/fstab
在 GRUB_CMDLINE_LINUX 那一行后面追加 numa=off transparent_hugepage=never
[ -d /sys/firmware/efi ] && echo UEFI || echo BIOS
grub2-mkconfig -o /boot/efi/EFI/kylin/grub.cfg
grub2-mkconfig -o /boot/grub2/grub.cfg
cat /sys/kernel/mm/transparent_hugepage/enabled
cat /sys/block/{DEVICE-NAME}/queue/scheduler
cat /sys/block/sda/queue/scheduler
cat /sys/block/sdb/queue/scheduler
cat /sys/block/vdb/queue/scheduler
查看麒麟版本命令: nkvers
将
systemctl daemon-reload;
systemctl restart systemd-logind
systemctl show systemd-logind | grep -i removeipc
4 数据库安装
mount -o loop dm8_20241227_x86_rh7_64.iso /mnt
su - dmdba
cd /mnt
./DMInstall.bin -i
请选择安装语言 [1]:1
是否输入Key文件路径? (Y/y:是 N/n:否) [Y/y]:y
请输入Key文件的路径地址 [dm.key]:/opt/dmdba/dm.key
是否设置时区? (Y/y:是 N/n:否) [Y/y]:y
请选择时区 [21]:21
请选择安装类型的数字序号 [1 典型安装]:1
请选择安装目录 [/home/dmdba/dmdbms]:/opt/dmdba/dmdbms
是否确认安装路径(/opt/dmdba/dmdbms)? (Y/y:是 N/n:否) [Y/y]:y
是否确认安装? (Y/y:是 N/n:否):y
exit
/opt/dmdba/dmdbms/script/root/root_installer.sh
5 初始化数据库
su - dmdba
./dminit path=/opt/dmdba/dmdata page_size=32 extent_size=32 log_size=2048 charset=0 case_sensitive=1 DB_NAME=DAMENG INSTANCE_NAME=DMSERVER SYSDBA_PWD=Dameng@123 SYSAUDITOR_PWD=Dameng@123 PORT_NUM=5236 BLANK_PAD_MODE=0
./dmserver /opt/dmdba/dmdata/DAMENG/dm.ini
输入 exit 正常关闭数据库
su - root
cd /opt/dmdba/dmdbms/script/root
./dm_service_installer.sh -t dmserver -p 5236 -dm_ini /opt/dmdba/dmdata/DAMENG/dm.ini
/opt/dmdba/dmdbms/bin/DmService5236 start
6 实例参数优化
su - dmdba
cd /opt/dmdba/dmdbms/bin
./disql SYSDBA/'"Dameng@123"'@127.0.0.1:5236
SP_SET_PARA_VALUE(2,'WORKER_THREADS',14);
SP_SET_PARA_VALUE(2,'IO_THR_GROUPS',16);
SP_SET_PARA_VALUE(2,'GEN_SQL_MEM_RECLAIM',0);
SP_SET_PARA_VALUE(2,'MAX_OS_MEMORY', 100);
SP_SET_PARA_VALUE(2,'MEMORY_POOL', 2048);
SP_SET_PARA_VALUE(2,'MEMORY_N_POOLS', 3);
SP_SET_PARA_VALUE(2,'MEMORY_TARGET', 10240);
SP_SET_PARA_VALUE(2,'BUFFER', 12000);
SP_SET_PARA_VALUE(2,'BUFFER_POOLS', 21);
SP_SET_PARA_VALUE(2,'RECYCLE', 2048);
SP_SET_PARA_VALUE(2,'RECYCLE_POOLS', 7);
SP_SET_PARA_VALUE(2,'FAST_POOL_PAGES', 9999);
SP_SET_PARA_VALUE(2,'FAST_ROLL_PAGES', 1000);
SP_SET_PARA_VALUE(2,'ENABLE_FREQROOTS',1);
SP_SET_PARA_VALUE(2,'MULTI_PAGE_GET_NUM',1);
SP_SET_PARA_VALUE(2,'PRELOAD_SCAN_NUM',0);
SP_SET_PARA_VALUE(2,'PRELOAD_EXTENT_NUM',0);
SP_SET_PARA_VALUE(2,'TASK_THREADS',8);
SP_SET_PARA_VALUE(2,'MEMORY_MAGIC_CHECK', 1);
SP_SET_PARA_VALUE(2,'HJ_BUF_GLOBAL_SIZE', 2048);
SP_SET_PARA_VALUE(2,'HJ_BUF_SIZE', 128);
SP_SET_PARA_VALUE(2,'HAGR_BUF_GLOBAL_SIZE',2048);
SP_SET_PARA_VALUE(2,'HAGR_BUF_SIZE', 128);
SP_SET_PARA_VALUE(2,'SORT_FLAG',0);
SP_SET_PARA_VALUE(2,'SORT_BLK_SIZE',1);
SP_SET_PARA_VALUE(2,'SORT_BUF_SIZE', 10);
SP_SET_PARA_VALUE(2,'SORT_BUF_GLOBAL_SIZE', 2048);
SP_SET_PARA_VALUE(2,'RLOG_POOL_SIZE', 1024);
SP_SET_PARA_VALUE(2,'CACHE_POOL_SIZE', 1024);
SP_SET_PARA_VALUE(2,'DICT_BUF_SIZE', 512);
SP_SET_PARA_VALUE(2,'VM_POOL_TARGET', 16384);
SP_SET_PARA_VALUE(2,'SESS_POOL_TARGET', 16384);
SP_SET_PARA_VALUE(2,'USE_PLN_POOL', 1);
SP_SET_PARA_VALUE(2,'ENABLE_MONITOR', 1);
SP_SET_PARA_VALUE(2,'SVR_LOG', 1);
SP_SET_PARA_VALUE(2,'TEMP_SIZE', 20480);
SP_SET_PARA_VALUE(2,'TEMP_SPACE_LIMIT', 204800);
SP_SET_PARA_VALUE(2,'MAX_SESSIONS', 1500);
SP_SET_PARA_VALUE(2,'MAX_SESSION_STATEMENT', 20480);
SP_SET_PARA_VALUE(2,'PK_WITH_CLUSTER', 0);
SP_SET_PARA_VALUE(2,'ENABLE_ENCRYPT',0);
SP_SET_PARA_VALUE(2,'OLAP_FLAG',2);
SP_SET_PARA_VALUE(2,'VIEW_PULLUP_FLAG',1);
SP_SET_PARA_VALUE(2,'OPTIMIZER_MODE',1);
SP_SET_PARA_VALUE(2,'ADAPTIVE_NPLN_FLAG',0);
SP_SET_PARA_VALUE(2,'MONITOR_INDEX_FLAG',2);
SP_SET_PARA_VALUE(2,'ENABLE_CREATE_BM_INDEX_FLAG',0);
SP_SET_PARA_VALUE(2,'OPTIMIZER_OR_NBEXP',0);
SP_SET_PARA_VALUE(2,'PARALLEL_PURGE_FLAG',1);
SP_SET_PARA_VALUE(2,'PARALLEL_POLICY',2);
SP_SET_PARA_DOUBLE_VALUE(2,'UNDO_RETENTION',900);
SP_SET_PARA_VALUE(2,'UNDO_EXTENT_NUM',16);
SP_SET_PARA_VALUE(2,'ENABLE_INJECT_HINT',1);
SP_SET_PARA_VALUE(2,'BTR_SPLIT_MODE',1);
SP_SET_PARA_VALUE(2,'FAST_LOGIN',1);
SP_SET_PARA_VALUE(2,'ENABLE_MONITOR_BP',0);
SP_SET_PARA_VALUE(2,'MVCC_RETRY_TIMES',300);
SP_SET_PARA_VALUE(2,'RLOG_APPEND_LOGIC',1);
SP_SET_PARA_VALUE(2,'CALC_AS_DECIMAL',1);
SP_SET_PARA_VALUE(2,'AUDIT_MAX_FILE_SIZE',1024);
SP_SET_PARA_VALUE(2,'AUDIT_SPACE_LIMIT',10240);
alter tablespace "MAIN" datafile 'MAIN.DBF' autoextend on maxsize 102400;
7 登录数据库配置归档与备份
su - dmdba
cd /opt/dmdba/dmdbms/bin
./disql SYSDBA/'"Dameng@123"'@127.0.0.1:5236
ALTER DATABASE MOUNT;
ALTER DATABASE ARCHIVELOG;
ALTER DATABASE ADD ARCHIVELOG 'DEST=/opt/dmdba/dmdata/dmarch,TYPE=LOCAL,FILE_SIZE=2048,SPACE_LIMIT=204800';
ALTER DATABASE OPEN;
CHECKPOINT(100);
backup database compressed;
SP_INIT_JOB_SYS(1);
call SP_CREATE_JOB('db_bak',1,0,'',0,0,'',0,'');
call SP_JOB_CONFIG_START('db_bak');
call SP_ADD_JOB_STEP('db_bak', 'db_bak', 6, '01000000', 1, 1, 0, 0, NULL, 0);
call SP_ADD_JOB_SCHEDULE('db_bak', 'db_bak', 1, 2, 1, 64, 0, '21:36:44', NULL, '2021-12-08 21:36:44', NULL, '');
call SP_JOB_CONFIG_COMMIT('db_bak');
call SP_CREATE_JOB('db_bak_add',1,0,'',0,0,'',0,'');
call SP_JOB_CONFIG_START('db_bak_add');
call SP_ADD_JOB_STEP('db_bak_add', 'db_bak_add', 6, '41000000/opt/dmdba/dmdata/DAMENG/bak', 1, 1, 0, 0, NULL, 0);
call SP_ADD_JOB_SCHEDULE('db_bak_add', 'db_bak_add', 1, 2, 1, 63, 0, '23:16:38', NULL, '2024-12-31 17:16:38', NULL, '');
call SP_JOB_CONFIG_COMMIT('db_bak_add');
call SP_CREATE_JOB('del_dbbak',1,0,'',0,0,'',0,'');
call SP_JOB_CONFIG_START('del_dbbak');
call SP_ADD_JOB_STEP('del_dbbak', 'del_dbbak', 0, 'CALL SP_DB_BAKSET_REMOVE_BATCH(''DISK'', NOW()-31);', 1, 1, 0, 0, NULL, 0);
call SP_ADD_JOB_SCHEDULE('del_dbbak', 'del_dbbak', 1, 1, 1, 0, 0, '22:04:40', NULL, '2021-12-08 22:04:40', NULL, '');
call SP_JOB_CONFIG_COMMIT('del_dbbak');
8 配置审计
su - dmdba
cd /opt/dmdba/dmdbms/bin
./disql SYSAUDITOR/'"Dameng@123"'@127.0.0.1:5236
SP_SET_ENABLE_AUDIT(1);
SP_AUDIT_STMT('TABLE', 'NULL', 'ALL');
9 创建用户
CREATE TABLESPACE "CESHI01_DATA"
DATAFILE 'CESHI_DATA_01.DBF' SIZE 1024 AUTOEXTEND
ON NEXT 1024 MAXSIZE 409600,
'CESHI_DATA_02.DBF' SIZE 1024 AUTOEXTEND
ON NEXT 1024 MAXSIZE 409600 CACHE = NORMAL;
CREATE TABLESPACE "CESHI02_INDEX" DATAFILE
'CESHI_INDEX_01.DBF' SIZE 1024 AUTOEXTEND
ON NEXT 1024 MAXSIZE 409600,
'CESHI_INDEX_02.DBF' SIZE 1024 AUTOEXTEND
ON NEXT 1024 MAXSIZE 409600 CACHE = NORMAL;
CREATE USER "CESHI" IDENTIFIED BY "Dameng@123"
DEFAULT TABLESPACE "CESHI01_DATA"
DEFAULT INDEX TABLESPACE "CESHI02_INDEX";
GRANT "PUBLIC","RESOURCE","SOI","SVI","VTI" TO "CESHI";
ALTER USER CESHI LIMIT FAILED_LOGIN_ATTEMPS UNLIMITED;
ALTER USER CESHI LIMIT PASSWORD_LIFE_TIME UNLIMITED;
ALTER USER CESHI LIMIT PASSWORD_LOCK_TIME UNLIMITED;
10 屏蔽关键字与数据库兼容模式
SP_SET_PARA_VALUE(2,'COMPATIBLE_MODE',0);
11 jdbc连接串配置
12 更多达梦数据库学习使用列表