重庆思庄Oracle、KingBase、PostgreSQL、Redhat认证学习论坛
标题:
[安装脚本]OL7&ORCL11.2.0.4
[打印本页]
作者:
Inkcup
时间:
2025-9-5 16:51
标题:
[安装脚本]OL7&ORCL11.2.0.4
本帖最后由 Inkcup 于 2025-9-5 16:58 编辑
#-----------------------------------
#11.2.0.4安装脚本01(安装前配置)
#-----------------------------------
#运行前需要先查看系统目录是否符合规范
#df -h
#先上传安装包到/tmp目录下
##6和#12项需按情况手动选择
#-----------------------------------
#1.域名解析
cat >> /etc/hosts << EOF
192.168.133.121 testserver
EOF
#2.关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
#3.关闭selinux
sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
#4.关闭虚拟网桥
yum remove libvirt-libs.x86_64
#5.关闭透明大页
grubby --update-kernel ALL --args transparent_hugepage=never
#6.安装依赖包
##配置本地yum源
mkdir /etc/yum.repos.d/bakrepo
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bakrepo
cat > /etc/yum.repos.d/localyum.repo<<EOF
[localyum]
name = localyum
baseurl = file:///mnt/
enabled = 1
gpgcheck = 0
EOF
#6.1#物理光驱版(默认):
mount /dev/sr0 /mnt/
#6.2#镜像文件版:
#mount -o loop /path/to/file.iso /mnt/
yum repolist all
##安装依赖包
yum install -y unzip binutils* compat-libcap1* compat-linstdc++* gcc gcc-c++ glibc glibc-devel* ksh libaio* libaio-devel libgcc libstdc++* libstdc++-devel libXi* libXtst make sysstat* unix0DBC-devel vim compat-libstdc++* elfutils-libelf-devel*
#7.修改Linux内核参数
cat >> /etc/sysctl.conf <<EOF
kernel.shmmax = 137438953472
kernel.shmmni = 4096
kernel.shmall = 33554432
kernel.sem = 250 32000 100 128
kernel.panic = 1
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 1048576
net.core.wmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_max = 1048576
fs.file-max = 6815744
fs.aio-max-nr = 3145728
EOF
sysctl -p
#8.修改系统限制
cat >> /etc/security/limits.conf <<EOF
* soft nofile 4096
* hard nofile 65536
oracle soft nproc 8192
oracle hard nproc 16384
oracle soft nofile 8192
oracle hard nofile 65536
oracle soft stack 10240
EOF
#9.验证登录限制
cat >> /etc/pam.d/login<<EOF
session required pam_limits.so
EOF
#10.修改文件数进程限制
cat >> /etc/profile<<EOF
if [ $USER = "oracle" ] || [ $USER = "grid" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
EOF
#11.创建组
groupadd dba ; groupadd oper ; groupadd oinstall
#12.创建用户
useradd -g oinstall -G dba,oper oracle
#测试环境:
#echo "oracle" | passwd --stdin oracle
#生产环境,交互输入(默认):
passwd oracle
#13.创建安装目录
mkdir -p /u01/app/oracle/product/11.2.0.4/dbhome_1
chown -R oracle:oinstall /u01/app/
chmod -R 775 /u01/app
#14.创建下载目录
mkdir /u01/setup
chown -R oracle:oinstall /u01/setup
chmod -R 775 /u01/setup
#15.设置oracle的环境变量
cat >> /home/oracle/.bash_profile <<EOF
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\$ORACLE_BASE/product/11.2.0.4/dbhome_1
export ORACLE_SID=orcl
export PATH=\$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib
EOF
#16.上传安装包
cp /tmp/p13390677_112040_Linux-x86-64_* /u01/setup/
chown -R oracle:oinstall /u01/setup
chmod -R 775 /u01/setup
#17.解压安装包
su - oracle -c 'unzip /u01/setup/p13390677_112040_Linux-x86-64_1of7.zip -d /u01/setup/; unzip /u01/setup/p13390677_112040_Linux-x86-64_2of7.zip -d /u01/setup/'
ll /u01/setup/
#18.重启系统
reboot
#-------------------------------重启完成,交互安装---------------------------------
注意:重启之后这些需要手动输入
su - oracle -c' export DISPLAY=192.168.133.1:0.0 ; /u01/setup/database/runInstaller'
y
#软件安装86%报错时运行下方命令:
#sed -i 's/$(MK_EMAGENT_NMECTL)/$(MK_EMAGENT_NMECTL) -lnnz11/' /u01/app/oracle/product/11.2.0.4/dbhome_1/sysman/lib/ins_emagent.mk
#安装结束执行root脚本:
#/u01/app/oraInventory/orainstRoot.sh
#/u01/app/oracle/product/11.2.0.4/dbhome_1/root.sh
#-------------------------------监听配置(交互)
#su - oracle -c' export DISPLAY=192.168.133.1:0.0 ;netca'
#-------------------------------配置实例(交互)
#su - oracle -c' export DISPLAY=192.168.133.1:0.0 ;dbca'
欢迎光临 重庆思庄Oracle、KingBase、PostgreSQL、Redhat认证学习论坛 (http://bbs.cqsztech.com/)
Powered by Discuz! X3.2