RedHat7安装达梦数据库记录

一、数据库软件安装

⑴环境检查

#uname -a
Linux oracle12c 3.10.0-123.el7.x86_64 #1 SMP Mon May 5 11:16:57 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux
##要求内核版本为2.4以上
~#uname -r
3.10.0-123.el7.x86_64
~#df -h
Filesystem             Size  Used Avail Use% Mounted on
/dev/mapper/rhel-root   46G   23G   23G  51% /
devtmpfs               1.9G     0  1.9G   0% /dev
tmpfs                  1.9G  148K  1.9G   1% /dev/shm
tmpfs                  1.9G  9.0M  1.9G   1% /run
tmpfs                  1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/sda1              497M  119M  379M  24% /boot
/dev/sr0               3.5G  3.5G     0 100% /run/media/oracle/RHEL-7.0 Server.x86_64
~#free -g
             total       used       free     shared    buffers     cached
Mem:             3          2          1          0          0          1
-/+ buffers/cache:          0          2
Swap:            3          0          3
##glibc版本要求2.6以上
~#rpm -q glibc
glibc-2.17-55.el7.x86_64

⑵创建用户及配置内核参数

~#groupadd dinstall
~#useradd -g dinstall dmdba
~#passwd dmdba
~#tail -2 /etc/security/limits.conf
dmdba soft nofile 4096
dmdba hard nofile 65536

⑶安装达梦数据库

1.上传介质dm8_20220304_x86_rh6_64_ent.zip

2.解压安装介质并挂载光盘

~#cd /u01
~#ls
dm8_20220304_x86_rh6_64_ent.zip
#unzip *.zip
Archive:  dm8_20220304_x86_rh6_64_ent.zip
   creating: dm8_20220304_x86_rh6_64_ent/
  inflating: dm8_20220304_x86_rh6_64_ent/dm8_20220304_x86_rh6_64_ent_8.1.2.114.iso_SHA256.txt  
  inflating: dm8_20220304_x86_rh6_64_ent/dm8_20220304_x86_rh6_64_ent_8.1.2.114.iso  
#cd dm8_20220304_x86_rh6_64_ent/
#mount -o loop dm8_20220304_x86_rh6_64_ent_8.1.2.114.iso /media/
mount: /dev/loop0 is write-protected, mounting read-only

3.将安装文件复制到/opt目录并修改安装文件权限

#cd /media
#ls -l
total 927088
-r-xr-xr-x. 1 root root   2802237 Mar  4 13:39 DM8 Install.pdf
-r-xr-xr-x. 1 root root 946534466 Mar  4 13:44 DMInstall.bin
#cp DMInstall.bin /opt
#chown dmdba.dinstall /opt/DMInstall.bin

4. 用dmdba用户执行安装程序

#su - dmdba
cd /opt
ls
DMInstall.bin  ORCLfmap  rh
ls -l
total 924352
-r-xr-xr-x. 1 dmdba dinstall 946534466 Jun  1 20:00 DMInstall.bin
drwxr-xr-x. 3 root  root            21 Aug 24  2020 ORCLfmap
drwxr-xr-x. 2 root  root             6 Jan 27  2014 rh
export DISPLAY=192.168.126.1:0.0
./DMInstall.bin
选择语言和时区

IMG

安装向导,点击下一步

IMG

同意协议并下一步

IMG

验证key(若无key,可略过)

IMG

安装组件,提供四种安装方式

IMG

典型安装:包括服务器、客户端、驱动、用户手册、数据库服务。
服务器安装:包括服务器、驱动、用户手册、数据库服务。
客户端安装:包括客户端、驱动、用户手册。
自定义安装:用户根据需求勾选组件,可以是服务器、客户端、驱动、用户手册、数据库服务中的任意组合。
此处选典型安装。
选择安装目录
#mkdir -p /dm/dmdbms
#chown -R dmdba:dinstall /dm

IMG

安装小结

IMG
确认无误后点击Install即可进行达梦数据库的安装。

执行配置脚本

IMG
使用root用户执行此脚本,该脚本会创建达梦服务文件、创建DMAP服务并启动。

#/dm/dmdbms/script/root/root_installer.sh
Move /dm/dmdbms/bin/dm_svc.conf to /etc
Modify the files' mode of DM Server
Create the DmAPService service
ln -s '/usr/lib/systemd/system/DmAPService.service' '/etc/systemd/system/multi-user.target.wants/DmAPService.service'
Finished to create the service (DmAPService)
Start the DmAPService service

IMG

提示是否初始化数据库,此处不勾选,点击完成。

IMG

5.添加PATH环境变量

