1,下载docker 镜像 https://eco.dameng.com/download/?_blank
2,安装步骤 https://eco.dameng.com/document/dm/zh-cn/start/dm-install-docker.html
# 导入镜像
docker load -i dm8_20230808_rev197096_x86_rh6_64_single.tar
# 创建容器并启动
docker run -d -p 30236:5236 --restart=always \
--name dm8_test --privileged=true \
-e PAGE_SIZE=16 -e LD_LIBRARY_PATH=/opt/dmdbms/bin \
-e EXTENT_SIZE=32 -e BLANK_PAD_MODE=1 -e LOG_SIZE=1024 \
-e UNICODE_FLAG=1 -e LENGTH_IN_CHAR=1 \
-e INSTANCE_NAME=dm8_test -v /data/dm8_test:/opt/dmdbms/data dm8_single:dm8_20230808_rev197096_x86_rh6_64
# 容器配置
# 30236 是映射到宿主机的端口
# --privileged=true 是容器获取宿主机root权限
# /data/dm8_test 是映射到宿主机目录,存储的是数据库文件
# 数据库初始化配置,后续无法修改
# page_size 数据文件使用的页大小,可以为 4 KB、8 KB、16 KB 或 32 KB 之一,选择的页大小越大,则 DM 支持的元组长度也越大,但同时空间利用率可能下降,缺省使用 8 KB。
# extent_size 指数据文件使用的簇大小,即每次分配新的段空间时连续的页数。只能是 16 页或 32 页或 64 页之一,缺省使用 16 页。
# UNICODE_FLAG 字符集 0:GB18030 1:UTF-8 2:EUC-KR
# LOG_SIZE 日志大小
# LENGTH_IN_CHAR VARCHAR类型长度是否以字符为单位(N),可选值:Y/N,1/0
# BLANK_PAD_MODE 设置字符串比较时, 结尾空格填充模式是否兼容 ORACLE。 取值: 1 兼容; 0 不兼容。默认为 0。可选参数。
# 查看日志
docker logs -f dm8_test
----------------------------------------------------------------------------日志-----------------------
create dm database success. 2024-01-11 09:32:07
initdb V8
db version: 0x7000c
Init DM success!
Start DmAPService...
Starting DmAPService: [ OK ]
/opt/dmdbms/conf/dm.ini does not exist, use default dm.ini
Start DMSERVER success!
Dmserver is running.
DM Database is not OK, please wait...
DM Database is not OK, please wait...
DM Database is not OK, please wait...
DM Database is not OK, please wait...
DM Database is not OK, please wait...
DM Database is not OK, please wait...
DM Database is not OK, please wait...
DM Database is not OK, please wait...
DM Database is not OK, please wait...
DM Database is not OK, please wait...
* Starting periodic command scheduler cron
...done.
2023-07-27 19:57:51.680 [INFO] database P0000023431 T0000000000000023435 rfil_close_low set main rfil[../datatest/DAMENG/DAMENG01.log]'s sta to inactive, l_next_seq = 4788, g_next_seq = 4788, clsn = 38842, handle = 7, free=8720896, len=268435456
2023-07-27 19:57:51.681 [INFO] database P0000023431 T0000000000000023435 os_sema2_free, sema_id:3309591, sema_value:1!
2023-07-27 19:57:51.691 [INFO] database P0000023431 T0000000000000023435 shutdown MAL subsystem...
2023-07-27 19:57:51.797 [INFO] database P0000023431 T0000000000000023435 global inject hint deinit
2023-07-27 19:57:51.797 [INFO] database P0000023431 T0000000000000023435 global stat cache deinit
2023-07-27 19:57:51.803 [INFO] database P0000023431 T0000000000000023435 fil_sys_destroy
2023-07-27 19:57:52.812 [INFO] database P0000023431 T0000000000000023435 close lsnr socket
2023-07-27 19:57:52.815 [INFO] database P0000023431 T0000000000000023435 [for dem]SYSTEM SHUTDOWN SUCCESS.
2023-07-27 19:57:52.815 [INFO] database P0000023431 T0000000000000023435 DM Database Server shutdown successfully.
2023-07-27 19:57:52.815 [INFO] database P0000023431 T0000000000000023435 nsvr_notify_exit wakeup main thread to exit
注意
- 如果使用 docker 容器里面的 disql,进入容器后,先执行 source /etc/profile 防止中文乱码。
- 新版本 Docker 镜像中数据库默认用户名/密码为 SYSDBA/SYSDBA001。
- 容器创建后,构建数据库需要一些时间初始化,需要耐心等待