1. 程式人生 > >centos7下靜默安裝oracle11g

centos7下靜默安裝oracle11g

1、yum install vim -y


2、yum install unzip -y

3、yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*i686 compat-libstdc++-33*.devel compat-libstdc++-33 compat-libstdc++-33*.devel gcc gcc-c++ glibc glibc*.i686 glibc-devel glibc-devel*.i686 ksh libaio libaio*.i686 libaio-devel libaio-devel*.devel libgcc libgcc*.i686 libstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.devel libXi libXi*.i686 libXtst libXtst*.i686 make sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686

安裝依賴包


4、rpm -q binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXi libXtst  make sysstat  unixODBC unixODBC-devel
檢查有沒有31個


5、新增安裝使用者和組
groupadd -g 501 oinstall 
groupadd -g 502 dba 
groupadd -g 601 asmadmin 
groupadd -g 602 asmdba 
groupadd -g 603 asmoper 
useradd -u 1101 -g oinstall -G dba  oracle
id oracle


6、新增核心引數
vim /etc/sysctl.conf
fs.aio-max-nr = 1048576 
fs.file-max = 6815744 
kernel.shmall = 2097152 
kernel.shmmax = 48719476736 
kernel.shmmni = 4096 
kernel.sem = 250 32000 200 200 
net.ipv4.ip_local_port_range = 9000 65500 
net.core.rmem_default = 262144 
net.core.wmem_default = 262144 
net.core.wmem_max = 1048586 
net.core.rmem_max = 4194304 


7、/sbin/sysctl -p


8、修改使用者的限制檔案
vim /etc/security/limits.conf
oracle soft nproc 2047 
oracle hard nproc 16384 
oracle soft nofile 1024 
oracle hard nofile 65536 


9、修改vim /etc/pam.d/login檔案
vim /etc/pam.d/login
session required  /lib64/security/pam_limits.so
session required pam_limits.so 


10、關閉selinux
vim /etc/selinux/config
設定SELINUX=disabled


11、關閉防火牆
service iptables stop
systemctl stop firewalld
systemctl disable firewalld


12、建立目錄和設定檔案許可權
mkdir -p /data/oracle/product/11.2.0
mkdir /data/oracle/oradata
mkdir /data/oracle/inventory
mkdir /data/oracle/fast_recovery_area
chown -R oracle:oinstall /data/oracle
chmod -R 775 /data/oracle


13、解壓檔案
mkdir -p /data/oracle/oracledir
cd /data/oracle/oracledir
unzip linux.x64_11gR2_database_1of2.zip && unzip linux.x64_11gR2_database_2of2.zip


14、su oracle。 vim .bash_profile
ORACLE_BASE=/data/oracle
ORACLE_HOME=$ORACLE_BASE/product/11.2.0
ORACLE_SID=orcl
PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH


使該檔案生效
source .bash_profile


15、
vim /etc/profile
if [ $USER = "oracle" ] ; then 
if [ $SHELL = "/bin/ksh" ]; then 
ulimit -p 16384 
ulimit -n 65536 
else 
ulimit -u 16384 -n 65536 
fi 
umask 022 
fi 


16、編輯靜默安裝響應檔案
cd /home/oracle
cp -R /data/oracle/oraclesetup/database/response/ .
cd response/
vim db_install.rsp
修改如下
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=CentOS
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/data/oracle/inventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/data/oracle/product/11.2.0
ORACLE_BASE=/data/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=dba
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=zkz.orcl
oracle.install.db.config.starterdb.SID=orcl
oracle.install.db.config.starterdb.password.ALL=123456
DECLINE_SECURITY_UPDATES=true


17、安裝
cd /data/oracle/oracledir/database/
 ./runInstaller -silent -responseFile /home/oracle/response/db_install.rsp -ignorePrereq
 檢視日誌
 
18、配置監聽
netca /silent /responseFile /home/oracle/response/netca.rsp
執行上面一句話後在 /data/oracle/product/11.2.0/netword/admin 下生成listener.ora檔案
修改listener檔案
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = orcl)
      (ORACLE_HOME = /data/oracle/product/11.2.0)
      (global_dbname = orcl)
    )
  )


LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.50)(PORT = 1521))
      )
    )
  )
  
18、建立例項
vi /home/oracle/response/dbca.rsp


GDBNAME = "orcl.zkz"
SID = "orcl"
SYSPASSWORD = "123456"
SYSTEMPASSWORD = "123456"
CHARACTERSET = "ZHS16GBK"
NATIONALCHARACTERSET= "AL16UTF16"


dbca -silent -responseFile /home/oracle/response/dbca.rsp
19、啟動監聽
lsnrctl stop
lsnrctl start
sqlplus /nolog
conn /as sysdba


connect sys/sys as sysdba
shutdown normal
startup mount
alter database open;