$cat .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/dm/dmdbms/bin"
export DM_HOME="/dm/dmdbms"
export PATH=$PATH:$DM_HOME/bin

二、创建数据库实例

两种方法:
1.图形界面:使用DBCA工具
2.命令行:使用DMINIT工具

⑴使用DBCA工具创建实例

DBCA工具是一个shell脚本,在/dm/dmdbms/tool目录下

$cd /dm/dmdbms/tool/
$ll dbca.sh
-rwxr-xr-x. 1 dmdba dinstall 749 Jun  1 20:13 dbca.sh
$./dbca.sh

IMG
IMG
指定数据库目录
IMG
输入数据库名和实例名
IMG
确认各文件路径(控制文件、数据文件、日志文件、初始化日志文件)
IMG
数据库初始化参数(簇大小、页大小、日志文件大小、字符集、字符串比较大小写敏感等)
IMG
设置密码DMDBA_2022
在这里插入图片描述

选择是否创建示例数据库(本次实验选择创建,方便后续操作)
IMG
安装详情,确认后点完成
IMG
IMG

执行初始化脚本,初始化数据库并开机自启动
IMG

#mv /dm/dmdbms/bin/DmServiceNBINS.service /usr/lib/systemd/system/DmServiceNBINS.service
#systemctl enable DmServiceNBINS.service
ln -s '/usr/lib/systemd/system/DmServiceNBINS.service' '/etc/systemd/system/multi-user.target.wants/DmServiceNBINS.service'
#systemctl start DmServiceNBINS.service

至此,实例创建完成,使用DISQL工具连接实例进行验证

⑵使用DMINIT工具创建实例(本次不进行实验,图形化可完成创建)

三、注册实例服务

⑴服务说明

达梦数据库管理系统DM8 默认有12个功能模块,每个模块都有对应的服务脚本,将这些模块注册成服务后,可以使用服务来管理这些功能,命令如下:

$cd /dm/dmdbms/bin
$ll Dm*
-rwxr-xr-x. 1 dmdba dinstall 13825 Jun  1 20:13 DmAPService
-rwxr-xr-x. 1 dmdba dinstall 14489 Jun  1 20:13 DmAuditMonitorService
-rwxr-xr-x. 1 dmdba dinstall 13653 Jun  1 20:13 DmInstanceMonitorService
-rwxr-xr-x. 1 dmdba dinstall 14126 Jun  1 20:13 DmJobMonitorService
-rwxr-xr-x. 1 dmdba dinstall 16544 Jun  1 20:27 DmServiceNBINS
##查看服务权限
$cd service_template/
$ls -l
total 180
-rwxr-xr-x. 1 dmdba dinstall 13825 Jun  1 20:13 DmAPService
-rwxr-xr-x. 1 dmdba dinstall 14050 Jun  1 20:13 DmASMSvrService
-rwxr-xr-x. 1 dmdba dinstall 13790 Jun  1 20:13 DmCSSMonitorService
-rwxr-xr-x. 1 dmdba dinstall 14065 Jun  1 20:13 DmCSSService
-rwxr-xr-x. 1 dmdba dinstall 13989 Jun  1 20:13 DmDCSService
-rwxr-xr-x. 1 dmdba dinstall 13760 Jun  1 20:13 DmDRASService
-rwxr-xr-x. 1 dmdba dinstall 13805 Jun  1 20:13 DmDRSService
-rwxr-xr-x. 1 dmdba dinstall 13737 Jun  1 20:13 DmDSSService
-rwxr-xr-x. 1 dmdba dinstall 13741 Jun  1 20:13 DmMonitorService
-rwxr-xr-x. 1 dmdba dinstall 16520 Jun  1 20:13 DmService
-rwxr-xr-x. 1 dmdba dinstall 13791 Jun  1 20:13 DmWatcherService

在使用这些服务脚本前,需根据实际情况对这些脚本进行修改,脚本说明如下:

服务名对应参数说明
DmAPServicedfs.iniDMAP辅助插件服务
DmAuditMonitorServicedmamon.iniDMAMON实时审计监控服务
DmJobMonitorServiceDMJMON实时作业监控
DmInstanceMonitorServiceDMIMON实例实时监控服务
DmServicedm.iniDMSERVER实例服务
DmWatcherServicedmwatcher.iniDM守护进程,DMWATCHER对应的服务脚本模板
DmMonitorServicedmmonitor.iniDM守护监视器服务,DMMONITOR对应的服务脚本模板
DmASMSvrServicedmdcr.iniDM自动存储管理器服务,DMASMSVR对应的服务脚本模板
DmCSSServicedmdcr.ini,dmdfs.iniDM集群同步服务,DMCSS对应的服务脚本模板
DmCSSMonitorServicedmcssm.iniDM集群同步监控服务,DMCSSM对应的服务脚本模板
DmDRSServicedrs.ini分布式日志服务器服务,DMDRS对应的服务脚本模板
DmDCSServicedcs.ini分布式目录服务器服务,DMDCS对应的服务脚本模板
DmDSSServicedss.ini分布式存储服务器服务,DMDSS对应的服务脚本模板
DmDRASServicedras.ini分布式日志归档服务器服务,DMDRAS对应的服务脚本模板

