一台服务器上如何安装2个版本的达梦数据库

背景描述

测试要求在同一台服务器上安装1个新版本(8.1.2及以上)的达梦软件并创建2个实例。可是查询发现该服务器上已经有了8.1.1版本的达梦库且已经有2个实例,且安装过程中提示,赶紧ctrl+c取消,担心安装新版本后老版本库不能使用。

--查看进程
[dmdba@host28 source]$ ps -ef | grep dmserver
dmdba    2496992       1  0 1月25 ?       00:01:16 /opt/dmdbms/bin/dmserver /opt/dmdbms/data/DAMENG/dm.ini -noconsole
dmdba    2497536       1  0 1月25 ?       00:35:21 /opt/dmdbms/bin/dmserver /opt/dmdbms/data/topicis/dm.ini -noconsole

--查看版本  原先的老版本是V8 1.1.88
[dmdba@host28 source]$ disql sysdba/SYSDBA

服务器[LOCALHOST:5236]:处于普通打开状态
登录使用时间: 2.481(毫秒)
disql V8
SQL> select top 1 banner ||' '||id_code from v$version;

行号     BANNER||''||ID_CODE
---------- -----------------------------------------------------
1          DM Database Server 64 V8  1-1-88-20.06.24-123627-ENT  #1.1.88小版本号

已用时间: 0.386(毫秒). 执行号:105.

--安装新版本提示please uninstall. If continue to install, DM DBMS may affect ....
[dmdba@host28 tmp]$ ./DMInstall.bin -i
安装语言:
[1]: 简体中文
[2]: English
请选择安装语言 [1]:2
Extract install files.........
In the system, has other versions of DM DBMS, please uninstall. If continue to install, DM DBMS may affect to using.
Continue? (Y/y:Yes N/n:No) [Y/y]:y
Welcome to DM DBMS Installer

Whether to input the path of Key File? (Y/y:Yes N/n:No) [Y/y]:^C

和厂商沟通说是已经安装的有达梦软件了,如果按照常规的方式安装,安装过程中会卸载旧的,安装新的,所以为保证旧版本库正常使用,不能按照常规的方式安装。需要按照以下步骤操作进行新版本的安装。具体步骤如下。

安装步骤

目录规划

--创建存放新版本安装介质的目录
mkdir -p /opt/dmsoft/

--创建存放新版本的安装目录
mkdir -p /opt/dm8231226/

--创建新版本的数据目录
mkdir -p /opt/dm8231226/data

--创建临时目录
mkdir -p /opt/dm8231226/tmp

下载并上传新版本的安装介质

官方下载地址:产品下载 | 达梦数据库

下载后上传至/opt/dmsoft/目录下

[root@host28 ~]# cd /opt/dmsoft/
[root@host28 dmsoft]# ls -l
总用量 1007548
-rw------- 1 root root 1031723008  1月 29 14:41 dm8_20231226_HWarm920_kylin10_sp1_64.iso

安装数据库软件

到Whether to input the path of Key File? (Y/y:Yes N/n:No) [Y/y]:^C 该步骤一定要ctrl+c取消

挂载镜像

--挂载镜像
mount /opt/dmsoft/dm8_20231226_HWarm920_kylin10_sp1_64.iso /mnt

--拷贝二进制安装文件至/opt/dm8231226/tmp
cp /mnt/DMInstall.bin  /opt/dm8231226/tmp/

安装数据库软件

到Whether to input the path of Key File? (Y/y:Yes N/n:No) [Y/y]:^C 该步骤一定要ctrl+c取消

--安装
[dmdba@host28 ~]$ cd /opt/dm8231226/tmp
[dmdba@host28 tmp]$ ls -l
总用量 1004960
-r-x------ 1 dmdba dinstall 1029072107  1月 29 15:18 DMInstall.bin
[dmdba@host28 tmp]$ ./DMInstall.bin -i
安装语言:
[1]: 简体中文
[2]: English
请选择安装语言 [1]:2
Extract install files.........
In the system, has other versions of DM DBMS, please uninstall. If continue to install, DM DBMS may affect to using.
Continue? (Y/y:Yes N/n:No) [Y/y]:y   #继续
Welcome to DM DBMS Installer

