达梦数据库快速安装使用

前言
主要是介绍如何快速安装、并使用达梦数据库。
1.安装达梦数据库软件基础配置
Linux 下安装达梦数据库软件
1)创建 dinstall 用户组和用户 dmdba
groupadd dinstall
useradd -g dinstall -m -d /home/dmdba -s /bin/bash dmdba
passwd dmdba

清空防火墙策略:
Iptables –F
Server iptables save

关闭 selinux :
vi /etc/selinux/config 将 SELINUX 的值由默认的 enforcing 修改为 disabled
Setenforce 0 修改完成以后生效

调整 Limits.conf:
vim /etc/security/limits.conf 添加以下内容
dmdba soft nproc 65536
dmdba hard nproc 65536
dmdba soft nofile 65536
dmdba hard nofile 65536

2.准备安装介质
[[email protected] home]# cd /home
[[email protected] home]# ls dm8_setup_rh7_64_ent_8.1.1.88_20200629.iso
[[email protected] home]# mount dm8_setup_rh7_64_ent_8.1.1.88_20200629.iso /mnt
[[email protected] mnt]# cd /mnt
[[email protected] mnt]# ls
DM8 Install.pdf DMInstall.bin
[[email protected] mnt]# xhost +
[[email protected] ~]# su - dmdba
[[email protected] mnt]$ ./DMInstall.bin -i
请选择安装语言(C/c:中文 E/e:英文) [C/c]:
解压安装程序…
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 3522
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 3522
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited

可打开文件数过少,建议至少设置为65536或更多。

欢迎使用达梦数据库安装程序

是否输入Key文件路径? (Y/y:是 N/n:否) [Y/y]:n

是否设置时区? (Y/y:是 N/n:否) [Y/y]:
设置时区:
[ 1]: GTM-12=日界线西
[ 2]: GTM-11=萨摩亚群岛
[ 3]: GTM-10=夏威夷
[ 4]: GTM-09=阿拉斯加
[ 5]: GTM-08=太平洋时间(美国和加拿大)
[ 6]: GTM-07=亚利桑那
[ 7]: GTM-06=中部时间(美国和加拿大)
[ 8]: GTM-05=东部部时间(美国和加拿大)
[ 9]: GTM-04=大西洋时间(美国和加拿大)
[10]: GTM-03=巴西利亚
[11]: GTM-02=中大西洋
[12]: GTM-01=亚速尔群岛
[13]: GTM=格林威治标准时间
[14]: GTM+01=萨拉热窝
[15]: GTM+02=开罗
[16]: GTM+03=莫斯科
[17]: GTM+04=阿布扎比
[18]: GTM+05=伊斯兰堡
[19]: GTM+06=达卡
[20]: GTM+07=曼谷,河内
[21]: GTM+08=中国标准时间
[22]: GTM+09=汉城
[23]: GTM+10=关岛
[24]: GTM+11=所罗门群岛
[25]: GTM+12=斐济
[26]: GTM+13=努库阿勒法
[27]: GTM+14=基里巴斯
请选择设置时区 [21]:21

安装类型:
1 典型安装
2 服务器
3 客户端
4 自定义
请选择安装类型的数字序号 [1 典型安装]:
所需空间: 1088M

请选择安装目录 [/home/dmdba/dmdbms]:/dm8
可用空间: 9G
是否确认安装路径(/dm8)? (Y/y:是 N/n:否) [Y/y]:

安装前小结
安装位置: /dm8
所需空间: 1088M
可用空间: 9G
版本信息:
有效日期:
安装类型: 典型安装
是否确认安装? (Y/y:是 N/n:否):y
2020-10-28 20:05:11
[INFO] 安装达梦数据库…
2020-10-28 20:05:11
[INFO] 安装 基础 模块…
2020-10-28 20:05:15
[INFO] 安装 服务器 模块…
2020-10-28 20:05:15
[INFO] 安装 客户端 模块…
2020-10-28 20:05:17
[INFO] 安装 驱动 模块…
2020-10-28 20:05:17
[INFO] 安装 手册 模块…
2020-10-28 20:05:18
[INFO] 安装 服务 模块…
2020-10-28 20:05:18
[INFO] 移动ant日志文件。
2020-10-28 20:05:19
[INFO] 安装达梦数据库完成。

