centos安装达梦数据库

测试需要频繁安装,搞个脚本

 

#!/bin/bash
export pw="demoPass123!"
echo "use password:$pw"
groupadd dinstall -g 2001
useradd  -G dinstall -m -d /home/dmdba -s /bin/bash -u 2001 dmdba
echo "$pw" | passwd --stdin dmdba

rm -rf /home/dmdba/dmdbms /dmdata/data /dmdata/

##实例保存目录
mkdir -p /dmdata/data 
##归档保存目录
mkdir -p /dmdata/arch
##备份保存目录
mkdir -p /dmdata/dmbak

chown -R dmdba:dinstall /dmdata/data
chown -R dmdba:dinstall /dmdata/arch
chown -R dmdba:dinstall /dmdata/dmbak

chmod -R 755 /dmdata/data
chmod -R 755 /dmdata/arch
chmod -R 755 /dmdata/dmbak

cat >/etc/security/limits.conf<<EOF
dmdba  soft      nice       0
dmdba  hard      nice       0
dmdba  soft      as         unlimited
dmdba  hard      as         unlimited
dmdba  soft      fsize      unlimited
dmdba  hard      fsize      unlimited
dmdba  soft      nproc      65536
dmdba  hard      nproc      65536
dmdba  soft      nofile     65536
dmdba  hard      nofile     65536
dmdba  soft      core       unlimited
dmdba  hard      core       unlimited
dmdba  soft      data       unlimited
dmdba  hard      data       unlimited
EOF

if [ ! -f "dm8_20240408_x86_rh7_64.iso" ];then
rm -f dm8_20240408_x86_rh7_64_ent_8.1.3.140.zip
wget http://192.168.31.7/dm8_20240408_x86_rh7_64_ent_8.1.3.140.zip
unzip dm8_20240408_x86_rh7_64_ent_8.1.3.140.zip
rm -f dm8_20240408_x86_rh7_64_ent_8.1.3.140.zip
rm -f dm8_20240408_x86_rh7_64.iso_SHA256.txt
fi
mount -o loop dm8_20240408_x86_rh7_64.iso /mnt
cd /mnt
sudo -u dmdba ./DMInstall.bin -i

cat >/home/dmdba/.bash_profile<<EOF
export LD_LIBRARY_PATH="\$LD_LIBRARY_PATH:/home/dmdba/dmdbms/bin"
export DM_HOME="/home/dmdba/dmdbms"
export PATH=\$PATH:\$DM_HOME/bin:\$DM_HOME/tool
EOF

source /home/dmdba/.bash_profile
bash /home/dmdba/dmdbms/script/root/root_installer.sh
cd /home/dmdba/dmdbms/bin
sudo -u dmdba ./dminit path=/dmdata/data SYSDBA_PWD=$pw

cd /home/dmdba/dmdbms/script/root/
./dm_service_installer.sh -t dmserver -dm_ini /dmdata/data/DAMENG/dm.ini -p DAMENG

cd /home/dmdba/dmdbms/bin
sudo -u dmdba /home/dmdba/dmdbms/bin/DmServiceDAMENG start
sudo -u dmdba /home/dmdba/dmdbms/bin/DmServiceDAMENG status
echo "----install dm over----"

if [ ! -f "unixODBC-2.3.12.tar.gz" ];then
wget https://www.unixodbc.org/unixODBC-2.3.12.tar.gz
fi

yum -y install gcc
rm -rf unixODBC-2.3.12
tar -xf unixODBC-2.3.12.tar.gz
cd unixODBC-2.3.12
./configure --enable-gui=no -bindir=/usr/bin --sysconfdir=/etc/
make -j4
make install


cat >/etc/odbc.ini<<EOF
[dm8]
Description = DM ODBC DSN
Driver = DM8 ODBC DRIVER
SERVER = localhost
TCP_PORT = 5236
UID = SYSDBA
PWD = $pw
Port = 5236
User = SYSDBA
Password = $pw
charset = utf8
EOF

cat >/etc/odbcinst.ini<<EOF
[DM8 ODBC DRIVER]
Description = ODBC DRIVER FOR DM8
Driver = /home/dmdba/dmdbms/drivers/odbc/libdodbc.so
EOF

exit
su - dmdba 
isql -v dm8
CREATE SCHEMA "TEST" AUTHORIZATION "SYSDBA";
SET SCHEMA TEST;
CREATE TABLE test.person(name VARCHAR(128)NULL);
INSERT INTO test.person(name) VALUES('darren');
select * from person;

 

posted on 2024-06-05 15:46  弘道者  阅读(28)  评论(0编辑  收藏  举报