Whether to input the path of Key File? (Y/y:Yes N/n:No) [Y/y]:^C  该步骤一定要ctrl+c取消

安装目录拷贝

--查看临时目录下的安装目录内容
[dmdba@host28 tmp]$ cd /tmp/DMInstall/source/
[dmdba@host28 source]$ ls -l
总用量 320
drwxr-xr-x  9 dmdba dinstall 5020  1月 29 15:20 bin
drwxr-xr-x  2 dmdba dinstall   60 12月 26 16:08 bin2
drwxr-xr-x  3 dmdba dinstall   60 12月 26 16:08 desktop
-rwxr-xr-x  1 dmdba dinstall   45 12月 26 16:08 dm_svc.conf
drwxr-xr-x  2 dmdba dinstall  460 12月 26 16:08 doc
drwxr-xr-x 14 dmdba dinstall  280 12月 26 16:09 drivers
drwxr-xr-x  2 dmdba dinstall  880 12月 26 16:09 include
drwxr-xr-x  2 dmdba dinstall  100 12月 26 16:08 jar
drwxr-xr-x  7 dmdba dinstall  240 12月 26 16:09 jdk
-rwxr-xr-x  1 dmdba dinstall 1146 12月 26 16:09 license_chs.txt
-rwxr-xr-x  1 dmdba dinstall 1138 12月 26 16:09 license_cht.txt
-rwxr-xr-x  1 dmdba dinstall 1071 12月 26 16:09 license_en.txt
drwxr-xr-x  2 dmdba dinstall   40 12月 26 16:09 log
drwxr-xr-x  6 dmdba dinstall  120 12月 26 16:09 samples
drwxr-xr-x  3 dmdba dinstall   80 12月 26 16:09 script
drwxr-xr-x  8 dmdba dinstall  700 12月 26 16:09 tool
drwxr-xr-x  3 dmdba dinstall  120  1月 29 15:20 uninstall
-rwxr-xr-x  1 dmdba dinstall 2208 12月 26 16:09 uninstall.sh

--拷贝/tmp/DMInstall/下的source目录至/opt/dm8231226/且将source目录重命名为dmdbms
su - dmdba
cd /tmp/DMInstall/
cp -r source /opt/dm8231226/
cd  /opt/dm8231226/
mv source dmdbms

初始化数据库实例

/opt/dm8231226/dmdbms/bin/dminit PATH=/opt/dm8231226/dmdata5239  CASE_SENSITIVE=1 CHARSET=1 LENGTH_IN_CHAR=1  DB_NAME=xsszcdb INSTANCE_NAME=xsszcdb  PORT_NUM=5239

生成启库脚本文件

拷贝并重命名启库脚本

--查看旧安装目录下的启库脚本文件
[root@host28 ~]# ls -l /opt/dmdbms/bin/Dm*
-rwxr-xr-x 1 dmdba dinstall 14000 10月 22  2020 /opt/dmdbms/bin/DmAPService
-rwxr-xr-x 1 dmdba dinstall 14461 10月 22  2020 /opt/dmdbms/bin/DmAuditMonitorService
-rwxr-xr-x 1 dmdba dinstall 13637 10月 22  2020 /opt/dmdbms/bin/DmInstanceMonitorService
-rwxr-xr-x 1 dmdba dinstall 14108 10月 22  2020 /opt/dmdbms/bin/DmJobMonitorService
-rwx------ 1 dmdba dinstall 15932 10月 22  2020 /opt/dmdbms/bin/DmServiceDMSERVER
-rwx------ 1 dmdba dinstall 15925  5月 11  2023 /opt/dmdbms/bin/DmServiceDQICIS
-rwx------ 1 dmdba dinstall 15932  5月 11  2023 /opt/dmdbms/bin/DmServiceTOPICIS


--拷贝至新安装目录下并重命名  后缀为实例名
cp /opt/dmdbms/bin/DmServiceTOPICIS /opt/dm8231226/dmdbms/bin/DmServicexsszcdb

更改脚本内容

vi /opt/dm8231226/dmdbms/bin/DmServicexsszcdb
更改前:
DM_HOME="/opt/dmdbms"
INI_PATH="/opt/dmdbms/data/topicis/dm.ini"

