暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

在Oracle Linux8.1下安装19c脚本

原创 deitlee 2020-03-13
2312

#----------------------------------------------------------------------
#在Oracle Linux 8.1 静态安装Oracle19c前需要执行的脚本
#2020年3月10日 deitlee
#安装前请修改ORACLE_SID为自己的名称
#换hostname
#----------------------------------------------------------------------
dnf install -y bc
dnf install -y binutils
dnf install -y compat-libstdc+±33
dnf install -y elfutils-libelf
dnf install -y elfutils-libelf-devel
dnf install -y fontconfig-devel glibc
dnf install -y glibc-devel
dnf install -y ksh
dnf install -y libaio
dnf install -y libaio-devel
dnf install -y libXrender
dnf install -y libXrender-devel
dnf install -y libX11
dnf install -y libXau
dnf install -y libXi
dnf install -y libXtst
dnf install -y libgcc
dnf install -y librdmacm-devel
dnf install -y libstdc++
dnf install -y libstdc+±devel
dnf install -y libxcb
dnf install -y make
dnf install -y net-tools
dnf install -y nfs-utils
dnf install -y python3
dnf install -y python3-configshell
dnf install -y python3-rtslib
dnf install -y python3-six
dnf install -y targetcli
dnf install -y smartmontools
dnf install -y sysstat
dnf install -y unixODBC
dnf install -y libnsl
dnf install -y libnsl.i686
dnf install -y libnsl2
dnf install -y libnsl2.i686
sleep 3
echo “创建用户”;
if ! grep ‘oinstall’ /etc/group;then groupadd -g 1001 oinstall;fi
if ! grep ‘dba’ /etc/group;then groupadd -g 1002 dba;fi
if ! grep ‘oper’ /etc/group;then groupadd -g 1003 oper;fi
if ! grep ‘oracle’ /etc/passwd; then
useradd -u 1001 -g oinstall -G dba,oper oracle;
echo “oraclezrsf” |passwd --stdin oracle;fi
sleep 3
echo “创建目录”;
mkdir -p /u01/app/oraInventory
mkdir -p /u01/app/oracle/product/19.3.0/dbhome_1
chown -R oracle: /u01/
sleep 3
if ! grep “export ORACLE_SID=orcl” /home/oracle/.bash_profile;then echo “export ORACLE_SID=orcl”>>/home/oracle/.bash_profile;fi
if ! grep “export ORACLE_BASE=/u01/app/oracle/” /home/oracle/.bash_profile;then echo “export ORACLE_BASE=/u01/app/oracle/”>>/home/oracle/.bash_profile;fi
if ! grep “export ORACLE_HOME=/u01/app/oracle/product/19.3.0/dbhome_1” /home/oracle/.bash_profile;then echo “export ORACLE_HOME=/u01/app/oracle/product/19.3.0/dbhome_1”>>/home/oracle/.bash_profile;fi
if ! grep “export LD_LIBRARY_PATH=/u01/app/oracle/product/19.3.0/dbhome_1/lib:/lib:/usr/lib/” /home/oracle/.bash_profile;then echo “export LD_LIBRARY_PATH=/u01/app/oracle/product/19.3.0/dbhome_1/lib:/lib:/usr/lib/”>>/home/oracle/.bash_profile;fi
if ! grep “export CLASSPATH=/u01/app/oracle/product/19.3.0/dbhome_1/JRE:/u01/app/oracle/product/19.3.0/dbhome_1/jlib:/u01/app/oracle/product/19.3.0/dbhome_1/rdbms/jlib/” /home/oracle/.bash_profile;then echo “export CLASSPATH=/u01/app/oracle/product/19.3.0/dbhome_1/JRE:/u01/app/oracle/product/19.3.0/dbhome_1/jlib:/u01/app/oracle/product/19.3.0/dbhome_1/rdbms/jlib/”>>/home/oracle/.bash_profile;fi
if ! grep “export PATH=PATH:/u01/app/oracle/product/19.3.0/dbhome1/bin"/home/oracle/.bashprofile;thenecho"exportPATH=PATH:/u01/app/oracle/product/19.3.0/dbhome_1/bin" /home/oracle/.bash_profile;then echo "export PATH=PATH:/u01/app/oracle/product/19.3.0/dbhome_1/bin”>>/home/oracle/.bash_profile;fi
if ! grep “export CV_ASSUME_DISTID=RHEL7.6” /home/oracle/.bash_profile;then echo “export CV_ASSUME_DISTID=RHEL7.6”>>/home/oracle/.bash_profile;fi
if ! grep “export NLS_LANG=AMERICAN_AMERICA.AL32UTF8” /home/oracle/.bash_profile;then echo “export NLS_LANG=AMERICAN_AMERICA.AL32UTF8”>>/home/oracle/.bash_profile;fi
#-----------------------------------------------------------------------
if ! grep “fs.aio-max-nr = 1048576” /etc/sysctl.conf;then echo “fs.aio-max-nr = 1048576”>>/etc/sysctl.conf;fi
if ! grep “fs.file-max = 6815744” /etc/sysctl.conf;then echo “fs.file-max = 6815744”>>/etc/sysctl.conf ;fi
if ! grep “kernel.shmall = 1073741824” /etc/sysctl.conf;then echo “kernel.shmall = 1073741824”>>/etc/sysctl.conf ;fi
if ! grep “kernel.shmmax = 4398046511104” /etc/sysctl.conf;then echo “kernel.shmmax = 4398046511104”>>/etc/sysctl.conf ;fi
if ! grep “kernel.shmmni = 4096” /etc/sysctl.conf;then echo “kernel.shmmni = 4096”>>/etc/sysctl.conf ;fi
if ! grep “kernel.sem = 250 32000 100 128” /etc/sysctl.conf;then echo “kernel.sem = 250 32000 100 128”>>/etc/sysctl.conf ;fi
if ! grep “kernel.panic_on_oops = 1” /etc/sysctl.conf;then echo “kernel.panic_on_oops = 1”>>/etc/sysctl.conf;fi
if ! grep “net.ipv4.ip_local_port_range = 9000 65500” /etc/sysctl.conf;then echo “net.ipv4.ip_local_port_range = 9000 65500”>>/etc/sysctl.conf;fi
if ! grep “net.ipv4.conf.all.rp_filter = 2” /etc/sysctl.conf;then echo “net.ipv4.conf.all.rp_filter = 2”>>/etc/sysctl.conf;fi
if ! grep “net.ipv4.conf.default.rp_filter = 2” /etc/sysctl.conf;then echo “net.ipv4.conf.default.rp_filter = 2”>>/etc/sysctl.conf;fi
if ! grep “net.core.rmem_default = 262144” /etc/sysctl.conf;then echo “net.core.rmem_default = 262144”>>/etc/sysctl.conf ;fi
if ! grep “net.core.rmem_max = 4194304” /etc/sysctl.conf;then echo “net.core.rmem_max = 4194304”>>/etc/sysctl.conf ;fi
if ! grep “net.core.wmem_default = 262144” /etc/sysctl.conf;then echo “net.core.wmem_default = 262144”>>/etc/sysctl.conf ;fi
if ! grep “net.core.wmem_max = 1048586” /etc/sysctl.conf;then echo “net.core.wmem_max = 1048586”>>/etc/sysctl.conf ;fi
sysctl -p
#----------------------------------------------------------------------
if ! grep “oracle soft nproc 2047” /etc/security/limits.conf;then echo “oracle soft nproc 2047”>>/etc/security/limits.conf;fi
if ! grep "oracle hard nproc 16384 " /etc/security/limits.conf;then echo “oracle hard nproc 16384”>>/etc/security/limits.conf;fi
if ! grep “oracle soft nofile 1024” /etc/security/limits.conf;then echo “oracle soft nofile 1024”>>/etc/security/limits.conf;fi
if ! grep "oracle hard nofile 65536 " /etc/security/limits.conf;then echo “oracle hard nofile 65536”>>/etc/security/limits.conf;fi
sleep 3
if ! grep “oracle soft nofile 1024” /etc/security/limits.d/oracle-database-preinstall-19c.conf;then echo “oracle soft nofile 1024”>/etc/security/limits.d/oracle-database-preinstall-19c.conf;fi
if ! grep “oracle hard nofile 65536” /etc/security/limits.d/oracle-database-preinstall-19c.conf;then echo “oracle hard nofile 65536”>>/etc/security/limits.d/oracle-database-preinstall-19c.conf;fi
if ! grep “oracle soft nproc 16384” /etc/security/limits.d/oracle-database-preinstall-19c.conf;then echo “oracle soft nproc 16384”>>/etc/security/limits.d/oracle-database-preinstall-19c.conf;fi
if ! grep “oracle hard nproc 16384” /etc/security/limits.d/oracle-database-preinstall-19c.conf;then echo “oracle hard nproc 16384”>>/etc/security/limits.d/oracle-database-preinstall-19c.conf;fi
if ! grep “oracle soft stack 10240” /etc/security/limits.d/oracle-database-preinstall-19c.conf;then echo “oracle soft stack 10240”>>/etc/security/limits.d/oracle-database-preinstall-19c.conf;fi
if ! grep “oracle hard stack 32768” /etc/security/limits.d/oracle-database-preinstall-19c.conf;then echo “oracle hard stack 32768”>>/etc/security/limits.d/oracle-database-preinstall-19c.conf;fi
if ! grep “oracle hard memlock 134217728” /etc/security/limits.d/oracle-database-preinstall-19c.conf;then echo “oracle hard memlock 134217728”>>/etc/security/limits.d/oracle-database-preinstall-19c.conf;fi
if ! grep “oracle soft memlock 134217728” /etc/security/limits.d/oracle-database-preinstall-19c.conf;then echo “oracle soft memlock 134217728”>>/etc/security/limits.d/oracle-database-preinstall-19c.conf;fi
if ! grep “session required pam_limits.so” /etc/pam.d/login;then echo “session required pam_limits.so”>>/etc/pam.d/login;fi
su - oracle <<EOF
echo “解压安装文件”;
unzip -q /tmp/LINUX.X64_193000_db_home.zip -d /u01/app/oracle/product/19.3.0/dbhome_1/;
sleep 3;
echo “开始安装数据库软件”;
/u01/app/oracle/product/19.3.0/dbhome_1/runInstaller -ignorePrereq -waitforcompletion -silent
-responseFile /u01/app/oracle/product/19.3.0/dbhome_1/install/response/db_install.rsp
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=rac02
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oraInventory
SELECTED_LANGUAGES=en,en_GB
ORACLE_HOME=/u01/app/oracle/product/19.3.0/dbhome_1
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.OSDBA_GROUP=dba
oracle.install.db.OSBACKUPDBA_GROUP=dba
oracle.install.db.OSDGDBA_GROUP=dba
oracle.install.db.OSKMDBA_GROUP=dba
oracle.install.db.OSRACDBA_GROUP=dba
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
DECLINE_SECURITY_UPDATES=true;
sleep 3;
exit;
EOF
sh /u01/app/oraInventory/orainstRoot.sh;
sh /u01/app/oracle/product/19.3.0/dbhome_1/root.sh;
su - oracle <<EOF
echo “开始安装数据库实例”;
/u01/app/oracle/product/19.3.0/dbhome_1/bin/dbca -silent -createDatabase
-templateName General_Purpose.dbc
-gdbname orcl.com -sid orcl \ -responseFile NO_VALUE
-characterSet AL32UTF8
-sysPassword Oracle12366
-systemPassword Oracle12366
-pdbAdminPassword Oracle12366
-totalMemory 2000
-storageType FS
-datafileDestination “/u01/app/oracle/oradata”
-redoLogFileSize 50
-emConfiguration NONE
-ignorePreReqs;
exit;
EOF

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论