您好,登錄后才能下訂單哦!
1 功能簡介
dminit是DM數(shù)據(jù)庫初始化工具。在安裝DM的過程中,用戶可以選擇是否創(chuàng)建初始數(shù)據(jù)庫。如果當時沒有創(chuàng)建,那么在安裝完成之后,可以利用創(chuàng)建數(shù)據(jù)庫工具dminit來創(chuàng)建。
系統(tǒng)管理員可以利用dminit工具提供的各種參數(shù),設(shè)置數(shù)據(jù)庫存放路徑、段頁大小、是否對大小寫敏感、以及是否使用UNICODE等,創(chuàng)建出滿足用戶需要的數(shù)據(jù)庫。該工具位于安裝目錄的/bin目錄下。
2 使用dminit
dminit工具需要從命令行啟動。找到dminit所在安裝目錄/bin,輸入dminit和參數(shù)后回車。參數(shù)在下一節(jié)詳細介紹。
語法如下:
dminit KEYWORD=value { KEYWORD=value }
KEYWORD:dminit參數(shù)關(guān)鍵字。多個參數(shù)之間排列順序無影響,參數(shù)之間使用空格間隔。value:參數(shù)取值。
dminit如果沒有帶參數(shù),系統(tǒng)會引導(dǎo)用戶進行設(shè)置。參數(shù)、等號和值之間不能有空格,例如PAGE_SIZE=16。HELP參數(shù)的后面不用添加“=”號。
例如,初始化一個數(shù)據(jù)庫,放在/home/test/dmdbms目錄下,數(shù)據(jù)頁PAGE_SIZE大小為16K。
./dminit PATH=/home/test/dmdbms PAGE_SIZE=16
如果創(chuàng)建成功,則屏幕顯示如下:
initdb V7.1.5.22-Build(2015.11.17-62910trunc) db version: 0x70009 create dm database success. 2015-12-21 15:46:27
此時在/home/test/dmdbms目錄下會出現(xiàn)一個DAMENG文件夾,內(nèi)容包含初始數(shù)據(jù)庫DAMENG的相關(guān)文件和DM數(shù)據(jù)庫啟動所必須的配置文件dm.ini。
3 查看dminit參數(shù)
dminit使用較為靈活,參數(shù)較多。用戶可使用“dminit HELP”快速查看各參數(shù)。
[dmdba@ora19c bin]$ ./dminit help initdb V7.1.6.46-Build(2018.02.08-89107)ENT db version: 0x7000a file dm.key not found, use default license! License will expire on 2020-06-05 Format: ./dminit KEYWORD=value Example: ./dminit PATH=/public/dmdb/dmData PAGE_SIZE=16 Keyword Explanation(default value) -------------------------------------------------------------------------------- INI_FILE dm.ini path PATH database path CTL_PATH control file path LOG_PATH log file path EXTENT_SIZE extent size of data file(16), optional value: 16,32, unit: PAGE PAGE_SIZE page size(8), optional value: 4,8,16,32, unit: K LOG_SIZE log file size(256), unit: M, range: 64M ~ 2G CASE_SENSITIVE whether case is sensitive(Y), optional value: Y/N or 1/0 CHARSET/UNICODE_FLAG CHARSET(0), optional value:0[GB18030],1[UTF-8],2[EUC-KR] LENGTH_IN_CHAR whether LENGTH for VARCHAR is in characters(N), optional value: Y/N, 1/0 SYSDBA_PWD set SYSDBA password(SYSDBA), password length must between 9 and 48 SYSAUDITOR_PWD set SYSAUDITOR password(SYSAUDITOR), password length must between 9 and 48 DB_NAME database name(DAMENG) INSTANCE_NAME instance name(DMSERVER) PORT_NUM listener port(5236) TIME_ZONE set time zone(+08:00) PAGE_CHECK page check mode(0), optional value: 0/1/2 EXTERNAL_CIPHER_NAME set default encrypt/decrypt algorithm EXTERNAL_HASH_NAME set default hash algorithm EXTERNAL_CRYPTO_NAME set crypto name to encrypt svr key RLOG_ENC_FLAG whether encrypt redo log(N), optional value: Y/N, 1/0 USBKEY_PIN set usbkey pin ENCRYPT_NAME set algorithm for encrypt the whole database BLANK_PAD_MODE set blank padding mode(0), optional value:0/1 SYSTEM_MIRROR_PATH mirror path of system data file MAIN_MIRROR_PATH mirror path of main file ROLL_MIRROR_PATH mirror path of roll file MAL_FLAG MAL_INI flag(0) in dm.ini ARCH_FLAG ARCH_INI(0) flag in dm.ini MPP_FLAG MPP_INI(0) flag in dm.ini CONTROL control file path! AUTO_OVERWRITE whether overwrite all files with the same name(0) 0: no 1: part 2: all USE_NEW_HASH whether use new hash algorithm for string. (default 1) DCP_MODE whether is DM CLUSTER PROXY mode(default 0) DCP_PORT_NUM in DCP mode, set dcp_port_num ELOG_PATH set the path of log file recording the contents during initialization HELP print help information
4 dminit初始化數(shù)據(jù)庫
CONTROL參數(shù)是dminit工具的高級功能,用于初始化數(shù)據(jù)庫時指定初始化配置文件。初始化配置文件是一個保存了各數(shù)據(jù)文件路徑和大小設(shè)置、所有dminit工具的命令行參數(shù)設(shè)置等信息的文本,名稱由用戶自己選取,例如:dminit.ini 、abc.txt、dminit.ctl等。
dminit工具使用CONTROL參數(shù),就不能再指定其他參數(shù),CONTROL參數(shù)只能單獨使用。
DM既支持初始化單機數(shù)據(jù)庫,又支持初始化RAC集群的數(shù)據(jù)庫。操作非常簡單,只要在使用dminit工具創(chuàng)建數(shù)據(jù)庫的時候,使用CONTROL參數(shù)指定初始化配置文件即可。
例如:初始化配置文件為dminit.ini。
./dminit CONTROL=/home/data/dminit.ini
初始化配置文件(本章統(tǒng)一命名為dminit.ini)內(nèi)容如何書寫,單機和RAC環(huán)境下略有不同,下面分別詳細介紹。
4.1 初始化單機數(shù)據(jù)庫
DM支持初始化數(shù)據(jù)庫到一個普通機器上或是一個共享存儲上。本節(jié)以文件系統(tǒng)為例,初始化單機數(shù)據(jù)庫。涉及路徑和文件大小的參數(shù)配置。
例如,在文件系統(tǒng)上創(chuàng)建數(shù)據(jù)庫。參數(shù)path、main、system、roll、ctl_path、log01、log02都指定了文件系統(tǒng),單機配置文件(命名dminit.ini)書寫如下:
[dmdba@ora19c dm7]$ cat dminit.ini [jy] --實例名使用control配置文件指定實例不能使用instance_name參數(shù) db_name = jy path =/dm7/data main = /dm7/data/jy/main.dbf main_size = 256 system = /dm7/data/jy//system.dbf system_size = 256 roll = /dm7/data/jy//roll.dbf roll_size = 256 ctl_path = /dm7/data/jy/dm.ctl log_path = /dm7/data/jy/log01.log log_path = /dm7/data/jy/log02.log log_size = 128 auto_overwrite = 2 初始化數(shù)據(jù)庫 [dmdba@ora19c bin]$ ./dminit control=/dm7/dminit.ini initdb V7.1.6.46-Build(2018.02.08-89107)ENT db version: 0x7000a file dm.key not found, use default license! License will expire on 2020-06-05 log file path: /dm7/data/jy/log01.log log file path: /dm7/data/jy/log02.log write to dir [/dm7/data/jy]. create dm database success. 2020-05-22 22:36:10 注冊數(shù)據(jù)庫服務(wù) [root@ora19c root]# ./dm_service_installer.sh -t dmserver -p jy -i /dm7/data/jy/dm.ini -m open ln -s '/usr/lib/systemd/system/DmServicejy.service' '/etc/systemd/system/multi-user.target.wants/DmServicejy.service' Finished to create the service (DmServicejy) [root@ora19c root]# systemctl start DmServicejy [root@ora19c root]# ps -ef | grep dmserver dmdba 31843 1 21 01:29 ? 00:00:05 /dm7/bin/dmserver /dm7/data/jy/dm.ini -noconsole root 31901 3225 0 01:30 pts/2 00:00:00 grep --color=auto dmserver 連接數(shù)據(jù)庫 [dmdba@ora19c ~]$ disql SYSDBA/SYSDBA@10.13.13.140:5236 Server[10.13.13.140:5236]:mode is normal, state is open login used time: 10.975(ms) disql V7.1.6.46-Build(2018.02.08-89107)ENT Connected to: DM 7.1.6.46 SQL> select * from v$version; LINEID BANNER ---------- ------------------------------------------------------------- 1 DM Database Server x64 V7.1.6.46-Build(2018.02.08-89107)ENT 2 DB Version: 0x7000a used time: 3.827(ms). Execute id is 807.
4.2初始化RAC集群的數(shù)據(jù)庫
DM RAC是一個單數(shù)據(jù)庫、多實例的集群系統(tǒng),數(shù)據(jù)庫部署在共享存儲上,供所有節(jié)點訪問,具有高可用性、高性能、低成本等特性。DM支持在RAC環(huán)境下創(chuàng)建數(shù)據(jù)庫。RAC的初始化庫配置文件dminit.ini中涉及到的參數(shù),是在單機dminit.ini基礎(chǔ)上,增加了RAC節(jié)點信息。同時,把單機dminit.ini中node_instance參數(shù)去掉,log_size,log_path二個參數(shù)下放到每個RAC節(jié)點里。
準備dminit.ini 配置文件
在2個節(jié)點的/dm/dmdbms/data目錄下創(chuàng)建 dminit.ini 配置文件,添加如下內(nèi)容。 在2個節(jié)點都創(chuàng)建。
[dmdba@dmrac1 data]$ vi dminit.ini db_name = rac system_path = +DMDATA/data system = +DMDATA/data/rac/system.dbf system_size = 128 roll = +DMDATA/data/rac/roll.dbf roll_size = 128 main = +DMDATA/data/rac/main.dbf main_size = 128 ctl_path = +DMDATA/data/rac/dm.ctl ctl_size = 8 log_size = 256 dcr_path = /dev/raw/raw1 #dcr 磁盤路徑,目前不支持 asm,只能是裸設(shè)備 dcr_seqno = 0 auto_overwrite = 1 [RAC0] #inst_name 跟 dmdcr_cfg.ini 中 DB 類型 group 中 DCR_EP_NAME 對應(yīng) config_path = /dm7/data/rac0_config port_num = 5236 mal_host = 10.10.10.161 mal_port = 9340 log_path = +DMLOG/log/rac0_log01.log log_path = +DMLOG/log/rac0_log02.log [RAC1] #inst_name 跟 dmdcr_cfg.ini 中 DB 類型 group 中 DCR_EP_NAME 對應(yīng) config_path = /dm7/data/rac1_config port_num = 5236 mal_host = 10.10.10.162 mal_port = 9341 log_path = +DMLOG/log/rac1_log01.log log_path = +DMLOG/log/rac1_log02.log [dmdba@dmrac2 data]$ vi dminit.ini db_name = rac system_path = +DMDATA/data system = +DMDATA/data/rac/system.dbf system_size = 128 roll = +DMDATA/data/rac/roll.dbf roll_size = 128 main = +DMDATA/data/rac/main.dbf main_size = 128 ctl_path = +DMDATA/data/rac/dm.ctl ctl_size = 8 log_size = 256 dcr_path = /dev/raw/raw1 #dcr 磁盤路徑,目前不支持 asm,只能是裸設(shè)備 dcr_seqno = 0 auto_overwrite = 1 [RAC0] #inst_name 跟 dmdcr_cfg.ini 中 DB 類型 group 中 DCR_EP_NAME 對應(yīng) config_path = /dm7/data/rac0_config port_num = 5236 mal_host = 10.10.10.161 mal_port = 9340 log_path = +DMLOG/log/rac0_log01.log log_path = +DMLOG/log/rac0_log02.log [RAC1] #inst_name 跟 dmdcr_cfg.ini 中 DB 類型 group 中 DCR_EP_NAME 對應(yīng) config_path = /dm7/data/rac1_config port_num = 5236 mal_host = 10.10.10.162 mal_port = 9341 log_path = +DMLOG/log/rac1_log01.log log_path = +DMLOG/log/rac1_log02.log
使用dminit初始化數(shù)據(jù)庫
在任意節(jié)點啟動 dminit 工具初始化數(shù)據(jù)庫。dminit 執(zhí)行完成后,會在 config_path 目錄(/dm7/data/rac0_config 和/dm7/data/rac1_config)下生成配置文件 dm.ini 和 dmmal.ini。
[dmdba@dmrac1 data]$ dminit control=/dm7/data/dminit.ini initdb V7.1.6.46-Build(2018.02.08-89107)ENT db version: 0x7000a file dm.key not found, use default license! License will expire on 2020-05-08 log file path: +DMLOG/log/rac0_log01.log log file path: +DMLOG/log/rac0_log02.log log file path: +DMLOG/log/rac1_log01.log log file path: +DMLOG/log/rac1_log02.log write to dir [+DMDATA/data/rac]. create dm database success. 2020-04-24 16:39:03
將節(jié)點一的配置文件復(fù)制到節(jié)點二:
[dmdba@dmrac1 data]$ scp -r rac1_config 10.13.13.162:`pwd` The authenticity of host '10.13.13.162 (10.13.13.162)' can't be established. RSA key fingerprint is 89:fc:3e:e3:2d:27:94:07:0e:6b:fc:c5:e8:89:44:1f. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '10.13.13.162' (RSA) to the list of known hosts. dmdba@10.13.13.162's password: sqllog.ini 100% 479 0.5KB/s 00:00 dm.ini 100% 40KB 39.8KB/s 00:00 dmmal.ini 100% 204 0.2KB/s 00:00 [dmdba@dmrac1 data]$
啟動數(shù)據(jù)庫服務(wù)器
1、在2個節(jié)點分別注冊DM 數(shù)據(jù)庫服務(wù):
節(jié)點一:
[root@dmrac1 init.d]# /dm7/script/root/dm_service_installer.sh -t dmserver -i /dm7/data/rac0_config/dm.ini -d /dm7/data/dmdcr.ini -p rac1 Move the service script file(/dm7/bin/DmServicerac1 to /etc/rc.d/init.d/DmServicerac1) Finished to create the service (DmServicerac1) 節(jié)點二: [root@dmrac2 ~]# /dm7/script/root/dm_service_installer.sh -t dmserver -i /dm7/data/rac1_config/dm.ini -d /dm7/data/dmdcr.ini -p rac2 Move the service script file(/dm7/bin/DmServicerac2 to /etc/rc.d/init.d/DmServicerac2) Finished to create the service (DmServicerac2)
2、啟動數(shù)據(jù)庫
[root@dmrac1 init.d]# service DmServicerac1 start Starting DmServicerac1: [ OK ] [root@dmrac2 ~]# service DmServicerac2 start Starting DmServicerac2: [ OK ]
手工啟動命令如下,手工啟動后窗口不能關(guān)閉,所以
./dmserver /dm7/data/rac0_config/dm.ini dcr_ini=/dm7/data/dmdcr.ini ./dmserver /dm7/data/rac1_config/dm.ini dcr_ini=/dm7/data/dmdcr.ini
連接數(shù)據(jù)庫驗證
1 配置服務(wù)名文件
[dmdba@dmrac1 ~]$ vi /etc/dm_svc.conf TIME_ZONE=(480) rac=(10.13.13.161:5236,10.13.13.162:5236) SWITCH_TIME=(10000) SWITCH_INTERVAL=(10) TIME_ZONE=(480) LANGUAGE=(en) [dmdba@dmrac2 ~]$ vi /etc/dm_svc.conf TIME_ZONE=(480) rac=(10.13.13.161:5236,10.13.13.162:5236) SWITCH_TIME=(10000) SWITCH_INTERVAL=(10) TIME_ZONE=(480) LANGUAGE=(en)
2連接RAC集群
[dmdba@dmrac1 ~]$ disql SYSDBA/SYSDBA@rac Server[10.13.13.161:5236]:mode is normal, state is open login used time: 10.365(ms) disql V7.1.6.46-Build(2018.02.08-89107)ENT Connected to: DM 7.1.6.46 SQL> select instance_name from v$instance; LINEID INSTANCE_NAME ---------- ------------- 1 RAC0 used time: 18.248(ms). Execute id is 807. SQL> select * from v$rac_ep_info; LINEID EP_NAME EP_SEQNO EP_GUID EP_TIMESTAMP EP_MODE EP_STATUS ---------- ------- ----------- -------------------- -------------------- ------- --------- 1 RAC0 0 2067076818 2067077298 MASTER OK 2 RAC1 1 2067098084 2067098537 SLAVE OK used time: 2.741(ms). Execute id is 808.
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。