快速静默安装配置Oracle 11g单机环境软件
基础环境配置
root用户执行:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | cat > oracle_install_lhr.sh <<"EOF00" #!/bin/bash #Author: xmmup.com #install package function install_package() { yum install -y openssh-clients openssh-server initscripts net-tools telnet which wget \ passwd e4fsprogs lrzsz sudo unzip lvm2 tree traceroute lsof file tar systemd \ bridge-utils mlocate mailx strace less mmv stress stress-ng iotop htop atop nmon \ dstat bcc-tools bcc yum-utils yum install -y dos2unix rlwrap xdpyinfo xorg-x11-apps nmap numactl numactl-devel \ iproute rsyslog bash-completion tmux sysbench vim redhat-lsb smartmontools xinetd \ gcc make sysstat ksh binutils socat cmake automake autoconf bzr bison libtool deltarpm \ rsync libev pv subversion gnuplot jq oniguruma yum-fastestmirror net-snmp net-snmp-utils \ nfs-utils rpcbind postfix dovecot bind-utils bind bind-chroot dnsmasq haproxy keepalived bzr \ fio bzip2 ntp flex lftp targetd targetcli iscsi-initiator-utils siege aria2 \ nethogs vnstat nload iptraf bmon bwm-ng trafshow collectl yum install -y ncurses-devel libgcrypt-devel libaio libaio-devel \ perl perl-Env perl-devel perl-Time-HiRes perl-DBD-MySQL perl-ExtUtils-MakeMaker perl-TermReadKey \ perl-Config-Tiny perl-Email-Date-Format perl-Log-Dispatch perl-Mail-Sender perl-Mail-Sendmail \ perl-MIME-Lite perl-Parallel-ForkManager perl-Digest-MD5 perl-ExtUtils-CBuilder perl-IO-Socket-SSL \ perl-JSON openssl-devel libverto-devel libsepol-devel libselinux-devel libkadm5 keyutils-libs-devel \ krb5-devel libcom_err-devel cyrus-sasl* perl-DBD-Pg perf slang perl-DBI perl-CPAN \ perl-ExtUtils-eBuilder cpan perl-tests yum install -y compat-libstdc++-33 gcc-c++ glibc glibc-common glibc.i686 glibc-devel glibc-devel.i686 \ libgcc libgcc.i686 libstdc++ libstdc++-devel libaio.i686 libaio-devel.i686 \ libXext libXext.i686 libXtst libXtst.i686 libX11 libX11.i686 libXau libXau.i686 \ libxcb libxcb.i686 libXi libXi.i686 unixODBC unixODBC-devel zlib-devel zlib-devel.i686 \ compat-libcap1 libXp libXp-devel libXp.i686 elfutils-libelf elfutils-libelf-devel compat-db \ gnome-libs pdksh xscreensaver fontconfig-devel libXrender-devel } #base_config function base_config() { #hostname hostnamectl set-hostname oraclelhr #close selinux sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config setenforce 0 #close firewalld systemctl stop firewalld && systemctl disable firewalld #add user and group groupadd oinstall && groupadd dba && groupadd oper && useradd -g oinstall -G dba,oper oracle \ && echo "lhr" | passwd oracle --stdin #mkdir oracle need directory ORACLE_BASE='/u01/app/oracle' mkdir -p ${ORACLE_BASE}/product/11.2.0/dbhome_1 && chmod -R 775 ${ORACLE_BASE} \ && chown -R oracle:oinstall ${ORACLE_BASE} ORACLE_INVENTORY='/u01/app/oraInventory' mkdir -p ${ORACLE_INVENTORY} && chmod -R 775 ${ORACLE_INVENTORY} \ && chown -R oracle:oinstall ${ORACLE_INVENTORY} #modify some file echo 'fs.file-max = 6815744 kernel.sem = 250 32000 100 128 kernel.shmmni = 4096 kernel.shmall = 1073741824 kernel.shmmax = 4398046511104 kernel.panic_on_oops = 1 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048576 net.ipv4.conf.all.rp_filter = 2 net.ipv4.conf.default.rp_filter = 2 fs.aio-max-nr = 1048576 net.ipv4.ip_local_port_range = 9000 65500 ' >> /etc/sysctl.conf && sysctl -p echo 'oracle soft nofile 1024 oracle hard nofile 65536 oracle soft nproc 16384 oracle hard nproc 16384 oracle soft stack 10240 oracle hard stack 32768 ' >> /etc/security/limits.conf echo 'session required /lib64/security/pam_limits.so session required pam_limits.so ' >> /etc/pam.d/login echo 'if [ $USER = "oracle" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi fi ' >> /etc/profile #add oracle environmental variable cat >> /home/oracle/.bash_profile <<"EOF" export TMP=/tmp export TMPDIR=$TMP export ORACLE_SID=lhrdb export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1 export PATH=/usr/sbin:$PATH export PATH=$ORACLE_HOME/bin:$PATH export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib export NLS_DATE_FORMAT='YYYY-MM-DD HH24:mi:ss' alias sqlplus='rlwrap sqlplus' alias rman='rlwrap rman' alias sas='sqlplus / as sysdba' EOF } function main() { install_package && \ base_config } #run script main EOF00 |
运行:
1 2 | chmod +x oracle_install_lhr.sh sh oracle_install_lhr.sh |
静默安装软件和静默建库
oracle用户执行:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | -- 解压 unzip p13390677_112040_Linux-x86-64_1of7.zip -d /tmp > /dev/null && unzip p13390677_112040_Linux-x86-64_2of7.zip -d /tmp > /dev/null -- 静默安装软件 /tmp/database/runInstaller -silent -force -noconfig -IgnoreSysPreReqs -ignorePrereq -showProgress \ oracle.install.option=INSTALL_DB_SWONLY \ DECLINE_SECURITY_UPDATES=true \ UNIX_GROUP_NAME=oinstall \ INVENTORY_LOCATION=/u01/app/oraInventory \ SELECTED_LANGUAGES=en \ ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 \ ORACLE_BASE=/u01/app/oracle \ oracle.install.db.InstallEdition=EE \ oracle.install.db.isCustomInstall=false \ oracle.install.db.DBA_GROUP=dba \ oracle.install.db.OPER_GROUP=dba \ oracle.install.db.isRACOneInstall=false \ oracle.install.db.config.starterdb.type=GENERAL_PURPOSE \ SECURITY_UPDATES_VIA_MYORACLESUPPORT=false \ oracle.installer.autoupdates.option=SKIP_UPDATES -- root用户执行 /u01/app/oraInventory/orainstRoot.sh /u01/app/oracle/product/11.2.0/dbhome_1/root.sh -- 静默建库 -- dbca -silent -deleteDatabase -sourceDB lhrdb dbca -silent -createDatabase -templateName General_Purpose.dbc -responseFile NO_VALUE \ -gdbname lhrdb -sid lhrdb \ -sysPassword lhr -systemPassword lhr \ -datafileDestination '/u01/app/oracle/oradata' \ -recoveryAreaDestination '/u01/app/oracle/flash_recovery_area' \ -redoLogFileSize 50 \ -storageType FS \ -characterset AL32UTF8 -nationalCharacterSet AL16UTF16 \ -sampleSchema true \ -memoryPercentage 10 \ -databaseType OLTP \ -emConfiguration NONE -- 监听 netca -silent -responsefile $ORACLE_HOME/assistants/netca/netca.rsp lsnrctl status |
其它配置
1、配置大页:https://www.xmmup.com/oracleshujukupeizhidaye.html