当前位置: 首页 > news >正文

本地虚拟机centos7安装达梦8数据库

在产品下载 | 达梦数据库可以下载docker文件

如下:dm8_20240715_x86_rh6_rq_single.tar文件

在linux可以

[root@localhost dm8]# docker load -i dm8_20240715_x86_rh6_rq_single.tar 
4a1518ebc26e: Loading layer [==================================================>] 75.19 MB/75.19 MB
b8a4238f8cd3: Loading layer [==================================================>] 16.14 MB/16.14 MB
78f411f0a3f4: Loading layer [==================================================>] 16.87 MB/16.87 MB
ee7e3338d636: Loading layer [==================================================>] 1.185 MB/1.185 MB
ad2c3a0ea0ae: Loading layer [==================================================>] 354.8 kB/354.8 kB
f238a8da5f88: Loading layer [==================================================>] 1.035 GB/1.035 GB
29bea1477fed: Loading layer [==================================================>]  5.12 kB/5.12 kB
d9d4efb7df38: Loading layer [==================================================>] 4.608 kB/4.608 kB
a4d32f2d669a: Loading layer [==================================================>] 3.072 kB/3.072 kB
407cb6f411e4: Loading layer [==================================================>]  2.56 kB/2.56 kB
27fc5e1a3138: Loading layer [==================================================>]  2.56 kB/2.56 kB
b17f6a378f4d: Loading layer [==================================================>] 4.096 kB/4.096 kB
80c94e424fcb: Loading layer [==================================================>] 4.096 kB/4.096 kB
Loaded image: dm8_single:dm8_20240715_rev232765_x86_rh6_64

安装好后可以用docker images看到

[root@localhost dm8]# docker images
REPOSITORY                                                  TAG                                 IMAGE ID            CREATED             SIZE
dm8_single                                                  dm8_20240715_rev232765_x86_rh6_64   0880e3256f92        8 weeks ago         1.14 GB
registry.cn-shanghai.aliyuncs.com/primeton-pub/eoslowcode   8.3.0                               c83d3e13d0fd        5 months ago        1.26 GB
docker.io/xuxueli/xxl-job-admin                             2.4.0                               add65eeff2e1        17 months ago       235 MB
docker.io/redis                                             3.2                                 87856cc39862        5 years ago         76 MB
docker.io/mysql                                             5.7.21                              5195076672a7        6 years ago         371 MB

同时按照下面运行

[root@localhost dm8]# docker run -d -p 5236:5236  --name dm8 --privileged=true \
> -e PAGE_SIZE=16 \
> -e LD_LIBRARY_PATH=/opt/dmdbms/bin \
> -e CASE_SENSITIVE=0 \
> -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 \
> -v /home/mydata/dm8:/opt/dmdbms/data dm8_single:dm8_20240715_rev232765_x86_rh6_64 
63161e1b396ca333996f40e9cddf2319d204512f493cde7489e080af8881865e

使用 -e 命令指定数据库初始化参数时,需要注意的是 页大小 (page_size)、簇大小 (extent_size)、大小写敏感 (case_sensitive,为0表示不敏感)、字符集 (UNICODE_FLAG) 、VARCHAR 类型以字符为单位 (LENGTH_IN_CHAR)、空格填充模式 (BLANK_PAD_MODE) 、页检查模式(PAGE CHECK) 等部分参数 

注意

1.如果使用 docker 容器里面的 disql,进入容器后,先执行 source /etc/profile 防止中文乱码。
2.新版本 Docker 镜像中数据库默认用户名/密码为 SYSDBA/SYSDBA001。

可以使用 docker inspect dm8 看ENV模块的密码

可以看运行日志,如下,这样就成功了。

[root@localhost dm8]# docker logs dm8
Script start.
length_in_char is no longer supported in this version, and this setting will not take effect. 
file dm.key not found, use default license!
License will expire on 2025-06-21
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLLlog file path: /opt/dmdbms/data/DAMENG/DAMENG01.loglog file path: /opt/dmdbms/data/DAMENG/DAMENG02.log
write to dir [/opt/dmdbms/data/DAMENG].
create dm database success. 2024-09-13 05:44:13
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 OK
Start DMSERVER success!
Dmserver is running.
DM Database is OK
Finished soft link DM current dm_DM8_202409.log to dm_DMSERVER.log
2024-09-13 05:45:14.820 [INFO] database P0000000146 T0000000000000000339  dthrd_info_add nth:146, dthrd_info:0x7fc8472ede40, thrd_name:dm_lsnr_thd
2024-09-13 05:45:14.820 [INFO] database P0000000146 T0000000000000000337  dthrd_info_add nth:144, dthrd_info:0x7fc8474efe40, thrd_name:nlgn_task_thread
2024-09-13 05:45:14.820 [INFO] database P0000000146 T0000000000000000146  backup control file /opt/dmdbms/data/DAMENG/dm.ctl to file /opt/dmdbms/data/DAMENG/ctl_bak/dm_20240913054514_820218.ctl succeed
2024-09-13 05:45:14.820 [INFO] database P0000000146 T0000000000000000146  local instance name is DM8, mode is NORMAL, status is OPEN.
2024-09-13 05:45:14.820 [INFO] database P0000000146 T0000000000000000146  SYSTEM IS READY.
2024-09-13 05:45:14.820 [INFO] database P0000000146 T0000000000000000146  [for dem]SYSTEM IS READY.
2024-09-13 05:45:14.820 [INFO] database P0000000146 T0000000000000000146  set g_dw_stat from UNDEFINED to NONE success, g_dw_recover_stop is 0
2024-09-13 05:45:15.821 [INFO] database P0000000146 T0000000000000000215  trx4_min_tid_collect set min_active_id_opt, min_active_id: 6753, first_tid: 6006
2024-09-13 05:45:20.293 [INFO] database P0000000146 T0000000000000000351  dthrd_info_add nth:158, dthrd_info:0x7fc8471ece40, thrd_name:dm_sql_thd
2024-09-13 05:45:20.340 [INFO] database P0000000146 T0000000000000000371  dthrd_info_add nth:178, dthrd_info:0x7fc8471ece40, thrd_name:dm_sql_thd

