Dameng database installation DM8

1. Installation of Dameng database

1. Environmental requirements

System platform Serve IP
centos7/8
redhat7/8
Kirin
Dameng database 192.168.229.204

The Kirin operating system is used here


Dameng database official website

2. Dameng's official installation documents

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-0IvRwZ7C-1684461397011)(../../%E5%8D%9A%E5%AE%A2/ %E7%A0%B4%E8%A7%A3%E5%AF%86%E7%A0%81/1668748826433.png)]


Click on Download Center and slide down

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-bmB6NJWY-1684461397013)(../../%E5%8D%9A%E5%AE%A2/ %E7%A0%B4%E8%A7%A3%E5%AF%86%E7%A0%81/1668748936944.png)]


The page after clicking the online product

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-zWy5KwHH-1684461397014)(../../%E5%8D%9A%E5%AE%A2/ %E7%A0%B4%E8%A7%A3%E5%AF%86%E7%A0%81/1668749043514.png)]


Click on the operation and maintenance guide

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-YetzmzEz-1684461397015)(../../%E5%8D%9A%E5%AE%A2/ %E7%A0%B4%E8%A7%A3%E5%AF%86%E7%A0%81/1668749100624.png)]


Before installation, you can take a look at the pre-installation preparations

Check the operating system version

[root@kylin10 ~]# cat /etc/os-release
NAME="Kylin Linux Advanced Server"
VERSION="V10 (Tercel)"
ID="kylin"
VERSION_ID="V10"
PRETTY_NAME="Kylin Linux Advanced Server V10 (Tercel)"
ANSI_COLOR="0;31"

// 以上是麒麟的查看方式
// 红帽或centos的查看方式
cat /etc/redhat-release

The time of the operating system should be consistent with the current

[root@kylin10 ~]# date "+%Y-%m-%d %H-%M-%S"  // 显示当前的时间的命令
2022-11-18 14-04-46
[root@kylin10 ~]# date -s "20231118 13:47:45"  // 修改时间的命令
2023年 11月 18日 星期五 13:47:45 CST
[root@kylin10 ~]# date "+%Y-%m-%d %H-%M-%S"
2023-11-18 13-47-51

Turn off the firewall and SElinux. If the firewall is not closed, a release rule is required

The service corresponding to the port cannot be accessed externally, and the cluster product cannot be installed

[root@kylin10 ~]# systemctl disable --now firewalld  // 关闭防火墙
[root@kylin10 ~]# systemctl status firewalld  // 查看防火墙状态
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor>
   Active: inactive (dead)
     Docs: man:firewalld(1)
lines 1-4/4 (END)

// 永久关闭SElinux
[root@kylin10 ~]# sed -i '/^SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config


// 临时关闭SElinux
setenforce 0

Redhat7/8 add port to firewall (Firewall)

##这是放行端口的方式(--permanent 永久生效,没有此参数重启后失效)
firewall-cmd --zone=public --add-port=5236/tcp --permanent
##重新载入
firewall-cmd --reload
##查看
firewall-cmd --zone=public --query-port=5236/tcp
##删除
firewall-cmd --zone=public --remove-port=5236/tcp --permanent

Notice

When adding a port to the firewall, it will take effect permanently after using --permanent, otherwise it will fail after restarting. restart firewall


close SELinuxmeaning

SELinuxComponents can be used to enhance system security. In Linux, SELinuxmany additional configuration items are set above the root authority. If you understand these configuration items, you can set them accordingly, but if you don’t understand them, SELinuxit may not only be of no practical help, but also bring a lot of uncertainties.

SELinux There are 3 modes, which are Enforcing, Permissive and Disabled states.

(1) Enforcing: Enforcing mode. The representative SELinux is running and has begun to limit the verification relationship between domain/type;

(2) Permissive: tolerance mode. It means that SELinux during operation, the verification relationship between domain/type will not be restricted, even if the verification is incorrect, the process can still operate on the file. Warn if validation is incorrect.

(3) Disabled: Turn off the mode. SELinux doesn't actually work.

The first two states can setenforce be set through commands, and if you want to change to the disabled state, you need to modify the configuration file and restart the system at the same time.

The value of the Enforcing state is 1, and the permissive state is 0, so it is set to permissive, and the command is: setenforce 0|1.