请以root系统用户执行命令:
/dm8/script/root/root_installer.sh
安装结束
[[email protected] ~]# /dm8/script/root/root_installer.sh
移动 /dm8/bin/dm_svc.conf 到/etc目录
修改服务器权限
创建DmAPService服务
Created symlink from /etc/systemd/system/multi-user.target.wants/DmAPService.service to /usr/lib/systemd/system/DmAPService.service.
创建服务(DmAPService)完成
启动DmAPService服务

3.创建数据库

  1. 命令行创建数据库
    [[email protected] ~]$ cd /dm8/bin
    [[email protected] bin]$ ./dminit path=/dm8/data
    initdb V8
    db version: 0x7000a
    file dm.key not found, use default license!
    License will expire on 2021-06-24
    log file path: /dm8/data/DAMENG/DAMENG01.log
    log file path: /dm8/data/DAMENG/DAMENG02.log
    write to dir [/dm8/data/DAMENG].
    create dm database success. 2020-10-28 20:08:25

2)正常启动一次数据库在停止
[[email protected] bin]$ ./dmserver /dm8/data/DAMENG/dm.ini
file dm.key not found, use default license!
version info: develop
Use normal os_malloc instead of HugeTLB
Use normal os_malloc instead of HugeTLB
DM Database Server x64 V8 1-1-88-20.06.24-123627-ENT startup…
Database mode = 0, oguid = 0
License will expire on 2021-06-24
file lsn: 0
ndct db load finished
ndct fill fast pool finished
iid page’s trxid[1002]
NEXT TRX ID = 1003
pseg_collect_items, collect 0 active_trxs, 0 cmt_trxs, 0 pre_cmt_trxs, 0 active_pages, 0 cmt_pages, 0 pre_cmt_pages
pseg_process_collect_items end, 0 active trx, 0 active pages, 0 committed trx, 0 committed pages
total 0 active crash trx, pseg_crash_trx_rollback sys_only(0) begin …
pseg_crash_trx_rollback end
purg2_crash_cmt_trx end, total 0 page purged
set EP[0]'s pseg state to inactive
pseg recv finished
nsvr_startup end.
aud sys init success.
aud rt sys init success.
trx: 2004 purged 1 pages
trx: 2023 purged 1 pages
trx: 2024 purged 1 pages
trx: 2025 purged 1 pages
trx: 2026 purged 1 pages
trx: 2036 purged 1 pages
trx: 2156 purged 1 pages
trx: 2169 purged 1 pages
trx: 2170 purged 1 pages
trx: 2171 purged 1 pages
trx: 2172 purged 1 pages
trx: 2173 purged 1 pages
trx: 2175 purged 1 pages
trx: 2176 purged 1 pages
trx: 2178 purged 1 pages
trx: 2180 purged 1 pages
trx: 2183 purged 1 pages
trx: 2189 purged 1 pages
trx: 2199 purged 1 pages
trx: 2207 purged 37 pages
trx: 2214 purged 1 pages
trx: 2215 purged 1 pages
trx: 2216 purged 1 pages
trx: 2217 purged 1 pages
trx: 2229 purged 1 pages
trx: 2231 purged 1 pages
trx: 2232 purged 1 pages
trx: 2233 purged 1 pages
trx: 2238 purged 21 pages
trx: 2265 purged 1 pages
trx: 2266 purged 1 pages
trx: 2267 purged 1 pages
trx: 2268 purged 1 pages
trx: 2274 purged 1 pages
trx: 2276 purged 1 pages
trx: 2278 purged 1 pages
trx: 2283 purged 1 pages
trx: 2288 purged 1 pages
trx: 2293 purged 1 pages
trx: 2295 purged 1 pages
trx: 2298 purged 1 pages
trx: 2300 purged 1 pages
trx: 2308 purged 1 pages
trx: 2309 purged 1 pages
trx: 2310 purged 1 pages
trx: 2311 purged 1 pages
trx: 2312 purged 1 pages
trx: 2313 purged 1 pages
trx: 2314 purged 1 pages
trx: 2315 purged 1 pages
trx: 2316 purged 1 pages
trx: 2319 purged 1 pages
trx: 2320 purged 1 pages
trx: 2321 purged 1 pages
trx: 2322 purged 1 pages
trx: 2323 purged 1 pages
trx: 2324 purged 1 pages
trx: 2325 purged 1 pages
trx: 2326 purged 1 pages
trx: 2327 purged 1 pages
trx: 2328 purged 1 pages
trx: 2329 purged 1 pages
trx: 2330 purged 1 pages
trx: 2332 purged 1 pages
trx: 2333 purged 1 pages
trx: 2482 purged 1 pages
trx: 2485 purged 8 pages
trx: 2514 purged 1 pages
systables desc init success.
ndct_db_load_info success.
nsvr_process_before_open begin.
nsvr_process_before_open success.
total 0 active crash trx, pseg_crash_trx_rollback sys_only(0) begin …
pseg_crash_trx_rollback end
SYSTEM IS READY.
exit
Server is stopping…
listener closed and all sessions disconnected
purge undo records in usegs…OK
full check point starting…
generate force checkpoint, rlog free space[529142784], used space[7719936]
ckpt_lsn, ckpt_fil, ckpt_off are set as (34756, 0, 7724032)
checkpoint: 0 pages flushed.
checkpoint finished, rlog free space, used space is (536862720, 0)
full check point end.
shutdown audit subsystem…OK
shutdown schedule subsystem…OK
shutdown timer successfully.
pre-shutdown MAL subsystem…OK
shutdown worker threads subsystem…OK
shutdown local parallel threads pool successfully.
shutdown replication subsystem…OK
shutdown sequence cache subsystem…OK
wait for mtsk link worker to exit…OK
shutdown mpp session subsystem…OK
wait for rapply is all over… OK
rapply worker threads exit successfully.
pre ending task & worker threads…OK
shutdown dblink subsystem…OK
shutdown session subsystem…OK
shutdown rollback segments purging subsystem…OK
shutdown rps subsystem…OK
shutdown transaction subsystem…OK
shutdown locking subsystem…OK
shutdown dbms_lock subsystem…OK
ending tsk and worker threads…OK
ckpt2_exec_immediately begin.
ckpt_lsn, ckpt_fil, ckpt_off are set as (34756, 0, 7724032)
checkpoint: 0 pages flushed.
checkpoint finished, rlog free space, used space is (536847360, 15360)
ckpt_lsn, ckpt_fil, ckpt_off are set as (34895, 0, 7739392)
checkpoint: 0 pages flushed.
checkpoint finished, rlog free space, used space is (536862720, 0)
ckpt_lsn, ckpt_fil, ckpt_off are set as (34895, 0, 7739392)
checkpoint: 0 pages flushed.
checkpoint finished, rlog free space, used space is (536862720, 0)
shutdown archive subsystem…OK
shutdown redo log subsystem…OK
shutdown MAL subsystem…OK
shutdown message compress subsystem successfully.
shutdown task subsystem…OK
shutdown trace subsystem…OK
shutdown svr_log subsystem…OK
shutdown plan cache subsystem…OK
shutdown file subsystem…OK
shutdown database dictionary subsystem…OK
shutdown mac cache subsystem…OK
shutdown dynamic login cache subsystem…OK
shutdown ifun/bifun/sfun/afun cache subsystem…OK
shutdown crypt subsystem…OK
shutdown pipe subsystem…OK
shutdown compress component…OK
shutdown slave redo subsystem…OK
shutdown kernel buffer subsystem…OK
shutdown SQL capture subsystem…OK
shutdown control file system…OK
shutdown dtype subsystem…OK
shutdown huge buffer and memory pools…OK
close lsnr socket
DM Database Server shutdown successfully.