通过下面方式可以测试数据库是否可以正常连接

[root@localhost dm8]# docker exec -it dm8 /bin/bash
root@63161e1b396c:/# cd /opt/dmdbms/bin
root@63161e1b396c:/opt/dmdbms/bin# ^C
root@63161e1b396c:/opt/dmdbms/bin# ./disql SYSDBA/SYSDBA001@192.168.199.151:5236
[-70028]:Create SOCKET connection failure.
disql V8
username:SYSDBA
password:Server[LOCALHOST:5236]:mode is normal, state is open
login used time : 5.432(ms)
SQL> 

常用的一些命令如下:

6.常用命令
创建表空间 OA,文件为 OA.DBF,大小 128 MB

CREATE TABLESPACE OA DATAFILE 'OA.DBF' size 128;

创建用户 OA,密码 aaaaaaaaa,默认表空间和索引表空间均为

OA CREATE USER OA IDENTIFIED by aaaaaaaaa DEFAULT TABLESPACE OA DEFAULT INDEX TABLESPACE OA;

授权 VIT 权限给 OA GRANT VTI TO OA;

授权 PUBLIC 权限给 OA GRANT PUBLIC TO OA;

授权 RESOURCE 权限给 OA GRANT RESOURCE TO OA;

修改用户OA的密码为bbbbbbbbb ALTER USER OA IDENTIFIED BY bbbbbbbbb; 

#查看达梦数据库运行状态

SELECT status$ as 状态 FROM v$instance;
 

#查看版本

SELECT banner as 版本信息 FROM v$version;

#使用 conn 命令切换用户。
conn DM/dameng123;

#使用 user 关键字返回当前登录用户。
SELECT user FROM DUAL;

#查看所有模式名
SELECT DISTINCT object_name FROM ALL_OBJECTS WHERE OBJECT_TYPE = 'SCH';

#根据模式名查询表名

SELECT table_name FROM dba_tables WHERE owner = '模式名';

#根据模式和表名查询表字段

SELECT COLUMN_NAME FROM all_tab_columns WHERE onwer = '模式名' AND Table_Name = '表名';

可以考虑安装win的DM管理工具


http://www.mrgr.cn/news/29216.html

相关文章:

  • 动手学深度学习10.1. 注意力提示-笔记练习(PyTorch)
  • 【测试框架篇】单元测试框架pytest(1):环境安装和配置
  • Ruby编程语言全景解析:从基础到进阶
  • springboot自动装配
  • Spring中的 bean 标签中的 factory-bean , factory-method
  • 13、指向Member Function的指针
  • uni-app 聊天界面滚动到消息底部
  • 大模型微调基本概念指北,零基础入门到精通,收藏这一篇就够了
  • Maven的详细解读和配置
  • 优化内容个性化:无限住宅代理如何做到的
  • 基于51单片机的锅炉控制系统PID调节proteus仿真
  • 架构师:生成唯一标识的技术指南
  • 腾讯百度阿里华为常见算法面试题TOP100(5):子串、堆
  • python 实现费马检测算法
  • 深入解析 Apache Kylin
  • 【JAVA】多线程的创建、线程池创建线程的方式(超详细)
  • 基于LangChain的Embedding开发手册(保姆级)
  • 【C/C++】涉及string类的经典OJ编程题
  • 深入理解JNDI注入—RMI/LDAP攻击
  • 变电站缺陷隐患检测图像数据集,总共包含8000张图片,包含渗漏油,鸟巢,表盘破损,呼吸器变色等
  • MySQL-DDL/DML(数据定义/操作语言)
  • 【乐企-业务篇】开票前置校验服务-规则链服务接口实现(纳税人基本信息)
  • 是时候对企业数字化转型进行一次复盘了
  • Java中的服务端点异常处理:全局异常处理器
  • 责任链模式详解:实现请求处理的灵活解耦
  • 独孤思维:踩中红利,你也赚不到钱