##临时关闭 SELinux:
[root@localhost ~]# setenforce 0
##临时开启 SELinux:
[root@localhost ~]# setenforce 1
##查看当前状态命令:
[root@localhost ~]# getenforce 
Permissive
##永久关闭 SELinux 需修改配置文件:/etc/selinux/config,修改 SELINUX=disabled
[root@localhost ~]# cat /etc/selinux/config 
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled      #修改为 disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected. 
# mls - Multi Level Security protection.
SELINUXTYPE=targeted 

Notice

The modification SELinuxis permanently closed, and the server must be restarted to take effect. And after it is permanently closed, it cannot be setenforce 1temporarily opened by command.


3. Download the installation package of Dameng database

Dameng database installation package download address

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-1yV7QBwg-1684461397016)(../../%E5%8D%9A%E5%AE%A2/ %E7%A0%B4%E8%A7%A3%E5%AF%86%E7%A0%81/1668756864545.png)]


3.1, DM8 download

Click the page that appears after downloading, and you can download the corresponding ISO image according to your needs

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-N8vqsJbh-1684461397016)(../../%E5%8D%9A%E5%AE%A2/ %E7%A0%B4%E8%A7%A3%E5%AF%86%E7%A0%81/1668756910140.png)]


3.2. Download of DM7

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-x2aS7SVL-1684461397017)(../../%E5%8D%9A%E5%AE%A2/ %E7%A0%B4%E8%A7%A3%E5%AF%86%E7%A0%81/1668756947333.png)]


4. Start the operation

4.1. Use xftp to transfer dm8 to the virtual machine

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-RwLAXitX-1684461397017)(../../%E5%8D%9A%E5%AE%A2/ %E7%A0%B4%E8%A7%A3%E5%AF%86%E7%A0%81/1668757689933.png)]

[root@kylin10 ~]# ll
总用量 921760
-rw------- 1 root root      2683 11月 14 17:23 anaconda-ks.cfg
-rw------- 1 root root 943764329 11月 18 15:45 dm8_20220720_x86_rh7_64_ent.zip
[root@kylin10 ~]# 
# 解压
[root@kylin10 ~]# file dm8_20220720_x86_rh7_64_ent.zip // 查看是用什么软件压缩的
dm8_20220720_x86_rh7_64_ent.zip: Zip archive data, at least v2.0 to extract
[root@kylin10 ~]# which unzip  // 查看是否有这个命令
/usr/bin/unzip
[root@kylin10 ~]# dnf provides unzip // 这个命令时有哪个包提供的
Last metadata expiration check: 0:33:47 ago on 2022年11月18日 星期五 15时15分50秒.
unzip-6.0-45.ky10.x86_64 : A utility for unpacking zip files
Repo        : @System
Matched from:
Provide    : unzip = 6.0-45.ky10

unzip-6.0-45.ky10.x86_64 : A utility for unpacking zip files
Repo        : ks10-adv-os
Matched from:
Provide    : unzip = 6.0-45.ky10

[root@kylin10 ~]# unzip dm8_20220720_x86_rh7_64_ent.zip  // 解压

[root@kylin10 ~]# ll
总用量 1857132
-rw------- 1 root root      2683 11月 14 17:23 anaconda-ks.cfg
-rw------- 1 root root 957816832  8月 19 10:50 dm8_20220720_x86_rh7_64_ent_8.1.2.114_pack11.iso   // 解压后出来的文件
-rw------- 1 root root       168  8月 19 10:50 dm8_20220720_x86_rh7_64_ent_8.1.2.114_pack11.iso_SHA256.txt
-rw------- 1 root root 943764329 11月 18 15:45 dm8_20220720_x86_rh7_64_ent.zip
-rw------- 1 root root    105672  1月 17  2019 htop-2.2.0-3.el7.x86_64.rpm
-rw-r--r-- 1 root root      2793 11月 14 17:25 initial-setup-ks.cfg
4.2. Download dependent packages
[root@kylin10 ~]# yum list all|grep ^openssl
openssl.x86_64              1:1.1.1d-9.ky10                        @anaconda    
openssl-ibmpkcs11.x86_64    1.0.2-1.ky10.ky10                      @anaconda    
openssl-libs.x86_64         1:1.1.1d-9.ky10                        @anaconda    
openssl-pkcs11.x86_64       0.4.10-1.ky10                          @anaconda    
openssl-devel.x86_64        1:1.1.1d-9.ky10                        ks10-adv-os  
openssl-help.noarch         1:1.1.1d-9.ky10                        ks10-adv-os  
openssl-pkcs11-devel.x86_64  0.4.10-1.ky10                         ks10-adv-os  
[root@kylin10 ~]# 
[root@kylin10 ~]# yum -y install openssl openssl-devel  // 下载
4.3. Copy the iso file of dm8 to the specified directory and mount it
# 创建存放dm8的iso的目录
[root@kylin10 ~]# mkdir -p /opt/DM8
[root@kylin10 ~]# cp -r dm8_20220720_x86_rh7_64_ent_8.1.2.114_pack11.iso /opt/DM8/
[root@kylin10 ~]# cd /opt/DM8/
[root@kylin10 DM8]# ll
总用量 935368
-rw------- 1 root root 957816832 11月 18 16:15 dm8_20220720_x86_rh7_64_ent_8.1.2.114_pack11.iso