4.注册数据库服务
[[email protected] ~]# cd /dm8/script/root/
[[email protected] root]# ls
dm_service_installer.sh dm_service_uninstaller.sh root_installer.sh
[[email protected] root]# ./dm_service_installer.sh -t dmserver -dm_ini /dm8/data/DAMENG/dm.ini -p DMSERVER
Created symlink from /etc/systemd/system/multi-user.target.wants/DmServiceDMSERVER.service to /usr/lib/systemd/system/DmServiceDMSERVER.service.
创建服务(DmServiceDMSERVER)完成

5.数据库的启动和关闭
启动或关闭数据库,首先切换到 dmdba 用户,如下

  1. 以服务方式启动(需要 root 用户来执行)
    –启动数据库 systemctl start DmServiceDMSERVER
    –关闭数据库 systemctl stop DmServiceDMSERVER
  2. 以控制台方式启动(使用 dmdba 用户来执行)
    cd /dm8/bin
    ./dmserver /dm8/data/DAMENG/dm.ini
  3. 后台方式启动|重启|停止(使用 dmdba 用户来执行)
    cd /dm8/bin
    ./DmServiceDMSERVER start|restart|stop

6.访问数据库
1)disql访问数据库
[[email protected] bin]# ./disql SYSDBA/SYSDBA
服务器[LOCALHOST:5236]:处于普通打开状态
登录使用时间: 3.658(毫秒)
disql V8
SQL> select * from V$version;
行号 BANNER


