达梦数据库安装
安装准备
数据库版本:dm8_20220525_x86_rh6_64.iso
操作系统:麒麟10(Kylin10)
将安装镜像挂载到/mnt目录下
创建安装组和安装用户
建议设置/tmp分区大小为3-4G,否则安装时会出现/tmp分区大小不足错误
修改方法:
临时生效
[root@localhost ~]# mkdir -p /opt/tmp
[root@localhost ~]# chown dmdba:dinstall /opt/tmp -R
[root@localhost ~]# su dmdba
[dmdba@localhost root]$ cd
[dmdba@localhost ~]$ vi .bash_profile
[dmdba@localhost ~]$ cat .bash_profile
export DM_INSTALL_TMPDIR=/opt/tmp
[dmdba@localhost ~]$ . .bash_profile
永久生效(需重启服务器)
修改/etc/fstab,添加下面内容:
tmpfs /tmp tmpfs nodev,nosuid,size=4G 0 0
设置文件最大打开数
临时生效
永久生效(需重启服务器)
修改/etc/security/limits.conf,在末尾添加:
dmdba soft nofile 65536
dmdba hard nofile 65536
设置图形化界面
DM8安装
图形化安装
[dmdba@localhost mnt]$ ./DMInstall.bin
直接下一步到底,如果有key文件,可以填入路径,或者安装时不填,后续有可用的key文件,可以直接替换dmdbms/bin下的dm.key,重启数据库实例生效
安装完成时使用root执行命令
命令行安装
[dmdba@localhost mnt]$ ./DMInstall.bin -i
卸载
图形化卸载
[dmdba@localhost dmdbms]$ ./uninstall.sh
命令行卸载
[dmdba@localhost dmdbms]$ ./uninstall.sh -i
数据库实例管理
初始化
图形化初始化
[dmdba@localhost ~]$ cd dmdbms/tool
[dmdba@localhost tool]$ ./dbca.sh
这里所有选项均为默认,因此直接下一步即可
root执行命令
图像化方式初始化不需要注册服务,且实例创建后就已经启动
命令行初始化
手动创建数据库
[dmdba@localhost bin]$ ./dminit db_name=DAMENG instance_name=DMSERVER port_num=5236 path=/home/dmdba/dmdbms/data
注册服务
启动服务
数据库连接
disql
两种方法打开:bin目录下和tool目录下,tool目录下需手动connect
[dmdba@localhost bin]$ ./disql username/passwd
[dmdba@localhost tool]$ ./disql
disql V8
SQL> connect username/passwd
DM管理工具
[dmdba@localhost tool]$ ./manager
数据库启停服务
数据库实例状态
shutdown:数据库关闭状态
mount:数据库配置状态,开启归档,集群的配置
open:打开状态,能正常对外提供服务
suspend:挂起状态,只读
以下状态可进行切换:
shutdown-mount
mount-shutdown
shutdown-open
open-shutdown
mount-open
open-mount
suspend-open
open-suspend
SQL语句切换
前台方式启动和关闭,适用于没有注册数据库服务的情况
启动,出现SYSTEM IS READY即启动成功
[dmdba@localhost bin]$ ./dmserver ../data/DAMENG/dm.ini
关闭
直接输入exit
后台方式启动和关闭,需注册服务
启动
[dmdba@localhost bin]$ ./DmServiceDMSERVER start
关闭
[dmdba@localhost bin]$ ./DmServiceDMSERVER stop
服务查看器方式启动和关闭,需以root用户操作
[root@localhost tool]# ./dmservice.sh
DM常用工具
tool目录下客户端工具
DM管理工具manager :数据库日常运维,对数据库、表空间、表做热备
[dmdba@localhost tool]$ ./manager
DM数据库配置助手DBCA
[dmdba@localhost tool]$ ./dbca.sh
DM服务查看器
[dmdba@localhost tool]$ ./dmservice.sh
DM控制台工具console :查看和修改参数,对数据库做冷备、整库还原、表空间花园
[dmdba@localhost tool]$ ./console
DM数据迁移工具dts
[dmdba@localhost tool]$ ./dts
DM性能监视工具monitor
[dmdba@localhost tool]$ ./monitor
DM审计分析工具analyzer
[dmdba@localhost tool]$ ./analyzer
bin目录下命令行工具
数据库初始化命令行工具dminit
[dmdba@localhost bin]$ ./dminit
SQL交互式查询工具disql
[dmdba@localhost bin]$ ./disql
快速数据装载命令行工具
[dmdba@localhost bin]$ ./dmfldr
逻辑导入导出命令行工具
[dmdba@localhost bin]$ ./dexp
[dmdba@localhost bin]$ ./dimp
备份还原命令行工具
[dmdba@localhost bin]$ ./dmrman