达梦学习笔记之一- 达梦数据库dm8安装
环境说明
• linux 环境下 DM, 如果以root用户安装, 数据库默认安装位置 /opt/dmdbms, 否则默认目录$HOME/dmdbms.
• 用图形界面比较方便. 内存较小时要设置TMP目录
安装前环境准备
groupadd -g 12349 dinstall
useradd -u 12345 -g dinstall -m -d /home/dmdba -s /bin/bash dmdba
passwd dmdba
创建目录
mkdir /home/dmdba/tmp
修改dmdba .bash_profile
export DM_HOME=/dm8
export PATH= D M H O M E / b i n : DM_HOME/bin: DMHOME/bin:DM_HOME/script: D M H O M E / t o o l : DM_HOME/tool: DMHOME/tool:PATH
export DM_INSTALL_TMPDIR=/home/dmdba/tmp
#export DISPLAY=:0.0
安装在/dm8目录
mkdir /dm8
chown -R dmdba.dinstall /dm8
设置dmdba的系统参数,直接修改 /etc/security/limits.conf, ,
[root@rh79 limits.d]# cat 99-dmdba-limits.conf
dmdba soft nproc 2047
dmdba hard nproc 16384
dmdba soft nofile 1024
dmdba hard nofile 65536
dmdba soft stack 10240
dmdba hard stack 32768
dmdba soft memlock -1
dmdba hard memlock -1
(可以创建一个专门给dm使用的文件/etc/security/limits.d/99-dmdba-limits.conf)
加压后,挂载iso
unzip dm8_20220701_x86_rh6_64_ent.zip
mount -t iso9660 dm8_20220701_x86_rh6_64_ent_8.1.2.128.iso /mnt
OR
mount -o loop dm8_20220701_x86_rh6_64_ent_8.1.2.128.iso /mnt
因为是只读.复制到/opt目录下.
chmod +x DMInstall.bin
如下以dmdba用户执行.
1. 安装方法
• 交互式(命令行)
./DMInstall.bin -i
• 用图形化
如果以root登录xwindows,
xhost +
env|grep DISPLAY (假设:0.0)
su - dmdba
source .bash_profile
export DISPLAY=:0.0
mkdir /home/dmdbs/tmp
export DM_INSTALL_TMPDIR=/home/dmdba/tmp
./DMInstall.bin
图形化安装时,虚拟机用4G内存,启动失败. 提示内存不够,启动java虚拟机失败. 改为8G后正常.
这是因为麒麟Linux10是
[root@kylin-dm8 ~]# uname -a
Linux kylin-dm8 4.19.90-24.4.v2101.ky10.x86_64 #1 SMP Mon May 24 12:14:55 CST 2021 x86_64 x86_64 x86_64 GNU/Linux
其tmp是从tmpfs分配. 当内存不大时,缺省的tmpfs不会分配大于2G, 比如内存2G,缺省分配/tmp是482M.
提高到8G时, tmpfs自然变大.就可以启动.
解决方法是修改DM_INSTALL_TMPDIR的目录
DM_INSTALL_TMPDIR=/mount_point/dir_name
export DM_INSTALL_TMPDIR
或者禁止tmp使用tmpfs
systemctl mask tmp.mount
[root@kylin-dm8 ~]# systemctl unmask tmp.mount
Removed /etc/systemd/system/tmp.mount.
恢复原状:
systemctl unmask tmp.mounte
需要重启系统.
如果root用户登录Xwindow,需要
env|grep DISPLAY
xhost+
su - dmdba
export DISPLAY=???
• 静默按照
./DMInstall.bin -q 配置文件全路径
2. 安装,建库.设置service 自动启动.
dbca.sh
页大小限制了varchar的最大长度
生产一般16k,32k.
3. 登录
disql
username: sysdba
password: damengdba
select * from dba_users;
select * from dba_tablespaces;
4.查看达梦数据库状态
• ps -ef|grep dmserver
• netstat -nat |grep 5236
[dmdba@kylin-dm8 ~]$ ps -ef|grep dmserver
dmdba 1384 1 0 05:57 ? 00:00:01 /home/dmdba/dmdbms/bin/dmserver path=/home/dmdba/dmdbms/data/DM8/dm.ini -noconsole
dmdba 2545 1 0 07:56 pts/1 00:00:01 /home/dmdba/dmdbms/bin/dmserver path=/home/dmdba/dmdbms/data/DAMENG/dm.ini -noconsole
dmdba 2697 2062 0 08:34 pts/1 00:00:00 grep dmserver
[dmdba@kylin-dm8 ~]$ netstat -nat |grep 5236
tcp6 0 0 :::5236 :: LISTEN
• systemctl
[root@rh79 dmdba]# systemctl list-unit-files |grep Dm
DmAPService.service enabled
DmServiceDMSERVER.service enabled
systemctl status DmServiceDMSERVER
systemctl status DmAPService
[root@rh79 dmdba]# systemctl status DmServiceDMSERVER
[root@rh79 dmdba]# systemctl start DmServiceDMSERVER
[root@rh79 dmdba]# systemctl status DmServiceDMSERVER
● DmServiceDMSERVER.service - DM Instance Service
Loaded: loaded (/usr/lib/systemd/system/DmServiceDMSERVER.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2022-08-29 16:51:37 CST; 9s ago
Process: 961 ExecStop=/opt/dmdbms/bin/DmServiceDMSERVER stop (code=exited, status=0/SUCCESS)
Process: 1399 ExecStart=/opt/dmdbms/bin/DmServiceDMSERVER start (code=exited, status=0/SUCCESS)
Main PID: 1433 (dmserver)
CGroup: /system.slice/DmServiceDMSERVER.service
└─1433 /opt/dmdbms/bin/dmserver path=/opt/dmdbms/data/DAMENG/dm.ini -noconsole
Aug 29 16:51:22 rh79 systemd[1]: Starting DM Instance Service…
Aug 29 16:51:37 rh79 DmServiceDMSERVER[1399]: [39B blob data]
Aug 29 16:51:37 rh79 systemd[1]: Started DM Instance Service.
• 登录
[root@rh79 dmdba]# su - dmdba
Last login: Mon Aug 29 16:49:41 CST 2022 from 192.168.56.1 on pts/2
[dmdba@rh79 ~]$ disql
disql V8
username:sysdba
password:
Server[LOCALHOST:5236]:mode is normal, state is open
login used time : 3.728(ms)
SQL> select tablespace_name from dba_tablespaces;
LINEID TABLESPACE_NAME
1 SYSTEM
2 ROLL
3 TEMP
4 MAIN
5 BOOKSHOP
6 DMHR
7 MAIN
7 rows got
used time: 3.424(ms). Execute id is 501.
SQL>
5.开启归档
alter database mount;
alter database archivelog;
alter database noarchivelog;(关闭)
alter database add archivelog;
alter database ADD ARCHIVELOG ‘type=local, dest=/home/dmdba/arch, file_size=64, space_limit=10240’;
alter database open;
alter system switch logfile;
alter system switch logfile;