⑵命令行注册和删除服务

1. 注册服务

DM服务注册和卸载脚本在/dm/dmdbms/scripts/root目录下进行

$cd /dm/dmdbms/script/root/
$ls
dm_service_installer.sh  dm_service_uninstaller.sh  root_installer.sh
需要使用root用户执行注册,在脚本后加-h可以查看脚本帮助

#./dm_service_installer.sh -h
Usage: dm_service_installer.sh -t service_type [-p service_name_postfix] [-dm_ini dm_ini_file]
        [-watcher_ini watcher_ini_file ] [-monitor_ini monitor_ini_file] [-cssm_ini cssm_ini_file]
        [-dfs_ini dfs_ini_file] [-dcr_ini dcr_ini_file]
        [-dss_ini dss_ini_file] [-drs_ini drs_ini_file] [-dras_ini dras_ini_file] [-dcs_ini dcs_ini_file] [-server server_info]
        [-dmap_ini dmap_ini_file] [-dpc_mode SP|MP|BP] [-m open|mount] [-y dependent_service] [-auto true|false]
  or dm_service_installer.sh [-s service_file_path]
  or dm_service_installer.sh -h

   -t               Service Type, include: dmimon,dmap,dmserver,dmwatcher,dmmonitor,dmcss,dmcssm,dmasmsvr,dmdcs,dmdrs,dmdras,dmdss.
   -p               Service Name Postfix, is invalid for dmimon,dmap.
   -dm_ini          The path of the dm.ini file.
   -watcher_ini     The path of the dmwatcher.ini file.
   -monitor_ini     The path of the dmmonitor.ini file.
   -dcr_ini         The path of the dmdcr.ini file.
   -cssm_ini        The path of the dmcssm.ini file.
   -dss_ini         The path of the dss.ini file.
   -drs_ini         The path of the drs.ini file.
   -dras_ini        The path of the dras.ini file.
   -dcs_ini         The path of the dcs.ini file.
   -dfs_ini         The path of the dfs.ini file.
   -dmap_ini        The path of the dmap.ini file.
   -dpc_mode        The mode of DPC.
   -server          server info
   -auto            Set the start type of the service, whether auto.include:truefalse, default true.
   -m               Set the start mode of the server, include:open or mount, is valid for dmserver only, select.
   -y               Set the dependent service, this parameter is valid for dmserver,dmasmsvr in systemd service environment.
   -s               The path of the service script file, if set this parameter and ignore other parameter but -y.
   -h               Help

2. 注册之前创建的NBINS实例

#./dm_service_installer.sh -t dmserver -dm_ini /dm/dmdbms/data/NBDMB/dm.ini -p NBINS
The service script file(/dm/dmdbms/bin/DmServiceNBINS) exist!
本次实验,由于之前图形化界面创建时已添加服务,所以提示服务已存在,在RH7中启动或停止服务需使用systemctl,如systemctl start DmServiceNBINS.service

3. 删除服务

服务删除脚本为dm_service_uninstaller.sh,直接调用该脚本并指定服务名即可。

#./dm_service_uninstaller.sh -h
Usage: dm_service_uninstaller.sh [-n service_name]
   -n     Service Name, delete the service
   -h     Help

⑶DBCA工具中的注册和删除服务

除了使用脚本,DBCA工具还提供了注册和删除服务。
使用dmdba用户执行dbca命令

$cd /dm/dmdbms/
$cd tool/
$ls
analyzer      backup.xml     console      dbca.sh  dmagent       dropins  dts.bmp         log4j.xml  manager.bmp  monitor.bmp  p2       restore.xml            templates   workspace
analyzer.bmp  configuration  console.bmp  disql    dmservice.sh  dts      dts_cmd_run.sh  manager    monitor      nca.sh       plugins  server_connection.xml  version.sh
Oracle-alone tool$./dbca.sh

1. 数据库配置助手,选择创建服务

IMG

2.注册数据库服务

IMG

3.执行配置脚本

注册中会提示应使用“root”用户执行配置脚本,由于本服务已创建,无法进行试验。

同时,删除和创建服务操作基本一致,不再进行试验。

  • 3
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值