// 挂载
[root@kylin10 DM8]# mount dm8_20220720_x86_rh7_64_ent_8.1.2.114_pack11.iso  /mnt/
mount: /mnt: WARNING: source write-protected, mounted read-only.
[root@kylin10 DM8]# df -h
文件系统               容量  已用  可用 已用% 挂载点
devtmpfs               705M     0  705M    0% /dev
tmpfs                  727M     0  727M    0% /dev/shm
tmpfs                  727M  1.2M  726M    1% /run
tmpfs                  727M     0  727M    0% /sys/fs/cgroup
/dev/mapper/klas-root   17G   11G  6.6G   62% /
tmpfs                  727M  4.0K  727M    1% /tmp
/dev/sda1             1014M  211M  804M   21% /boot
tmpfs                  146M     0  146M    0% /run/user/990
tmpfs                  146M     0  146M    0% /run/user/0
/dev/loop0             914M  914M     0  100% /mnt  # 看到这个表示挂载成功

4.4. Create DM installation user and installation user group and initialize user password
[root@kylin10 ~]# groupadd dinstall
[root@kylin10 ~]# useradd -g dinstall -m -d /home/dmdba -s /bin/bash dmdba
[root@kylin10 ~]# passwd dmdba
更改用户 dmdba 的密码 。
新的 密码: CloudSino@2F01
重新输入新的 密码:  CloudSino@2F01
passwd:所有的身份验证令牌已经成功更新。
4.5. Create directory
[root@kylin10 ~]# mkdir -p /opt/dm/dmdbms  // 数据目录
[root@kylin10 ~]# mkdir -p /opt/dm/dmarch  // 归档目录
[root@kylin10 ~]# mkdir -p /opt/dm/dmbak   // 备份目录
# 设置 /opt/dm 目录的所有者和所属组 -R递归
[root@kylin10 ~]# chown -R dmdba:dinstall /opt/dm
# 设置权限 
[root@kylin10 ~]# chmod -R 755 /opt/dm
4.6, configure environment variables
[root@kylin10 ~]# echo export PATH=$PATH:/opt/dm/dmdbms/bin >> /etc/profile
[root@kylin10 ~]# source /etc/profile  // 让其生效
[root@kylin10 ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/.dotnet/tools:/root/bin:/opt/dm/dmdbms/bin
4.7, copy the installation file
[root@kylin10 ~]# cd /mnt/
[root@kylin10 mnt]# ls
'DM8 Install.pdf'   DMInstall.bin
[root@kylin10 mnt]# cd
[root@kylin10 ~]# cd /opt/dm/
[root@kylin10 dm]# cp -r /mnt/* .  # 复制到当前目录下
[root@kylin10 dm]# ll
总用量 935312
-r-x------ 1 root  root       2802614 11月 18 16:32 'DM8 Install.pdf'
drwxr-xr-x 2 dmdba dinstall         6 11月 18 16:21  dmarch
drwxr-xr-x 2 dmdba dinstall         6 11月 18 16:21  dmbak
drwxr-xr-x 2 dmdba dinstall         6 11月 18 16:21  dmdbms
-r-x------ 1 root  root     954950767 11月 18 16:32  DMInstall.bin


# DMInstall.bin  //  此文件就是DM 的安装程序。在运行安装前需要给执行权限
[root@kylin10 dm]# chmod 755 DMInstall.bin 
[root@kylin10 dm]# ll DMInstall.bin  -d
-rwxr-xr-x 1 root root 954950767 11月 18 16:32 DMInstall.bin



4.8. Command line installation
[root@kylin10 dm]# ./DMInstall.bin -i
请选择安装语言(C/c:中文 E/e:英文) [C/c]:c   # 选择c
解压安装程序......... 
core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 5636
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) 5636
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

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

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

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

是否设置时区? (Y/y:是 N/n:否) [Y/y]: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   # 选择21

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

