创建实例

1 不带任何参数的方式

[[email protected] ~]$ dminit
initdb V7.6.0.95-Build(2018.09.13-97108)ENT
db version: 0x7000a
file dm.key not found, use default license!
License will expire on 2029-03-14
input system dir:
input db name:
input port num:
input page size(4, 8, 16, 32):
input err , input again:
input err , input again:
input err , input again:8
input extent size(16, 32):
input err , input again:16
input time zone(-12:59,+14:00): +8
string case sensitive? ([Y]es, [N]o):
input err , input again:Y
which charset to use? (0[GB18030], 1[UTF-8], 2[EUC-KR]): 0
length in char? ([Y]es, [N]o): Y
enable database encrypt? ([Y]es, [N]o):
input err , input again:N
page check mode? (0/1/2): 0
input elog path:
auto_overwrite mode? (0/1/2):
input err , input again:0

 log file path: /home/dmdba/DAMENG/DAMENG01.log


 log file path: /home/dmdba/DAMENG/DAMENG02.log

write to dir [/home/dmdba/DAMENG].
create dm database success. 2029-02-28 15:40:44
[[email protected] ~]$

从结果看,有些参数虽然有默认值,但还是必须要选择。

2 带参数创建

虽然dminit有很多选项,这些选项都有默认值,尤其是涉及到page大小的,默认值大部分也是最佳的选择,所以我们只需要指定实例的创建路径和数据库名称即可。

[[email protected] ~]$ dminit PATH=/dm/dmdbms/data DB_NAME=cndba INSTANCE_NAME=dave
initdb V7.6.0.95-Build(2018.09.13-97108)ENT
db version: 0x7000a
file dm.key not found, use default license!
License will expire on 2029-03-14

 log file path: /dm/dmdbms/data/cndba/cndba01.log


 log file path: /dm/dmdbms/data/cndba/cndba02.log

write to dir [/dm/dmdbms/data/cndba].
create dm database success. 2029-02-28 15:48:12
[[email protected] ~]$

有可能 初始化数据库到  /opt/dmdbms/bin/DAMENG 目录

注册数据库服务

命令行创建的实例没有对应的服务,不能使用服务进行管理。所以在使用命令行创建实例之后进行注册,重新注册成系统服务,方便用户管理与控制。

2 Shell 脚本注册

注册的shell 脚本dm_service_installer.sh在DM_HOME/script/root目录下:

[[email protected] root]$ pwd
/dm/dmdbms/script/root
[[email protected] root]$ ls
dm_service_installer.sh  dm_service_uninstaller.sh  root_installer.sh
[[email protected] root]$
1.通过指定服务类型注册服务
[root@dm2 root]# pwd
/dm/dmdbms/script/root [root@dm2 root]# ls dm_service_installer.sh dm_service_uninstaller.sh root_installer.sh [root@dm2 root]# ./dm_service_installer.sh -t dmserver -i /dm/dmdbms/data/cndba/dm.ini -p dave Move the service script file(/dm/dmdbms/bin/DmServicedave to /etc/rc.d/init.d/DmServicedave) Finished to create the service (DmServicedave) [root@dm2 root]# [root@dm2 root]# ll /etc/rc.d/init.d/DmServicedave -rwxr-xr-x 1 root root 12394 Feb 28 16:15 /etc/rc.d/init.d/DmServicedave [root@dm2 root]# 测试: [[email protected] root]$ service DmServicedave status DmServicedave is stopped [[email protected] root]$ service DmServicedave start Starting DmServicedave: [ OK ] [[email protected] root]$ service DmServicedave status DmServicedave (pid 3556) is running... [[email protected] root]$ service DmServicedave stop Stopping DmServicedave: [ OK ] [[email protected] root]$ service DmServicedave status DmServicedave is stopped [[email protected] root]$



测试通过

 开机启动
  [root@test01 root]# systemctl enable DmServiceDMSERVER.service

启动服务
[root@test01 root]# systemctl start DmServiceDMSERVER.service

[root@test01 root]# systemctl status DmServiceDMSERVER.service
● DmServiceDMSERVER.service - DmServiceDMSERVER
   Loaded: loaded (/usr/lib/systemd/system/DmServiceDMSERVER.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2019-06-21 10:32:03 CST; 1min 18s ago
  Process: 86596 ExecStart=/opt/app/dm7/dmdbms/bin/DmServiceDMSERVER start (code=exited, status=0/SUCCESS)
 Main PID: 86638 (dmserver)
   CGroup: /system.slice/DmServiceDMSERVER.service
           ‣ 86638 /opt/app/dm7/dmdbms/bin/dmserver /opt/dmdata/data/DAMENG/dm.ini -noconsole

Jun 21 10:31:47 test01 systemd[1]: Starting DmServiceDMSERVER...
Jun 21 10:31:47 test01 su[86622]: (to dmdba) root on none
Jun 21 10:31:48 test01 DmServiceDMSERVER[86596]: Starting DmServiceDMSERVER: stty: standard input: Inappropriate ioctl for device
Jun 21 10:31:48 test01 DmServiceDMSERVER[86596]: stty: standard input: Inappropriate ioctl for device
Jun 21 10:31:48 test01 DmServiceDMSERVER[86596]: Last login: Fri Jun 21 09:49:29 CST 2019
Jun 21 10:32:03 test01 DmServiceDMSERVER[86596]: [11B blob data]
Jun 21 10:32:03 test01 systemd[1]: Started DmServiceDMSERVER.
[root@test01 root]#

连接测试:
[dmdba@test01 bin]$  disql SYSDBA/SYSDBA@localhost

Server[localhost:5236]:mode is normal, state is open
login used time: 4.659(ms)
disql V7.1.6.46-Build(2018.02.08-89107)ENT
Connected to: DM 7.1.6.46
SQL> 


 
12-20 22:24