更改后:
DM_HOME="/opt/dm8231226/dmdbms"
INI_PATH="/opt/dm8231226/dmdata5239/xsszcdb/dm.ini"

问题处理

--问题描述
[root@host28 script]# /opt/dm8231226/dmdbms/script/root/dm_service_installer.sh -t dmserver -dm_ini /opt/dm8231226/dmdata5239/xsszcdb/dm.ini -p xsszcdb
-bash: /opt/dm8231226/dmdbms/script/root/dm_service_installer.sh: 没有那个文件或目录

--解决办法
不能采用注册系统服务的方式,需要拷贝bin目录下的启动脚本并更改DM_HOME和INI_PATH参数,使用bin目录下./DmServicexsszcdb start 方式启库

启动数据库

cd /opt/dm8231226/dmdbms/bin
./DmServicexsszcdb start 

注意:./DmServicexsszcdb start 本身就具有后台启动的作用,不需要加nohup &。

创建业务用户

--查询是否有同名的用户
select username,account_status from dba_users WHERE username='FWY';
select username,account_status from dba_users WHERE username='fwy';
--查看已有表空间和数据文件的位置
select tablespace_name, file_name, status from dba_data_files;

--创建业务用户的表空间  单位默认M  maxsize 32764  32G 可自定义更改maxsize
create tablespace "fwy" datafile '/opt/dm8231226/dmdata5245/fwydb/fwy01.DBF'
size 1024
autoextend on maxsize 32764 CACHE = NORMAL;

--创建用户
create user "fwy" identified by "123456789"
limit failed_login_attemps unlimited, password_lock_time unlimited, password_grace_time unlimited
default tablespace "fwy";

参数说明:
failed_login_attemps:将引起一个账户被锁定的连续注册失败的次数
PASSWORD_LOCK_TIME:如果超过 FAILED_LOGIN_ATTEMPTS 设置值,一个账户将被锁定的分钟数
PASSWORD_GRACE_TIME:以天为单位的口令过期宽限时间,过期口令超过该期限后,禁止执行除修改口令以外的其他操作

-- 用户授权
grant "DBA","PUBLIC" to "fwy";

查看版本

查看大版本查看v$version视图

查看小版本查看v$instancef 1-3-100代表小版本是1.3

[dmdba@host28 bin]$ ./disql sysdba/SYSDBA:5239

服务器[LOCALHOST:5239]:处于普通打开状态
登录使用时间 : 2.503(ms)
disql V8
SQL> select * from v$version;

行号     BANNER
---------- ---------------------------------
1          DM Database Server 64 V8
2          DB Version: 0x7000c
3          03134284132-20231226-213242-20081

已用时间: 0.167(毫秒). 执行号:62801.
SQL> select * from v$instance;

行号     NAME    INSTANCE_NAME INSTANCE_NUMBER HOST_NAME SVR_VERSION                DB_VERSION          START_TIME          STATUS$ MODE$  OGUID       DSC_SEQNO   DSC_ROLE
---------- ------- ------------- --------------- --------- -------------------------- ------------------- ------------------- ------- ------ ----------- ----------- --------
           BUILD_VERSION                        BUILD_TIME
           ------------------------------------ --------------------
1          XSSZCDB XSSZCDB       1               host28    DM Database Server x64 V8  DB Version: 0x7000c 2024-01-29 17:20:00 OPEN    NORMAL 0           0           NULL
           1-3-100-2023.12.26-213242-20081-ENT  Dec 26 2023 15:47:57


已用时间: 0.565(毫秒). 执行号:62802.
SQL> select top 1 banner ||' '||id_code from v$version;

行号     BANNER||''||ID_CODE
---------- ------------------------------------------------------------
1          DM Database Server 64 V8 --03134284132-20231226-213242-20081

已用时间: 0.612(毫秒). 执行号:62803.
SQL> select id_code;

行号     ID_CODE
---------- -----------------------------------
1          --03134284132-20231226-213242-20081

已用时间: 0.418(毫秒). 执行号:62804.

经测试,分别访问2个版本的数据库无干扰。

你可能感兴趣的:(数据库,服务器,java)