请选择安装目录 [/opt/dmdbms]:/opt/dm/dmdbms   # 选择/opt/dm/dmdbms
可用空间: 5G
是否确认安装路径(/opt/dm/dmdbms)? (Y/y:是 N/n:否)  [Y/y]:y  # 选择y

安装前小结
安装位置: /opt/dm/dmdbms
所需空间: 1611M
可用空间: 5G
版本信息: 
有效日期: 
安装类型: 典型安装
是否确认安装? (Y/y:是 N/n:否):y  # 选择y
2022-11-18 16:46:46 
[INFO] 安装达梦数据库...
2022-11-18 16:46:46 
[INFO] 安装 基础 模块...
2022-11-18 16:46:55 
[INFO] 安装 服务器 模块...
2022-11-18 16:46:57 
[INFO] 安装 客户端 模块...
4.9. Create a database instance
[root@kylin10 ~]# cd /opt/dm/dmdbms/bin
[root@kylin10 bin]# ./dminit help   # 查看参数
initdb V8
db version: 0x7000c
file dm.key not found, use default license!
License will expire on 2023-07-20
version: 03134283890-20220720-165295-10045 Pack11
格式: ./dminit     KEYWORD=value

例程: ./dminit     PATH=/public/dmdb/dmData PAGE_SIZE=16

关键字                     说明(默认值)
--------------------------------------------------------------------------------
INI_FILE                   初始化文件dm.ini存放的路径
PATH                       初始数据库存放的路径
CTL_PATH                   控制文件路径
LOG_PATH                   日志文件路径
EXTENT_SIZE                数据文件使用的簇大小(16),可选值:16, 32, 64,单位:页
PAGE_SIZE                  数据页大小(8),可选值:4, 8, 16, 32,单位:K


[root@kylin10 bin]# ./dminit PATH=/opt/dm/dmdbms/data DB_NAME=agan INSTANCE_NAME=dmsrv CASE_SENSITIVE=0
initdb V8
db version: 0x7000c
file dm.key not found, use default license!
License will expire on 2023-07-20
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL

 log file path: /opt/dm/dmdbms/data/agan/agan01.log


 log file path: /opt/dm/dmdbms/data/agan/agan02.log

write to dir [/opt/dm/dmdbms/data/agan].
create dm database success. 2022-11-18 17:32:00

When creating a database instance, it is necessary to include the parameter CASE_SENSITIVE=0 , otherwise the database query will be case-sensitive. And the instance cannot be changed after it is created, it must be specified at the time of creation


4.10. Register Dameng database service
[root@Kylin01 root]# pwd
/opt/dm/dmdbms/script/root

[root@Kylin01 root]# ./dm_service_installer.sh -t dmserver -dm_ini /opt/dm/dmdbms/data/agan/dm.ini -p dmsrv
Created symlink /etc/systemd/system/multi-user.target.wants/DmServicedmsrv.service → /usr/lib/systemd/system/DmServicedmsrv.service.
创建服务(DmServicedmsrv)完成
[root@Kylin01 root]# 


[root@Kylin01 root]# service DmServicedmsrv status // 查看达梦数据库状态
Redirecting to /bin/systemctl status DmServicedmsrv.service
● DmServicedmsrv.service - DM Instance Service(DmServicedmsrv).
   Loaded: loaded (/usr/lib/systemd/system/DmServicedmsrv.service; enabled; vendor preset: disabled)
   Active: inactive (dead)
