#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
~#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
#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
#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
典型安装:包括服务器、客户端、驱动、用户手册、数据库服务。 服务器安装:包括服务器、驱动、用户手册、数据库服务。 客户端安装:包括客户端、驱动、用户手册。 自定义安装:用户根据需求勾选组件,可以是服务器、客户端、驱动、用户手册、数据库服务中的任意组合。 此处选典型安装。
#mkdir -p /dm/dmdbms #chown -R dmdba:dinstall /dm
确认无误后点击Install即可进行达梦数据库的安装。
使用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
$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工具是一个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
指定数据库目录
输入数据库名和实例名
确认各文件路径(控制文件、数据文件、日志文件、初始化日志文件)
数据库初始化参数(簇大小、页大小、日志文件大小、字符集、字符串比较大小写敏感等)
设置密码DMDBA_2022
选择是否创建示例数据库(本次实验选择创建,方便后续操作)
安装详情,确认后点完成
执行初始化脚本,初始化数据库并开机自启动
#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工具连接实例进行验证
达梦数据库管理系统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
在使用这些服务脚本前,需根据实际情况对这些脚本进行修改,脚本说明如下:
服务名 | 对应参数 | 说明 |
---|---|---|
DmAPService | dfs.ini | DMAP辅助插件服务 |
DmAuditMonitorService | dmamon.ini | DMAMON实时审计监控服务 |
DmJobMonitorService | DMJMON实时作业监控 | |
DmInstanceMonitorService | DMIMON实例实时监控服务 | |
DmService | dm.ini | DMSERVER实例服务 |
DmWatcherService | dmwatcher.ini | DM守护进程,DMWATCHER对应的服务脚本模板 |
DmMonitorService | dmmonitor.ini | DM守护监视器服务,DMMONITOR对应的服务脚本模板 |
DmASMSvrService | dmdcr.ini | DM自动存储管理器服务,DMASMSVR对应的服务脚本模板 |
DmCSSService | dmdcr.ini,dmdfs.ini | DM集群同步服务,DMCSS对应的服务脚本模板 |
DmCSSMonitorService | dmcssm.ini | DM集群同步监控服务,DMCSSM对应的服务脚本模板 |
DmDRSService | drs.ini | 分布式日志服务器服务,DMDRS对应的服务脚本模板 |
DmDCSService | dcs.ini | 分布式目录服务器服务,DMDCS对应的服务脚本模板 |
DmDSSService | dss.ini | 分布式存储服务器服务,DMDSS对应的服务脚本模板 |
DmDRASService | dras.ini | 分布式日志归档服务器服务,DMDRAS对应的服务脚本模板 |
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:true或false, 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
#./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
服务删除脚本为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工具还提供了注册和删除服务。
使用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
注册中会提示应使用“root”用户执行配置脚本,由于本服务已创建,无法进行试验。
同时,删除和创建服务操作基本一致,不再进行试验。
文章
阅读量
获赞