`
vipshichg
  • 浏览: 260870 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Linux下Oracle环境配置及自动安装脚本

阅读更多

大家可以根据自己的需要修改安装路径位置,以及根据服务器内存大小修改对应的参数值 "kernel.shmmax = 2147483648”

#!/bin/bash
echo "back file to oraclerpm"
cp /etc/redhat-release oraclerpm/back/etc_redhat-release
cp /etc/sysctl.conf oraclerpm/back/etc_sysctl.conf
cp /etc/security/limits.conf oraclerpm/back/etc_security_limits.conf
cp /etc/pam.d/login oraclerpm/back/etc_pam.d
echo "back over /etc/redhat-release /etc/sysctl.conf"
if [ $USER != "root" ] ; then
echo "the user must be root ,and now you user is '$USER',plaese su to root"
exit 0
else
echo "setup 1:check root ,OK!" | tee -a oracle.log
######send to display and oracle.log
fi
######check weather have edit kernel

#exg:if grep -q "your string" /your/file; then echo yes; else echo no; fi¡¡

if grep -c "kernel.shmall" /etc/sysctl.conf >>/dev/null; then
echo "you have already edit the Kernel" | tee -a oracle.log
else
cat >> /etc/sysctl.conf << EOF
kernel.shmall = 2097152 
kernel.shmmax = 2147483648 
kernel.shmmni = 4096 
kernel.sem = 250 32000 100 128 
fs.file-max = 65536 
net.ipv4.ip_local_port_range = 1024 65000
EOF
fi
/sbin/sysctl -p >>/dev/null
echo ""setup 2:edit kernel,PASS!"" | tee -a oracle.log
cp /etc/redhat-release /etc/redhat-release.backup1
cat > /etc/redhat-release << EOF
Red Hat Enterprise Linux AS release 3 (Taroon)
EOF
echo "setup 3:edit the release,OK!" |tee -a oracle.log
if grep 'oinstall' /etc/group > /dev/null;then
echo "the group oinstall already existed!"
else
/usr/sbin/groupadd oinstall
fi
if grep 'dba' /etc/group > /dev/null;then
 echo "The group dba already existed!"
else
 /usr/sbin/groupadd dba
fi


if test -e /u01/app/oracle >/dev/null;then
echo "the setup_path for oracle "/u01/app/oracle" already have exits" | tee -a oracle.log
else
mkdir -p /u01/app/oracle
echo "/u01/app/oracle make" | tee -a oracle.log
fi
if test -e /data/oradata >/dev/null;then
echo "the data_path for oracle "/data/oradata" already have exits" | tee -a oracle.log
else
mkdir -p /data/oradata 
echo "/data/oradata make" | tee -a oracle.log
chown -R oracle:oinstall /u01/app/oracle /data/oradata
chmod -R 775 /u01/app/oracle /data/oradata
fi

#if grep /data/ "oracle"; then

#echo "the data_path for oracle "/data/oradata" already have given to user oracl"

#fi

echo "setup 3:add the oracle user,dba,install group ,oracle setup path,oracle data path OK!" | tee -a oracle.log
echo "now check for need rpm" | tee -a oracle.log
if rpm -q gcc make binutils openmotif setarch compat-db compat-gcc-32 openmotif compat-gcc-32-c++ compat-libstdc++-33 glibc | grep "not" >>oracle.log;then
echo "install rpm -----------------------" | tee -a oracle.log
rpm -ivh oraclerpm/*.rpm
else
echo "the rpm had install,then check it again!" | tee -a oracle.log
fi
if rpm -q gcc make binutils openmotif setarch compat-db compat-gcc-32 openmotif compat-gcc-32-c++ compat-libstdc++-33 glibc | grep "not" >>oracle.log;then
echo "install have wrong ,please check the log oracle.log" | tee -a oracle.log
exit 0;
else
echo "setup 5:rpm check OK!" | tee -a oracle.log
fi
#the rpm list: gcc make binutils openmotif setarch compat-db compat-gcc openmotif compat-gcc-c++ compat-libstdc++ compat-libstdc++-devel

#but the compat-gcc is not need thought the book said it is impartant

#at cenots46 compat-gcc ->compat-gcc-32 ,compat-gcc-c++ ->compat-gcc-c++-32,compat-libstdc++ ->compat-libstdc++33 compat-libstdc++-devel is not need

#if cat /etc/security/limits.conf | grep ^[^#];then

if grep "oracle" /etc/security/limits.conf >>/dev/null;then
echo "/etc/security/limits.conf have edited" | tee -a oracle.log
else
echo "/etc/security/limits.conf is going to edit"
echo "##############################oracle ####################### " >> /etc/security/limits.conf
echo "oracle soft nofile 65536" >> /etc/security/limits.conf 
echo "oracle hard nofile 65536" >> /etc/security/limits.conf 
echo "oracle soft nproc 16384" >> /etc/security/limits.conf 
echo "oracle hard nproc 16384" >> /etc/security/limits.conf
echo "####################################################################"
echo "##########################oracle########################### " >> /etc/pam.d/login 
echo "session required /lib/security/pam_limits.so" >> /etc/pam.d/login 
echo "session required pam_limits.so" >> /etc/pam.d/login 
echo "####################################################################"
fi
echo "setup 6:security have been set" | tee -a oracle.log
if grep "ORACLE_BASE" /home/oracle/.bash_profile >>/dev/null;then
echo "/home/oracle/.bash_profile have already been edited" | tee -a oracle.log
else
echo "now edit the /home/oracle/.bash_profile" | tee -a oracle.log
sid=orcl
read -p "Please type the oracle_sid in 20 minutes,if you dont type any,the default oracle_sid is orcl: " -t 20 sid
sed '/unset USERNAME/d' /home/oracle/.bash_profile >>/dev/null
sed '/PATH/d' /home/oracle/.bash_profile >>/dev/null
cat >> /home/oracle/.bash_profile <<"EOF"
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/10.1.0/Db_1
EOF
echo "ORACLE_SID=$sid" |tee -a oracle.log
echo "ORACLE_SID=$sid">>/home/oracle/.bash_profile
cat >> /home/oracle/.bash_profile <<"EOF"
export ORACLE_BASE ORACLE_HOME ORACLE_SID
PATH=$PATH:$HOME/bin:$ORACLE_BASE/product/10.1.0/Db_1/bin:
export PATH
unset USERNAME
EOF
fi
echo "setup 7:/home/oracle/.bash_profile OK!" | tee -a oracle.log
echo "now begain to install oracle" | tee -a oracle.log
echo "===========now put all the important message to oracle.log===========" |tee -a oracle.log
echo "============rpm -q gcc make binutils openmotif setarch compat-db compat-gcc-32 openmotif compat-gcc-32-c++ compat-libstdc++-33 glibc========" >> oracle.log
rpm -q rpm -q gcc make binutils openmotif setarch compat-db compat-gcc-32 openmotif compat-gcc-32-c++ compat-libstdc++-33 glibc >> oracle.log
echo "============ /etc/sysctl.conf====================" |tee -a oracle.log
cat /etc/sysctl.conf >>oracle.log 
echo "============ /etc/redhat-release====================" |tee -a oracle.log
cat /etc/redhat-release >>oracle.log
echo "============ id oracle====================" |tee -a oracle.log
id oracle>>oracle.log
echo "============ /etc/security/limits.conf====================" |tee -a oracle.log
cat /etc/security/limits.conf >>oracle.log
echo "============ /etc/pam.d/login ====================" |tee -a oracle.log
cat /etc/pam.d/login >>oracle.log
echo "============ /home/oracle/.bash_profile====================" |tee -a oracle.log
cat /home/oracle/.bash_profile>>oracle.log

 

4
4
分享到:
评论
1 楼 魔力猫咪 2013-09-06  
不建议这样。如果Oracle可以做这个东西应该早做了。既然没有做那么就表示很多东西还是自己配置比较安全。

相关推荐

    LInux系统 oracle数据库安装前各项参数脚本化一键自动配置

    经过数天的修改与调试终于以跳板机的方式实现LInux系统 oracle数据库安装前各项参数脚本话一键自动配置,包含单向互信的添加与删除,asm磁盘对的绑定和limits和sysctl.conf,grid和oracle用户的添加及环境配置。

    linux一键初始化oracle11g安装环境脚本(centos)

    设置基础安装环境工序太多,所以写了一个脚本起到能在linux一键初始化oracle11g安装环境脚本的目的,其中主要更改主机名、关闭防火墙、禁用Selinx、配置用户和组、创建目录、更改核心参数,配置Oracle环境变量等,...

    Linux 7.6 安装19c rac 环境一键准备脚本

    Linux 7.6 安装19c 环境一键准备脚本,自动创建用户,安装目录 ,修改 sysctl.cnf ,修改limit

    Linux安装oracle 11G各系统变量配置脚本

    用root身份执行该脚本,实现对limits.conf,login,sysctl.conf,profile,.bash_profile文件进行设置,并创建用户oracle,创建oinstall和dba组,创建安装目录 执行脚本命令 ./path.ksh 密码(oracle用户的密码) ...

    oracle11g一键安装脚本

    oracle11g centos7一键安装脚本,脚本里面有完整安装提示说明。大概步骤如下 1、关闭防火墙 2、设置服务器名称并增加映射 3、安装Oracle所需的依赖 4、解压oracle安装包 5、创建用户和组 6、修改内核参数 7、修改用户...

    基于linux的Oracle数据库管理实训报告

     2.4 指定oracle环境变量,安装路径….….....3  2.5 Oracle开始进行安装前的检查工作….….....3  2.6 选择配置选项….….....3  2.7 选择创建的数据库模式….….....3  2.8 指定数据库配置的相关选项.…… ...

    shell脚本卸载数据模板(Oracle)

    脚本只需配置/etl/sql/sql_mb.txt模板中的SQL语句,以及配置/etl/sql/filename.txt文件中对应的文件名称即可将数据卸载到对应文件名称的文本文档中,配置自由。 脚本中包括数据卸载,编码转换(GBK转UTF8),获取...

    linux as 4安装oracle 10g

    1.6配置oracle环境变量 12 1.7配置X-windows 12 1.8上传文件并解压 13 2安装oracle 13 2.1在本机安装oracle 13 2.2确认没有warning 16 2.3选择是否安装database 17 2.4选择字符集 19 2.5指定密码 21 2.6确认安装 23 ...

    oracle物理增量备份(windows客户机linux数据库服务器)

    在windows系统下去备份linux数据库服务上的...本文以上述环境为备份场景,采用物理增量备份方法,制定备份策略,包括自动备份的脚本以及任务计划的配置。 本文可作为oracle自动物理增量备份手册,为运维人员参考采用。

    Oracle single instance for Centos7 autoinstall

    对之前一个相同脚本做了补充,增加使用系统...脚本自动配置Oracle的环境,在挂载本地光盘的前提下,自动验证光盘,从本地光盘yum 支持包,本地光盘没有的将忽略。自动配置数据库安装的响应文件,打开防火墙1521端口。

    oracle 视图,函数,过程,触发器自动编译脚本

    该脚本运行于oracle9i,linux 环境下面 #!/bin/sh nowdir=`pwd` #配置文件的生成日期 nowtime=`date '+%Y%m%d'` nowtime_h=`date '+%Y%m%d%H%M'` #脚本执行的目录 dmpdir=/oracle_script/auto_recompile #初始化...

    [手工整理]208个Oracle安装文档,包含各个平台各个版本的单实例RAC以及DataGuard(1).xlsx

    108 RAC 11204 for Linux(RAC) 环境配置及数据库参数最佳实践 109 RAC 12c R2 GI 和RAC 安装文档 110 RAC 19c-rac-linux-install 111 RAC AIX 6.1安装Oracle 11203 112 RAC AIX 部署oracle 11GR2 集群实施报告 ...

    oracle启动与管理服务脚本

    数据库系统用户oracle 需配置好要求的环境变量 PATH变量指定到$ORACLE_HOME/bin目录下。 注意:如果数据库用户或者组有不同,需要修改脚本,本脚本未在集群环境下使用过,因此可能需要根据具体环境调整。

    Oracle数据库安装详细手册For Win 2008与Linux系统

    Linux环境配置脚本 pdksh安装包Oracle安装手册-RedHat Enterprise Linux 64bitOracle安装手册-Windows Server 2008 R2 SP1 64bit

    Oracle 主要配置文件介绍

    保护数据考虑的 尤其在 CAMS 双机应用模式下 能够保证数据的一致性 具体的修改操作可参考 Linux与 Oracle 安装手册 初始化参数文件是一个包含实例配置参数的文本文件 这些参数被设置为特 定的值 用于...

    oracle 11g安装配置

    为用户oracle设置环境变量,并允许使用X终端 [root@dbserver ~]# groupadd oinstall //安装组 [root@dbserver ~]# groupadd dba //管理组 [root@dbserver ~]# useradd -g oinstall -G dba oracle [root@dbserver ~]...

    Oracle 11g安装手册 For Windows/Linux

    《Oracle安装手册》,Linux环境配置脚本,pdksh安装包,图文并茂,Oracle11g详细安装教程,包括WindowsServer2008R2SP164bit和RedHatEnterpriseLinux64bit。

    Oracle数据批量导入elasticsearch脚本

    Linux环境下使用sqlplus工具将oracle中的数据导入到elasticsearch中。只需要在es_bulk_tool.properties配置sql即可实现数据的批量导入。在elasticsearch6中测试通过。shell脚本需要使用sqlplus。

    Linux 7下脚本安装配置oracle 11g r2教程

    一、环境脚本简单配置 #!/bin/bash mv /etc/yum.repos.d/* /tmp mv iso.repo /etc/yum.repos.d/ tar zxvf a.tar.gz mv 7Server /root/ sed -i '3 s/^#//' /etc/yum.repos.d/iso.repo sed -i '4 s/^/#/' /etc/yum....

Global site tag (gtag.js) - Google Analytics