Informix数据库根据参数自动创建实例shell脚本

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档


前言


一、建立环境变量并使能

#make env_variable file and enable it
 if [ !  -d  "/opt/user_profile" ]
 then 
     echo "Error: The library user_profile not exists!
else
    echo "The library  user_profile already exists!"
fi

if [ ! -e "/opt/user_profile/profile_example" ]
then
   touch  /opt/user_profile/profile_example
   check
   cat >/opt/user_profile/profile_example<<FLAGEOF
   export INFORMIXDIR=/opt/xigeme_DB_Software_Bundle
   export INFORMIXSERVER=example
   export INFORMIXSQLHOSTS=\$INFORMIXDIR\etc\sqlhosts.example
   export ONCONFIG=onconfig.example
   export PATH=\$INFORMIXDIR/bin:.:\$PATH
FLAGEOF
  source /opt/user_profile/profile_example
else
  echo "The file profile_example is already exists!"
  source /opt/user_profile/profile_example
fi

二、按需求修改onconfig配置文件

#modify onconfig.example 
cp $INFORMIXDIR/etc/onconfig.std $INFORMIXDIR/etc/onconfig.example
sed -i 's/^DBSERVERNAME.*/DBSERVERNAME example/' $INFORMIXDIR/etc/onconfig.example 
sed -i 's/^ROOTPATH.*/ROOTPATH $INFORMIXDIR\/dbs_1\/rootdbs/' $INFORMIXDIR/etc/onconfig.example
sed -i 's/^ROOTSIZE.*/ROOTSIZE 5000000/' $INFORMIXDIR/etc/onconfig.example 
sed -i 's/^ROOTNAME.*/ROOTNAME rootdbs/' $INFORMIXDIR/etc/onconfig.example
sed -i 's/^FULL_DISK_INIT.*/FULL_DISK_INIT 1/' $INFORMIXDIR/etc/onconfig.example
sed -i 's/^MULTIPROCESSOR.*/MULTIPROCESSOR 1/' $INFORMIXDIR/etc/onconfig.example
sed -i 's/^NETTYPE.*/NETTYPE soctcp,10,50,CPU/' $INFORMIXDIR/etc/onconfig.example
sed -i 's/^PHYSFILES.*/PHYSFILE 1000000/' $INFORMIXDIR/etc/onconfig.example
sed -i 's/^LOGFILES.*/LOGFILES 3/' $INFORMIXDIR/etc/onconfig.example
sed -i 's/^LOGSIZE.*/LOGSIZE 1000000/' $INFORMIXDIR/etc/onconfig.example
sed -i 's/^SBSPACENAME.*/SBSPACENAME sbspace/' $INFORMIXDIR/etc/onconfig.example
sed -i 's/^TAPEDEV.*/TAPEDEV \/dev\/null/' $INFORMIXDIR/etc/onconfig.example
sed -i 's/^LTAPEDEV.*/LTAPEDEV \/dev\/null/' $INFORMIXDIR/etc/onconfig.example

三、创建rootdbspace,blobdbspace,tmpdbspace

#function of make dbsapce
function make_dbspacefile(){
if [ ! -e "$INFORMIXDIR/dbs_1/$1" ]
then 
     touch $INFORMIXDIR/dbs_1/$1
else
     echo "The file $1 already exists!"
fi
}
#make dbspace
 make_dbspacefile rootdbs
 make_dbspacefile sbspace
 make_dbspacefile datadbs1

#change the files' permisssion of dbs_1:
cd $INFORMIXDIR
chmod -R 660 $INFORMIXDIR/dbs_1/*
 

四、修改sqlhosts连接文件

#modify sqlhosts.example
cp $INFORMIXDIR/etc/sqlhosts.std $INFORMIXDIR/etc/sqlhosts.example
sed -i 's/^demo_on.*/example onsoctcp localhost 9088/' $INFORMIXSQLHOSTS

五、脚本使用前配置

1.在root用户下,在/opt/目录下创建user_profile文件夹,将此文件夹权限改为777。
2.在informix用户下source 自动化创建脚本文件。

总结

本文仅仅简单介绍了informix的实例创建自动化搭建的shell脚本,对于物理日志和逻辑日志的迁移还并没有涉及,在之后有时间会增加这部分的内容。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值