[root@Kylin01 root]# service DmServicedmsrv start  // 启动达梦数据库
Redirecting to /bin/systemctl start DmServicedmsrv.service
[root@Kylin01 root]# service DmServicedmsrv status 
Redirecting to /bin/systemctl status DmServicedmsrv.service
● DmServicedmsrv.service - DM Instance Service(DmServicedmsrv).
   Loaded: loaded (/usr/lib/systemd/system/DmServicedmsrv.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2023-01-31 14:48:32 CST; 2s ago
  Process: 18534 ExecStart=/opt/dm/dmdbms/bin/DmServicedmsrv start (code=exited, status=0/SUCCESS)
 Main PID: 18558 (dmserver)
    Tasks: 65
   Memory: 444.4M
   CGroup: /system.slice/DmServicedmsrv.service
           └─18558 /opt/dm/dmdbms/bin/dmserver path=/opt/dm/dmdbms/data/oobsdb/dm.ini -noconsole

1月 31 14:48:17 Kylin01 systemd[1]: Starting DM Instance Service(DmServicedmsrv)....
1月 31 14:48:32 Kylin01 DmServicedmsrv[18534]: [36B blob data]
1月 31 14:48:32 Kylin01 systemd[1]: Started DM Instance Service(DmServicedmsrv)..
[root@Kylin01 root]# 

[root@Kylin01 root]# ss -antl|grep 5236  // 查看端口
LISTEN   0        128                    *:5236                *:*   


# 查看进程
[root@Kylin01 ~]# ps -ef | grep dmserver
dmdba       5094       1  0 13:55 ?        00:00:24 /opt/dm/dmdbms/bin/dmserver path=/opt/dm/dmdbms/data/oobsdb/dm.ini -noconsole
root       11556   10722  0 18:57 pts/4    00:00:00 grep dmserver
[root@Kylin01 ~]# 
4.11. Connect to Dameng database
[root@Kylin01 ~]# /opt/dm/dmdbms/bin/disql SYSDBA/SYSDBA

服务器[LOCALHOST:5236]:处于普通打开状态
登录使用时间 : 4.705(ms)
disql V8
SQL> 

# 默认数据库系统管理员用户SYSDBA,密码和用户名一样,数据库端口5236

# CREATE USER agan IDENTIFIED BY "Agan@5236";  // 创建用户
# grant dba to agan with admin option; // 授权给agan用户有管理员的权限

5. Some basic operations

5.1. Delete instance
停止服务
service DmServicedmsrv stop


卸载服务
[root@Kylin01 root]# pwd
/opt/dm/dmdbms/script/root
[root@Kylin01 root]# ./dm_service_uninstaller.sh -n DmServicedmsrv

5.2. Basic commands of Dameng
SQL> select username from dba_users; # 查看当前系统有哪些用户

行号     username  
---------- ----------
1          SYSAUDITOR
2          SYSSSO
3          SYSDBA
4          AGAN
5          SYS

SQL> select username from user_users; # 查看当前是由哪个用户登录的

行号     username
---------- --------
1          SYSDBA


alter user 用户名 identified by "密码"  # 更改用户密码


# 删除账户(慎用,操作之前备份该用户的数据)
# 用户没有数据下这样删除
Drop user 用户名

# 用户下有数据的情况下这样删除。删除用户数据会丢失
Drop user 用户名 cascade
5.3. Logical backup and logical export
# 1、导出数据
dexp userid=SYSDBA/SYSDBA OWNER=agan file=agan_$(date +'%Y-%m-%d').dmp

userid: 数据用户和密码
OWNER: 导出agan下用户所有表
file: 导出文件

如果用户或密码包含特殊字符例如@, 需要使用转义 \
dexp userid=agan/\"Agan@5236\" OWNER=agan file=agan_$(date +'%Y-%m-%d').dmp


导出 agan 下数据
dexp userid=agan/\"Agan@5236\" OWNER=agan file=agan_$(date +'%Y-%m-%d').dmp


# 2、导入数据

导入 agan 数据
dimp userid=agan/\"Agan@5236\" OWNER=agan file=agan_$(date +'%Y-%m-%d').dmp



导入数据必须要求对应的用户存在, 如果用户不存在先创建。 例如:

CREATE USER agan IDENTIFIED BY "Agan@5236";
grant dba to agan with admin option;  # 授权,管理员的权限


5.4. Execute the script test.sql in the Dameng database service without logging in
# 创建存放脚本的目录
[root@Kylin01 ~]# mkdir /script
[root@Kylin01 script]# cat test.sql 
select name,create_time from v$database;   # 查看数据库名及创建时间
exit;  # 执行完后退出
[root@Kylin01 script]# ll
总用量 4
-rw------- 1 root root 49  2月  2 17:23 test.sql
[root@Kylin01 script]# 
[root@Kylin01 script]# disql agan/'"Agan@5236"'  \`/script/test.sql 

服务器[LOCALHOST:5236]:处于普通打开状态
登录使用时间 : 3.744(ms)
disql V8
SQL> select name,create_time from v$database;  

行号     name   create_time        
---------- ------ -------------------
1          agan 2023-01-31 14:40:46

已用时间: 1.599(毫秒). 执行号:58600.
SQL> exit;
[root@Kylin01 script]# 
[root@Kylin01 script]# cat data.sql 
select name,create_time from v$database;  
exit; 

# 如何执行这个脚本:/dameng/dmdbms/bin/disql SYSDBA/SYSDBA   \`/script/data.sql
[root@Kylin01 script]# /dameng/dmdbms/bin/disql SYSDBA/SYSDBA   \`/script/data.sql

服务器[LOCALHOST:5236]:处于普通打开状态
登录使用时间 : 6.327(ms)
disql V8
SQL> select name,create_time from v$database;  

行号     name   create_time        
---------- ------ -------------------
1          oobsdb 2023-05-30 09:34:09

已用时间: 2.465(毫秒). 执行号:174600.
SQL> exit; 
[root@Kylin01 script]# cat test_dm.sh 
#!/bin/bash

/dameng/dmdbms/bin/disql  SYSDBA/SYSDBA   \`/script/data.sql
[root@Kylin01 script]# sh test_dm.sh 

服务器[LOCALHOST:5236]:处于普通打开状态
登录使用时间 : 12.589(ms)
disql V8
SQL> select name,create_time from v$database;  

行号     name   create_time        
---------- ------ -------------------
1          oobsdb 2023-05-30 09:34:09

已用时间: 0.735(毫秒). 执行号:174700.
SQL> exit; 
[root@Kylin01 script]# 

error message

[root@kylin10 dm]# ./DMInstall.bin -i
请选择安装语言(C/c:中文 E/e:英文) [C/c]:c
安装程序临时目录(/tmp)可用空间为726M. 安装程序需要至少800M的临时空间, 请调整临时目录的空间或设置环境变量DM_INSTALL_TMPDIR来指定安装程序的临时目录.
[root@kylin10 dm]# 


解决
[root@kylin10 dm]# df -h
文件系统               容量  已用  可用 已用% 挂载点
devtmpfs               705M     0  705M    0% /dev
tmpfs                  727M     0  727M    0% /dev/shm
tmpfs                  727M  1.2M  726M    1% /run
tmpfs                  727M     0  727M    0% /sys/fs/cgroup
/dev/mapper/klas-root   17G   12G  5.6G   68% /
tmpfs                  727M  4.0K  727M    1% /tmp   // 把这个内存加大
/dev/sda1             1014M  211M  804M   21% /boot
tmpfs                  146M     0  146M    0% /run/user/990
tmpfs                  146M     0  146M    0% /run/user/0
/dev/loop0             914M  914M     0  100% /mnt
[root@kylin10 dm]# mount -o remount,size=2G /tmp/  # 执行此命令
[root@kylin10 dm]# df -h
文件系统               容量  已用  可用 已用% 挂载点
devtmpfs               705M     0  705M    0% /dev
tmpfs                  727M     0  727M    0% /dev/shm
tmpfs                  727M  1.2M  726M    1% /run
tmpfs                  727M     0  727M    0% /sys/fs/cgroup
/dev/mapper/klas-root   17G   12G  5.6G   68% /
tmpfs                  2.0G  4.0K  2.0G    1% /tmp
/dev/sda1             1014M  211M  804M   21% /boot
tmpfs                  146M     0  146M    0% /run/user/990
tmpfs                  146M     0  146M    0% /run/user/0
/dev/loop0             914M  914M     0  100% /mnt
[root@kylin10 dm]# 

Error messages when using scheduled tasks

[root@Kylin01 script]# cat /tmp/agan_log 
/opt/dm/dmdbms/bin/dexp: error while loading shared libraries: libdmp_dll.so: cannot open shared object file: No such file or directory
# 把脚本写到计划任务里去就会报缺很多依赖库,缺的依赖库都在这个位置里 /opt/dm/dmdbms/bin

solution

# 把全部lib* 已下的都复制到 /usr/local/lib
[root@Kylin01 ~]# cp -r  /opt/dm/dmdbms/bin/lib* /usr/local/lib
[root@Kylin01 ~]# cd /usr/local/lib
[root@Kylin01 lib]# chmod 755 lib*    // 跟原来的权限一致
[root@Kylin01 lib]# ldconfig 
ldconfig: /usr/local/lib/libxerces-c-3.1.so #  不是符号链接
[root@Kylin01 ~]# rm -rf /usr/local/lib/libxerces-c-3.1.so  // 删除这个
[root@Kylin01 ~]# echo '/usr/local/lib' >> /etc/ld.so.conf
[root@Kylin01 ~]# ldconfig  


# ldconfig命令的作用主要是在默认搜寻目录/lib和/usr/lib以及动态库配置文件/etc/ld.so.conf内所列的目录下,搜索出可共享的动态链接库,进而创建出动态装入程序(ld.so)所需的连接和缓存文件。

Guess you like

Origin blog.csdn.net/m0_58805648/article/details/130760500