1 DM Database Server 64 V8
2 DB Version: 0x7000a
已用时间: 29.357(毫秒). 执行号:4.

2)管理工具访问数据库
[[email protected] dm8]# cd tool/
[[email protected] tool]# ./manager
达梦数据库快速安装使用
达梦数据库快速安装使用
在【窗口】—【选项】中设置工具的相关属性。 在【窗口】—【视图】中,查看 SQL 执行日志等信息。 管理工具使用的 log 位于/dm8/log/tool.log

更多数据库操作请查看/dm8/doc下的手册
[[email protected] doc]# ll
总用量 78844
-rwxr-xr-x 1 dmdba dinstall 1389506 10月 28 20:05 DM8_dexp和dimp使用手册.pdf
-rwxr-xr-x 1 dmdba dinstall 1302895 10月 28 20:05 DM8_DIsql使用手册.pdf
-rwxr-xr-x 1 dmdba dinstall 684596 10月 28 20:05 DM8_dmdbchk使用手册.pdf
-rwxr-xr-x 1 dmdba dinstall 1188095 10月 28 20:05 DM8_dmfldr使用手册.pdf
-rwxr-xr-x 1 dmdba dinstall 953586 10月 28 20:05 DM8_dminit使用手册.pdf
-rwxr-xr-x 1 dmdba dinstall 1358185 10月 28 20:05 DM8_dmPython使用手册.pdf
-rwxr-xr-x 1 dmdba dinstall 741675 10月 28 20:05 DM8_Linux服务脚本使用手册.pdf
-rwxr-xr-x 1 dmdba dinstall 1578109 10月 28 20:05 DM8_PROC使用手册.pdf
-rwxr-xr-x 1 dmdba dinstall 1731638 10月 28 20:05 DM8_SQL程序设计.pdf
-rwxr-xr-x 1 dmdba dinstall 28430736 10月 28 20:05 DM8_SQL语言使用手册.pdf
-rwxr-xr-x 1 dmdba dinstall 1944638 10月 28 20:05 DM8安全管理.pdf
-rwxr-xr-x 1 dmdba dinstall 3280977 10月 28 20:05 DM8安装手册.pdf
-rwxr-xr-x 1 dmdba dinstall 4275214 10月 28 20:05 DM8备份与还原.pdf
-rwxr-xr-x 1 dmdba dinstall 6780679 10月 28 20:05 DM8程序员手册.pdf
-rwxr-xr-x 1 dmdba dinstall 1972288 10月 28 20:05 DM8大规模并行处理MPP.pdf
-rwxr-xr-x 1 dmdba dinstall 3756875 10月 28 20:05 DM8共享存储集群.pdf
-rwxr-xr-x 1 dmdba dinstall 1257005 10月 28 20:05 DM8集群代理使用手册.pdf
-rwxr-xr-x 1 dmdba dinstall 6586009 10月 28 20:05 DM8数据守护与读写分离集群V4.0.pdf
-rwxr-xr-x 1 dmdba dinstall 4804174 10月 28 20:05 DM8系统包使用手册.pdf
-rwxr-xr-x 1 dmdba dinstall 4831831 10月 28 20:05 DM8系统管理员手册.pdf
-rwxr-xr-x 1 dmdba dinstall 1842813 10月 28 20:05 DM8作业系统使用手册.pdf